summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-09-16 16:45:57 +0200
committersb <sb@openoffice.org>2010-09-16 16:45:57 +0200
commit1132d70e49231f199de83fe899ee47ce7f88cd24 (patch)
tree2422efdf66ccc113128ce2ff04df4ba1d09064d0
parentd2f80bf22a6e7d45dd16e8af7a41debe9164cd04 (diff)
parent9587364f011f889d6d65a175d57275e915f65672 (diff)
sb126: merged in DEV300_m87
-rw-r--r--avmedia/prj/build.lst4
-rw-r--r--avmedia/source/framework/mediacontrol.cxx4
-rw-r--r--avmedia/source/gstreamer/exports.dxp3
-rw-r--r--avmedia/source/gstreamer/gstcommon.hxx68
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.cxx307
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.hxx81
-rw-r--r--avmedia/source/gstreamer/gstmanager.cxx85
-rw-r--r--avmedia/source/gstreamer/gstmanager.hxx74
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx938
-rw-r--r--avmedia/source/gstreamer/gstplayer.hxx236
-rw-r--r--avmedia/source/gstreamer/gstuno.cxx106
-rw-r--r--avmedia/source/gstreamer/gstwindow.cxx668
-rw-r--r--avmedia/source/gstreamer/gstwindow.hxx197
-rw-r--r--avmedia/source/gstreamer/makefile.mk71
-rw-r--r--avmedia/source/inc/mediamisc.hxx24
-rw-r--r--avmedia/source/java/PlayerWindow.java4
-rw-r--r--avmedia/source/java/avmedia.jarbin16420 -> 15776 bytes
-rw-r--r--avmedia/source/viewer/mediawindow.cxx47
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx107
-rw-r--r--avmedia/source/viewer/mediawindow_impl.hxx41
-rw-r--r--avmedia/source/viewer/mediawindowbase_impl.cxx65
-rw-r--r--avmedia/source/viewer/mediawindowbase_impl.hxx5
-rw-r--r--avmedia/source/win/winuno.cxx6
-rw-r--r--basic/inc/basic/process.hxx6
-rw-r--r--basic/inc/basic/sbmod.hxx7
-rw-r--r--basic/inc/basic/sbobjmod.hxx12
-rw-r--r--basic/source/app/process.cxx38
-rw-r--r--basic/source/basmgr/basmgr.cxx12
-rw-r--r--basic/source/classes/disas.cxx34
-rw-r--r--basic/source/classes/eventatt.cxx2
-rw-r--r--[-rwxr-xr-x]basic/source/classes/sb.cxx48
-rwxr-xr-x[-rw-r--r--]basic/source/classes/sbunoobj.cxx12
-rw-r--r--basic/source/classes/sbxmod.cxx582
-rw-r--r--basic/source/comp/exprtree.cxx9
-rwxr-xr-x[-rw-r--r--]basic/source/comp/sbcomp.cxx312
-rw-r--r--basic/source/inc/namecont.hxx10
-rwxr-xr-x[-rw-r--r--]basic/source/inc/sbtrace.hxx (renamed from sfx2/source/appl/sfxdll.cxx)51
-rw-r--r--basic/source/inc/scriptcont.hxx4
-rw-r--r--basic/source/runtime/dllmgr.cxx2
-rw-r--r--basic/source/runtime/methods.cxx86
-rw-r--r--basic/source/runtime/methods1.cxx33
-rw-r--r--basic/source/runtime/props.cxx7
-rw-r--r--basic/source/runtime/rtlproto.hxx1
-rw-r--r--[-rwxr-xr-x]basic/source/runtime/runtime.cxx19
-rw-r--r--basic/source/runtime/stdobj.cxx1
-rw-r--r--basic/source/runtime/step0.cxx44
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/step2.cxx48
-rw-r--r--basic/source/runtime/wnt-mingw.s4
-rw-r--r--basic/source/sbx/sbxbase.cxx7
-rw-r--r--basic/source/sbx/sbxdate.cxx8
-rw-r--r--basic/source/uno/namecont.cxx8
-rw-r--r--basic/source/uno/scriptcont.cxx10
-rw-r--r--configmgr/source/rootaccess.cxx5
-rw-r--r--configmgr/source/xcuparser.cxx8
-rw-r--r--connectivity/source/commontools/FValue.cxx107
-rw-r--r--connectivity/source/drivers/adabas/BDriver.cxx44
-rw-r--r--connectivity/source/drivers/adabas/BFunctions.cxx2
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx6
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx10
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx13
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx5
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageAccess.cxx10
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageMap.cxx16
-rw-r--r--connectivity/source/drivers/jdbc/Boolean.cxx17
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx8
-rw-r--r--connectivity/source/drivers/jdbc/String.cxx20
-rw-r--r--connectivity/source/drivers/kab/makefile.mk3
-rw-r--r--connectivity/source/drivers/mozab/MDriver.cxx2
-rw-r--r--connectivity/source/drivers/odbc/OFunctions.cxx4
-rw-r--r--connectivity/source/inc/java/lang/Boolean.hxx1
-rw-r--r--connectivity/source/inc/java/lang/Object.hxx2
-rw-r--r--connectivity/source/inc/java/lang/String.hxx1
-rw-r--r--connectivity/source/inc/odbc/OFunctiondefs.hxx2
-rw-r--r--desktop/inc/app.hxx3
-rw-r--r--desktop/prj/build.lst4
-rw-r--r--desktop/source/app/app.cxx607
-rw-r--r--desktop/source/app/langselect.cxx23
-rw-r--r--desktop/source/app/langselect.hxx19
-rw-r--r--desktop/source/app/officeipcthread.cxx2
-rw-r--r--[-rwxr-xr-x]desktop/source/deployment/gui/dp_gui_dialog2.cxx24
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx8
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx2
-rw-r--r--desktop/source/deployment/manager/dp_properties.hxx5
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx5
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx62
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx5
-rw-r--r--desktop/source/deployment/registry/dp_registry.cxx7
-rw-r--r--desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx5
-rw-r--r--desktop/source/deployment/registry/help/dp_helpbackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/help/dp_helpbackenddb.hxx5
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx22
-rw-r--r--desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx5
-rw-r--r--[-rwxr-xr-x]desktop/source/migration/migration.cxx0
-rw-r--r--[-rwxr-xr-x]desktop/source/migration/services/cexportsoo3.cxx5
-rw-r--r--[-rwxr-xr-x]desktop/source/migration/services/oo3extensionmigration.cxx7
-rw-r--r--[-rwxr-xr-x]desktop/source/migration/services/oo3extensionmigration.hxx7
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_app.cxx33
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx105
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_shared.h6
-rw-r--r--desktop/source/splash/splash.cxx10
-rw-r--r--desktop/test/deployment/boxt/makefile.mk6
-rw-r--r--desktop/util/ooverinfo2.rc22
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx128
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx20
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx4
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx6
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx4
-rw-r--r--drawinglayer/prj/d.lst2
-rw-r--r--drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx339
-rw-r--r--drawinglayer/source/primitive2d/makefile.mk1
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx21
-rw-r--r--drawinglayer/source/primitive2d/structuretagprimitive2d.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclhelperbitmaprender.cxx36
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx488
-rw-r--r--editeng/source/editeng/editattr.cxx9
-rwxr-xr-xediteng/source/editeng/editview.cxx10
-rwxr-xr-xediteng/source/editeng/impedit2.cxx12
-rwxr-xr-xediteng/source/editeng/impedit4.cxx19
-rw-r--r--editeng/source/misc/txtrange.cxx8
-rwxr-xr-x[-rw-r--r--]editeng/source/misc/unolingu.cxx3
-rw-r--r--formula/inc/formula/errorcodes.hxx8
-rw-r--r--fpicker/source/unx/gnome/SalGtkFilePicker.cxx52
-rw-r--r--fpicker/source/unx/gnome/SalGtkFolderPicker.cxx3
-rw-r--r--fpicker/source/unx/gnome/SalGtkPicker.cxx41
-rw-r--r--fpicker/source/unx/gnome/SalGtkPicker.hxx2
-rw-r--r--fpicker/source/unx/kde4/KDE4FilePicker.cxx12
-rw-r--r--framework/inc/macros/debug/memorymeasure.hxx2
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx31
-rw-r--r--idl/source/cmptools/hash.cxx4
-rw-r--r--idl/source/cmptools/lex.cxx8
-rw-r--r--idl/source/prj/database.cxx6
-rw-r--r--idl/source/prj/globals.cxx10
-rw-r--r--idl/source/prj/makefile.mk1
-rwxr-xr-x[-rw-r--r--]officecfg/registry/data/org/openoffice/Office/Math.xcu5
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Paths.xcu3
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu10
-rwxr-xr-x[-rw-r--r--]officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu15
-rw-r--r--officecfg/registry/data/org/openoffice/Office/makefile.mk2
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Math.xcs23
-rwxr-xr-xofficecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs2
-rw-r--r--oovbaapi/ooo/vba/XApplicationBase.idl17
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/makefile.mk2
-rw-r--r--oovbaapi/ooo/vba/makefile.mk5
-rw-r--r--oovbaapi/ooo/vba/word/makefile.mk2
-rw-r--r--oovbaapi/prj/d.lst2
-rwxr-xr-xreadlicense_oo/util/makefile.pmk6
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx25
-rw-r--r--scripting/source/dlgprov/dlgprov.hxx5
-rw-r--r--scripting/source/pyprov/mailmerge.py4
-rw-r--r--sfx2/inc/sfx2/docfile.hxx3
-rw-r--r--[-rwxr-xr-x]sfx2/inc/sfx2/objsh.hxx4
-rw-r--r--sfx2/inc/sfx2/titledockwin.hxx10
-rw-r--r--sfx2/qa/cppunit/makefile.mk7
-rw-r--r--sfx2/qa/cppunit/test_metadatable.cxx2
-rw-r--r--sfx2/source/appl/app.cxx2
-rw-r--r--sfx2/source/appl/appquit.cxx3
-rw-r--r--sfx2/source/appl/impldde.cxx8
-rw-r--r--sfx2/source/appl/makefile.mk1
-rw-r--r--[-rwxr-xr-x]sfx2/source/dialog/dinfdlg.cxx13
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx4
-rw-r--r--[-rwxr-xr-x]sfx2/source/dialog/securitypage.cxx30
-rw-r--r--[-rwxr-xr-x]sfx2/source/dialog/securitypage.src0
-rw-r--r--sfx2/source/dialog/titledockwin.cxx24
-rw-r--r--sfx2/source/doc/objserv.cxx9
-rw-r--r--sfx2/source/doc/objstor.cxx7
-rw-r--r--[-rwxr-xr-x]sfx2/source/doc/objxtor.cxx7
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx6
-rw-r--r--sfx2/source/doc/syspathw32.cxx2
-rwxr-xr-xsfx2/source/menu/mnumgr.cxx8
-rw-r--r--sfx2/source/view/frame2.cxx5
-rw-r--r--sfx2/source/view/userinputinterception.cxx14
-rw-r--r--sfx2/source/view/viewfrm.cxx16
-rw-r--r--sfx2/source/view/viewimp.hxx4
-rw-r--r--sfx2/source/view/viewprn.cxx19
-rwxr-xr-xshell/inc/internal/utilities.hxx6
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/columninfo/columninfo.cxx5
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/infotips/infotips.cxx6
-rwxr-xr-xshell/source/win32/shlxthandler/ooofilt/ooofilt.cxx3
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx4
-rwxr-xr-xshell/source/win32/shlxthandler/propsheets/propsheets.cxx99
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx3
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/util/fileextensions.cxx11
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/util/utilities.cxx22
-rw-r--r--svx/inc/svdstr.hrc1
-rw-r--r--svx/inc/svimbase.hxx4
-rwxr-xr-xsvx/inc/svx/dialogs.hrc4
-rw-r--r--svx/inc/svx/sdrmasterpagedescriptor.hxx3
-rw-r--r--svx/inc/svx/svdedtv.hxx12
-rw-r--r--svx/inc/svx/svdmodel.hxx10
-rw-r--r--svx/inc/svx/svdpage.hxx1
-rw-r--r--svx/inc/svx/xpoly.hxx4
-rw-r--r--svx/source/engine3d/scene3d.cxx2
-rw-r--r--svx/source/gengal/gengal.cxx5
-rw-r--r--svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx18
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpage.cxx83
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx7
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx6
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx12
-rw-r--r--svx/source/sdr/properties/textproperties.cxx21
-rw-r--r--svx/source/svdraw/sdrmasterpagedescriptor.cxx23
-rw-r--r--svx/source/svdraw/svdedtv.cxx40
-rw-r--r--svx/source/svdraw/svdmodel.cxx1
-rw-r--r--svx/source/svdraw/svdmrkv.cxx5
-rw-r--r--svx/source/svdraw/svdocirc.cxx2
-rw-r--r--svx/source/svdraw/svdopath.cxx3
-rw-r--r--svx/source/svdraw/svdpage.cxx12
-rw-r--r--svx/source/svdraw/svdpagv.cxx4
-rw-r--r--svx/source/svdraw/svdstr.src5
-rw-r--r--svx/source/tbxctrls/makefile.mk1
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx16
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.src (renamed from idl/source/prj/idldll.cxx)54
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx14
-rw-r--r--svx/util/svxpch.cxx2
-rw-r--r--sysui/desktop/debian/makefile.mk20
-rw-r--r--sysui/desktop/productversion.mk2
-rw-r--r--sysui/desktop/slackware/makefile.mk20
-rwxr-xr-x[-rw-r--r--]ucb/source/core/cmdenv.cxx2
-rw-r--r--ucb/source/ucp/odma/odma_lib.cxx4
-rw-r--r--ucb/source/ucp/package/makefile.mk1
-rw-r--r--ucb/source/ucp/package/pkguri.cxx36
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx3
-rw-r--r--[-rwxr-xr-x]uui/source/iahndl-authentication.cxx1
-rwxr-xr-xuui/source/iahndl.cxx73
-rwxr-xr-xuui/source/iahndl.hxx3
-rw-r--r--[-rwxr-xr-x]uui/source/ids.hrc8
-rw-r--r--[-rwxr-xr-x]uui/source/loginerr.hxx2
-rwxr-xr-x[-rw-r--r--]uui/source/makefile.mk4
-rwxr-xr-xuui/source/nameclashdlg.cxx107
-rwxr-xr-x[-rw-r--r--]uui/source/nameclashdlg.hrc (renamed from uui/source/passcrtdlg.hrc)26
-rwxr-xr-x[-rw-r--r--]uui/source/nameclashdlg.hxx (renamed from uui/source/passcrtdlg.hxx)56
-rwxr-xr-xuui/source/nameclashdlg.src113
-rw-r--r--uui/source/passcrtdlg.cxx128
-rw-r--r--uui/source/passcrtdlg.src108
-rw-r--r--vbahelper/inc/vbahelper/vbaapplicationbase.hxx21
-rw-r--r--vbahelper/inc/vbahelper/vbacollectionimpl.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentbase.hxx4
-rwxr-xr-xvbahelper/inc/vbahelper/vbaeventshelperbase.hxx162
-rw-r--r--vbahelper/inc/vbahelper/vbaglobalbase.hxx6
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx1
-rw-r--r--vbahelper/inc/vbahelper/vbahelperinterface.hxx30
-rw-r--r--vbahelper/prj/d.lst1
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx33
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx4
-rw-r--r--vbahelper/source/vbahelper/makefile.mk2
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx111
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx53
-rwxr-xr-xvbahelper/source/vbahelper/vbaeventshelperbase.cxx218
-rw-r--r--vbahelper/source/vbahelper/vbaglobalbase.cxx59
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx22
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx3
-rw-r--r--xmloff/source/core/RDFaExportHelper.cxx37
-rw-r--r--xmloff/source/core/xmltoken.cxx3
-rw-r--r--xmloff/source/draw/ximpcustomshape.cxx1
-rw-r--r--xmloff/source/text/XMLTextMarkImportContext.cxx1
263 files changed, 7457 insertions, 2085 deletions
diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst
index 1ef04ca0f7..6651d9d74f 100644
--- a/avmedia/prj/build.lst
+++ b/avmedia/prj/build.lst
@@ -6,6 +6,6 @@ av avmedia\source\viewer nmake - all av_viewer NULL
av avmedia\source\framework nmake - all av_framework NULL
av avmedia\source\win nmake - all av_win NULL
av avmedia\source\java nmake - all av_java NULL
-av avmedia\source\xine nmake - all av_xine NULL
av avmedia\source\quicktime nmake - all av_quicktime NULL
-av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_xine NULL
+av avmedia\source\gstreamer nmake - all av_gstreamer NULL
+av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_gstreamer NULL
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index 178ee237ee..a251846e67 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -91,8 +91,6 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) :
if( MEDIACONTROLSTYLE_SINGLELINE != meControlStyle )
{
-
-
maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), String( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) );
maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN );
@@ -103,8 +101,6 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) :
}
else
{
- maTimeSlider.SetBackground();
- maVolumeSlider.SetBackground();
mpZoomListBox->SetBackground();
maZoomToolBox.SetBackground();
diff --git a/avmedia/source/gstreamer/exports.dxp b/avmedia/source/gstreamer/exports.dxp
new file mode 100644
index 0000000000..9630d7e067
--- /dev/null
+++ b/avmedia/source/gstreamer/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx
new file mode 100644
index 0000000000..83bb818aef
--- /dev/null
+++ b/avmedia/source/gstreamer/gstcommon.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 _GSTCOMMON_HXX
+#define _GSTCOMMON_HXX
+
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/MouseButton.hpp>
+#include <com/sun/star/media/XManager.hpp>
+
+#include <memory>
+
+#define AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer"
+#define AVMEDIA_GSTREAMER_MANAGER_SERVICENAME "com.sun.star.media.Manager_GStreamer"
+
+#define AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_GStreamer"
+#define AVMEDIA_GSTREAMER_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer"
+
+#define AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer"
+#define AVMEDIA_GSTREAMER_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer"
+
+#define AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_GStreamer"
+#define AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_GStreamer"
+
+#endif // _GSTCOMMOM_HXX
diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx
new file mode 100644
index 0000000000..13f0c5c4e7
--- /dev/null
+++ b/avmedia/source/gstreamer/gstframegrabber.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "gstframegrabber.hxx"
+#include "gstplayer.hxx"
+
+#include <vcl/graph.hxx>
+#include <vcl/bmpacc.hxx>
+
+using namespace ::com::sun::star;
+
+namespace avmedia { namespace gst {
+
+const gulong GRAB_TIMEOUT = 10000000;
+
+// ----------------
+// - FrameGrabber -
+// ----------------
+
+FrameGrabber::FrameGrabber( GString* pURI ) :
+ Player( pURI ),
+ mpFrameMutex( g_mutex_new() ),
+ mpFrameCond( g_cond_new() ),
+ mpLastPixbuf( NULL ),
+ mbIsInGrabMode( false )
+{
+}
+
+// ------------------------------------------------------------------------------
+
+FrameGrabber::~FrameGrabber()
+{
+ if( g_atomic_pointer_get( &mpPlayer ) )
+ {
+ implQuitThread();
+ }
+
+ // thread has ended, so that no more synchronization is necessary
+ if( mpLastPixbuf )
+ {
+ g_object_unref( mpLastPixbuf );
+ mpLastPixbuf = NULL;
+ }
+
+ g_cond_free( mpFrameCond );
+ g_mutex_free( mpFrameMutex );
+}
+
+// ------------------------------------------------------------------------------
+
+FrameGrabber* FrameGrabber::create( const GString* pURI )
+{
+ FrameGrabber* pFrameGrabber = NULL;
+
+ if( pURI && pURI->len )
+ {
+ // safely initialize GLib threading framework
+ try
+ {
+ if( !g_thread_supported() )
+ {
+ g_thread_init( NULL );
+ }
+ }
+ catch( ... )
+ {}
+
+ if( g_thread_supported() )
+ {
+ pFrameGrabber = new FrameGrabber( g_string_new( pURI->str ) );
+
+ // wait until thread signals that it has finished initialization
+ if( pFrameGrabber->mpThread )
+ {
+ g_mutex_lock( pFrameGrabber->mpMutex );
+
+ while( !pFrameGrabber->implIsInitialized() )
+ {
+ g_cond_wait( pFrameGrabber->mpCond, pFrameGrabber->mpMutex );
+ }
+
+ g_mutex_unlock( pFrameGrabber->mpMutex );
+ }
+
+ GstElement* pPixbufSink = gst_element_factory_make( "gdkpixbufsink", NULL );
+
+ // check if player pipeline and GdkPixbufSink could be initialized
+ if( !pFrameGrabber->mpPlayer || !pPixbufSink )
+ {
+ delete pFrameGrabber;
+ pFrameGrabber = NULL;
+ }
+ else
+ {
+ g_object_set( pFrameGrabber->mpPlayer, "audio-sink", gst_element_factory_make( "fakesink", NULL ), NULL );
+ g_object_set( pFrameGrabber->mpPlayer, "video-sink", pPixbufSink, NULL );
+ }
+ }
+ }
+
+ return( pFrameGrabber );
+}
+
+// ------------------------------------------------------------------------------
+
+gboolean FrameGrabber::busCallback( GstBus* pBus, GstMessage* pMsg )
+{
+ bool bDone = false;
+
+ if( pMsg && pMsg->structure )
+ {
+ GstStructure* pStruct = pMsg->structure;
+ const gchar* pStructName = gst_structure_get_name( pStruct );
+
+ if( ( ::std::string( pStructName ).find( "pixbuf" ) != ::std::string::npos ) &&
+ gst_structure_has_field ( pStruct, "pixbuf") )
+ {
+ bool bFrameGrabbed = false;
+
+ g_mutex_lock( mpFrameMutex );
+
+ if( mbIsInGrabMode && ( getMediaTime() >= mfGrabTime ) )
+ {
+ OSL_TRACE( "Grabbing frame at %fs", getMediaTime() );
+
+ if( mpLastPixbuf )
+ {
+ g_object_unref( mpLastPixbuf );
+ mpLastPixbuf = NULL;
+ }
+
+ mpLastPixbuf = GDK_PIXBUF( g_value_dup_object( gst_structure_get_value( pStruct, "pixbuf" ) ) );
+ bFrameGrabbed = true;
+ }
+
+ g_mutex_unlock( mpFrameMutex );
+
+ if( bFrameGrabbed )
+ {
+ g_cond_signal( mpFrameCond );
+ }
+
+ bDone = true;
+ }
+ }
+
+ return( bDone || Player::busCallback( pBus, pMsg ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< graphic::XGraphic > xRet;
+
+ if( implInitPlayer() )
+ {
+ OSL_TRACE( "Trying to grab frame at %fs", fMediaTime );
+
+ GTimeVal aTimeoutTime;
+
+ g_get_current_time( &aTimeoutTime );
+ g_time_val_add( &aTimeoutTime, GRAB_TIMEOUT );
+ setMediaTime( fMediaTime );
+ start();
+
+ if( isPlaying() )
+ {
+ g_mutex_lock( mpFrameMutex );
+
+ mbIsInGrabMode = true;
+ mfGrabTime = fMediaTime;
+ g_cond_timed_wait( mpFrameCond, mpFrameMutex, &aTimeoutTime );
+ mbIsInGrabMode = false;
+
+ g_mutex_unlock( mpFrameMutex );
+
+ stop();
+ }
+
+ OSL_ENSURE( g_atomic_pointer_get( &mpLastPixbuf ), "FrameGrabber timed out without receiving a Pixbuf" );
+
+ if( g_atomic_pointer_get( &mpLastPixbuf ) )
+ {
+ OSL_TRACE( "FrameGrabber received a GdkPixbuf");
+
+ g_mutex_lock( mpFrameMutex );
+
+ const int nWidth = gdk_pixbuf_get_width( mpLastPixbuf );
+ const int nHeight = gdk_pixbuf_get_height( mpLastPixbuf );
+ const int nChannels = gdk_pixbuf_get_n_channels( mpLastPixbuf );
+ const guchar* pBuffer = gdk_pixbuf_get_pixels( mpLastPixbuf );
+
+ if( pBuffer && ( nWidth > 0 ) && ( nHeight > 0 ) )
+ {
+ Bitmap aFrame( Size( nWidth, nHeight), 24 );
+ bool bInit = false;
+
+ if( ( gdk_pixbuf_get_colorspace( mpLastPixbuf ) == GDK_COLORSPACE_RGB ) &&
+ ( nChannels >= 3 ) && ( nChannels <= 4 ) &&
+ ( gdk_pixbuf_get_bits_per_sample( mpLastPixbuf ) == 8 ) )
+ {
+ BitmapWriteAccess* pAcc = aFrame.AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ BitmapColor aPixel( 0, 0, 0 );
+ const int nRowStride = gdk_pixbuf_get_rowstride( mpLastPixbuf );
+ const bool bAlpha = ( nChannels == 4 );
+
+ for( int nRow = 0; nRow < nHeight; ++nRow )
+ {
+ guchar* pCur = const_cast< guchar* >( pBuffer + nRow * nRowStride );
+
+ for( int nCol = 0; nCol < nWidth; ++nCol )
+ {
+ aPixel.SetRed( *pCur++ );
+ aPixel.SetGreen( *pCur++ );
+ aPixel.SetBlue( *pCur++ );
+
+ // ignore alpha channel
+ if( bAlpha )
+ {
+ ++pCur;
+ }
+
+ pAcc->SetPixel( nRow, nCol, aPixel );
+ }
+ }
+
+ aFrame.ReleaseAccess( pAcc );
+ bInit = true;
+ }
+ }
+
+ if( !bInit )
+ {
+ aFrame.Erase( Color( COL_BLACK ) );
+ }
+
+ xRet = Graphic( aFrame ).GetXGraphic();
+ }
+
+ g_object_unref( mpLastPixbuf );
+ mpLastPixbuf = NULL;
+
+ g_mutex_unlock( mpFrameMutex );
+ }
+ }
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) );
+
+ return aRet;
+}
+
+} // namespace win
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx
new file mode 100644
index 0000000000..a074cd8be6
--- /dev/null
+++ b/avmedia/source/gstreamer/gstframegrabber.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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 _FRAMEGRABBER_HXX
+#define _FRAMEGRABBER_HXX
+
+#include "gstplayer.hxx"
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_
+#include "com/sun/star/media/XFrameGrabber.hdl"
+#endif
+
+namespace avmedia { namespace gst {
+
+// ----------------
+// - FrameGrabber -
+// ----------------
+
+class FrameGrabber : public Player,
+ public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ // static create method instead of public Ctor
+ static FrameGrabber* create( const GString* pUri );
+
+ ~FrameGrabber();
+
+ // XFrameGrabber
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+protected: FrameGrabber( GString* pURI = NULL );
+
+ virtual gboolean busCallback( GstBus* pBus,
+ GstMessage* pMsg );
+
+private: FrameGrabber( const FrameGrabber& );
+ FrameGrabber& operator=( const FrameGrabber& );
+
+ GMutex* mpFrameMutex;
+ GCond* mpFrameCond;
+ GdkPixbuf* mpLastPixbuf;
+ double mfGrabTime;
+ bool mbIsInGrabMode;
+};
+
+} // namespace gst
+} // namespace avmedia
+
+#endif // _FRAMEGRABBER_HXX
diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx
new file mode 100644
index 0000000000..61ee4ce22c
--- /dev/null
+++ b/avmedia/source/gstreamer/gstmanager.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * 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 "gstmanager.hxx"
+#include "gstplayer.hxx"
+
+using namespace ::com::sun::star;
+
+namespace avmedia
+{
+namespace gst
+{
+// ----------------
+// - Manager -
+// ----------------
+
+Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ mxMgr( rxMgr )
+{}
+
+// ------------------------------------------------------------------------------
+
+Manager::~Manager()
+{}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
+ throw( uno::RuntimeException )
+{
+ return( ::avmedia::gst::Player::create( rURL ) );
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Manager::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aRet( 1 );
+ aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) );
+
+ return( aRet );
+}
+} // namespace gst
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstmanager.hxx b/avmedia/source/gstreamer/gstmanager.hxx
new file mode 100644
index 0000000000..9f80e8c1a9
--- /dev/null
+++ b/avmedia/source/gstreamer/gstmanager.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * 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 _GSTMANAGER_HXX
+#define _GSTMANAGER_HXX
+
+#include "gstcommon.hxx"
+
+#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_
+#include "com/sun/star/media/XManager.hdl"
+#endif
+
+// -----------
+// - Manager -
+// -----------
+
+namespace avmedia
+{
+namespace gst
+{
+class Manager : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XManager,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public: Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+ ~Manager();
+
+ // XManager
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer(
+ const ::rtl::OUString& aURL )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+};
+} // namespace gst
+} // namespace avmedia
+
+#endif // _GSTMANAGER_HXX
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
new file mode 100644
index 0000000000..f082cfc5c5
--- /dev/null
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -0,0 +1,938 @@
+/*************************************************************************
+ *
+ * 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 "gstplayer.hxx"
+#include "gstwindow.hxx"
+#include "gstframegrabber.hxx"
+#include <stdio.h>
+#include <unistd.h>
+#include <math.h>
+#include <string>
+#include <gst/gstelement.h>
+#include <gst/interfaces/xoverlay.h>
+
+
+// maximum timeout time in nanoseconds
+#define GST_MAX_TIMEOUT (2500 * GST_MSECOND)
+
+using namespace ::com::sun::star;
+
+namespace avmedia
+{
+namespace gst
+{
+const double NANO_TIME_FACTOR = 1000000000.0;
+
+const long VIDEO_DEFAULT_WIDTH = 256;
+const long VIDEO_DEFAULT_HEIGHT = 192;
+
+// ----------------
+// - GstBusSource -
+// ----------------
+
+struct GstBusSource : public GSource
+{
+ GstBus* mpBus;
+
+ GstBusSource() :
+ mpBus( NULL )
+ {}
+
+ ~GstBusSource()
+ {}
+};
+
+// ---------------
+// - Player -
+// ---------------
+Player::Player( GString* pURI ) :
+ mpMutex( g_mutex_new() ),
+ mpCond( g_cond_new() ),
+ mpThread( NULL ),
+ mpContext( NULL ),
+ mpLoop( NULL ),
+ mpPlayer( NULL ),
+ mpURI( pURI ),
+ mpPlayerWindow( NULL ),
+ mnIsVideoSource( 0 ),
+ mnVideoWidth( 0 ),
+ mnVideoHeight( 0 ),
+ mnInitialized( 0 ),
+ mnVolumeDB( 0 ),
+ mnLooping( 0 ),
+ mnQuit( 0 ),
+ mnVideoWindowSet( 0 ),
+ mnInitFail( 0 )
+{
+ // initialize GStreamer framework only once
+ static bool bGstInitialized = false;
+
+ if( !bGstInitialized )
+ {
+ gst_init( NULL, NULL );
+ bGstInitialized = true;
+ }
+
+ if( pURI )
+ {
+ OSL_TRACE( ">>> --------------------------------" );
+ OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str );
+
+ mpThread = g_thread_create( Player::implThreadFunc, this, true, NULL );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+Player::~Player()
+{
+ if( g_atomic_pointer_get( &mpPlayer ) )
+ {
+ implQuitThread();
+ }
+
+ // cleanup
+ g_cond_free( mpCond );
+ g_mutex_free( mpMutex );
+ g_string_free( mpURI, false );
+}
+
+// ------------------------------------------------------------------------------
+Player* Player::create( const ::rtl::OUString& rURL )
+{
+ Player* pPlayer = NULL;
+
+ if( rURL.getLength() )
+ {
+ // safely initialize GLib threading framework
+ try
+ {
+ if( !g_thread_supported() )
+ {
+ g_thread_init( NULL );
+ }
+ }
+ catch( ... )
+ {}
+
+ if( g_thread_supported() )
+ {
+ const INetURLObject aURL( rURL );
+
+ if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ GString* pURI = g_string_new( ::rtl::OUStringToOString(
+ aURL.GetMainURL( INetURLObject::NO_DECODE ),
+ RTL_TEXTENCODING_UTF8 ).getStr() );
+
+ if( pURI->len )
+ {
+ pPlayer = new Player( pURI );
+
+ // wait until thread signals that it has finished initialization
+ if( pPlayer->mpThread )
+ {
+ g_mutex_lock( pPlayer->mpMutex );
+
+ while( !pPlayer->implIsInitialized() )
+ {
+ g_cond_wait( pPlayer->mpCond, pPlayer->mpMutex );
+ }
+
+ g_mutex_unlock( pPlayer->mpMutex );
+ }
+
+ // check if player pipeline could be initialized
+ if( !pPlayer->mpPlayer )
+ {
+ delete pPlayer;
+ pPlayer = NULL;
+ }
+ }
+ else
+ {
+ g_string_free( pURI, false );
+ }
+ }
+ }
+ }
+
+ return( pPlayer );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::start()
+ throw( uno::RuntimeException )
+{
+ if( implInitPlayer() && !isPlaying() )
+ {
+ gst_element_set_state( mpPlayer, GST_STATE_PLAYING );
+ }
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::stop()
+ throw( uno::RuntimeException )
+{
+ if( implInitPlayer() && isPlaying() )
+ {
+ gst_element_set_state( mpPlayer, GST_STATE_PAUSED );
+ }
+}
+
+// ------------------------------------------------------------------------------
+sal_Bool SAL_CALL Player::isPlaying()
+ throw( uno::RuntimeException )
+{
+ GstState aState = GST_STATE_NULL;
+
+ if( mpPlayer )
+ {
+ gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT );
+ }
+
+ return( GST_STATE_PLAYING == aState );
+}
+
+// ------------------------------------------------------------------------------
+double SAL_CALL Player::getDuration()
+ throw( uno::RuntimeException )
+{
+ gint64 nDuration = 0;
+
+ if( implInitPlayer() )
+ {
+ GstFormat aFormat = GST_FORMAT_TIME;
+
+ if( !gst_element_query_duration( mpPlayer, &aFormat, &nDuration ) ||
+ ( GST_FORMAT_TIME != aFormat ) ||
+ ( nDuration < 0 ) )
+ {
+ nDuration = 0;
+ }
+ }
+
+ return( static_cast< double >( nDuration ) / NANO_TIME_FACTOR );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::setMediaTime( double fTime )
+ throw( uno::RuntimeException )
+{
+ if( implInitPlayer() )
+ {
+ fTime = ::std::min( ::std::max( fTime, 0.0 ), getDuration() );
+
+ gst_element_seek_simple( mpPlayer, GST_FORMAT_TIME,
+ (GstSeekFlags) ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT ),
+ static_cast< gint64 >( fTime * NANO_TIME_FACTOR ) );
+ }
+}
+
+// ------------------------------------------------------------------------------
+double SAL_CALL Player::getMediaTime()
+ throw( uno::RuntimeException )
+{
+ double fRet = 0.0;
+
+ if( implInitPlayer() )
+ {
+ GstFormat aFormat = GST_FORMAT_TIME;
+ gint64 nCurTime = 0;
+
+ if( gst_element_query_position( mpPlayer, &aFormat, &nCurTime ) &&
+ ( GST_FORMAT_TIME == aFormat ) &&
+ ( nCurTime >= 0 ) )
+ {
+ fRet = static_cast< double >( nCurTime ) / NANO_TIME_FACTOR;
+ }
+ }
+
+ return( fRet );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::setStopTime( double /* fTime */ )
+ throw( uno::RuntimeException )
+{
+ OSL_TRACE( "GStreamer method avmedia::gst::Player::setStopTime needs to be implemented" );
+
+ /* Currently no need for implementation since higher levels of code don't use this method at all
+ !!! TODO: needs to be implemented if this functionality is needed at a later point of time
+ if( implInitPlayer() )
+ {
+ }
+
+ */
+}
+
+// ------------------------------------------------------------------------------
+double SAL_CALL Player::getStopTime()
+ throw( uno::RuntimeException )
+{
+ /*
+ Currently no need for implementation since higher levels of code don't set a stop time ATM
+ !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time
+ */
+
+ return( getDuration() );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::setRate( double /* fRate */ )
+ throw( uno::RuntimeException )
+{
+ OSL_TRACE( "GStreamer method avmedia::gst::Player::setRate needs to be implemented" );
+
+ /* Currently no need for implementation since higher levels of code don't use this method at all
+ !!! TODO: needs to be implemented if this functionality is needed at a later point of time
+ */
+}
+
+// ------------------------------------------------------------------------------
+double SAL_CALL Player::getRate()
+ throw( uno::RuntimeException )
+{
+ /*
+ Currently no need for implementation since higher levels of code don't set a different rate than 1 ATM
+ !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time
+ */
+
+ return( 1.0 );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet )
+ throw( uno::RuntimeException )
+{
+ if( bSet && !isPlaybackLoop() )
+ g_atomic_int_inc( &mnLooping );
+ else if( !bSet && isPlaybackLoop() )
+ g_atomic_int_dec_and_test( &mnLooping );
+}
+
+// ------------------------------------------------------------------------------
+sal_Bool SAL_CALL Player::isPlaybackLoop()
+ throw( uno::RuntimeException )
+{
+ return( g_atomic_int_get( &mnLooping ) > 0 );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::setMute( sal_Bool bSet )
+ throw( uno::RuntimeException )
+{
+ if( implInitPlayer() && ( bSet != isMute() ) )
+ {
+ if( bSet )
+ {
+ g_object_set( mpPlayer, "volume", 0.0, NULL );
+ }
+ else
+ {
+ setVolumeDB( mnVolumeDB );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------
+sal_Bool SAL_CALL Player::isMute()
+ throw( uno::RuntimeException )
+{
+ gdouble fGstVolume = 1.0;
+
+ if( implInitPlayer() )
+ {
+ g_object_get( mpPlayer, "volume", &fGstVolume, NULL );
+ }
+
+ return( 0.0 == fGstVolume );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB )
+ throw( uno::RuntimeException )
+{
+ if( implInitPlayer() )
+ {
+ g_mutex_lock( mpMutex );
+ mnVolumeDB = nVolumeDB;
+ g_mutex_unlock( mpMutex );
+
+ // maximum gain for gstreamer volume is 10
+ double fGstVolume = pow( 10.0, static_cast< double >( ::std::min(
+ nVolumeDB, static_cast< sal_Int16 >( 20 ) ) / 20.0 ) );
+
+ g_object_set( mpPlayer, "volume", fGstVolume, NULL );
+ }
+}
+
+// ------------------------------------------------------------------------------
+sal_Int16 SAL_CALL Player::getVolumeDB()
+ throw( uno::RuntimeException )
+{
+ return( static_cast< sal_Int16 >( g_atomic_int_get( &mnVolumeDB ) ) );
+}
+
+// ------------------------------------------------------------------------------
+awt::Size SAL_CALL Player::getPreferredPlayerWindowSize()
+ throw( uno::RuntimeException )
+{
+ awt::Size aSize( 0, 0 );
+
+ if( implInitPlayer() && ( g_atomic_int_get( &mnIsVideoSource ) > 0 ) )
+ {
+ aSize.Width = g_atomic_int_get( &mnVideoWidth );
+ aSize.Height = g_atomic_int_get( &mnVideoHeight );
+
+ // if we have a video source, but no size is given => use default size
+ if( ( aSize.Width <= 0 ) || ( aSize.Height <= 0 ) )
+ {
+ aSize.Width = VIDEO_DEFAULT_WIDTH;
+ aSize.Height = VIDEO_DEFAULT_HEIGHT;
+ }
+ }
+
+ OSL_TRACE( ">>> Requested preferred video size is: %d x %d pixel", aSize.Width, aSize.Height );
+
+ return( aSize );
+}
+
+// ------------------------------------------------------------------------------
+uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow(
+ const uno::Sequence< uno::Any >& rArguments )
+ throw( uno::RuntimeException )
+{
+ uno::Reference< ::media::XPlayerWindow > xRet;
+ awt::Size aSize( getPreferredPlayerWindowSize() );
+
+ OSL_ENSURE( !g_atomic_pointer_get( &mpPlayerWindow ), "::avmedia::gst::Player already has a player window" );
+
+ if( ( aSize.Width > 0 ) && ( aSize.Height > 0 ) )
+ {
+ Window* pPlayerWindow = new Window( *this );
+
+ xRet = pPlayerWindow;
+
+ if( !pPlayerWindow->create( rArguments ) )
+ {
+ xRet.clear();
+ }
+ else
+ {
+ // try to use gconf user configurable video sink first
+ GstElement* pVideoSink = gst_element_factory_make( "gconfvideosink", NULL );
+
+ if( ( NULL != pVideoSink ) ||
+ ( NULL != ( pVideoSink = gst_element_factory_make( "autovideosink", NULL ) ) ) ||
+ ( NULL != ( pVideoSink = gst_element_factory_make( "xvimagesink", NULL ) ) ) ||
+ ( NULL != ( pVideoSink = gst_element_factory_make( "ximagesink", NULL ) ) ) )
+ {
+ GstState aOldState = GST_STATE_NULL;
+
+ mpPlayerWindow = pPlayerWindow;
+ gst_element_get_state( mpPlayer, &aOldState, NULL, GST_MAX_TIMEOUT );
+ gst_element_set_state( mpPlayer, GST_STATE_READY );
+ g_object_set( mpPlayer, "video-sink", pVideoSink, NULL );
+ gst_element_set_state( mpPlayer, aOldState );
+ }
+ }
+ }
+
+ return( xRet );
+}
+
+// ------------------------------------------------------------------------------
+uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber()
+ throw( ::com::sun::star::uno::RuntimeException )
+{
+ FrameGrabber* pFrameGrabber = NULL;
+ const awt::Size aPrefSize( getPreferredPlayerWindowSize() );
+
+ if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) )
+ {
+ pFrameGrabber = FrameGrabber::create( mpURI );
+ }
+
+ return( pFrameGrabber );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::dispose()
+ throw( uno::RuntimeException )
+{
+ if( mpPlayer )
+ {
+ stop();
+ implQuitThread();
+ }
+
+ OSL_ASSERT( NULL == mpPlayer );
+}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::addEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ )
+ throw( uno::RuntimeException )
+{}
+
+// ------------------------------------------------------------------------------
+void SAL_CALL Player::removeEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ )
+ throw( uno::RuntimeException )
+{}
+
+// ------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL Player::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME ) ) );
+}
+
+// ------------------------------------------------------------------------------
+sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) ) );
+}
+
+// ------------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aRet( 1 );
+ aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) );
+
+ return( aRet );
+}
+
+// ------------------------------------------------------------------------------
+void Player::implQuitThread()
+{
+ if( mpThread )
+ {
+ // set quit flag to 1 so that the main loop will be quit in idle
+ // handler the next time it is called from the thread's main loop
+ g_atomic_int_inc( &mnQuit );
+
+ // wait until loop and as such the thread has quit
+ g_thread_join( mpThread );
+ mpThread = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------------
+bool Player::implInitPlayer()
+{
+ bool bRet = false;
+
+ if( mpPlayer && (mnInitFail < 3) )
+ {
+ GstState aState = GST_STATE_NULL;
+
+ if( gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS )
+ {
+ bRet = ( GST_STATE_PAUSED == aState ) || ( GST_STATE_PLAYING == aState );
+
+ if( !bRet )
+ {
+ gst_element_set_state( mpPlayer, GST_STATE_PAUSED );
+ bRet = ( gst_element_get_state( mpPlayer, &aState, NULL,
+ GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS ) &&
+ ( GST_STATE_PAUSED == aState );
+ }
+ }
+
+ if( ! bRet )
+ mnInitFail++;
+ }
+
+ return( bRet );
+}
+
+// ------------------------------------------------------------------------------
+gboolean Player::implBusPrepare( GSource* pSource,
+ gint* pTimeout )
+{
+ if( pTimeout )
+ {
+ *pTimeout = 0;
+ }
+
+ return( implBusCheck( pSource ) );
+}
+
+// ------------------------------------------------------------------------------
+gboolean Player::implBusCheck( GSource* pSource )
+{
+ GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
+
+ return( pBusSource &&
+ GST_IS_BUS( pBusSource->mpBus ) &&
+ gst_bus_have_pending( GST_BUS_CAST( pBusSource->mpBus ) ) );
+}
+
+// ------------------------------------------------------------------------------
+gboolean Player::implBusDispatch( GSource* pSource,
+ GSourceFunc /*aCallback*/,
+ gpointer pData )
+{
+ GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
+ gboolean bRet = false;
+
+ if( pData && pBusSource && GST_IS_BUS( pBusSource->mpBus ) )
+ {
+ GstMessage* pMsg = gst_bus_pop( pBusSource->mpBus );
+
+ if( pMsg )
+ {
+ bRet = static_cast< Player* >( pData )->busCallback( pBusSource->mpBus, pMsg );
+ gst_message_unref( pMsg );
+ }
+ }
+
+ return( bRet );
+}
+
+// ------------------------------------------------------------------------------
+void Player::implBusFinalize( GSource* pSource )
+{
+ GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
+
+ if( pBusSource && pBusSource->mpBus )
+ {
+ gst_object_unref( pBusSource->mpBus );
+ pBusSource->mpBus = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------------
+gboolean Player::busCallback( GstBus* /*pBus*/,
+ GstMessage* pMsg )
+{
+ if( pMsg && mpLoop )
+ {
+ switch( GST_MESSAGE_TYPE( pMsg ) )
+ {
+ case ( GST_MESSAGE_EOS ):
+ {
+ if( g_atomic_int_get( &mnLooping ) > 0 )
+ {
+ setMediaTime( 0.0 );
+ start();
+ }
+ else
+ {
+ stop();
+ }
+ }
+ break;
+
+ case ( GST_MESSAGE_ERROR ):
+ {
+ gchar* pDebug;
+ GError* pErr;
+
+ gst_message_parse_error( pMsg, &pErr, &pDebug );
+ fprintf( stderr, "Error: %s\n", pErr->message );
+
+ g_free( pDebug );
+ g_error_free( pErr );
+ }
+ break;
+
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ return( true );
+}
+
+// ------------------------------------------------------------------------------
+gboolean Player::implIdleFunc( gpointer pData )
+{
+ return( pData ? static_cast< Player* >( pData )->idle() : true );
+}
+
+// ------------------------------------------------------------------------------
+gpointer Player::implThreadFunc( gpointer pData )
+{
+ return( pData ? static_cast< Player* >( pData )->run() : NULL );
+}
+
+// ------------------------------------------------------------------------------
+GstBusSyncReply Player::implHandleCreateWindowFunc( GstBus* pBus,
+ GstMessage* pMsg,
+ gpointer pData )
+{
+ return( pData ? static_cast< Player* >( pData )->handleCreateWindow( pBus, pMsg ) : GST_BUS_PASS );
+}
+
+// ------------------------------------------------------------------------------
+void Player::implHandleNewElementFunc( GstBin* /* pBin */,
+ GstElement* pElement,
+ gpointer pData )
+{
+ if( pElement )
+ {
+#ifdef DEBUG
+ gchar* pElementName = gst_element_get_name( pElement );
+
+ if( pElementName )
+ {
+ OSL_TRACE( ">>> Bin has element: %s", pElementName );
+ g_free( pElementName );
+ }
+#endif
+
+ if( GST_IS_BIN( pElement ) )
+ {
+ // set this handler in case we have a GstBin element
+ g_signal_connect( GST_BIN( pElement ), "element-added",
+ G_CALLBACK( Player::implHandleNewElementFunc ), pData );
+ }
+
+ // watch for all pads that are going to be added to this element;
+ g_signal_connect( pElement, "pad-added",
+ G_CALLBACK( Player::implHandleNewPadFunc ), pData );
+ }
+}
+
+// ------------------------------------------------------------------------------
+void Player::implHandleNewPadFunc( GstElement* pElement,
+ GstPad* pPad,
+ gpointer pData )
+{
+ Player* pPlayer = static_cast< Player* >( pData );
+
+ if( pPlayer && pElement && pPad )
+ {
+#ifdef DEBUG
+ gchar* pElementName = gst_element_get_name( pElement );
+ gchar* pPadName = gst_pad_get_name( pPad );
+
+ OSL_TRACE( ">>> Element %s has pad: %s", pElementName, pPadName );
+
+ g_free( pPadName );
+ g_free( pElementName );
+#endif
+
+ GstCaps* pCaps = gst_pad_get_caps( pPad );
+
+ // we are interested only in getting video properties
+ // width and height or if we have a video source at all
+ if( pCaps )
+ {
+ for( gint i = 0, nSize = gst_caps_get_size( pCaps ); i < nSize; ++i )
+ {
+ const GstStructure* pStruct = gst_caps_get_structure( pCaps, i );
+
+ if( pStruct )
+ {
+ const gchar* pStructName = gst_structure_get_name( pStruct );
+
+#ifdef DEBUG
+ OSL_TRACE( "\t>>> Pad has structure: %s", pStructName );
+
+ for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n )
+ {
+ OSL_TRACE( "\t\t>>> Structure has field: %s", gst_structure_nth_field_name( pStruct, n ) );
+ }
+#endif
+
+ // just look for structures having 'video' in their names
+ if( ::std::string( pStructName ).find( "video" ) != ::std::string::npos )
+ {
+ g_atomic_int_inc( &pPlayer->mnIsVideoSource );
+
+ for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n )
+ {
+ const gchar* pFieldName = gst_structure_nth_field_name( pStruct, n );
+ gint nValue;
+
+ if( ( ::std::string( pFieldName ).find( "width" ) != ::std::string::npos ) &&
+ gst_structure_get_int( pStruct, pFieldName, &nValue ) )
+ {
+ const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoWidth );
+ g_atomic_int_add( &pPlayer->mnVideoWidth, ::std::max( nDiff, 0 ) );
+ }
+ else if( ( ::std::string( pFieldName ).find( "height" ) != ::std::string::npos ) &&
+ gst_structure_get_int( pStruct, pFieldName, &nValue ) )
+ {
+ const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoHeight );
+ g_atomic_int_add( &pPlayer->mnVideoHeight, ::std::max( nDiff, 0 ) );
+ }
+ }
+ }
+ }
+ }
+
+ gst_caps_unref( pCaps );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------
+gboolean Player::idle()
+{
+ // test if main loop should quit and set flag mnQuit to 1
+ bool bQuit = g_atomic_int_compare_and_exchange( &mnQuit, 1, 1 );
+
+ if( bQuit )
+ {
+ // set mnQuit back to 0 to avoid mutiple g_main_loop_quit calls
+ // in case Player::idle() is called again later;
+ // the flag should have been set only once within Ctor called from
+ // the application thread
+ g_atomic_int_dec_and_test( &mnQuit );
+ g_main_loop_quit( mpLoop );
+ }
+
+ // don't eat up all cpu time
+ usleep( 1000 );
+
+ return( true );
+}
+
+// ------------------------------------------------------------------------------
+gpointer Player::run()
+{
+ static GSourceFuncs aSourceFuncs =
+ {
+ Player::implBusPrepare,
+ Player::implBusCheck,
+ Player::implBusDispatch,
+ Player::implBusFinalize,
+ NULL,
+ NULL
+ };
+
+ if( NULL != ( mpPlayer = gst_element_factory_make( "playbin", NULL ) ) )
+ {
+ // initialization
+ // no mutex necessary since initialization
+ // is synchronous until loop is started
+ mpContext = g_main_context_new();
+ mpLoop = g_main_loop_new( mpContext, false );
+
+ // add idle callback
+ GSource* pIdleSource = g_idle_source_new();
+ g_source_set_callback( pIdleSource, Player::implIdleFunc, this, NULL );
+ g_source_attach( pIdleSource, mpContext );
+
+ // add bus callback
+ GSource* pBusSource = g_source_new( &aSourceFuncs, sizeof( GstBusSource ) );
+ static_cast< GstBusSource* >( pBusSource )->mpBus = gst_pipeline_get_bus( GST_PIPELINE( mpPlayer ) );
+ g_source_set_callback( pBusSource, NULL, this, NULL );
+ g_source_attach( pBusSource, mpContext );
+
+ // add bus sync handler to intercept video window creation for setting our own window
+ gst_bus_set_sync_handler( static_cast< GstBusSource* >( pBusSource )->mpBus,
+ Player::implHandleCreateWindowFunc, this );
+
+ // watch for all elements (and pads) that will be added to the playbin,
+ // in order to retrieve properties like video width and height
+ g_signal_connect( GST_BIN( mpPlayer ), "element-added",
+ G_CALLBACK( Player::implHandleNewElementFunc ), this );
+
+ // set source URI for player
+ g_object_set( mpPlayer, "uri", mpURI->str, NULL );
+
+ // set video fake sink first, since we only create a player without window here
+ // and don't want to have the gstreamer default window appearing
+ g_object_set( mpPlayer, "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL );
+
+ // set state of player to READY or destroy object in case of FAILURE
+ if( gst_element_set_state( mpPlayer, GST_STATE_READY ) == GST_STATE_CHANGE_FAILURE )
+ {
+ gst_object_unref( mpPlayer );
+ mpPlayer = NULL;
+ }
+
+ g_atomic_int_add( &mnInitialized, 1 );
+ g_cond_signal( mpCond );
+
+ // run the main loop
+ g_main_loop_run( mpLoop );
+
+ // clenanup
+ // no mutex necessary since other thread joined us (this thread)
+ // after setting the quit flag
+ if( mpPlayer )
+ {
+ gst_element_set_state( mpPlayer, GST_STATE_NULL );
+ gst_object_unref( mpPlayer );
+ mpPlayer = NULL;
+ }
+
+ g_main_loop_unref( mpLoop );
+ mpLoop = NULL;
+
+ g_source_destroy( pBusSource );
+ g_source_unref( pBusSource );
+
+ g_source_destroy( pIdleSource );
+ g_source_unref( pIdleSource );
+
+ g_main_context_unref( mpContext );
+ mpContext = NULL;
+ }
+ else
+ {
+ g_atomic_int_add( &mnInitialized, 1 );
+ g_cond_signal( mpCond );
+ }
+
+ return( NULL );
+}
+
+// ------------------------------------------------------------------------------
+GstBusSyncReply Player::handleCreateWindow( GstBus* /* pBus */,
+ GstMessage* pMsg )
+{
+ GstBusSyncReply eRet = GST_BUS_PASS;
+
+ if( pMsg &&
+ ( GST_MESSAGE_TYPE( pMsg ) == GST_MESSAGE_ELEMENT ) &&
+ gst_structure_has_name( pMsg->structure, "prepare-xwindow-id" ) &&
+ g_atomic_pointer_get( &mpPlayerWindow ) )
+ {
+ OSL_TRACE( ">>> Got Request to create XOverlay" );
+
+ gst_x_overlay_set_xwindow_id( GST_X_OVERLAY( GST_MESSAGE_SRC( pMsg ) ),
+ static_cast< Window* >( g_atomic_pointer_get(
+ &mpPlayerWindow ) )->getXWindowHandle() );
+
+ gst_message_unref( pMsg );
+ eRet = GST_BUS_DROP;
+ }
+
+ return( eRet );
+}
+} // namespace gst
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx
new file mode 100644
index 0000000000..5c80cb4e1d
--- /dev/null
+++ b/avmedia/source/gstreamer/gstplayer.hxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * 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 _GSTPLAYER_HXX
+#define _GSTPLAYER_HXX
+
+#include "gstcommon.hxx"
+#include <glib.h>
+#include <glib/gatomic.h>
+
+// necessary for mixed environments with GStreamer-0.10 and GLib versions < 2.8
+#ifndef G_GNUC_NULL_TERMINATED
+#if __GNUC__ >= 4
+#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
+#else
+#define G_GNUC_NULL_TERMINATED
+#endif
+#endif
+
+struct _GOptionGroup;
+typedef struct _GOptionGroup GOptionGroup;
+
+#include <gst/gst.h>
+#include "com/sun/star/media/XPlayer.hdl"
+
+namespace avmedia
+{
+namespace gst
+{
+class Window;
+
+// ---------------
+// - Player_Impl -
+// ---------------
+
+class Player : public ::cppu::WeakImplHelper3< ::com::sun::star::media::XPlayer,
+ ::com::sun::star::lang::XComponent,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ // static create method instead of public Ctor
+ static Player* create( const ::rtl::OUString& rURL );
+
+ ~Player();
+
+ // XPlayer
+ virtual void SAL_CALL start()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL stop()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL isPlaying()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual double SAL_CALL getDuration()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setMediaTime( double fTime )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual double SAL_CALL getMediaTime()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setStopTime( double fTime )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual double SAL_CALL getStopTime()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setRate( double fRate )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual double SAL_CALL getRate()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL isPlaybackLoop()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setMute( sal_Bool bSet )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL isMute()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int16 SAL_CALL getVolumeDB()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > SAL_CALL createPlayerWindow(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+
+protected:
+
+ Player( GString* pURI = NULL );
+
+ virtual gboolean busCallback( GstBus* pBus,
+ GstMessage* pMsg );
+
+ virtual gboolean idle();
+
+ virtual gpointer run();
+
+ virtual GstBusSyncReply handleCreateWindow( GstBus* pBus,
+ GstMessage* pMsg );
+
+ void implQuitThread();
+
+ bool implInitPlayer();
+
+ bool implIsInitialized() const
+ {
+ return( g_atomic_int_get( &mnInitialized ) > 0 );
+ }
+
+
+private:
+
+ Player( const Player& );
+
+ Player& operator=( const Player& );
+
+ static gboolean implBusPrepare( GSource* pSource,
+ gint* pTimeout );
+
+ static gboolean implBusCheck( GSource* pSource );
+
+ static gboolean implBusDispatch( GSource* pSource,
+ GSourceFunc aCallback,
+ gpointer pData );
+
+ static void implBusFinalize( GSource* pSource );
+
+ static gboolean implIdleFunc( gpointer pData );
+
+ static gpointer implThreadFunc( gpointer pData );
+
+ static GstBusSyncReply implHandleCreateWindowFunc( GstBus* pBus,
+ GstMessage* pMsg,
+ gpointer pDData );
+
+ static void implHandleNewElementFunc( GstBin* pBin,
+ GstElement* pElement,
+ gpointer pData );
+
+ static void implHandleNewPadFunc( GstElement* pElem,
+ GstPad* pPad,
+ gpointer pData );
+
+protected:
+
+ GMutex* mpMutex;
+ GCond* mpCond;
+ GThread* mpThread;
+ GMainContext* mpContext;
+ GMainLoop* mpLoop;
+ GstElement* mpPlayer;
+ GString* mpURI;
+
+private:
+
+ ::avmedia::gst::Window* mpPlayerWindow;
+ gint mnIsVideoSource;
+ gint mnVideoWidth;
+ gint mnVideoHeight;
+ gint mnInitialized;
+ gint mnVolumeDB;
+ gint mnLooping;
+ gint mnQuit;
+ gint mnVideoWindowSet;
+ gint mnInitFail;
+};
+} // namespace gst
+} // namespace avmedia
+
+#endif // _GSTPLAYER_HXX
diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx
new file mode 100644
index 0000000000..a13a0f153b
--- /dev/null
+++ b/avmedia/source/gstreamer/gstuno.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * 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 "gstcommon.hxx"
+#include "gstmanager.hxx"
+
+using namespace ::com::sun::star;
+
+// -------------------
+// - factory methods -
+// -------------------
+
+static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
+{
+ return uno::Reference< uno::XInterface >( *new ::avmedia::gst::Manager( rxFact ) );
+}
+
+// ------------------------------------------
+// - component_getImplementationEnvironment -
+// ------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+// -----------------------
+// - component_writeInfo -
+// -----------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ uno::Reference< registry::XRegistryKey > xNewKey1(
+ static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
+ ::rtl::OUString::createFromAscii(
+ "/" AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/"
+ AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) );
+
+ bRet = sal_True;
+ }
+ catch( registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+{
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+ void* pRet = 0;
+
+ if( rtl_str_compare( pImplName, AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) == 0 )
+ {
+ const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) );
+
+ xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
+ reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
+ ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ),
+ create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
+ }
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx
new file mode 100644
index 0000000000..12606ad5e8
--- /dev/null
+++ b/avmedia/source/gstreamer/gstwindow.cxx
@@ -0,0 +1,668 @@
+/*************************************************************************
+ *
+ * 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 <tools/prex.h>
+#include <tools/postx.h>
+
+#include <com/sun/star/awt/SystemPointer.hdl>
+
+#include "gstwindow.hxx"
+#include "gstplayer.hxx"
+#include <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
+
+using namespace ::com::sun::star;
+
+namespace avmedia
+{
+namespace gst
+{
+// ---------------------
+// - PlayerChildWindow -
+// ---------------------
+
+class PlayerChildWindow : public SystemChildWindow
+{
+public:
+
+ PlayerChildWindow( Window* pParent );
+ ~PlayerChildWindow();
+
+protected:
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+};
+
+// ---------------------------------------------------------------------
+
+PlayerChildWindow::PlayerChildWindow( Window* pParent ) :
+ SystemChildWindow( pParent, WB_CLIPCHILDREN )
+{
+}
+
+// ---------------------------------------------------------------------
+
+PlayerChildWindow::~PlayerChildWindow()
+{
+}
+
+// ---------------------------------------------------------------------
+
+void PlayerChildWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
+ rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
+
+ SystemChildWindow::MouseMove( rMEvt );
+ GetParent()->MouseMove( aTransformedEvent );
+}
+
+// ---------------------------------------------------------------------
+
+void PlayerChildWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
+ rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
+
+ SystemChildWindow::MouseButtonDown( rMEvt );
+ GetParent()->MouseButtonDown( aTransformedEvent );
+}
+
+// ---------------------------------------------------------------------
+
+void PlayerChildWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
+ rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
+
+ SystemChildWindow::MouseButtonUp( rMEvt );
+ GetParent()->MouseButtonUp( aTransformedEvent );
+}
+
+// ---------------------------------------------------------------------
+
+void PlayerChildWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ SystemChildWindow::KeyInput( rKEvt );
+ GetParent()->KeyInput( rKEvt );
+}
+
+// ---------------------------------------------------------------------
+
+void PlayerChildWindow::KeyUp( const KeyEvent& rKEvt )
+{
+ SystemChildWindow::KeyUp( rKEvt );
+ GetParent()->KeyUp( rKEvt );
+}
+
+// ---------------------------------------------------------------------
+
+void PlayerChildWindow::Command( const CommandEvent& rCEvt )
+{
+ const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
+ rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
+
+ SystemChildWindow::Command( rCEvt );
+ GetParent()->Command( aTransformedEvent );
+}
+
+// ---------------
+// - Window -
+// ---------------
+Window::Window( ::avmedia::gst::Player& rPlayer ) :
+ maListeners( maMutex ),
+ maWindowRect( 0, 0, 0, 0 ),
+ mrPlayer( rPlayer ),
+ mpPlayerWindow( NULL ),
+ meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
+ mnPointerType( awt::SystemPointer::ARROW )
+{}
+
+// ------------------------------------------------------------------------------
+
+Window::~Window()
+{
+ dispose();
+}
+
+// ------------------------------------------------------------------------------
+
+void Window::implLayoutVideoWindow()
+{
+ if( mpPlayerWindow && ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) )
+ {
+ awt::Size aPrefSize( mrPlayer.getPreferredPlayerWindowSize() );
+ awt::Rectangle aRect = getPosSize();
+ int nW = aRect.Width, nH = aRect.Height;
+ int nVideoW = nW, nVideoH = nH;
+ int nX = 0, nY = 0, nWidth = 0, nHeight = 0;
+ bool bDone = false, bZoom = false;
+
+ if( media::ZoomLevel_ORIGINAL == meZoomLevel )
+ {
+ bZoom = true;
+ }
+ else if( media::ZoomLevel_ZOOM_1_TO_4 == meZoomLevel )
+ {
+ aPrefSize.Width >>= 2;
+ aPrefSize.Height >>= 2;
+ bZoom = true;
+ }
+ else if( media::ZoomLevel_ZOOM_1_TO_2 == meZoomLevel )
+ {
+ aPrefSize.Width >>= 1;
+ aPrefSize.Height >>= 1;
+ bZoom = true;
+ }
+ else if( media::ZoomLevel_ZOOM_2_TO_1 == meZoomLevel )
+ {
+ aPrefSize.Width <<= 1;
+ aPrefSize.Height <<= 1;
+ bZoom = true;
+ }
+ else if( media::ZoomLevel_ZOOM_4_TO_1 == meZoomLevel )
+ {
+ aPrefSize.Width <<= 2;
+ aPrefSize.Height <<= 2;
+ bZoom = true;
+ }
+ else if( media::ZoomLevel_FIT_TO_WINDOW == meZoomLevel )
+ {
+ nWidth = nVideoW;
+ nHeight = nVideoH;
+ bDone = true;
+ }
+
+ if( bZoom )
+ {
+ if( ( aPrefSize.Width <= nVideoW ) && ( aPrefSize.Height <= nVideoH ) )
+ {
+ nX = ( nVideoW - aPrefSize.Width ) >> 1;
+ nY = ( nVideoH - aPrefSize.Height ) >> 1;
+ nWidth = aPrefSize.Width;
+ nHeight = aPrefSize.Height;
+ bDone = true;
+ }
+ }
+
+ if( !bDone )
+ {
+ if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) && ( nVideoW > 0 ) && ( nVideoH > 0 ) )
+ {
+ double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height;
+
+ if( fPrefWH < ( (double) nVideoW / nVideoH ) )
+ {
+ nVideoW = (int) ( nVideoH * fPrefWH );
+ }
+ else
+ {
+ nVideoH = (int) ( nVideoW / fPrefWH );
+ }
+
+ nX = ( nW - nVideoW ) >> 1;
+ nY = ( nH - nVideoH ) >> 1;
+ nWidth = nVideoW;
+ nHeight = nVideoH;
+ }
+ else
+ {
+ nX = nY = nWidth = nHeight = 0;
+ }
+ }
+
+ mpPlayerWindow->SetPosSizePixel( Point( nX, nY ), Size( nWidth, nHeight ) );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+bool Window::create( const uno::Sequence< uno::Any >& rArguments )
+{
+ OSL_ASSERT( !mpPlayerWindow );
+ OSL_ENSURE( rArguments.getLength() > 2,
+"::avmedia::gst::Windiow::create: GStreamer backend needs \
+valid parent SystemChildWindow pointer (sal_IntPtr) as third Any \
+value in sequence of arguments" );
+
+ bool bRet = false;
+
+ if( !mpPlayerWindow && ( rArguments.getLength() > 2 ) )
+ {
+ SystemChildWindow* pParentWindow = NULL;
+ sal_IntPtr pIntPtr = 0;
+
+ // we are not interested in the first argument, which is a pure X11 window handle;
+ // this backend relies on a SystemChildWindow as parent for the PlayerWindow, given
+ // as third Sal_IntPtr value within the argument Sequence
+ rArguments[ 1 ] >>= maWindowRect;
+
+ rArguments[ 2 ] >>= pIntPtr;
+ pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
+
+ if( pParentWindow )
+ {
+ meZoomLevel = media::ZoomLevel_ORIGINAL;
+
+ mpPlayerWindow = new PlayerChildWindow( pParentWindow );
+ mpPlayerWindow->SetBackground( Color( COL_BLACK ) );
+ mpPlayerWindow->SetPosSizePixel( Point( maWindowRect.X, maWindowRect.Y ),
+ Size( maWindowRect.Width, maWindowRect.Height ) );
+ mpPlayerWindow->Show();
+
+ bRet = true;
+ }
+ }
+
+ return( bRet );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::update()
+ throw( uno::RuntimeException )
+{
+ if( mpPlayerWindow )
+ {
+ mpPlayerWindow->Invalidate( INVALIDATE_UPDATE );
+ mpPlayerWindow->Sync();
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
+ throw(uno::RuntimeException)
+{
+ bool bRet = false;
+
+ if( ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) &&
+ ( media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) )
+ {
+ if( eZoomLevel != meZoomLevel )
+ {
+ meZoomLevel = eZoomLevel;
+ implLayoutVideoWindow();
+ }
+
+ bRet = true;
+ }
+
+ return( bRet );
+}
+
+// ------------------------------------------------------------------------------
+
+media::ZoomLevel SAL_CALL Window::getZoomLevel()
+ throw( uno::RuntimeException )
+{
+ return( meZoomLevel );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setPointerType( sal_Int32 nPointerType )
+ throw( uno::RuntimeException )
+{
+ if( mpPlayerWindow )
+ {
+ Pointer ePointer = POINTER_ARROW;
+
+ switch( nPointerType )
+ {
+ case (awt::SystemPointer::CROSS) :
+ {
+ ePointer = POINTER_CROSS;
+ }
+ break;
+
+ case (awt::SystemPointer::HAND) :
+ {
+ ePointer = POINTER_HAND;
+ }
+ break;
+
+ case (awt::SystemPointer::MOVE) :
+ {
+ ePointer = POINTER_MOVE;
+ }
+ break;
+
+ case (awt::SystemPointer::WAIT) :
+ {
+ ePointer = POINTER_WAIT;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ mpPlayerWindow->SetPointer( ePointer );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setPosSize( sal_Int32 nX,
+ sal_Int32 nY,
+ sal_Int32 nWidth,
+ sal_Int32 nHeight,
+ sal_Int16 /* Flags */ )
+ throw( uno::RuntimeException )
+{
+ maWindowRect.X = nX;
+ maWindowRect.Y = nY;
+ maWindowRect.Width = nWidth;
+ maWindowRect.Height = nHeight;
+
+ implLayoutVideoWindow();
+}
+
+// ------------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL Window::getPosSize()
+ throw( uno::RuntimeException )
+{
+ return( maWindowRect );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setVisible( sal_Bool bVisible )
+ throw( uno::RuntimeException )
+{
+ if( mpPlayerWindow )
+ {
+ bVisible ? mpPlayerWindow->Show() : mpPlayerWindow->Hide();
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setEnable( sal_Bool bEnable )
+ throw( uno::RuntimeException )
+{
+ if( mpPlayerWindow )
+ {
+ mpPlayerWindow->Enable( bEnable );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::setFocus()
+ throw( uno::RuntimeException )
+{
+ if( mpPlayerWindow )
+ {
+ mpPlayerWindow->GrabFocus();
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::dispose()
+ throw( uno::RuntimeException )
+{
+ delete mpPlayerWindow;
+ mpPlayerWindow = NULL;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.addInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >&
+ xListener )
+ throw( uno::RuntimeException )
+{
+ maListeners.removeInterface( getCppuType( &xListener ), xListener );
+}
+
+// ------------------------------------------------------------------------------
+
+void Window::fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer =
+ maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) );
+
+ if( pContainer )
+ {
+ ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
+
+ while( aIter.hasMoreElements() )
+ {
+ uno::Reference< awt::XMouseListener >( aIter.next(),
+ uno::UNO_QUERY )->mousePressed( rEvt );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Window::fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer =
+ maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) );
+
+ if( pContainer )
+ {
+ ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
+
+ while( aIter.hasMoreElements() )
+ {
+ uno::Reference< awt::XMouseListener >( aIter.next(),
+ uno::UNO_QUERY )->mouseReleased( rEvt );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Window::fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer =
+ maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseMotionListener >* )
+ 0 ) );
+
+ if( pContainer )
+ {
+ ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
+
+ while( aIter.hasMoreElements() )
+ {
+ uno::Reference< awt::XMouseMotionListener >( aIter.next(),
+ uno::UNO_QUERY )->mouseMoved( rEvt );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Window::fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer =
+ maListeners.getContainer( getCppuType( ( uno::Reference< awt::XFocusListener >* ) 0 ) );
+
+ if( pContainer )
+ {
+ ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
+
+ while( aIter.hasMoreElements() )
+ {
+ uno::Reference< awt::XFocusListener >( aIter.next(),
+ uno::UNO_QUERY )->focusGained( rEvt );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+long Window::getXWindowHandle() const
+{
+ return( mpPlayerWindow ? mpPlayerWindow->GetSystemData()->aWindow : 0 );
+}
+
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Window::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME ) ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aRet( 1 );
+ aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) );
+
+ return( aRet );
+}
+} // namespace gst
+} // namespace avmedia
diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx
new file mode 100644
index 0000000000..3a55fca9c8
--- /dev/null
+++ b/avmedia/source/gstreamer/gstwindow.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * 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 _GSTWINDOW_HXX
+#define _GSTWINDOW_HXX
+
+#include "gstcommon.hxx"
+#include <cppuhelper/interfacecontainer.h>
+
+#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_
+#include "com/sun/star/media/XPlayerWindow.hdl"
+#endif
+
+namespace avmedia
+{
+namespace gst
+{
+
+class PlayerChildWindow;
+
+// ---------------
+// - Window -
+// ---------------
+
+class Player;
+
+class Window : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayerWindow,
+ ::com::sun::star::lang::XServiceInfo >
+{
+ friend class Player;
+
+public: Window( ::avmedia::gst::Player& rPlayer );
+ ~Window();
+
+ bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
+
+ // XPlayerWindow
+ virtual void SAL_CALL update()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setPointerType( sal_Int32 nPointerType )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XWindow
+ virtual void SAL_CALL setPosSize( sal_Int32 X,
+ sal_Int32 Y,
+ sal_Int32 Width,
+ sal_Int32 Height,
+ sal_Int16 Flags )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setVisible( sal_Bool Visible )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setEnable( sal_Bool Enable )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setFocus()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addWindowListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeWindowListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addFocusListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeFocusListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addKeyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeKeyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addMouseListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeMouseListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addMouseMotionListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeMouseMotionListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addPaintListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removePaintListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+
+public:
+
+ void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
+
+ void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
+
+ void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
+
+ void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
+
+ void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
+
+ void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt );
+
+protected:
+
+ long getXWindowHandle() const;
+
+private:
+
+ ::osl::Mutex maMutex;
+ ::cppu::OMultiTypeInterfaceContainerHelper maListeners;
+ ::com::sun::star::awt::Rectangle maWindowRect;
+ Player& mrPlayer;
+ PlayerChildWindow* mpPlayerWindow;
+ ::com::sun::star::media::ZoomLevel meZoomLevel;
+ sal_Int32 mnPointerType;
+
+ void implLayoutVideoWindow();
+};
+} // namespace gst
+} // namespace avmedia
+
+#endif // _GSTWINDOW_HXX
diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk
new file mode 100644
index 0000000000..2f22c73337
--- /dev/null
+++ b/avmedia/source/gstreamer/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# 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=avmediagst
+TARGET=avmediagst
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
+CDEFS+= -DVERBOSE
+.ENDIF
+
+# --- Files ----------------------------------
+
+.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" && "$(ENABLE_GSTREAMER)" != ""
+
+PKGCONFIG_MODULES=gtk+-2.0 gstreamer-0.10 gstreamer-interfaces-0.10
+.INCLUDE : pkg_config.mk
+
+SLOFILES= \
+ $(SLO)$/gstuno.obj \
+ $(SLO)$/gstmanager.obj \
+ $(SLO)$/gstwindow.obj \
+ $(SLO)$/gstplayer.obj \
+ $(SLO)$/gstframegrabber.obj
+
+EXCEPTIONSFILES= \
+ $(SLO)$/gstuno.obj \
+ $(SLO)$/gstplayer.obj \
+ $(SLO)$/gstframegrabber.obj
+
+SHL1TARGET=$(TARGET)
+SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(TOOLSLIB) $(VCLLIB)
+SHL1STDLIBS+=$(PKGCONFIG_LIBS)
+SHL1IMPLIB=i$(TARGET)
+SHL1LIBS=$(SLB)$/$(TARGET).lib
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+.ENDIF
+
+.INCLUDE : target.mk
diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx
index db5a72d925..32066bf489 100644
--- a/avmedia/source/inc/mediamisc.hxx
+++ b/avmedia/source/inc/mediamisc.hxx
@@ -30,12 +30,30 @@ class ResMgr;
#define AVMEDIA_RESID( nId ) ResId( nId, * ::avmedia::GetResMgr() )
#ifdef WNT
-#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_DirectX"
+
+#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_DirectX"
+#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False
+
+#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 ""
+#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False
+
#else
#ifdef QUARTZ
-#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime"
+
+#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime"
+#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False
+
+#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 ""
+#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False
+
#else
-#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_Java"
+
+#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_GStreamer"
+#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False
+
+#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "com.sun.star.comp.avmedia.Manager_Java"
+#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_True
+
#endif
#endif
diff --git a/avmedia/source/java/PlayerWindow.java b/avmedia/source/java/PlayerWindow.java
index 4bc9db4ac7..58df751b39 100644
--- a/avmedia/source/java/PlayerWindow.java
+++ b/avmedia/source/java/PlayerWindow.java
@@ -67,9 +67,7 @@ public class PlayerWindow implements java.awt.event.KeyListener,
maFrame = new WindowAdapter( AnyConverter.toInt( aArgs[ 0 ] ) );
maFrame.setPosSize( aBoundRect.X, aBoundRect.Y, aBoundRect.Width, aBoundRect.Height, (short) 0 );
-
- if( aArgs.length > 2 )
- mbShowControls = AnyConverter.toBoolean( aArgs[ 2 ] );
+ mbShowControls = false;
java.awt.Panel aPanel = new java.awt.Panel( new java.awt.BorderLayout() );
diff --git a/avmedia/source/java/avmedia.jar b/avmedia/source/java/avmedia.jar
index 55576baa5b..85a98bbcf3 100644
--- a/avmedia/source/java/avmedia.jar
+++ b/avmedia/source/java/avmedia.jar
Binary files differ
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index edc9ee5154..b5667dfaa3 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -162,7 +162,9 @@ Size MediaWindow::getPreferredSize() const
void MediaWindow::setPosSize( const Rectangle& rNewRect )
{
if( mpImpl )
+ {
mpImpl->setPosSize( rNewRect );
+ }
}
// -------------------------------------------------------------------------
@@ -368,6 +370,7 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector )
"AU Audio", "au",
"AVI", "avi",
"CD Audio", "cda",
+ "Matroska Media", "mkv",
"MIDI Audio", "mid;midi",
"MPEG Audio", "mp2;mp3;mpa",
"MPEG Video", "mpg;mpeg;mpv;mp4",
@@ -464,39 +467,28 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr
{
if( bDeep || pPreferredSizePixel )
{
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
-
- if( xFactory.is() )
+ try
{
- try
- {
- fprintf(stderr, "-->%s uno reference \n\n",AVMEDIA_MANAGER_SERVICE_NAME);
+ sal_Bool bIsJavaBasedMediaWindow;
+ uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer(
+ aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ),
+ bIsJavaBasedMediaWindow ) );
- uno::Reference< ::com::sun::star::media::XManager > xManager(
- xFactory->createInstance( ::rtl::OUString::createFromAscii( AVMEDIA_MANAGER_SERVICE_NAME ) ),
- uno::UNO_QUERY );
+ if( xPlayer.is() )
+ {
+ bRet = true;
- if( xManager.is() )
+ if( pPreferredSizePixel )
{
- uno::Reference< media::XPlayer > xPlayer( xManager->createPlayer( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) );
-
- if( xPlayer.is() )
- {
- bRet = true;
+ const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() );
- if( pPreferredSizePixel )
- {
- const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() );
-
- pPreferredSizePixel->Width() = aAwtSize.Width;
- pPreferredSizePixel->Height() = aAwtSize.Height;
- }
- }
+ pPreferredSizePixel->Width() = aAwtSize.Width;
+ pPreferredSizePixel->Height() = aAwtSize.Height;
}
}
- catch( ... )
- {
- }
+ }
+ catch( ... )
+ {
}
}
else
@@ -525,7 +517,8 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr
uno::Reference< media::XPlayer > MediaWindow::createPlayer( const ::rtl::OUString& rURL )
{
- return priv::MediaWindowImpl::createPlayer( rURL );
+ sal_Bool bJavaBased = sal_False;
+ return priv::MediaWindowImpl::createPlayer( rURL, bJavaBased );
}
// -------------------------------------------------------------------------
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 24d17abe4d..cb5d9675a1 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -1,4 +1,4 @@
-/*************************************************************************
+/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -77,7 +77,7 @@ MediaWindowControl::~MediaWindowControl()
void MediaWindowControl::update()
{
MediaItem aItem;
-
+
static_cast< MediaWindowImpl* >( GetParent() )->updateMediaItem( aItem );
setState( aItem );
}
@@ -94,7 +94,7 @@ void MediaWindowControl::execute( const MediaItem& rItem )
// --------------------
MediaChildWindow::MediaChildWindow( Window* pParent ) :
- JavaChildWindow( pParent, WB_CLIPCHILDREN )
+ SystemChildWindow( pParent, WB_CLIPCHILDREN )
{
}
@@ -110,8 +110,8 @@ void MediaChildWindow::MouseMove( const MouseEvent& rMEvt )
{
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
- JavaChildWindow::MouseMove( rMEvt );
+
+ SystemChildWindow::MouseMove( rMEvt );
GetParent()->MouseMove( aTransformedEvent );
}
@@ -121,8 +121,8 @@ void MediaChildWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
- JavaChildWindow::MouseButtonDown( rMEvt );
+
+ SystemChildWindow::MouseButtonDown( rMEvt );
GetParent()->MouseButtonDown( aTransformedEvent );
}
@@ -132,8 +132,8 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
- JavaChildWindow::MouseButtonUp( rMEvt );
+
+ SystemChildWindow::MouseButtonUp( rMEvt );
GetParent()->MouseButtonUp( aTransformedEvent );
}
@@ -141,7 +141,7 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt )
void MediaChildWindow::KeyInput( const KeyEvent& rKEvt )
{
- JavaChildWindow::KeyInput( rKEvt );
+ SystemChildWindow::KeyInput( rKEvt );
GetParent()->KeyInput( rKEvt );
}
@@ -149,7 +149,7 @@ void MediaChildWindow::KeyInput( const KeyEvent& rKEvt )
void MediaChildWindow::KeyUp( const KeyEvent& rKEvt )
{
- JavaChildWindow::KeyUp( rKEvt );
+ SystemChildWindow::KeyUp( rKEvt );
GetParent()->KeyUp( rKEvt );
}
@@ -159,8 +159,8 @@ void MediaChildWindow::Command( const CommandEvent& rCEvt )
{
const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
-
- JavaChildWindow::Command( rCEvt );
+
+ SystemChildWindow::Command( rCEvt );
GetParent()->Command( aTransformedEvent );
}
@@ -179,9 +179,10 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo
mpEmptyBmpEx( NULL ),
mpAudioBmpEx( NULL )
{
+ maChildWindow.SetBackground( Color( COL_BLACK ) );
maChildWindow.SetHelpId( HID_AVMEDIA_PLAYERWINDOW );
maChildWindow.Hide();
-
+
if( mpMediaWindowControl )
{
mpMediaWindowControl->SetSizePixel( mpMediaWindowControl->getMinSizePixel() );
@@ -211,12 +212,12 @@ void MediaWindowImpl::cleanUp()
xPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
xPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
xPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
-
+
uno::Reference< lang::XComponent > xComponent( xPlayerWindow, uno::UNO_QUERY );
-
+
if( xComponent.is() )
xComponent->dispose();
-
+
setPlayerWindow( NULL );
}
@@ -229,25 +230,30 @@ void MediaWindowImpl::onURLChanged()
{
if( getPlayer().is() )
{
- uno::Sequence< uno::Any > aArgs( 2 );
uno::Reference< media::XPlayerWindow > xPlayerWindow;
- const Point aPoint;
- const Size aSize( maChildWindow.GetSizePixel() );
- const sal_IntPtr nWndHandle = static_cast< sal_IntPtr >( maChildWindow.getParentWindowHandleForJava() );
-
- aArgs[ 0 ] = uno::makeAny( nWndHandle );
- aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) );
+ const Point aPoint;
+ const Size aSize( maChildWindow.GetSizePixel() );
+ const sal_IntPtr nWndHandle = (sal_IntPtr) maChildWindow.GetParentWindowHandle( isMediaWindowJavaBased() );
+
try
{
if( nWndHandle != 0 )
+ {
+ uno::Sequence< uno::Any > aArgs( 3 );
+
+ aArgs[ 0 ] = uno::makeAny( nWndHandle );
+ aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) );
+ aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( &maChildWindow ) );
+
xPlayerWindow = getPlayer()->createPlayerWindow( aArgs );
+ }
}
catch( uno::RuntimeException )
{
// happens eg, on MacOSX where Java frames cannot be created from X11 window handles
}
-
+
setPlayerWindow( xPlayerWindow );
if( xPlayerWindow.is() )
@@ -260,21 +266,19 @@ void MediaWindowImpl::onURLChanged()
}
else
setPlayerWindow( NULL );
-
+
if( getPlayerWindow().is() )
maChildWindow.Show();
else
maChildWindow.Hide();
-
+
if( mpMediaWindowControl )
{
MediaItem aItem;
-
+
updateMediaItem( aItem );
mpMediaWindowControl->setState( aItem );
}
-
- Invalidate();
}
// ---------------------------------------------------------------------
@@ -282,7 +286,7 @@ void MediaWindowImpl::onURLChanged()
void MediaWindowImpl::update()
{
uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
-
+
if( xPlayerWindow.is() )
xPlayerWindow->update();
}
@@ -291,7 +295,7 @@ void MediaWindowImpl::update()
void MediaWindowImpl::setPosSize( const Rectangle& rRect )
{
- SetPosSizePixel( rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight() );
+ SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() );
}
// ---------------------------------------------------------------------
@@ -299,25 +303,24 @@ void MediaWindowImpl::setPosSize( const Rectangle& rRect )
void MediaWindowImpl::setPointer( const Pointer& rPointer )
{
uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
-
+
SetPointer( rPointer );
maChildWindow.SetPointer( rPointer );
-
+
if( xPlayerWindow.is() )
{
-
long nPointer;
-
+
switch( rPointer.GetStyle() )
{
case( POINTER_CROSS ): nPointer = awt::SystemPointer::CROSS; break;
case( POINTER_HAND ): nPointer = awt::SystemPointer::HAND; break;
case( POINTER_MOVE ): nPointer = awt::SystemPointer::MOVE; break;
case( POINTER_WAIT ): nPointer = awt::SystemPointer::WAIT; break;
-
+
default: nPointer = awt::SystemPointer::ARROW; break;
}
-
+
xPlayerWindow->setPointerType( nPointer );
}
}
@@ -345,20 +348,20 @@ void MediaWindowImpl::Resize()
const sal_Int32 nOffset( mpMediaWindowControl ? AVMEDIA_CONTROLOFFSET : 0 );
Size aPlayerWindowSize( aCurSize.Width() - ( nOffset << 1 ),
aCurSize.Height() - ( nOffset << 1 ) );
-
+
if( mpMediaWindowControl )
{
const sal_Int32 nControlHeight = mpMediaWindowControl->GetSizePixel().Height();
const sal_Int32 nControlY = ::std::max( aCurSize.Height() - nControlHeight - nOffset, 0L );
-
+
aPlayerWindowSize.Height() = ( nControlY - ( nOffset << 1 ) );
mpMediaWindowControl->SetPosSizePixel( Point( nOffset, nControlY ), Size( aCurSize.Width() - ( nOffset << 1 ), nControlHeight ) );
}
-
- maChildWindow.SetPosSizePixel( Point( nOffset, nOffset ), aPlayerWindowSize );
-
+
if( xPlayerWindow.is() )
xPlayerWindow->setPosSize( 0, 0, aPlayerWindowSize.Width(), aPlayerWindowSize.Height(), 0 );
+
+ maChildWindow.SetPosSizePixel( Point( nOffset, nOffset ), aPlayerWindowSize );
}
// ---------------------------------------------------------------------
@@ -397,25 +400,25 @@ void MediaWindowImpl::StateChanged( StateChangedType eType )
void MediaWindowImpl::Paint( const Rectangle& )
{
BitmapEx* pLogo = NULL;
-
+
if( !getPlayer().is() )
{
if( !mpEmptyBmpEx )
mpEmptyBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_EMPTYLOGO ) );
-
+
pLogo = mpEmptyBmpEx;
}
- else if ( !getPlayerWindow().is() )
+ else if( !getPlayerWindow().is() )
{
if( !mpAudioBmpEx )
mpAudioBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) );
-
+
pLogo = mpAudioBmpEx;
}
const Point aBasePos( maChildWindow.GetPosPixel() );
- const Rectangle aVideoRect( aBasePos, maChildWindow.GetSizePixel() );
-
+ const Rectangle aVideoRect( aBasePos, maChildWindow.GetSizePixel() );
+
if( pLogo && !pLogo->IsEmpty() && ( aVideoRect.GetWidth() > 0 ) && ( aVideoRect.GetHeight() > 0 ) )
{
Size aLogoSize( pLogo->GetSizePixel() );
@@ -424,7 +427,7 @@ void MediaWindowImpl::Paint( const Rectangle& )
SetLineColor( aBackgroundColor );
SetFillColor( aBackgroundColor );
DrawRect( aVideoRect );
-
+
if( ( aLogoSize.Width() > aVideoRect.GetWidth() || aLogoSize.Height() > aVideoRect.GetHeight() ) &&
( aLogoSize.Height() > 0 ) )
{
@@ -442,12 +445,10 @@ void MediaWindowImpl::Paint( const Rectangle& )
}
}
- DrawBitmapEx( Point( aBasePos.X() + ( ( aVideoRect.GetWidth() - aLogoSize.Width() ) >> 1 ),
+ DrawBitmapEx( Point( aBasePos.X() + ( ( aVideoRect.GetWidth() - aLogoSize.Width() ) >> 1 ),
aBasePos.Y() + ( ( aVideoRect.GetHeight() - aLogoSize.Height() ) >> 1 ) ),
aLogoSize, *pLogo );
}
-
- update();
}
// ---------------------------------------------------------------------
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index 1b6f8c60b7..d82c50bcec 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -1,11 +1,14 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: mediawindow_impl.hxx,v $
+ * $Revision: 1.3 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -29,7 +32,7 @@
#define _AVMEDIA_MEDIAWINDOW_IMPL_HXX
#include <svtools/transfer.hxx>
-#include <vcl/javachild.hxx>
+#include <vcl/syschild.hxx>
#include "mediawindowbase_impl.hxx"
#include "mediacontrol.hxx"
@@ -43,16 +46,16 @@ namespace avmedia
// ----------------------
// - MediaWindowControl -
// ----------------------
-
+
class MediaWindowControl : public MediaControl
{
public:
-
+
MediaWindowControl( Window* pParent );
~MediaWindowControl();
-
+
protected:
-
+
void update();
void execute( const MediaItem& rItem );
};
@@ -60,16 +63,16 @@ namespace avmedia
// --------------------
// - MediaChildWindow -
// --------------------
-
- class MediaChildWindow : public JavaChildWindow
+
+ class MediaChildWindow : public SystemChildWindow
{
public:
-
+
MediaChildWindow( Window* pParent );
~MediaChildWindow();
-
+
protected:
-
+
virtual void MouseMove( const MouseEvent& rMEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
@@ -77,7 +80,7 @@ namespace avmedia
virtual void KeyUp( const KeyEvent& rKEvt );
virtual void Command( const CommandEvent& rCEvt );
};
-
+
// ------------------.
// - MediaWindowImpl -
// -------------------
@@ -88,7 +91,7 @@ namespace avmedia
public MediaWindowBaseImpl,
public DropTargetHelper,
public DragSourceHelper
-
+
{
public:
@@ -97,18 +100,18 @@ namespace avmedia
virtual void cleanUp();
virtual void onURLChanged();
-
+
public:
-
+
void update();
void setPosSize( const Rectangle& rRect );
-
+
void setPointer( const Pointer& rPointer );
const Pointer& getPointer() const;
-
+
bool hasInternalMediaControl() const;
-
+
protected:
// Window
diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx
index fdfa0b5ae5..db6d1f174e 100644
--- a/avmedia/source/viewer/mediawindowbase_impl.cxx
+++ b/avmedia/source/viewer/mediawindowbase_impl.cxx
@@ -47,8 +47,18 @@ namespace avmedia { namespace priv {
// - MediaWindowBaseImpl -
// -----------------------
+struct ServiceManager
+{
+ const char* pServiceName;
+ sal_Bool bIsJavaBased;
+};
+
+// ---------------------------------------------------------------------
+
+
MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow ) :
- mpMediaWindow( pMediaWindow )
+ mpMediaWindow( pMediaWindow ),
+ mbIsMediaWindowJavaBased( sal_False )
{
}
@@ -61,35 +71,53 @@ MediaWindowBaseImpl::~MediaWindowBaseImpl()
// -------------------------------------------------------------------------
-uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL )
+uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL, sal_Bool& rbJavaBased )
{
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
uno::Reference< media::XPlayer > xPlayer;
+ rbJavaBased = sal_False;
+
if( xFactory.is() )
{
- try
+ static const ServiceManager aServiceManagers[] =
{
-
- uno::Reference< ::com::sun::star::media::XManager > xManager(
- xFactory->createInstance( ::rtl::OUString::createFromAscii( AVMEDIA_MANAGER_SERVICE_NAME ) ),
- uno::UNO_QUERY );
-
- if( xManager.is() )
+ { AVMEDIA_MANAGER_SERVICE_NAME, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED },
+ { AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 }
+ };
+
+ for( sal_uInt32 i = 0; !xPlayer.is() && ( i < ( sizeof( aServiceManagers ) / sizeof( ServiceManager ) ) ); ++i )
+ {
+ const String aServiceName( aServiceManagers[ i ].pServiceName, RTL_TEXTENCODING_ASCII_US );
+
+ if( aServiceName.Len() )
+ {
+ OSL_TRACE( "Trying to create media manager service %s", aServiceManagers[ i ].pServiceName );
+
+ try
+ {
+ uno::Reference< media::XManager > xManager( xFactory->createInstance( aServiceName ), uno::UNO_QUERY );
+
+ if( xManager.is() )
+ {
+ xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), uno::UNO_QUERY );
+ }
+ }
+ catch( ... )
+ {
+ }
+ }
+
+ if( xPlayer.is() )
{
- xPlayer = uno::Reference< ::com::sun::star::media::XPlayer >(
- xManager->createPlayer( rURL ), uno::UNO_QUERY );
+ rbJavaBased = aServiceManagers[ i ].bIsJavaBased;
}
}
- catch( ... )
- {
- }
}
return xPlayer;
}
-
// ---------------------------------------------------------------------
void MediaWindowBaseImpl::setURL( const ::rtl::OUString& rURL )
@@ -112,7 +140,7 @@ void MediaWindowBaseImpl::setURL( const ::rtl::OUString& rURL )
if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
maFileURL = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
- mxPlayer = createPlayer( maFileURL );
+ mxPlayer = createPlayer( maFileURL, mbIsMediaWindowJavaBased );
onURLChanged();
}
}
@@ -143,10 +171,7 @@ void MediaWindowBaseImpl::stopPlayingInternal( bool bStop )
{
if( isPlaying() )
{
- if( bStop )
- mxPlayer->stop();
- else
- mxPlayer->start();
+ bStop ? mxPlayer->stop() : mxPlayer->start();
}
}
diff --git a/avmedia/source/viewer/mediawindowbase_impl.hxx b/avmedia/source/viewer/mediawindowbase_impl.hxx
index 0cef83a473..c406ae3664 100644
--- a/avmedia/source/viewer/mediawindowbase_impl.hxx
+++ b/avmedia/source/viewer/mediawindowbase_impl.hxx
@@ -61,7 +61,8 @@ namespace avmedia
virtual void cleanUp();
virtual void onURLChanged();
- static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL,
+ sal_Bool& rbJavaBased );
public:
@@ -112,6 +113,7 @@ namespace avmedia
void stopPlayingInternal( bool );
MediaWindow* getMediaWindow() const;
+ inline sal_Bool isMediaWindowJavaBased() const { return( mbIsMediaWindowJavaBased ); }
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > getPlayer() const;
@@ -124,6 +126,7 @@ namespace avmedia
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > mxPlayerWindow;
MediaWindow* mpMediaWindow;
+ sal_Bool mbIsMediaWindowJavaBased;
};
}
}
diff --git a/avmedia/source/win/winuno.cxx b/avmedia/source/win/winuno.cxx
index 288950f6d0..0d559c4f75 100644
--- a/avmedia/source/win/winuno.cxx
+++ b/avmedia/source/win/winuno.cxx
@@ -62,7 +62,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey )
{
uno::Reference< registry::XRegistryKey > xNewKey1(
static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
- ::rtl::OUString::createFromAscii( "/com.sun.star.comp.media.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) );
+ ::rtl::OUString::createFromAscii( "/com.sun.star.comp.avmedia.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) );
bRet = sal_True;
}
@@ -84,13 +84,13 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void*
uno::Reference< lang::XSingleServiceFactory > xFactory;
void* pRet = 0;
- if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_DirectX" ) == 0 )
+ if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_DirectX" ) == 0 )
{
const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_DirectX" ) );
xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
- ::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_DirectX" ),
+ ::rtl::OUString::createFromAscii( "com.sun.star.comp.avmedia.Manager_DirectX" ),
create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
}
diff --git a/basic/inc/basic/process.hxx b/basic/inc/basic/process.hxx
index 066e87aefc..2890d9a910 100644
--- a/basic/inc/basic/process.hxx
+++ b/basic/inc/basic/process.hxx
@@ -39,9 +39,9 @@ typedef Environment::value_type EnvironmentVariable;
class Process
{
// Internal members and methods
- NAMESPACE_VOS(OArgumentList) *pArgumentList;
- NAMESPACE_VOS(OEnvironment) *pEnvList;
- NAMESPACE_VOS(OProcess) *pProcess;
+ vos::OArgumentList *pArgumentList;
+ vos::OEnvironment *pEnvList;
+ vos::OProcess *pProcess;
BOOL ImplIsRunning();
long ImplGetExitCode();
BOOL bWasGPF;
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index 7f401ef69f..15afc1f40f 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -28,10 +28,12 @@
#ifndef _SB_SBMOD_HXX
#define _SB_SBMOD_HXX
+#include <com/sun/star/script/XInvocation.hpp>
#include <basic/sbdef.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sbxdef.hxx>
#include <rtl/ustring.hxx>
+#include <vector>
class SbMethod;
class SbProperty;
@@ -55,8 +57,10 @@ class SbModule : public SbxObject
friend class SbClassModuleObject;
SbModuleImpl* mpSbModuleImpl; // Impl data
+ std::vector< String > mModuleVariableNames;
protected:
+ com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
::rtl::OUString aOUSource;
String aComment;
SbiImage* pImage; // the Image
@@ -131,6 +135,9 @@ public:
INT32 GetModuleType() { return mnType; }
void SetModuleType( INT32 nType ) { mnType = nType; }
bool GetIsProxyModule() { return bIsProxyModule; }
+ void AddVarName( const String& aName );
+ void RemoveVars();
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
};
diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx
index 3d638a475f..9ff46d1931 100644
--- a/basic/inc/basic/sbobjmod.hxx
+++ b/basic/inc/basic/sbobjmod.hxx
@@ -36,6 +36,7 @@
#ifndef _SB_OBJMOD_HXX
#define _SB_OBJMOD_HXX
+#include <rtl/ref.hxx>
#include <basic/sbmod.hxx>
#include <basic/sbstar.hxx>
#include <com/sun/star/script/ModuleInfo.hpp>
@@ -60,10 +61,12 @@ public:
void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
};
+class FormObjEventListenerImpl;
+
class SbUserFormModule : public SbObjModule
{
com::sun::star::script::ModuleInfo m_mInfo;
- css::uno::Reference<css::lang::XEventListener> m_DialogListener;
+ ::rtl::Reference< FormObjEventListenerImpl > m_DialogListener;
css::uno::Reference<css::awt::XDialog> m_xDialog;
css::uno::Reference<css::frame::XModel> m_xModel;
String sFormName;
@@ -76,16 +79,19 @@ class SbUserFormModule : public SbObjModule
public:
TYPEINFO();
SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+ virtual ~SbUserFormModule();
virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
void ResetApiObj();
void Unload();
- void load();
+ void Load();
void triggerMethod( const String& );
void triggerMethod( const String&, css::uno::Sequence< css::uno::Any >& );
void triggerActivateEvent();
- void triggerDeActivateEvent();
+ void triggerDeactivateEvent();
void triggerInitializeEvent();
void triggerTerminateEvent();
+ void triggerLayoutEvent();
+ void triggerResizeEvent();
class SbUserFormModuleInstance* CreateInstance();
};
diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx
index 1ed7f7b3aa..6ade66ef49 100644
--- a/basic/source/app/process.cxx
+++ b/basic/source/app/process.cxx
@@ -72,9 +72,9 @@ BOOL Process::ImplIsRunning()
{
if ( pProcess && bHasBeenStarted )
{
- NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo;
- pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo );
- if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_ExitCode)) )
+ vos::OProcess::TProcessInfo aProcessInfo;
+ pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
+ if ( !(aProcessInfo.Fields & vos::OProcess::TData_ExitCode) )
return TRUE;
else
return FALSE;
@@ -87,9 +87,9 @@ long Process::ImplGetExitCode()
{
if ( pProcess )
{
- NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo;
- pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo );
- if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_ExitCode)) )
+ vos::OProcess::TProcessInfo aProcessInfo;
+ pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
+ if ( !(aProcessInfo.Fields & vos::OProcess::TData_ExitCode) )
SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
return aProcessInfo.Code;
}
@@ -124,7 +124,7 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
nParamCount++;
}
}
- pArgumentList = new NAMESPACE_VOS(OArgumentList)( pParamList, nCount );
+ pArgumentList = new vos::OArgumentList( pParamList, nCount );
::rtl::OUString *pEnvArray = NULL;
@@ -143,12 +143,12 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
nEnvCount++;
aIter++;
}
- pEnvList = new NAMESPACE_VOS(OEnvironment)( pEnvArray, nEnvCount );
+ pEnvList = new vos::OEnvironment( pEnvArray, nEnvCount );
}
::rtl::OUString aNormalizedAppPath;
osl::FileBase::getFileURLFromSystemPath( ::rtl::OUString(aAppPath), aNormalizedAppPath );
- pProcess = new NAMESPACE_VOS(OProcess)( aNormalizedAppPath );
+ pProcess = new vos::OProcess( aNormalizedAppPath );
bHasBeenStarted = FALSE;
delete [] pParamList;
@@ -170,20 +170,20 @@ BOOL Process::Start()
#endif
if ( pEnvList )
{
- bSuccess = pProcess->execute( (NAMESPACE_VOS(OProcess)::TProcessOption)
- ( NAMESPACE_VOS(OProcess)::TOption_SearchPath
- /*| NAMESPACE_VOS(OProcess)::TOption_Detached*/
- /*| NAMESPACE_VOS(OProcess)::TOption_Wait*/ ),
+ bSuccess = pProcess->execute( (vos::OProcess::TProcessOption)
+ ( vos::OProcess::TOption_SearchPath
+ /*| vos::OProcess::TOption_Detached*/
+ /*| vos::OProcess::TOption_Wait*/ ),
*pArgumentList,
- *pEnvList ) == NAMESPACE_VOS(OProcess)::E_None;
+ *pEnvList ) == vos::OProcess::E_None;
}
else
{
- bSuccess = pProcess->execute( (NAMESPACE_VOS(OProcess)::TProcessOption)
- ( NAMESPACE_VOS(OProcess)::TOption_SearchPath
- /*| NAMESPACE_VOS(OProcess)::TOption_Detached*/
- /*| NAMESPACE_VOS(OProcess)::TOption_Wait*/ ),
- *pArgumentList ) == NAMESPACE_VOS(OProcess)::E_None;
+ bSuccess = pProcess->execute( (vos::OProcess::TProcessOption)
+ ( vos::OProcess::TOption_SearchPath
+ /*| vos::OProcess::TOption_Detached*/
+ /*| vos::OProcess::TOption_Wait*/ ),
+ *pArgumentList ) == vos::OProcess::E_None;
}
#ifdef WNT
}
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 247a833b3e..b2e0f58c05 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -67,8 +67,8 @@
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
-#include <com/sun/star/script/XVBAModuleInfo.hpp>
-#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -240,7 +240,7 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
Any aElement = xLibNameAccess->getByName( aModuleName );
::rtl::OUString aMod;
aElement >>= aMod;
- Reference< XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, UNO_QUERY );
+ Reference< vba::XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aModuleName ) )
{
ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aModuleName );
@@ -285,9 +285,9 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
StarBASIC* pLib = mpMgr->GetLib( aName );
if ( pLib )
{
- Reference<XVBACompat> xVBACompat( xScriptCont, UNO_QUERY );
+ Reference< vba::XVBACompatibility > xVBACompat( xScriptCont, UNO_QUERY );
if ( xVBACompat.is() )
- pLib->SetVBAEnabled( xVBACompat->getVBACompatModeOn() );
+ pLib->SetVBAEnabled( xVBACompat->getVBACompatibilityMode() );
}
}
else
@@ -302,7 +302,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
{
::rtl::OUString aMod;
Event.Element >>= aMod;
- Reference< XVBAModuleInfo > xVBAModuleInfo( Event.Source, UNO_QUERY );
+ Reference< vba::XVBAModuleInfo > xVBAModuleInfo( Event.Source, UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aName ) )
{
ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aName );
diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx
index 82f3c08d61..f6402a8f45 100644
--- a/basic/source/classes/disas.cxx
+++ b/basic/source/classes/disas.cxx
@@ -35,6 +35,7 @@
#include "sb.hxx"
#include "iosys.hxx"
#include "disas.hxx"
+#include "sbtrace.hxx"
static const char* pOp1[] = {
@@ -153,6 +154,7 @@ static const char* pOp3[] = {
"DCREATE_REDIMP", // Change dimensions of a user defined Object-Array (+StringId+StringId)
"FIND_CM", // Search inside a class module (CM) to enable global search in time
"PUBLIC_P", // Module global Variable (persisted between calls)(+StringID+Typ)
+ "FIND_STATIC", // local static var lookup (+StringID+Typ)
};
static const char** pOps[3] = { pOp1, pOp2, pOp3 };
@@ -220,6 +222,7 @@ static const Func pOperand3[] = {
&SbiDisas::Str2Op, // Redimensionate User defined Object-Array (+StringId+StringId)
&SbiDisas::VarOp, // FIND_CM
&SbiDisas::VarDefOp, // PUBLIC_P
+ &SbiDisas::VarOp, // FIND_STATIC
};
// TODO: Why as method? Isn't a simple define sufficient?
@@ -359,6 +362,11 @@ BOOL SbiDisas::DisasLine( String& rText )
rText.Erase();
if( !Fetch() )
return FALSE;
+
+#ifdef DBG_TRACE_BASIC
+ String aTraceStr_STMNT;
+#endif
+
// New line?
if( eOp == _STMNT && nOp1 != nLine )
{
@@ -391,8 +399,13 @@ BOOL SbiDisas::DisasLine( String& rText )
rText.AppendAscii( "; " );
rText += s;
rText.AppendAscii( _crlf() );
+
+#ifdef DBG_TRACE_BASIC
+ aTraceStr_STMNT = s;
+#endif
}
}
+
// Label?
const char* p = "";
if( cLabels[ nPC >> 3 ] & ( 1 << ( nPC & 7 ) ) )
@@ -430,20 +443,29 @@ BOOL SbiDisas::DisasLine( String& rText )
rText.AppendAscii( _crlf() );
}
snprintf( cBuf, sizeof(cBuf), pMask[ nParts ], nPC, (USHORT) eOp, nOp1, nOp2 );
- rText.AppendAscii( cBuf );
+
+ String aPCodeStr;
+ aPCodeStr.AppendAscii( cBuf );
int n = eOp;
if( eOp >= SbOP2_START )
n -= SbOP2_START;
else if( eOp >= SbOP1_START )
n -= SbOP1_START;
- rText += '\t';
- rText.AppendAscii( pOps[ nParts-1 ][ n ] );
- rText += '\t';
+ aPCodeStr += '\t';
+ aPCodeStr.AppendAscii( pOps[ nParts-1 ][ n ] );
+ aPCodeStr += '\t';
switch( nParts )
{
- case 2: (this->*( pOperand2[ n ] ) )( rText ); break;
- case 3: (this->*( pOperand3[ n ] ) )( rText ); break;
+ case 2: (this->*( pOperand2[ n ] ) )( aPCodeStr ); break;
+ case 3: (this->*( pOperand3[ n ] ) )( aPCodeStr ); break;
}
+
+ rText += aPCodeStr;
+
+#ifdef DBG_TRACE_BASIC
+ dbg_RegisterTraceTextForPC( pMod, nPC, aTraceStr_STMNT, aPCodeStr );
+#endif
+
return TRUE;
}
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 4b1efefbdf..16d05a6661 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -255,7 +255,7 @@ Any BasicScriptListener_Impl::approveFiring( const ScriptEvent& aScriptEvent )
void BasicScriptListener_Impl::disposing(const EventObject& ) throw ( RuntimeException )
{
// TODO: ???
- //NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+ //vos::OGuard guard( Application::GetSolarMutex() );
//xSbxObj.Clear();
}
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 9be441e011..df5bd58e90 100755..100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -339,27 +339,18 @@ SbxBase* SbFormFactory::Create( UINT16, UINT32 )
SbxObject* SbFormFactory::CreateObject( const String& rClassName )
{
- static String aLoadMethodName( RTL_CONSTASCII_USTRINGPARAM("load") );
-
- SbxObject* pRet = NULL;
- SbModule* pMod = pMOD;
- if( pMod )
+ if( SbModule* pMod = pMOD )
{
- SbxVariable* pVar = pMod->Find( rClassName, SbxCLASS_OBJECT );
- if( pVar )
+ if( SbxVariable* pVar = pMod->Find( rClassName, SbxCLASS_OBJECT ) )
{
- SbxBase* pObj = pVar->GetObject();
- SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pObj );
-
- if( pFormModule != NULL )
+ if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) )
{
- pFormModule->load();
- SbUserFormModuleInstance* pFormInstance = pFormModule->CreateInstance();
- pRet = pFormInstance;
+ pFormModule->Load();
+ return pFormModule->CreateInstance();
}
}
}
- return pRet;
+ return 0;
}
@@ -569,11 +560,13 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
}
}
SetModuleType( ModuleType::CLASS );
+ mbVBACompat = pClassModule->mbVBACompat;
}
SbClassModuleObject::~SbClassModuleObject()
{
- triggerTerminateEvent();
+ if( StarBASIC::IsRunning() )
+ triggerTerminateEvent();
// Must be deleted by base class dtor because this data
// is not owned by the SbClassModuleObject object
@@ -606,7 +599,28 @@ void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType
{
SbxValues aVals;
aVals.eType = SbxVARIANT;
- pMeth->Get( aVals );
+
+ SbxArray* pArg = pVar->GetParameters();
+ USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
+ if( nVarParCount > 1 )
+ {
+ SbxArrayRef xMethParameters = new SbxArray;
+ xMethParameters->Put( pMeth, 0 ); // Method as parameter 0
+ for( USHORT i = 1 ; i < nVarParCount ; ++i )
+ {
+ SbxVariable* pPar = pArg->Get( i );
+ xMethParameters->Put( pPar, i );
+ }
+
+ pMeth->SetParameters( xMethParameters );
+ pMeth->Get( aVals );
+ pMeth->SetParameters( NULL );
+ }
+ else
+ {
+ pMeth->Get( aVals );
+ }
+
pVar->Put( aVals );
}
}
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 291aaa4f7d..1193aad492 100644..100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -911,7 +911,7 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
case SbxVARIANT: aRetType = ::getCppuType( (Any*)0 ); break;
//case SbxDATAOBJECT: break;
case SbxCHAR: aRetType = ::getCppuType( (sal_Unicode*)0 ); break;
- case SbxBYTE: aRetType = ::getCppuType( (sal_Int16*)0 ); break;
+ case SbxBYTE: aRetType = ::getCppuType( (sal_Int8*)0 ); break;
case SbxUSHORT: aRetType = ::getCppuType( (sal_uInt16*)0 ); break;
case SbxULONG: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
//case SbxLONG64: break;
@@ -3762,7 +3762,7 @@ BasicAllListener_Impl::~BasicAllListener_Impl()
void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet )
{
- NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+ vos::OGuard guard( Application::GetSolarMutex() );
if( xSbxObj.Is() )
{
@@ -3827,7 +3827,7 @@ Any BasicAllListener_Impl::approveFiring( const AllEventObject& Event ) throw (
// Methoden von XEventListener
void BasicAllListener_Impl ::disposing(const EventObject& ) throw ( RuntimeException )
{
- NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+ vos::OGuard guard( Application::GetSolarMutex() );
xSbxObj.Clear();
}
@@ -4201,7 +4201,7 @@ void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty,
if( !m_bProxyIsClassModuleObject )
throw UnknownPropertyException();
- NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+ vos::OGuard guard( Application::GetSolarMutex() );
::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Set ") );
aPropertyFunctionName += m_aPrefix;
@@ -4242,7 +4242,7 @@ Any SAL_CALL ModuleInvocationProxy::getValue( const ::rtl::OUString& rProperty )
if( !m_bProxyIsClassModuleObject )
throw UnknownPropertyException();
- NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+ vos::OGuard guard( Application::GetSolarMutex() );
::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Get ") );
aPropertyFunctionName += m_aPrefix;
@@ -4280,7 +4280,7 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
Sequence< Any >& )
throw( CannotConvertException, InvocationTargetException )
{
- NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+ vos::OGuard guard( Application::GetSolarMutex() );
Any aRet;
if( !m_xScopeObj.Is() )
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 79ab2071c3..834d7316a2 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -45,6 +45,7 @@
#include "runtime.hxx"
#include "token.hxx"
#include "sbunoobj.hxx"
+#include "sbtrace.hxx"
//#include <basic/hilight.hxx>
@@ -53,9 +54,10 @@
#include <basic/basrdll.hxx>
#include <vos/mutex.hxx>
#include <basic/sbobjmod.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
-#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
using namespace com::sun::star;
@@ -76,15 +78,362 @@ using namespace com::sun::star;
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
+#include <map>
+#include <com/sun/star/reflection/XProxyFactory.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <basic/sbobjmod.hxx>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <map>
+#include <com/sun/star/script/XInvocation.hpp>
+
using namespace ::com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::script;
+
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/awt/XDialogProvider.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <cppuhelper/implbase1.hxx>
#include <comphelper/anytostring.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
+typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
+::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
+void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
+
+class DocObjectWrapper : public DocObjectWrapper_BASE
+{
+ Reference< XAggregation > m_xAggProxy;
+ Reference< XInvocation > m_xAggInv;
+ Reference< XTypeProvider > m_xAggregateTypeProv;
+ Sequence< Type > m_Types;
+ SbModule* m_pMod;
+ SbMethodRef getMethod( const rtl::OUString& aName ) throw (RuntimeException);
+ SbPropertyRef getProperty( const rtl::OUString& aName ) throw (RuntimeException);
+ String mName; // for debugging
+
+public:
+ DocObjectWrapper( SbModule* pMod );
+ virtual ~DocObjectWrapper();
+
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (RuntimeException)
+ {
+ if( !m_xAggregateTypeProv.is() )
+ throw RuntimeException();
+ return m_xAggregateTypeProv->getImplementationId();
+ }
+
+ virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (RuntimeException);
+
+ virtual Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException);
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw ( RuntimeException );
+
+ virtual Sequence< Type > SAL_CALL getTypes() throw ( RuntimeException );
+};
+
+DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pVar->GetName() )
+{
+ SbObjModule* pMod = PTR_CAST(SbObjModule,pVar);
+ if ( pMod )
+ {
+ if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
+ {
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ // Use proxy factory service to create aggregatable proxy.
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pMod->GetObject() );
+ Reference< XInterface > xIf;
+ if ( pUnoObj )
+ {
+ Any aObj = pUnoObj->getUnoAny();
+ aObj >>= xIf;
+ if ( xIf.is() )
+ {
+ m_xAggregateTypeProv.set( xIf, UNO_QUERY );
+ m_xAggInv.set( xIf, UNO_QUERY );
+ }
+ }
+ if ( xIf.is() )
+ {
+ try
+ {
+ Reference< XMultiComponentFactory > xMFac( xFactory, UNO_QUERY_THROW );
+ Reference< XPropertySet> xPSMPropertySet( xMFac, UNO_QUERY_THROW );
+ Reference< XComponentContext > xCtx;
+ xPSMPropertySet->getPropertyValue(
+ String( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xCtx;
+ Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.ProxyFactory" ) ), xCtx ), UNO_QUERY_THROW );
+ m_xAggProxy = xProxyFac->createProxy( xIf );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "DocObjectWrapper::DocObjectWrapper: Caught exception!" );
+ }
+ }
+
+ if ( m_xAggProxy.is() )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+
+ /* i35609 - Fix crash on Solaris. The setDelegator call needs
+ to be in its own block to ensure that all temporary Reference
+ instances that are acquired during the call are released
+ before m_refCount is decremented again */
+ {
+ m_xAggProxy->setDelegator( static_cast< cppu::OWeakObject * >( this ) );
+ }
+
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+ }
+ }
+}
+
+void SAL_CALL
+DocObjectWrapper::acquire() throw ()
+{
+ osl_incrementInterlockedCount( &m_refCount );
+ OSL_TRACE("DocObjectWrapper::acquire(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
+}
+void SAL_CALL
+DocObjectWrapper::release() throw ()
+{
+ if ( osl_decrementInterlockedCount( &m_refCount ) == 0 )
+ {
+ OSL_TRACE("DocObjectWrapper::release(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
+ delete this;
+ }
+ else
+ OSL_TRACE("DocObjectWrapper::release(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
+}
+
+DocObjectWrapper::~DocObjectWrapper()
+{
+}
+
+Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
+ throw ( RuntimeException )
+{
+ if ( m_Types.getLength() == 0 )
+ {
+ Sequence< Type > sTypes;
+ if ( m_xAggregateTypeProv.is() )
+ sTypes = m_xAggregateTypeProv->getTypes();
+ m_Types.realloc( sTypes.getLength() + 1 );
+ Type* pPtr = m_Types.getArray();
+ for ( int i=0; i<m_Types.getLength(); ++i, ++pPtr )
+ {
+ if ( i == 0 )
+ *pPtr = XInvocation::static_type( NULL );
+ else
+ *pPtr = sTypes[ i - 1 ];
+ }
+ }
+ return m_Types;
+}
+
+Reference< XIntrospectionAccess > SAL_CALL
+DocObjectWrapper::getIntrospection( ) throw (RuntimeException)
+{
+ return NULL;
+}
+
+Any SAL_CALL
+DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasMethod( aFunctionName ) )
+ return m_xAggInv->invoke( aFunctionName, aParams, aOutParamIndex, aOutParam );
+ SbMethodRef pMethod = getMethod( aFunctionName );
+ if ( !pMethod )
+ throw RuntimeException();
+ // check number of parameters
+ sal_Int32 nParamsCount = aParams.getLength();
+ SbxInfo* pInfo = pMethod->GetInfo();
+ if ( pInfo )
+ {
+ sal_Int32 nSbxOptional = 0;
+ USHORT n = 1;
+ for ( const SbxParamInfo* pParamInfo = pInfo->GetParam( n ); pParamInfo; pParamInfo = pInfo->GetParam( ++n ) )
+ {
+ if ( ( pParamInfo->nFlags & SBX_OPTIONAL ) != 0 )
+ ++nSbxOptional;
+ else
+ nSbxOptional = 0;
+ }
+ sal_Int32 nSbxCount = n - 1;
+ if ( nParamsCount < nSbxCount - nSbxOptional )
+ {
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "wrong number of parameters!" ) ), Reference< XInterface >() );
+ }
+ }
+ // set parameters
+ SbxArrayRef xSbxParams;
+ if ( nParamsCount > 0 )
+ {
+ xSbxParams = new SbxArray;
+ const Any* pParams = aParams.getConstArray();
+ for ( sal_Int32 i = 0; i < nParamsCount; ++i )
+ {
+ SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), pParams[i] );
+ xSbxParams->Put( xSbxVar, static_cast< USHORT >( i ) + 1 );
+
+ // Enable passing by ref
+ if ( xSbxVar->GetType() != SbxVARIANT )
+ xSbxVar->SetFlag( SBX_FIXED );
+ }
+ }
+ if ( xSbxParams.Is() )
+ pMethod->SetParameters( xSbxParams );
+
+ // call method
+ SbxVariableRef xReturn = new SbxVariable;
+ ErrCode nErr = SbxERR_OK;
+
+ nErr = pMethod->Call( xReturn );
+ Any aReturn;
+ // get output parameters
+ if ( xSbxParams.Is() )
+ {
+ SbxInfo* pInfo_ = pMethod->GetInfo();
+ if ( pInfo_ )
+ {
+ OutParamMap aOutParamMap;
+ for ( USHORT n = 1, nCount = xSbxParams->Count(); n < nCount; ++n )
+ {
+ const SbxParamInfo* pParamInfo = pInfo_->GetParam( n );
+ if ( pParamInfo && ( pParamInfo->eType & SbxBYREF ) != 0 )
+ {
+ SbxVariable* pVar = xSbxParams->Get( n );
+ if ( pVar )
+ {
+ SbxVariableRef xVar = pVar;
+ aOutParamMap.insert( OutParamMap::value_type( n - 1, sbxToUnoValue( xVar ) ) );
+ }
+ }
+ }
+ sal_Int32 nOutParamCount = aOutParamMap.size();
+ aOutParamIndex.realloc( nOutParamCount );
+ aOutParam.realloc( nOutParamCount );
+ sal_Int16* pOutParamIndex = aOutParamIndex.getArray();
+ Any* pOutParam = aOutParam.getArray();
+ for ( OutParamMap::iterator aIt = aOutParamMap.begin(); aIt != aOutParamMap.end(); ++aIt, ++pOutParamIndex, ++pOutParam )
+ {
+ *pOutParamIndex = aIt->first;
+ *pOutParam = aIt->second;
+ }
+ }
+ }
+
+ // get return value
+ aReturn = sbxToUnoValue( xReturn );
+
+ pMethod->SetParameters( NULL );
+
+ return aReturn;
+}
+
+void SAL_CALL
+DocObjectWrapper::setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
+ return m_xAggInv->setValue( aPropertyName, aValue );
+
+ SbPropertyRef pProperty = getProperty( aPropertyName );
+ if ( !pProperty.Is() )
+ throw UnknownPropertyException();
+ unoToSbxValue( (SbxVariable*) pProperty, aValue );
+}
+
+Any SAL_CALL
+DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
+ return m_xAggInv->getValue( aPropertyName );
+
+ SbPropertyRef pProperty = getProperty( aPropertyName );
+ if ( !pProperty.Is() )
+ throw UnknownPropertyException();
+
+ SbxVariable* pProp = ( SbxVariable* ) pProperty;
+ if ( pProp->GetType() == SbxEMPTY )
+ pProperty->Broadcast( SBX_HINT_DATAWANTED );
+
+ Any aRet = sbxToUnoValue( pProp );
+ return aRet;
+}
+
+::sal_Bool SAL_CALL
+DocObjectWrapper::hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasMethod( aName ) )
+ return sal_True;
+ return getMethod( aName ).Is();
+}
+
+::sal_Bool SAL_CALL
+DocObjectWrapper::hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException)
+{
+ sal_Bool bRes = sal_False;
+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aName ) )
+ bRes = sal_True;
+ else bRes = getProperty( aName ).Is();
+ return bRes;
+}
+
+Any SAL_CALL DocObjectWrapper::queryInterface( const Type& aType )
+ throw ( RuntimeException )
+{
+ Any aRet = DocObjectWrapper_BASE::queryInterface( aType );
+ if ( aRet.hasValue() )
+ return aRet;
+ else if ( m_xAggProxy.is() )
+ aRet = m_xAggProxy->queryAggregation( aType );
+ return aRet;
+}
+
+SbMethodRef DocObjectWrapper::getMethod( const rtl::OUString& aName ) throw (RuntimeException)
+{
+ SbMethodRef pMethod = NULL;
+ if ( m_pMod )
+ {
+ USHORT nSaveFlgs = m_pMod->GetFlags();
+ // Limit search to this module
+ m_pMod->ResetFlag( SBX_GBLSEARCH );
+ pMethod = (SbMethod*) m_pMod->SbModule::Find( aName, SbxCLASS_METHOD );
+ m_pMod->SetFlags( nSaveFlgs );
+ }
+
+ return pMethod;
+}
+
+SbPropertyRef DocObjectWrapper::getProperty( const rtl::OUString& aName ) throw (RuntimeException)
+{
+ SbPropertyRef pProperty = NULL;
+ if ( m_pMod )
+ {
+ USHORT nSaveFlgs = m_pMod->GetFlags();
+ // Limit search to this module.
+ m_pMod->ResetFlag( SBX_GBLSEARCH );
+ pProperty = (SbProperty*)m_pMod->SbModule::Find( aName, SbxCLASS_PROPERTY );
+ m_pMod->SetFlag( nSaveFlgs );
+ }
+
+ return pProperty;
+}
TYPEINIT1(SbModule,SbxObject)
TYPEINIT1(SbMethod,SbxMethod)
@@ -112,9 +461,9 @@ bool getDefaultVBAMode( StarBASIC* pb )
uno::Reference< beans::XPropertySet > xProp( aDoc, uno::UNO_QUERY );
if ( xProp.is() )
{
- uno::Reference< script::XVBACompat > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
if ( xVBAMode.is() )
- bResult = ( xVBAMode->getVBACompatModeOn() == sal_True );
+ bResult = xVBAMode->getVBACompatibilityMode() == sal_True;
}
}
}
@@ -199,12 +548,24 @@ SbModule::SbModule( const String& rName, BOOL bVBACompat )
SbModule::~SbModule()
{
+ OSL_TRACE("Module named %s is destructing", rtl::OUStringToOString( GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
if( pImage )
delete pImage;
if( pBreaks )
delete pBreaks;
if( pClassData )
delete pClassData;
+ mxWrapper = NULL;
+}
+
+uno::Reference< script::XInvocation >
+SbModule::GetUnoModule()
+{
+ if ( !mxWrapper.is() )
+ mxWrapper = new DocObjectWrapper( this );
+
+ OSL_TRACE("Module named %s returning wrapper mxWrapper (0x%x)", rtl::OUStringToOString( GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mxWrapper.get() );
+ return mxWrapper;
}
BOOL SbModule::IsCompiled() const
@@ -684,6 +1045,9 @@ USHORT SbModule::Run( SbMethod* pMeth )
StarBASICRef xBasic;
if( bDelInst )
{
+#ifdef DBG_TRACE_BASIC
+ dbg_InitTrace();
+#endif
// #32779: Basic waehrend der Ausfuehrung festhalten
xBasic = (StarBASIC*) GetParent();
@@ -762,18 +1126,28 @@ USHORT SbModule::Run( SbMethod* pMeth )
SbModule* pOldMod = pMOD;
pMOD = this;
SbiRuntime* pRt = new SbiRuntime( this, pMeth, pMeth->nStart );
+
+#ifdef DBG_TRACE_BASIC
+ dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl );
+#endif
+
pRt->pNext = pINST->pRun;
if( pRt->pNext )
pRt->pNext->block();
pINST->pRun = pRt;
if ( mbVBACompat )
- {
+ {
pINST->EnableCompatibility( TRUE );
- }
+ }
while( pRt->Step() ) {}
if( pRt->pNext )
pRt->pNext->unblock();
+#ifdef DBG_TRACE_BASIC
+ bool bLeave = true;
+ dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl, bLeave );
+#endif
+
// #63710 Durch ein anderes Thread-Handling bei Events kann es passieren,
// dass show-Aufruf an einem Dialog zurueckkehrt (durch schliessen des
// Dialogs per UI), BEVOR ein per Event ausgeloester weitergehender Call,
@@ -867,9 +1241,20 @@ void SbModule::RunInit()
pMOD = this;
// Der Init-Code beginnt immer hier
SbiRuntime* pRt = new SbiRuntime( this, NULL, 0 );
+
+#ifdef DBG_TRACE_BASIC
+ dbg_traceNotifyCall( this, NULL, 0 );
+#endif
+
pRt->pNext = pINST->pRun;
pINST->pRun = pRt;
while( pRt->Step() ) {}
+
+#ifdef DBG_TRACE_BASIC
+ bool bLeave = true;
+ dbg_traceNotifyCall( this, NULL, 0, bLeave );
+#endif
+
pINST->pRun = pRt->pNext;
delete pRt;
pMOD = pOldMod;
@@ -884,6 +1269,33 @@ void SbModule::RunInit()
}
// Mit private/dim deklarierte Variablen loeschen
+
+void SbModule::AddVarName( const String& aName )
+{
+ // see if the name is added allready
+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
+ {
+ if ( aName == *it )
+ return;
+ }
+ mModuleVariableNames.push_back( aName );
+}
+
+void SbModule::RemoveVars()
+{
+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
+ {
+ // We don't want a Find being called in a derived class ( e.g.
+ // SbUserform because it could trigger say an initialise event
+ // which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile )
+ SbxVariableRef p = SbModule::Find( *it, SbxCLASS_PROPERTY );
+ if( p.Is() )
+ Remove (p);
+ }
+}
+
void SbModule::ClearPrivateVars()
{
for( USHORT i = 0 ; i < pProps->Count() ; i++ )
@@ -1600,9 +2012,9 @@ SbObjModule::Find( const XubString& rName, SbxClassType t )
return pVar;
}
-typedef ::cppu::WeakImplHelper1< awt::XTopWindowListener > EventListener_BASE;
+typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE;
-class FormObjEventListenerImpl : public EventListener_BASE
+class FormObjEventListenerImpl : public FormObjEventListener_BASE
{
SbUserFormModule* mpUserForm;
uno::Reference< lang::XComponent > mxComponent;
@@ -1612,39 +2024,57 @@ class FormObjEventListenerImpl : public EventListener_BASE
sal_Bool mbShowing;
FormObjEventListenerImpl(); // not defined
FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined
+
public:
- FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
+ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) :
+ mpUserForm( pUserForm ), mxComponent( xComponent) ,
+ mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
{
if ( mxComponent.is() )
{
- uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
- OSL_TRACE("*********** Registering the listener");
- xList->addTopWindowListener( this );
+ OSL_TRACE("*********** Registering the listeners");
+ try
+ {
+ uno::Reference< awt::XTopWindow >( mxComponent, uno::UNO_QUERY_THROW )->addTopWindowListener( this );
+ }
+ catch( uno::Exception& ) {}
+ try
+ {
+ uno::Reference< awt::XWindow >( mxComponent, uno::UNO_QUERY_THROW )->addWindowListener( this );
+ }
+ catch( uno::Exception& ) {}
}
}
- ~FormObjEventListenerImpl()
+ virtual ~FormObjEventListenerImpl()
{
removeListener();
}
- sal_Bool isShowing() { return mbShowing; }
+
+ sal_Bool isShowing() const { return mbShowing; }
+
void removeListener()
{
- try
+ if ( mxComponent.is() && !mbDisposed )
{
- if ( mxComponent.is() && !mbDisposed )
+ OSL_TRACE("*********** Removing the listeners");
+ try
{
- uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
- OSL_TRACE("*********** Removing the listener");
- xList->removeTopWindowListener( this );
- mxComponent = NULL;
+ uno::Reference< awt::XTopWindow >( mxComponent, uno::UNO_QUERY_THROW )->removeTopWindowListener( this );
}
+ catch( uno::Exception& ) {}
+ try
+ {
+ uno::Reference< awt::XWindow >( mxComponent, uno::UNO_QUERY_THROW )->removeWindowListener( this );
+ }
+ catch( uno::Exception& ) {}
}
- catch( uno::Exception& ) {}
- }
+ mxComponent.clear();
+ }
+
virtual void SAL_CALL windowOpened( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
- if ( mpUserForm )
+ if ( mpUserForm )
{
mbOpened = sal_True;
mbShowing = sal_True;
@@ -1691,12 +2121,23 @@ public:
}
//liuchen 2009-7-21
- virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) { mbOpened = sal_False; mbShowing = sal_False; }
- virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
- virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException){}
+ virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ mbOpened = sal_False;
+ mbShowing = sal_False;
+ }
+
+ virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
virtual void SAL_CALL windowActivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
- if ( mpUserForm )
+ if ( mpUserForm )
{
mbActivated = sal_True;
if ( mbOpened )
@@ -1709,18 +2150,38 @@ public:
virtual void SAL_CALL windowDeactivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
- if ( mpUserForm )
- mpUserForm->triggerDeActivateEvent();
+ if ( mpUserForm )
+ mpUserForm->triggerDeactivateEvent();
}
+ virtual void SAL_CALL windowResized( const awt::WindowEvent& /*e*/ ) throw (uno::RuntimeException)
+ {
+ if ( mpUserForm )
+ {
+ mpUserForm->triggerResizeEvent();
+ mpUserForm->triggerLayoutEvent();
+ }
+ }
- virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
+ virtual void SAL_CALL windowMoved( const awt::WindowEvent& /*e*/ ) throw (uno::RuntimeException)
+ {
+ if ( mpUserForm )
+ mpUserForm->triggerLayoutEvent();
+ }
+
+ virtual void SAL_CALL windowShown( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL windowHidden( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
{
OSL_TRACE("** Userform/Dialog disposing");
mbDisposed = true;
- uno::Any aSource;
- aSource <<= Source;
- mxComponent = NULL;
+ mxComponent.clear();
if ( mpUserForm )
mpUserForm->ResetApiObj();
}
@@ -1734,6 +2195,10 @@ SbUserFormModule::SbUserFormModule( const String& rName, const com::sun::star::s
m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW );
}
+SbUserFormModule::~SbUserFormModule()
+{
+}
+
void SbUserFormModule::ResetApiObj()
{
if ( m_xDialog.is() ) // probably someone close the dialog window
@@ -1796,23 +2261,22 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
void SbUserFormModule::triggerActivateEvent( void )
{
- OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
- triggerMethod( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm_activate") ) );
- OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
+ OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
+ triggerMethod( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm_Activate") ) );
+ OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
}
-void SbUserFormModule::triggerDeActivateEvent( void )
+void SbUserFormModule::triggerDeactivateEvent( void )
{
- OSL_TRACE("**** SbUserFormModule::triggerDeActivate");
- triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_DeActivate") ) );
+ OSL_TRACE("**** SbUserFormModule::triggerDeactivate");
+ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_Deactivate") ) );
}
void SbUserFormModule::triggerInitializeEvent( void )
-
{
if ( mbInit )
return;
- OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
+ OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Initialize") );
triggerMethod( aInitMethodName );
mbInit = true;
@@ -1820,12 +2284,24 @@ void SbUserFormModule::triggerInitializeEvent( void )
void SbUserFormModule::triggerTerminateEvent( void )
{
- OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
+ OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Terminate") );
triggerMethod( aTermMethodName );
mbInit=false;
}
+void SbUserFormModule::triggerLayoutEvent( void )
+{
+ static String aMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Layout") );
+ triggerMethod( aMethodName );
+}
+
+void SbUserFormModule::triggerResizeEvent( void )
+{
+ static String aMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Resize") );
+ triggerMethod( aMethodName );
+}
+
SbUserFormModuleInstance* SbUserFormModule::CreateInstance()
{
SbUserFormModuleInstance* pInstance = new SbUserFormModuleInstance( this, GetName(), m_mInfo, IsVBACompat() );
@@ -1853,7 +2329,7 @@ SbxVariable* SbUserFormModuleInstance::Find( const XubString& rName, SbxClassTyp
}
-void SbUserFormModule::load()
+void SbUserFormModule::Load()
{
OSL_TRACE("** load() ");
// forces a load
@@ -1891,21 +2367,20 @@ void SbUserFormModule::Unload()
if( pMeth )
{
OSL_TRACE("Attempting too run the UnloadObjectMethod");
- m_xDialog = NULL; //release ref to the uno object
+ m_xDialog.clear(); //release ref to the uno object
SbxValues aVals;
- FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
bool bWaitForDispose = true; // assume dialog is showing
- if ( pFormListener )
+ if ( m_DialogListener.get() )
{
- bWaitForDispose = pFormListener->isShowing();
+ bWaitForDispose = m_DialogListener->isShowing();
OSL_TRACE("Showing %d", bWaitForDispose );
}
pMeth->Get( aVals);
- if ( !bWaitForDispose )
- {
- // we've either already got a dispose or we'er never going to get one
+ if ( !bWaitForDispose )
+ {
+ // we've either already got a dispose or we'er never going to get one
ResetApiObj();
- } // else wait for dispose
+ } // else wait for dispose
OSL_TRACE("UnloadObject completed ( we hope )");
}
}
@@ -1943,13 +2418,12 @@ void SbUserFormModule::InitObject()
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
// remove old listener if it exists
- FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
- if ( pFormListener )
- pFormListener->removeListener();
+ if ( m_DialogListener.get() )
+ m_DialogListener->removeListener();
m_DialogListener = new FormObjEventListenerImpl( this, xComponent );
triggerInitializeEvent();
- }
+ }
}
catch( uno::Exception& )
{
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 604ac61745..389b9e49c2 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -1009,13 +1009,8 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
else
pExpr = new SbiExpression( pParser );
- if( bByVal )
- {
- if( !pExpr->IsLvalue() )
- pParser->Error( SbERR_LVALUE_EXPECTED );
- else
- pExpr->SetByVal();
- }
+ if( bByVal && pExpr->IsLvalue() )
+ pExpr->SetByVal();
//pExpr = bConst ? new SbiConstExpression( pParser )
// : new SbiExpression( pParser );
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index c91624de5e..b1769343bb 100644..100755
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -22,7 +22,7 @@
* 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
@@ -31,10 +31,310 @@
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
#include "image.hxx"
+#include "sbtrace.hxx"
+
+
+//==========================================================================
+// Tracing, for debugging only
+
+// To activate tracing enable in sbtrace.hxx
+#ifdef DBG_TRACE_BASIC
+
+#include <hash_map>
+
+// Trace Settings
+static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt";
+static const bool GbIncludePCodes = false;
+static const int GnIndentPerCallLevel = 4;
+static const int GnIndentForPCode = 2;
+
+struct TraceTextData
+{
+ rtl::OString m_aTraceStr_STMNT;
+ rtl::OString m_aTraceStr_PCode;
+};
+typedef std::hash_map< sal_Int32, TraceTextData > PCToTextDataMap;
+typedef std::hash_map< ::rtl::OUString, PCToTextDataMap*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleTraceMap;
+
+ModuleTraceMap GaModuleTraceMap;
+ModuleTraceMap& rModuleTraceMap = GaModuleTraceMap;
+
+static void lcl_PrepareTraceForModule( SbModule* pModule )
+{
+ String aModuleName = pModule->GetName();
+ ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
+ if( it != rModuleTraceMap.end() )
+ {
+ PCToTextDataMap* pInnerMap = it->second;
+ delete pInnerMap;
+ rModuleTraceMap.erase( it );
+ }
+
+ String aDisassemblyStr;
+ pModule->Disassemble( aDisassemblyStr );
+}
+
+static void lcl_lineOut( const char* pFileName, const char* pStr, const char* pPreStr = NULL )
+{
+ const char* pPrintFirst = (pPreStr != NULL) ? pPreStr : "";
+ FILE* pFile = fopen( pFileName, "a+" );
+ if( pFile != NULL )
+ {
+ fprintf( pFile, "%s%s\n", pPrintFirst, pStr );
+ fclose( pFile );
+ }
+}
+
+const char* lcl_getSpaces( int nSpaceCount )
+{
+ static sal_Char Spaces[] = " "
+ " "
+ " ";
+ static int nAvailableSpaceCount = strlen( Spaces );
+ static sal_Char* pSpacesEnd = Spaces + nAvailableSpaceCount;
+
+ if( nSpaceCount > nAvailableSpaceCount )
+ nSpaceCount = nAvailableSpaceCount;
+
+ return pSpacesEnd - nSpaceCount;
+}
+
+static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
+{
+ static sal_Char Buffer[1000];
+
+ rtl::OString aOStr = OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US );
+ const sal_Char* pStr = aOStr.getStr();
+ // Skip whitespace
+ sal_Char c = *pStr;
+ while( c == ' ' || c == '\t' )
+ {
+ pStr++;
+ c = *pStr;
+ }
+
+ int nLen = strlen( pStr );
+ strncpy( Buffer, pStr, nLen );
+ Buffer[nLen] = 0;
+
+ rtl::OString aORetStr( Buffer );
+ return aORetStr;
+}
+
+String dumpMethodParameters( SbMethod* pMethod )
+{
+ String aStr;
+ if( pMethod == NULL )
+ return aStr;
+
+ SbxError eOld = SbxBase::GetError();
+
+ SbxArray* pParams = pMethod->GetParameters();
+ SbxInfo* pInfo = pMethod->GetInfo();
+ if ( pParams )
+ {
+ aStr += '(';
+ // 0 is sub itself
+ for ( USHORT nParam = 1; nParam < pParams->Count(); nParam++ )
+ {
+ SbxVariable* pVar = pParams->Get( nParam );
+ DBG_ASSERT( pVar, "Parameter?!" );
+ if ( pVar->GetName().Len() )
+ aStr += pVar->GetName();
+ else if ( pInfo )
+ {
+ const SbxParamInfo* pParam = pInfo->GetParam( nParam );
+ if ( pParam )
+ aStr += pParam->aName;
+ }
+ aStr += '=';
+ if( pVar->GetType() & SbxARRAY )
+ aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ else
+ aStr += pVar->GetString();
+ if ( nParam < ( pParams->Count() - 1 ) )
+ aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ }
+ aStr += ')';
+ }
+
+ SbxBase::ResetError();
+ if( eOld != SbxERR_OK )
+ SbxBase::SetError( eOld );
+
+ return aStr;
+}
+
+// Public functions
+void dbg_InitTrace( void )
+{
+ FILE* pFile = fopen( GpTraceFileName, "w" );
+ if( pFile != NULL )
+ fclose( pFile );
+}
+
+void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
+{
+ SbModule* pTraceMod = pModule;
+ if( pTraceMod->ISA(SbClassModuleObject) )
+ {
+ SbClassModuleObject* pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
+ pTraceMod = pClassModuleObj->getClassModule();
+ }
+
+ String aModuleName = pTraceMod->GetName();
+ ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
+ if( it == rModuleTraceMap.end() )
+ {
+ const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
+ char Buffer[200];
+ sprintf( Buffer, "TRACE ERROR: Unknown module \"%s\"", pModuleNameStr );
+ lcl_lineOut( GpTraceFileName, Buffer );
+ return;
+ }
+ PCToTextDataMap* pInnerMap = it->second;
+ if( pInnerMap == NULL )
+ {
+ lcl_lineOut( GpTraceFileName, "TRACE INTERNAL ERROR: No inner map" );
+ return;
+ }
+
+ PCToTextDataMap::iterator itInner = pInnerMap->find( nPC );
+ if( itInner == pInnerMap->end() )
+ {
+ const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
+ char Buffer[200];
+ sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", nPC, pModuleNameStr );
+ lcl_lineOut( GpTraceFileName, Buffer );
+ return;
+ }
+
+ //nCallLvl--;
+ //if( nCallLvl < 0 )
+ // nCallLvl = 0;
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+
+ const TraceTextData& rTraceTextData = itInner->second;
+ const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
+ if( rStr_STMNT.getLength() )
+ lcl_lineOut( GpTraceFileName, rStr_STMNT.getStr(), lcl_getSpaces( nIndent ) );
+
+ if( !GbIncludePCodes )
+ return;
+
+ nIndent += GnIndentForPCode;
+ const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode;
+ if( rStr_PCode.getLength() )
+ lcl_lineOut( GpTraceFileName, rStr_PCode.getStr(), lcl_getSpaces( nIndent ) );
+}
+
+void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave )
+{
+ static const char* pSeparator = "' ================================================================================";
+
+ SbModule* pTraceMod = pModule;
+ SbClassModuleObject* pClassModuleObj = NULL;
+ if( pTraceMod->ISA(SbClassModuleObject) )
+ {
+ pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
+ pTraceMod = pClassModuleObj->getClassModule();
+ }
+
+ if( nCallLvl > 0 )
+ nCallLvl--;
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+ if( !bLeave )
+ {
+ lcl_lineOut( GpTraceFileName, "" );
+ lcl_lineOut( GpTraceFileName, pSeparator, lcl_getSpaces( nIndent ) );
+ }
+
+ String aStr;
+ if( bLeave )
+ {
+ lcl_lineOut( GpTraceFileName, "}", lcl_getSpaces( nIndent ) );
+ aStr.AppendAscii( "' Leaving " );
+ }
+ else
+ {
+ aStr.AppendAscii( "Entering " );
+ }
+ String aModuleName = pModule->GetName();
+ aStr += aModuleName;
+ if( pMethod != NULL )
+ {
+ aStr.AppendAscii( "::" );
+ String aMethodName = pMethod->GetName();
+ aStr += aMethodName;
+ }
+ else
+ {
+ aStr.AppendAscii( "/RunInit" );
+ }
+
+ if( pClassModuleObj != NULL )
+ {
+ aStr.AppendAscii( "[this=" );
+ aStr += pClassModuleObj->GetName();
+ aStr.AppendAscii( "]" );
+ }
+ if( !bLeave )
+ aStr += dumpMethodParameters( pMethod );
+
+ lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
+ if( !bLeave )
+ lcl_lineOut( GpTraceFileName, "{", lcl_getSpaces( nIndent ) );
+
+ if( bLeave )
+ lcl_lineOut( GpTraceFileName, "" );
+}
+
+void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl )
+{
+ rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
+
+ char Buffer[200];
+ const char* pHandledStr = bTraceErrHandled ? " / HANDLED" : "";
+ sprintf( Buffer, "*** ERROR%s, Id = %d, Msg = \"%s\" ***", pHandledStr, (int)nTraceErr, aOTraceErrMsg.getStr() );
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+ lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
+}
+
+void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
+ const String& aTraceStr_STMNT, const String& aTraceStr_PCode )
+{
+ String aModuleName = pModule->GetName();
+ ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
+ PCToTextDataMap* pInnerMap;
+ if( it == rModuleTraceMap.end() )
+ {
+ pInnerMap = new PCToTextDataMap();
+ rModuleTraceMap[ aModuleName ] = pInnerMap;
+ }
+ else
+ {
+ pInnerMap = it->second;
+ }
+
+ TraceTextData aData;
+
+ rtl::OString aOTraceStr_STMNT = lcl_toOStringSkipLeadingWhites( aTraceStr_STMNT );
+ aData.m_aTraceStr_STMNT = aOTraceStr_STMNT;
+
+ rtl::OString aOTraceStr_PCode = lcl_toOStringSkipLeadingWhites( aTraceStr_PCode );
+ aData.m_aTraceStr_PCode = aOTraceStr_PCode;
+
+ (*pInnerMap)[nPC] = aData;
+}
+
+#endif
+
+
+//==========================================================================
// For debugging only
-// #define DBG_SAVE_DISASSEMBLY
+//#define DBG_SAVE_DISASSEMBLY
#ifdef DBG_SAVE_DISASSEMBLY
static bool dbg_bDisassemble = true;
@@ -67,7 +367,7 @@ void dbg_SaveDisassembly( SbModule* pModule )
( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
if( xSFI.is() )
{
- String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/BasicAsm_") );
+ String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/zBasic.Asm/Asm_") );
StarBASIC* pBasic = (StarBASIC*)pModule->GetParent();
if( pBasic )
{
@@ -99,6 +399,7 @@ void dbg_SaveDisassembly( SbModule* pModule )
}
#endif
+
// Diese Routine ist hier definiert, damit der Compiler als eigenes Segment
// geladen werden kann.
@@ -131,6 +432,7 @@ BOOL SbModule::Compile()
if( bRet )
{
pBasic->ClearAllModuleVars();
+ RemoveVars(); // remove 'this' Modules variables
// clear all method statics
for( USHORT i = 0; i < pMethods->Count(); i++ )
{
@@ -154,6 +456,10 @@ BOOL SbModule::Compile()
dbg_SaveDisassembly( this );
#endif
+#ifdef DBG_TRACE_BASIC
+ lcl_PrepareTraceForModule( this );
+#endif
+
return bRet;
}
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 6db0b96933..72cdcee2da 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -60,7 +60,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/compbase8.hxx>
#include <cppuhelper/interfacecontainer.hxx>
-#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
class BasicManager;
@@ -74,7 +74,7 @@ typedef ::cppu::WeakComponentImplHelper8<
::com::sun::star::script::XLibraryContainerExport,
::com::sun::star::script::XLibraryContainer3,
::com::sun::star::container::XContainer,
- ::com::sun::star::script::XVBACompat,
+ ::com::sun::star::script::vba::XVBACompatibility,
::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
@@ -507,9 +507,9 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
throw (::com::sun::star::uno::RuntimeException) = 0;
- // Methods XVBACompat
- virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ // Methods XVBACompatibility
+ virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
};
class LibraryContainerMethodGuard
diff --git a/sfx2/source/appl/sfxdll.cxx b/basic/source/inc/sbtrace.hxx
index 3635770b38..6d24325c94 100644..100755
--- a/sfx2/source/appl/sfxdll.cxx
+++ b/basic/source/inc/sbtrace.hxx
@@ -25,45 +25,18 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sfx2.hxx"
-
-#ifdef WIN
-#include <svwin.h>
-#endif
-
-#ifndef GCC
-#endif
-
-#ifdef WIN
-
-// Statische DLL-Verwaltungs-Variablen
-static HINSTANCE hDLLInst = 0;
-
-//==========================================================================
-
-extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
-{
-#ifndef WNT
- if ( nHeap )
- UnlockData( 0 );
+#ifndef _SBTRACE_HXX
+#define _SBTRACE_HXX
+
+// #define DBG_TRACE_BASIC
+
+#ifdef DBG_TRACE_BASIC
+void dbg_InitTrace( void );
+void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl );
+void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false );
+void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl );
+void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
+ const String& aTraceStr_STMNT, const String& aTraceStr_PCode );
#endif
- hDLLInst = hDLL;
-
- return TRUE;
-}
-
-
-//--------------------------------------------------------------------------
-
-extern "C" int CALLBACK WEP( int )
-{
- return 1;
-}
-
-
-//==========================================================================
-
#endif
-
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 2c71183918..71ad535600 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -30,7 +30,7 @@
#include "namecont.hxx"
#include <basic/basmgr.hxx>
-#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
#include <comphelper/uno3.hxx>
class BasicManager;
@@ -141,7 +141,7 @@ public:
//============================================================================
typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
-typedef ::cppu::ImplHelper1 < ::com::sun::star::script::XVBAModuleInfo
+typedef ::cppu::ImplHelper1 < ::com::sun::star::script::vba::XVBAModuleInfo
> SfxScriptLibrary_BASE;
class SfxScriptLibrary : public SfxLibrary
diff --git a/basic/source/runtime/dllmgr.cxx b/basic/source/runtime/dllmgr.cxx
index bc08a8cb64..04f1ee0a8a 100644
--- a/basic/source/runtime/dllmgr.cxx
+++ b/basic/source/runtime/dllmgr.cxx
@@ -684,7 +684,7 @@ 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);
+ HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
if (h == 0) {
dlls.erase(i);
return 0;
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 41e7df439c..29459b1de9 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -103,15 +103,10 @@ using namespace com::sun::star::io;
#include <stdlib.h>
#include <ctype.h>
-#if defined (WIN) || defined (WNT) || defined (OS2)
+#if defined (WNT) || defined (OS2)
#include <direct.h> // _getdcwd get current work directory, _chdrive
#endif
-#ifdef WIN
-#include <dos.h> // _dos_getfileattr
-#include <errno.h>
-#endif
-
#ifdef UNX
#include <errno.h>
#include <unistd.h>
@@ -420,7 +415,7 @@ RTLFUNC(CurDir)
// zu ermitteln, dass eine virtuelle URL geliefert werden koennte.
// rPar.Get(0)->PutEmpty();
-#if defined (WIN) || defined (WNT) || defined (OS2)
+#if defined (WNT) || defined (OS2)
int nCurDir = 0; // Current dir // JSM
if ( rPar.Count() == 2 )
{
@@ -527,7 +522,7 @@ RTLFUNC(ChDrive) // JSM
#ifndef UNX
String aPar1 = rPar.Get(1)->GetString();
-#if defined (WIN) || defined (WNT) || defined (OS2)
+#if defined (WNT) || defined (OS2)
if (aPar1.Len() > 0)
{
int nCurDrive = (int)aPar1.GetBuffer()[0]; ;
@@ -2792,11 +2787,7 @@ RTLFUNC(Dir)
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
else
pRTLData->nDirFlags = 0;
- // Nur diese Bitmaske ist unter Windows erlaubt
- #ifdef WIN
- if( nFlags & ~0x1E )
- StarBASIC::Error( SbERR_BAD_ARGUMENT ), pRTLData->nDirFlags = 0;
- #endif
+
// Sb_ATTR_VOLUME wird getrennt gehandelt
if( pRTLData->nDirFlags & Sb_ATTR_VOLUME )
aPath = aEntry.GetVolume();
@@ -2826,31 +2817,7 @@ RTLFUNC(Dir)
}
DirEntry aNextEntry=(*(pRTLData->pDir))[pRTLData->nCurDirPos++];
aPath = aNextEntry.GetName(); //Full();
- #ifdef WIN
- aNextEntry.ToAbs();
- String sFull(aNextEntry.GetFull());
- unsigned nFlags;
-
- if (_dos_getfileattr( sFull.GetStr(), &nFlags ))
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- else
- {
- INT16 nCurFlags = pRTLData->nDirFlags;
- if( (nCurFlags == Sb_ATTR_NORMAL)
- && !(nFlags & ( _A_HIDDEN | _A_SYSTEM | _A_VOLID | _A_SUBDIR ) ) )
- break;
- else if( (nCurFlags & Sb_ATTR_HIDDEN) && (nFlags & _A_HIDDEN) )
- break;
- else if( (nCurFlags & Sb_ATTR_SYSTEM) && (nFlags & _A_SYSTEM) )
- break;
- else if( (nCurFlags & Sb_ATTR_VOLUME) && (nFlags & _A_VOLID) )
- break;
- else if( (nCurFlags & Sb_ATTR_DIRECTORY) && (nFlags & _A_SUBDIR) )
- break;
- }
- #else
break;
- #endif
}
}
rPar.Get(0)->PutString( aPath );
@@ -3404,8 +3371,8 @@ RTLFUNC(Shell)
}
else
{
- USHORT nOptions = NAMESPACE_VOS(OProcess)::TOption_SearchPath|
- NAMESPACE_VOS(OProcess)::TOption_Detached;
+ USHORT nOptions = vos::OProcess::TOption_SearchPath|
+ vos::OProcess::TOption_Detached;
String aCmdLine = rPar.Get(1)->GetString();
// Zusaetzliche Parameter anhaengen, es muss eh alles geparsed werden
if( nArgCount >= 4 )
@@ -3483,13 +3450,13 @@ RTLFUNC(Shell)
switch( nWinStyle )
{
case 2:
- nOptions |= NAMESPACE_VOS(OProcess)::TOption_Minimized;
+ nOptions |= vos::OProcess::TOption_Minimized;
break;
case 3:
- nOptions |= NAMESPACE_VOS(OProcess)::TOption_Maximized;
+ nOptions |= vos::OProcess::TOption_Maximized;
break;
case 10:
- nOptions |= NAMESPACE_VOS(OProcess)::TOption_FullScreen;
+ nOptions |= vos::OProcess::TOption_FullScreen;
break;
}
@@ -3497,10 +3464,10 @@ RTLFUNC(Shell)
if( nArgCount >= 5 )
bSync = rPar.Get(4)->GetBool();
if( bSync )
- nOptions |= NAMESPACE_VOS(OProcess)::TOption_Wait;
+ nOptions |= vos::OProcess::TOption_Wait;
}
- NAMESPACE_VOS(OProcess)::TProcessOption eOptions =
- (NAMESPACE_VOS(OProcess)::TProcessOption)nOptions;
+ vos::OProcess::TProcessOption eOptions =
+ (vos::OProcess::TProcessOption)nOptions;
// #72471 Parameter aufbereiten
@@ -3530,25 +3497,25 @@ RTLFUNC(Shell)
}
//const char* pParams = aParams.Len() ? aParams.GetStr() : 0;
- NAMESPACE_VOS(OProcess)* pApp;
- pApp = new NAMESPACE_VOS(OProcess)( aOUStrProgUNC );
+ vos::OProcess* pApp;
+ pApp = new vos::OProcess( aOUStrProgUNC );
BOOL bSucc;
if( nParamCount == 0 )
{
- bSucc = pApp->execute( eOptions ) == NAMESPACE_VOS(OProcess)::E_None;
+ bSucc = pApp->execute( eOptions ) == vos::OProcess::E_None;
}
else
{
- NAMESPACE_VOS(OArgumentList) aArgList( pArgumentList, nParamCount );
- bSucc = pApp->execute( eOptions, aArgList ) == NAMESPACE_VOS(OProcess)::E_None;
+ vos::OArgumentList aArgList( pArgumentList, nParamCount );
+ bSucc = pApp->execute( eOptions, aArgList ) == vos::OProcess::E_None;
}
/*
if( nParamCount == 0 )
- pApp = new NAMESPACE_VOS(OProcess)( pProg );
+ pApp = new vos::OProcess( pProg );
else
- pApp = new NAMESPACE_VOS(OProcess)( pProg, pParamList, nParamCount );
- BOOL bSucc = pApp->execute( eOptions ) == NAMESPACE_VOS(OProcess)::E_None;
+ pApp = new vos::OProcess( pProg, pParamList, nParamCount );
+ BOOL bSucc = pApp->execute( eOptions ) == vos::OProcess::E_None;
*/
delete pApp;
@@ -4134,8 +4101,7 @@ RTLFUNC(Load)
{
if( pObj->IsA( TYPE( SbUserFormModule ) ) )
{
- SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
- pFormModule->load();
+ ((SbUserFormModule*)pObj)->Load();
}
else if( pObj->IsA( TYPE( SbxObject ) ) )
{
@@ -4381,16 +4347,6 @@ RTLFUNC(SetAttr) // JSM
// #57064 Bei virtuellen URLs den Real-Path extrahieren
DirEntry aEntry( aStr );
String aFile = aEntry.GetFull();
- #ifdef WIN
- int nErr = _dos_setfileattr( aFile.GetStr(),(unsigned ) nFlags );
- if ( nErr )
- {
- if (errno == EACCES)
- StarBASIC::Error( SbERR_ACCESS_DENIED );
- else
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- }
- #endif
ByteString aByteFile( aFile, gsl_getSystemTextEncoding() );
#ifdef WNT
if (!SetFileAttributes (aByteFile.GetBuffer(),(DWORD)nFlags))
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index f22a52c51a..881a1a821b 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -28,11 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#if defined(WIN)
-#include <string.h>
-#else
#include <stdlib.h> // getenv
-#endif
#include <vcl/svapp.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/wrkwin.hxx>
@@ -52,10 +48,6 @@
#include <svpm.h>
#endif
-#if defined(WIN)
-#include <tools/svwin.h>
-#endif
-
#ifndef CLK_TCK
#define CLK_TCK CLOCKS_PER_SEC
#endif
@@ -1163,31 +1155,10 @@ RTLFUNC(Environ)
}
String aResult;
// sollte ANSI sein, aber unter Win16 in DLL nicht moeglich
-#if defined(WIN)
- LPSTR lpszEnv = GetDOSEnvironment();
- String aCompareStr( rPar.Get(1)->GetString() );
- aCompareStr += '=';
- const char* pCompare = aCompareStr.GetStr();
- int nCompareLen = aCompareStr.Len();
- while ( *lpszEnv )
- {
- // Es werden alle EnvString in der Form ENV=VAL 0-terminiert
- // aneinander gehaengt.
-
- if ( strnicmp( pCompare, lpszEnv, nCompareLen ) == 0 )
- {
- aResult = (const char*)(lpszEnv+nCompareLen);
- rPar.Get(0)->PutString( aResult );
- return;
- }
- lpszEnv += lstrlen( lpszEnv ) + 1; // Next Enviroment-String
- }
-#else
ByteString aByteStr( rPar.Get(1)->GetString(), gsl_getSystemTextEncoding() );
const char* pEnvStr = getenv( aByteStr.GetBuffer() );
if ( pEnvStr )
aResult = String::CreateFromAscii( pEnvStr );
-#endif
rPar.Get(0)->PutString( aResult );
}
@@ -1198,11 +1169,7 @@ static double GetDialogZoomFactor( BOOL bX, long nValue )
if( pDevice )
{
Size aRefSize( nValue, nValue );
-#ifndef WIN
Fraction aFracX( 1, 26 );
-#else
- Fraction aFracX( 1, 23 );
-#endif
Fraction aFracY( 1, 24 );
MapMode aMap( MAP_APPFONT, Point(), aFracX, aFracY );
Size aScaledSize = pDevice->LogicToPixel( aRefSize, aMap );
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 5a215bb40d..c7e81cf162 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -76,6 +76,13 @@ RTLFUNC(False)
rPar.Get(0)->PutBool( FALSE );
}
+RTLFUNC(Empty)
+{
+ (void)pBasic;
+ (void)bWrite;
+ (void)rPar;
+}
+
RTLFUNC(Nothing)
{
(void)pBasic;
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index 13485d7bb2..e3b2a05395 100644
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -38,6 +38,7 @@ extern RTLFUNC(Date);
extern RTLFUNC(Err);
extern RTLFUNC(Erl);
extern RTLFUNC(False);
+extern RTLFUNC(Empty);
extern RTLFUNC(Nothing);
extern RTLFUNC(Null);
extern RTLFUNC(True);
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index b27495099a..a8eff4d55d 100755..100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include "sbunoobj.hxx"
#include "errobject.hxx"
+#include "sbtrace.hxx"
using namespace ::com::sun::star;
@@ -720,6 +721,12 @@ BOOL SbiRuntime::Step()
if( pInst->IsReschedule() && bStaticGlobalEnableReschedule )
Application::Reschedule();
}
+
+#ifdef DBG_TRACE_BASIC
+ UINT32 nPC = ( pCode - (const BYTE* )pImg->GetCode() );
+ dbg_traceStep( pMod, nPC, pINST->nCallLvl );
+#endif
+
SbiOpcode eOp = (SbiOpcode ) ( *pCode++ );
UINT32 nOp1, nOp2;
if( eOp <= SbOP0_END )
@@ -756,6 +763,11 @@ BOOL SbiRuntime::Step()
// (insbesondere nicht nach Compiler-Fehlern zur Laufzeit)
if( nError && bRun )
{
+#ifdef DBG_TRACE_BASIC
+ SbError nTraceErr = nError;
+ String aTraceErrMsg = GetSbData()->aErrMsg;
+ bool bTraceErrHandled = true;
+#endif
SbError err = nError;
ClearExprStack();
nError = 0;
@@ -836,12 +848,19 @@ BOOL SbiRuntime::Step()
// Kein Error-Hdl gefunden -> altes Vorgehen
else
{
+#ifdef DBG_TRACE_BASIC
+ bTraceErrHandled = false;
+#endif
pInst->Abort();
}
// ALT: Nur
// pInst->Abort();
}
+
+#ifdef DBG_TRACE_BASIC
+ dbg_traceNotifyError( nTraceErr, aTraceErrMsg, bTraceErrHandled, pINST->nCallLvl );
+#endif
}
}
return bRun;
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index a4a7f7f68b..d621a12f0f 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -221,6 +221,7 @@ static Methods aMethods[] = {
{ "FileSpec", SbxSTRING, 0,NULL,0 },
{ "DumpAll", SbxINTEGER, _OPT, NULL,0 },
+{ "Empty", SbxVARIANT, _CPROP, RTLNAME(Empty),0 },
{ "EqualUnoObjects",SbxBOOL, 2 | _FUNCTION, RTLNAME(EqualUnoObjects),0 },
{ "Variant", SbxVARIANT, 0,NULL,0 },
{ "Variant", SbxVARIANT, 0,NULL,0 },
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 2c576e07f6..00f72a1b9c 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -138,7 +138,6 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
}
}
-#ifndef WIN
static SbxVariable* pTRUE = NULL;
static SbxVariable* pFALSE = NULL;
@@ -162,12 +161,6 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
}
PushVar( pFALSE );
}
-#else
- BOOL bRes = p2->Compare( eOp, *p1 );
- SbxVariable* pRes = new SbxVariable;
- pRes->PutBool( bRes );
- PushVar( pRes );
-#endif
}
void SbiRuntime::StepEXP() { StepArith( SbxEXP ); }
@@ -312,9 +305,21 @@ void SbiRuntime::StepIS()
{
SbxVariableRef refVar1 = PopVar();
SbxVariableRef refVar2 = PopVar();
- BOOL bRes = BOOL(
- refVar1->GetType() == SbxOBJECT
- && refVar2->GetType() == SbxOBJECT );
+
+ SbxDataType eType1 = refVar1->GetType();
+ SbxDataType eType2 = refVar2->GetType();
+ if ( eType1 == SbxEMPTY )
+ {
+ refVar1->Broadcast( SBX_HINT_DATAWANTED );
+ eType1 = refVar1->GetType();
+ }
+ if ( eType2 == SbxEMPTY )
+ {
+ refVar2->Broadcast( SBX_HINT_DATAWANTED );
+ eType2 = refVar2->GetType();
+ }
+
+ BOOL bRes = BOOL( eType1 == SbxOBJECT && eType2 == SbxOBJECT );
if ( bVBAEnabled && !bRes )
Error( SbERR_INVALID_USAGE_OBJECT );
bRes = ( bRes && refVar1->GetObject() == refVar2->GetObject() );
@@ -520,9 +525,10 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// Handle withevents
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
- Reference< XInterface > xComListener;
- if( bWithEvents )
+ if ( bWithEvents )
{
+ Reference< XInterface > xComListener;
+
SbxBase* pObj = refVal->GetObject();
SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
if( pUnoObj != NULL )
@@ -533,13 +539,17 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
::rtl::OUString aPrefix = refVar->GetName();
SbxObjectRef xScopeObj = refVar->GetParent();
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
- }
- }
- *refVar = *refVal;
+ refVal->SetDeclareClassName( aDeclareClassName );
+ refVal->SetComListener( xComListener ); // Hold reference
+ }
- if( bWithEvents )
- refVar->SetComListener( xComListener ); // Hold reference
+ *refVar = *refVal;
+ }
+ else
+ {
+ *refVar = *refVal;
+ }
// 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
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 48a0a0da99..995c425c0e 100644..100755
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -261,10 +261,12 @@ SbxVariable* SbiRuntime::FindElement
if( bSet )
pElem->SetType( t2 );
pElem = pNew;
- }
+ }
// Index-Access bei UnoObjekten beruecksichtigen
- /*
- else if( pElem->ISA(SbUnoProperty) )
+ // definitely we want this for VBA where properties are often
+ // collections ( which need index access ), but lets only do
+ // this if we actually have params following
+ else if( bVBAEnabled && pElem->ISA(SbUnoProperty) && pElem->GetParameters() )
{
// pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen
SbxVariableRef refTemp = pElem;
@@ -274,7 +276,6 @@ SbxVariable* SbiRuntime::FindElement
pElem->SetParameters( NULL ); // sonst bleibt Ref auf sich selbst
pElem = pNew;
}
- */
}
return CheckArray( pElem );
}
@@ -377,7 +378,8 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
bool bError_ = true;
SbUnoMethod* pUnoMethod = PTR_CAST(SbUnoMethod,p);
- if( pUnoMethod )
+ SbUnoProperty* pUnoProperty = PTR_CAST(SbUnoProperty,p);
+ if( pUnoMethod || pUnoProperty )
{
SbUnoObject* pParentUnoObj = PTR_CAST( SbUnoObject,p->GetParent() );
if( pParentUnoObj )
@@ -677,7 +679,18 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
while( iLoop >= nParamCount )
{
p = new SbxVariable();
- p->PutErr( 448 ); // Wie in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND)
+
+ if( SbiRuntime::isVBAEnabled() &&
+ (t == SbxOBJECT || t == SbxSTRING) )
+ {
+ if( t == SbxOBJECT )
+ p->PutObject( NULL );
+ else
+ p->PutString( String() );
+ }
+ else
+ p->PutErr( 448 ); // Wie in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND)
+
refParams->Put( p, iLoop );
iLoop--;
}
@@ -1157,15 +1170,26 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
StepPUBLIC_Impl( nOp1, nOp2, true );
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
- SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);;
- BOOL bFlag = rBasic.IsSet( SBX_NO_MODIFY );
+ SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
+
+ // Store module scope variables at module scope
+ // in non vba mode these are stored at the library level :/
+ // not sure if this really should not be enabled for ALL basic
+ SbxObject* pStorage = &rBasic;
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ pStorage = pMod;
+ pMod->AddVarName( aName );
+ }
+
+ BOOL bFlag = pStorage->IsSet( SBX_NO_MODIFY );
rBasic.SetFlag( SBX_NO_MODIFY );
- SbxVariableRef p = rBasic.Find( aName, SbxCLASS_PROPERTY );
+ SbxVariableRef p = pStorage->Find( aName, SbxCLASS_PROPERTY );
if( p.Is() )
- rBasic.Remove (p);
- p = rBasic.Make( aName, SbxCLASS_PROPERTY, t );
+ pStorage->Remove (p);
+ p = pStorage->Make( aName, SbxCLASS_PROPERTY, t );
if( !bFlag )
- rBasic.ResetFlag( SBX_NO_MODIFY );
+ pStorage->ResetFlag( SBX_NO_MODIFY );
if( p )
{
p->SetFlag( SBX_DONTSTORE );
diff --git a/basic/source/runtime/wnt-mingw.s b/basic/source/runtime/wnt-mingw.s
index 7868ddd386..8c332c1a8c 100644
--- a/basic/source/runtime/wnt-mingw.s
+++ b/basic/source/runtime/wnt-mingw.s
@@ -44,8 +44,8 @@ _DllMgr_callFp:
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):
+ # 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
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 2a7849cb82..5304d892b5 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -48,18 +48,11 @@ TYPEINIT0(SbxBase)
SbxAppData* GetSbxData_Impl()
{
-#ifndef DOS
SbxAppData** ppData = (SbxAppData**) ::GetAppData( SHL_SBX );
SbxAppData* p = *ppData;
if( !p )
p = *ppData = new SbxAppData;
return p;
-#else
- SbxAppData** ppData;
- SbxAppData* p;
- p = *ppData = new SbxAppData;
- return p;
-#endif
}
SbxAppData::~SbxAppData()
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index a653b77a9b..f2c299ac25 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -90,7 +90,6 @@ double ImpGetDate( const SbxValues* p )
nRes = 0;
else
{
-#ifndef DOS
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
SvNumberFormatter* pFormatter;
@@ -141,9 +140,6 @@ double ImpGetDate( const SbxValues* p )
}
delete pFormatter;
-#else
- SbxBase::SetError( SbxERR_CONVERSION ); nRes = 0;
-#endif
}
break;
case SbxOBJECT:
@@ -246,7 +242,6 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
-#ifndef DOS
{
if( !p->pString )
p->pString = new XubString;
@@ -301,11 +296,8 @@ start:
eLangType );
pFormatter->GetOutputString( n, nIndex, *p->pString, &pColor );
delete pFormatter;
-#endif
break;
-#ifndef DOS
}
-#endif
case SbxOBJECT:
{
SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index b641323507..2eb7a4e77e 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2793,8 +2793,7 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
}
}
-
-//XLibraryContainer3
+//XLibraryContainer3
OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString& Name )
throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
{
@@ -2808,12 +2807,13 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
}
-::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
+// XVBACompatibility
+::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatibilityMode() throw (RuntimeException)
{
return mbVBACompat;
}
-void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
+void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
{
BasicManager* pBasMgr = getBasicManager();
if( pBasMgr )
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 2bc4787a65..e10d1110f1 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -216,8 +216,7 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
Any aElement = xLib->getByName( aElementName );
aElement >>= aMod.aCode;
- Reference < script::XVBAModuleInfo > xModInfo( xLib, UNO_QUERY );
-
+ Reference< script::vba::XVBAModuleInfo > xModInfo( xLib, UNO_QUERY );
if( xModInfo.is() && xModInfo->hasModuleInfo( aElementName ) )
{
script::ModuleInfo aModInfo = xModInfo->getModuleInfo( aElementName );
@@ -312,9 +311,9 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
// aMod.aName ignored
if( aMod.aModuleType.getLength() > 0 )
{
- if( !getVBACompatModeOn() )
+ if( !getVBACompatibilityMode() )
{
- setVBACompatModeOn( sal_True );
+ setVBACompatibilityMode( sal_True );
Any aGlobs;
Sequence< Any > aArgs(1);
@@ -381,8 +380,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
}
}
- Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib,
- UNO_QUERY );
+ Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
if( xVBAModuleInfo.is() )
{
if( xVBAModuleInfo->hasModuleInfo( aElementName ) )
diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx
index 95a346d720..f5d0bb1372 100644
--- a/configmgr/source/rootaccess.cxx
+++ b/configmgr/source/rootaccess.cxx
@@ -96,11 +96,12 @@ void RootAccess::initBroadcaster(
for (ChangesListeners::iterator i(changesListeners_.begin());
i != changesListeners_.end(); ++i)
{
+ cppu::OWeakObject* pSource = static_cast< cppu::OWeakObject * >(this);
+ css::uno::Reference< css::uno::XInterface > xBase( pSource, css::uno::UNO_QUERY );
broadcaster->addChangesNotification(
*i,
css::util::ChangesEvent(
- static_cast< cppu::OWeakObject * >(this),
- css::uno::makeAny(pathRepresentation_), set));
+ pSource, makeAny( xBase ), set));
}
}
}
diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx
index eda478b18b..cd1e6e55d0 100644
--- a/configmgr/source/xcuparser.cxx
+++ b/configmgr/source/xcuparser.cxx
@@ -196,6 +196,14 @@ bool XcuParser::startElement(
{
handleSetNode(
reader, dynamic_cast< SetNode * >(state_.top().node.get()));
+ } else if (ns == XmlReader::NAMESPACE_NONE &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("prop")))
+ {
+ OSL_TRACE(
+ "configmgr bad set node <prop> member in %s",
+ rtl::OUStringToOString(
+ reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
+ state_.push(State(true)); // ignored
} else {
throw css::uno::RuntimeException(
(rtl::OUString(
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 9f1afe1e93..647ddaccde 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -258,6 +258,7 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType)
(*this) = getAny();
break;
default:
+ (*this) = getAny();
OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!");
}
}
@@ -344,6 +345,19 @@ void ORowSetValue::free()
TRACE_FREE( Any )
m_aValue.m_pValue = NULL;
break;
+ case DataType::BIT:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::BOOLEAN:
+ break;
+ default:
+ if ( m_aValue.m_pValue )
+ {
+ delete (Any*)m_aValue.m_pValue;
+ TRACE_FREE( Any )
+ m_aValue.m_pValue = NULL;
+ }
+ break;
}
m_bNull = sal_True;
@@ -849,7 +863,9 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
bRet = false;
break;
default:
+ bRet = false;
OSL_ENSURE(0,"ORowSetValue::operator==(): UNSPUPPORTED TYPE!");
+ break;
}
return bRet;
}
@@ -942,6 +958,8 @@ Any ORowSetValue::makeAny() const
break;
default:
OSL_ENSURE(0,"ORowSetValue::makeAny(): UNSPUPPORTED TYPE!");
+ rValue = getAny();
+ break;
}
}
return rValue;
@@ -1032,6 +1050,12 @@ Any ORowSetValue::makeAny() const
}
}
break;
+ default:
+ {
+ Any aValue = getAny();
+ aValue >>= aRet;
+ break;
+ }
}
}
return aRet;
@@ -1104,8 +1128,11 @@ sal_Bool ORowSetValue::getBool() const
bRet = m_bSigned ? (m_aValue.m_nInt32 != 0) : (*static_cast<sal_Int64*>(m_aValue.m_pValue) != sal_Int64(0));
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aValue = getAny();
+ aValue >>= bRet;
+ break;
+ }
}
}
return bRet;
@@ -1174,8 +1201,11 @@ sal_Int8 ORowSetValue::getInt8() const
nRet = static_cast<sal_Int8>(*static_cast<sal_Int64*>(m_aValue.m_pValue));
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aValue = getAny();
+ aValue >>= nRet;
+ break;
+ }
}
}
return nRet;
@@ -1244,8 +1274,11 @@ sal_Int16 ORowSetValue::getInt16() const
nRet = static_cast<sal_Int16>(*static_cast<sal_Int64*>(m_aValue.m_pValue));
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aValue = getAny();
+ aValue >>= nRet;
+ break;
+ }
}
}
return nRet;
@@ -1314,8 +1347,11 @@ sal_Int32 ORowSetValue::getInt32() const
nRet = static_cast<sal_Int32>(*static_cast<sal_Int64*>(m_aValue.m_pValue));
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aValue = getAny();
+ aValue >>= nRet;
+ break;
+ }
}
}
return nRet;
@@ -1384,8 +1420,11 @@ sal_Int64 ORowSetValue::getLong() const
nRet = *(sal_Int64*)m_aValue.m_pValue;
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aValue = getAny();
+ aValue >>= nRet;
+ break;
+ }
}
}
return nRet;
@@ -1458,8 +1497,11 @@ float ORowSetValue::getFloat() const
nRet = float(*(sal_Int64*)m_aValue.m_pValue);
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aValue = getAny();
+ aValue >>= nRet;
+ break;
+ }
}
}
return nRet;
@@ -1534,8 +1576,11 @@ double ORowSetValue::getDouble() const
nRet = double(*(sal_Int64*)m_aValue.m_pValue);
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aValue = getAny();
+ aValue >>= nRet;
+ break;
+ }
}
}
return nRet;
@@ -1626,6 +1671,11 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype)
TRACE_ALLOC( sal_Int64 )
}
break;
+ default:
+ {
+ m_aValue.m_pValue = new Any(_rVal);
+ break;
+ }
}
m_eTypeKind = _nDatatype;
}
@@ -1692,7 +1742,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
aSeq = *static_cast< Sequence<sal_Int8>*>(m_aValue.m_pValue);
break;
default:
- ;
+ {
+ Any aValue = getAny();
+ aValue >>= aSeq;
+ break;
+ }
}
}
return aSeq;
@@ -1734,8 +1788,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
}
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aAnyValue = getAny();
+ aAnyValue >>= aValue;
+ break;
+ }
}
}
return aValue;
@@ -1776,8 +1833,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
aValue = *static_cast< ::com::sun::star::util::Time*>(m_aValue.m_pValue);
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aAnyValue = getAny();
+ aAnyValue >>= aValue;
+ break;
+ }
}
}
return aValue;
@@ -1826,8 +1886,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
aValue = *static_cast< ::com::sun::star::util::DateTime*>(m_aValue.m_pValue);
break;
default:
- OSL_ENSURE(0,"Illegal conversion!");
- break;
+ {
+ Any aAnyValue = getAny();
+ aAnyValue >>= aValue;
+ break;
+ }
}
}
return aValue;
@@ -2094,7 +2157,7 @@ void ORowSetValue::impl_fill( const sal_Int32 _nType, sal_Bool _bNullable, const
break;
default:
OSL_ENSURE( false, "ORowSetValue::fill: unsupported type!" );
- bReadData = false;
+ (*this) = _rValueSource.getObject();
break;
}
if ( bReadData && _bNullable && _rValueSource.wasNull() )
diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx
index c39ac718f7..b77109902a 100644
--- a/connectivity/source/drivers/adabas/BDriver.cxx
+++ b/connectivity/source/drivers/adabas/BDriver.cxx
@@ -48,9 +48,7 @@
#include <memory>
#include <sys/stat.h>
-#if defined(MAC)
-const char sNewLine = '\015';
-#elif defined(UNX)
+#if defined(UNX)
const char sNewLine = '\012';
#else
const char sNewLine[] = "\015\012"; // \015\012 and not \n
@@ -464,8 +462,10 @@ void SAL_CALL ODriver::createCatalog( const Sequence< PropertyValue >& info ) th
{
TDatabaseStruct aDBInfo;
fillInfo(info,aDBInfo);
- static char envName[] = "DBSERVICE=0";
- putenv( envName );
+
+ ::rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DBSERVICE"));
+ ::rtl::OUString envData(RTL_CONSTASCII_USTRINGPARAM("0"));
+ osl_setEnvironment(envVar.pData, envData.pData);
m_sDbRunDir = m_sDbWorkURL + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/wrk/")) + aDBInfo.sDBName;
String sTemp;
@@ -854,7 +854,7 @@ void ODriver::createNeededDirs(const ::rtl::OUString& sDBName)
if(UCBContentHelper::Exists(sTemp))
UCBContentHelper::Kill(sTemp);
-#if !(defined(WIN) || defined(WNT))
+#if !(defined(WNT))
sTemp = sDBConfig;
sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diag"));
if(!UCBContentHelper::IsFolder(sTemp))
@@ -876,7 +876,7 @@ void ODriver::createNeededDirs(const ::rtl::OUString& sDBName)
void ODriver::clearDatabase(const ::rtl::OUString& sDBName)
{ // stop the database
::rtl::OUString sCommand;
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
::rtl::OUString sStop = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("stop"));
OArgumentList aArgs(2,&sDBName,&sStop);
sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x_cons.exe"));
@@ -921,7 +921,7 @@ void ODriver::createDb( const TDatabaseStruct& _aInfo)
PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KERNELTRACESIZE")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("100")));
PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOG_QUEUE_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("10")));
-#if !(defined(WIN) || defined(WNT))
+#if !defined(WNT)
PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPMSG1")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/dev/null")));
#endif
@@ -989,7 +989,7 @@ int ODriver::X_PARAM(const ::rtl::OUString& _DBNAME,
::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
pFileStream->Seek(STREAM_SEEK_TO_END);
(*pFileStream) << "x_param"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
<< ".exe"
#endif
<< " -d "
@@ -1000,7 +1000,7 @@ int ODriver::X_PARAM(const ::rtl::OUString& _DBNAME,
<< ::rtl::OString(_PWD,_PWD.getLength(),gsl_getSystemTextEncoding())
<< " "
<< ::rtl::OString(_CMD,_CMD.getLength(),gsl_getSystemTextEncoding())
-#if (defined(WIN) || defined(WNT))
+#if defined(WNT)
#if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL)
<< " >> %DBWORK%\\create.log 2>&1"
#endif
@@ -1050,7 +1050,7 @@ void ODriver::PutParam(const ::rtl::OUString& sDBName,
{
OArgumentList aArgs(3,&sDBName,&rWhat,&rHow);
::rtl::OUString sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("putparam"));
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
sCommand += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".exe"));
#endif
@@ -1112,7 +1112,7 @@ OSL_TRACE("CreateFile %d",_nSize);
int ODriver::X_START(const ::rtl::OUString& sDBName)
{
::rtl::OUString sCommand;
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d"));
::rtl::OUString sArg3 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService"));
@@ -1150,7 +1150,7 @@ int ODriver::X_START(const ::rtl::OUString& sDBName)
int ODriver::X_STOP(const ::rtl::OUString& sDBName)
{
::rtl::OUString sCommand;
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d"));
::rtl::OUString sArg2 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService"));
@@ -1195,7 +1195,7 @@ void ODriver::XUTIL(const ::rtl::OUString& _rParam,
::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
pFileStream->Seek(STREAM_SEEK_TO_END);
(*pFileStream) <<
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
"xutil.exe"
#else
"utility"
@@ -1248,7 +1248,7 @@ void ODriver::LoadBatch(const ::rtl::OUString& sDBName,
::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
pFileStream->Seek(STREAM_SEEK_TO_END);
(*pFileStream) << "xload"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
<< ".exe"
#endif
<< " -d "
@@ -1317,7 +1317,7 @@ void ODriver::fillEnvironmentVariables()
::rtl::OUString ODriver::generateInitFile() const
{
String sExt;
-#if !(defined(WIN) || defined(WNT))
+#if !defined(WNT)
sExt = String::CreateFromAscii(".sh");
#else
sExt = String::CreateFromAscii(".bat");
@@ -1325,13 +1325,13 @@ void ODriver::fillEnvironmentVariables()
String sWorkUrl(m_sDbWorkURL);
::utl::TempFile aCmdFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl);
-#if !(defined(WIN) || defined(WNT))
+#if !defined(WNT)
String sPhysicalPath;
LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath);
chmod(ByteString(sPhysicalPath,gsl_getSystemTextEncoding()).GetBuffer(),S_IRUSR|S_IWUSR|S_IXUSR);
#endif
-#if !(defined(WIN) || defined(WNT))
+#if !defined(WNT)
SvStream* pFileStream = aCmdFile.GetStream(STREAM_WRITE);
(*pFileStream) << "#!/bin/sh"
<< sNewLine
@@ -1441,7 +1441,7 @@ void ODriver::X_CONS(const ::rtl::OUString& sDBName,const ::rtl::OString& _ACTIO
pFileStream->Seek(STREAM_SEEK_TO_END);
(*pFileStream) << "x_cons"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
<< ".exe"
#endif
<< " "
@@ -1524,7 +1524,7 @@ sal_Bool ODriver::isVersion(const ::rtl::OUString& sDBName, const char* _pVersio
pFileStream->Seek(STREAM_SEEK_TO_END);
(*pFileStream) << "getparam"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
<< ".exe"
#endif
<< " "
@@ -1574,7 +1574,7 @@ void ODriver::checkAndInsertNewDevSpace(const ::rtl::OUString& sDBName,
pFileStream->Seek(STREAM_SEEK_TO_END);
(*pFileStream) << "getparam"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
<< ".exe"
#endif
<< " "
@@ -1654,7 +1654,7 @@ sal_Bool ODriver::isKernelVersion(const char* _pVersion)
// -----------------------------------------------------------------------------
void ODriver::installSystemTables( const TDatabaseStruct& _aInfo)
{
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
// xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% -b %m_sDbRoot%\env\TERMCHAR.ind
::rtl::OUString aBatch = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-b "));
::rtl::OUString sTemp2 = m_sDbRootURL + m_sDelimit
diff --git a/connectivity/source/drivers/adabas/BFunctions.cxx b/connectivity/source/drivers/adabas/BFunctions.cxx
index 5c65e4e477..22761bf44a 100644
--- a/connectivity/source/drivers/adabas/BFunctions.cxx
+++ b/connectivity/source/drivers/adabas/BFunctions.cxx
@@ -129,7 +129,7 @@ sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath)
}
const sal_Char* pLibraryAsciiName = NULL;
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
pLibraryAsciiName = "SQLOD32.DLL";
#elif ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX)
pLibraryAsciiName = "odbclib.so";
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index b71601cd65..6b989a3505 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -692,6 +692,10 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeExcept
void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
{
+ // ::osl::MutexGuard aGuard( m_aMutex );
+ //checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ // if ( getResultSetConcurrency() == ResultSetConcurrency::READ_ONLY )
+ // throw SQLException();
}
// -------------------------------------------------------------------------
@@ -977,7 +981,7 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& ro
sal_Int32 OResultSet::getResultSetConcurrency() const
throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
- sal_Int32 nValue=0;
+ sal_Int32 nValue=ResultSetConcurrency::READ_ONLY;
LockTypeEnum eRet;
if(!SUCCEEDED(m_pRecordSet->get_LockType(&eRet)))
{
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 2982f484a3..590663488e 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -1432,16 +1432,8 @@ BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile)
char aBuffer[512]; // write buffer
memset(aBuffer,0,sizeof(aBuffer));
-#ifdef WIN
- m_pMemoStream->Seek(0L);
- for (UINT16 i = 0; i < 512; i++)
- {
- (*m_pMemoStream) << BYTE(0);
- }
-#else
m_pMemoStream->SetFiller('\0');
m_pMemoStream->SetStreamSize(512);
-#endif
m_pMemoStream->Seek(0L);
(*m_pMemoStream) << long(1); // Zeiger auf ersten freien Block
@@ -2607,7 +2599,7 @@ void ODbaseTable::throwInvalidDbaseFormat()
// no dbase file
const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_SQL_NAME_ERROR,
+ STR_INVALID_DBASE_FILE,
"$filename$", getEntry(m_pConnection,m_Name)
) );
::dbtools::throwGenericSQLException( sError, *this );
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index ef0ae138a2..11877004c5 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -75,12 +75,7 @@ using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
// Maximale Anzahl von Rows, die mit ORDER BY sortiert durchlaufen werden koennen:
-#if defined (WIN)
-#define MAX_KEYSET_SIZE 0x3ff0 // Etwas weniger als ein Segment, damit
- // noch Platz fuer Memory Debug-Informationen
-#else
#define MAX_KEYSET_SIZE 0x40000 // 256K
-#endif
namespace
{
@@ -1049,7 +1044,7 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset,
//
INT32 nTempPos = m_nRowPos;
// exclusiver zugriff auf die Tabelle
- // NAMESPACE_VOS(OGuard)* pGuard = m_pTable->Lock();
+ // vos::OGuard* pGuard = m_pTable->Lock();
if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT &&
!isCount())
@@ -1200,7 +1195,9 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset,
break;
}
- if (m_nRowPos == 0)
+ if ( m_nRowPos < 0 )
+ goto Error;
+ else if (m_nRowPos == 0)
{
// COUNT(*) in Ergebnisrow packen
// (muss die erste und einzige Variable in der Row sein)
@@ -1407,7 +1404,7 @@ BOOL OResultSet::OpenImpl()
m_nRowCountResult = -1;
// exclusiver zugriff auf die Tabelle
- // NAMESPACE_VOS(OGuard)* pGuard = pTable->Lock();
+ // vos::OGuard* pGuard = pTable->Lock();
m_nLastVisitedPos = m_pTable->getCurrentLastPos();
switch(m_aSQLIterator.getStatementType())
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index d3d8f2d6a3..6ec9b7cf2b 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -159,7 +159,10 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
(m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0)))
{
bNumeric = FALSE;
- nStartPosFirstLine2 = nStartPosFirstLine;
+ if ( m_cStringDelimiter != '\0' )
+ aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter);
+ else
+ nStartPosFirstLine2 = nStartPosFirstLine;
}
else
{
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
index 1849a40078..428f922148 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -234,7 +234,7 @@ jint read_from_storage_stream_into_buffer( JNIEnv * env, jobject /*obj_this*/,js
if ( xIn.is() )
{
jsize nLen = env->GetArrayLength(buffer);
- if ( nLen < len )
+ if ( nLen < len || len <= 0 )
{
ThrowException( env,
"java/io/IOException",
@@ -439,21 +439,17 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst
if ( xOut.is() )
{
jbyte *buf = env->GetByteArrayElements(buffer,NULL);
-#ifdef HSQLDB_DBG
- OSL_ENSURE(len <= env->GetArrayLength(buffer),"Length is greater than the buffer!");
-#endif
-
if (JNI_FALSE != env->ExceptionCheck())
{
env->ExceptionClear();
OSL_ENSURE(0,"ExceptionClear");
}
OSL_ENSURE(buf,"buf is NULL");
- if ( buf )
+ if ( buf && len > 0 && len <= env->GetArrayLength(buffer))
{
Sequence< ::sal_Int8 > aData(buf + off,len);
- xOut->writeBytes(aData);
env->ReleaseByteArrayElements(buffer, buf, JNI_ABORT);
+ xOut->writeBytes(aData);
#ifdef HSQLDB_DBG
if ( logger )
logger->write( aData.getConstArray(), len );
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
index c6af914682..cd96e62ca3 100644
--- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
@@ -61,14 +61,15 @@ namespace connectivity
{
try
{
- m_xStream.clear();
- m_xSeek.clear();
+ m_xStream.clear();
+ m_xSeek.clear();
if ( m_xInputStream.is() )
{
m_xInputStream->closeInput();
- m_xInputStream.clear();
+ m_xInputStream.clear();
}
- if ( m_xOutputStream.is() )
+ // this is done implicity by the closing of the input stream
+ else if ( m_xOutputStream.is() )
{
m_xOutputStream->closeOutput();
try
@@ -83,11 +84,12 @@ namespace connectivity
OSL_UNUSED( e );
OSL_ENSURE(0,"Could not dispose OutputStream");
}
- m_xOutputStream.clear();
+ m_xOutputStream.clear();
}
}
- catch(Exception& )
+ catch(Exception& ex)
{
+ OSL_UNUSED( ex );
OSL_ENSURE(0,"Exception catched!");
}
}
@@ -133,7 +135,7 @@ namespace connectivity
::rtl::OUString StorageContainer::removeOldURLPrefix(const ::rtl::OUString& _sURL)
{
::rtl::OUString sRet = _sURL;
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
sal_Int32 nIndex = sRet.lastIndexOf('\\');
#else
sal_Int32 nIndex = sRet.lastIndexOf('/');
diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx
index 5018770aab..fdb276a333 100644
--- a/connectivity/source/drivers/jdbc/Boolean.cxx
+++ b/connectivity/source/drivers/jdbc/Boolean.cxx
@@ -49,20 +49,3 @@ jclass java_lang_Boolean::getMyClass() const
{
return st_getMyClass();
}
-
-java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- // Java-Call fuer den Konstruktor absetzen
- // temporaere Variable initialisieren
- static const char * cSignature = "(Z)V";
- jobject tempObj;
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, "<init>",cSignature, mID);
- tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 );
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
- // und aufraeumen
-}
-
-
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index d2e88e8397..ea25e8983f 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -166,14 +166,6 @@ void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj )
}
-java_lang_Class * java_lang_Object::getClass()
-{
- SDBThreadAttach t;
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getClass","()Ljava/lang/Class;", mID);
- return out ? new java_lang_Class( t.pEnv, out ) : NULL;
-}
-
::rtl::OUString java_lang_Object::toString() const
{
static jmethodID mID(NULL);
diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx
index edae1d78ee..62b77859d9 100644
--- a/connectivity/source/drivers/jdbc/String.cxx
+++ b/connectivity/source/drivers/jdbc/String.cxx
@@ -52,26 +52,6 @@ jclass java_lang_String::st_getMyClass()
}
//--------------------------------------------------------------------------
-java_lang_String::java_lang_String( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- if( !t.pEnv )
- return;
- jvalue args[1];
- // Parameter konvertieren
- args[0].l = convertwchar_tToJavaString(t.pEnv,_par0);
- // Java-Call fuer den Konstruktor absetzen
- // temporaere Variable initialisieren
- static const char * cSignature = "(Ljava/lang/String;)V";
- jobject tempObj;
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, "<init>",cSignature, mID);
- tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args );
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
-}
-//--------------------------------------------------------------------------
java_lang_String::operator ::rtl::OUString()
{
SDBThreadAttach t;
diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk
index 2a0dc5cd89..219bdd6cd0 100644
--- a/connectivity/source/drivers/kab/makefile.mk
+++ b/connectivity/source/drivers/kab/makefile.mk
@@ -46,6 +46,9 @@ CFLAGS+=$(KDE_CFLAGS)
.IF "$(KDE_ROOT)"!=""
EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib
+.IF "$(OS)$(CPU)" == "LINUXX"
+EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib64
+.ENDIF
.ENDIF
# === KAB base library ==========================
diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx
index ac4e3be969..f1cbc63188 100644
--- a/connectivity/source/drivers/mozab/MDriver.cxx
+++ b/connectivity/source/drivers/mozab/MDriver.cxx
@@ -249,7 +249,7 @@ EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url )
const sal_Char* pScheme;
} aSchemeMap[] =
{
-#if defined(WNT) || defined(WIN)
+#if defined(WNT)
{ Outlook, "outlook" },
{ OutlookExpress, "outlookexp" },
#endif
diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx
index d693a9a298..292ed6ef1d 100644
--- a/connectivity/source/drivers/odbc/OFunctions.cxx
+++ b/connectivity/source/drivers/odbc/OFunctions.cxx
@@ -109,10 +109,6 @@ sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath)
if (bLoaded)
return sal_True;
-#ifdef WIN
- _rPath = ::rtl::OUString::createFromAscii("ODBC.DLL");
-
-#endif
#ifdef WNT
_rPath = ::rtl::OUString::createFromAscii("ODBC32.DLL");
#endif
diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx
index a63b1ed72e..fe237fb2fd 100644
--- a/connectivity/source/inc/java/lang/Boolean.hxx
+++ b/connectivity/source/inc/java/lang/Boolean.hxx
@@ -44,7 +44,6 @@ namespace connectivity
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
java_lang_Boolean( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){}
- java_lang_Boolean( sal_Bool _par0 );
static jclass st_getMyClass();
};
}
diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx
index 95e464e592..f60099e43c 100644
--- a/connectivity/source/inc/java/lang/Object.hxx
+++ b/connectivity/source/inc/java/lang/Object.hxx
@@ -118,8 +118,6 @@ namespace connectivity
void clearObject(JNIEnv& rEnv);
void clearObject();
- java_lang_Class * getClass();
-
virtual ::rtl::OUString toString() const;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xFactory; }
diff --git a/connectivity/source/inc/java/lang/String.hxx b/connectivity/source/inc/java/lang/String.hxx
index 157a4d474e..3bc3631bd7 100644
--- a/connectivity/source/inc/java/lang/String.hxx
+++ b/connectivity/source/inc/java/lang/String.hxx
@@ -42,7 +42,6 @@ namespace connectivity
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
java_lang_String( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){}
- java_lang_String( const ::rtl::OUString& _par0 );
operator ::rtl::OUString();
static jclass st_getMyClass();
diff --git a/connectivity/source/inc/odbc/OFunctiondefs.hxx b/connectivity/source/inc/odbc/OFunctiondefs.hxx
index 0cff012b5e..274e9cb55a 100644
--- a/connectivity/source/inc/odbc/OFunctiondefs.hxx
+++ b/connectivity/source/inc/odbc/OFunctiondefs.hxx
@@ -29,7 +29,7 @@
#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_
#define _CONNECTIVITY_OFUNCTIONDEFS_HXX_
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
#ifdef _MSC_VER
#pragma warning(push)
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 05309d56ef..1c13317c3b 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -75,7 +75,8 @@ class Desktop : public Application
BE_USERINSTALL_FAILED,
BE_LANGUAGE_MISSING,
BE_USERINSTALL_NOTENOUGHDISKSPACE,
- BE_USERINSTALL_NOWRITEACCESS
+ BE_USERINSTALL_NOWRITEACCESS,
+ BE_OFFICECONFIG_BROKEN
};
enum BootstrapStatus
{
diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst
index 8029b6ecc9..dc5d7a99b2 100644
--- a/desktop/prj/build.lst
+++ b/desktop/prj/build.lst
@@ -3,7 +3,7 @@ dt desktop usr1 - all dt_mkout NULL
dt desktop\inc nmake - all dt_inc NULL
dt desktop\prj get - all dt_prj NULL
dt desktop\res get - all dt_res NULL
-dt desktop\source\app nmake - all dt_app dt_migr dt_inc NULL
+dt desktop\source\app nmake - all dt_app dt_migr dt_inc dt_dp_misc NULL
dt desktop\source\migration nmake - all dt_migr dt_inc NULL
dt desktop\source\migration\services nmake - all dt_services dt_inc dt_dp_misc NULL
dt desktop\source\so_comp nmake - all dt_so_comp dt_inc NULL
@@ -35,7 +35,7 @@ dt desktop\source\deployment\registry\configuration nmake - all dt_dp_registry_c
dt desktop\source\deployment\registry\help nmake - all dt_dp_registry_help dt_inc NULL
dt desktop\source\deployment\registry\executable nmake - all dt_dp_registry_executable dt_inc NULL
dt desktop\scripts nmake - u dt_scripts dt_inc NULL
-dt desktop\util nmake - all dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w NULL
+dt desktop\util nmake - all dt_util dt_app dt_pagein.u dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w NULL
dt desktop\zipintro nmake - all dt_zipintro NULL
dt desktop\registry\data\org\openoffice\Office nmake - all sn_regconfig NULL
dt desktop\source\registration\com\sun\star\servicetag\resources get - all sn_svctagres NULL
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index d91f56a541..dd371556eb 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -28,6 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+#include <cstdlib>
+#include <vector>
+
#include <memory>
#include <unistd.h>
#include "app.hxx"
@@ -119,6 +122,7 @@
#include <osl/file.hxx>
#include <osl/signal.h>
#include <rtl/uuid.h>
+#include <rtl/uri.hxx>
#include <unotools/pathoptions.hxx>
#include <svl/languageoptions.hxx>
#include <unotools/internaloptions.hxx>
@@ -155,6 +159,11 @@
#include "langselect.hxx"
+#if defined MACOSX
+#include <errno.h>
+#include <sys/wait.h>
+#endif
+
#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII))
#define U2S(STRING) ::rtl::OUStringToOString(STRING, RTL_TEXTENCODING_UTF8)
@@ -460,6 +469,194 @@ void ReplaceStringHookProc( UniString& rStr )
}
}
+static const char pLastSyncFileName[] = "lastsynchronized";
+static const sal_Int32 nStrLenLastSync = 16;
+
+static bool needsSynchronization(
+ ::rtl::OUString const & baseSynchronizedURL, ::rtl::OUString const & userSynchronizedURL )
+{
+ bool bNeedsSync( false );
+
+ ::osl::DirectoryItem itemUserFile;
+ ::osl::File::RC err1 =
+ ::osl::DirectoryItem::get(userSynchronizedURL, itemUserFile);
+
+ //If it does not exist, then there is nothing to be done
+ if (err1 == ::osl::File::E_NOENT)
+ {
+ return true;
+ }
+ else if (err1 != ::osl::File::E_None)
+ {
+ OSL_ENSURE(0, "Cannot access lastsynchronized in user layer");
+ return true; //sync just in case
+ }
+
+ //If last synchronized does not exist in base layer, then do nothing
+ ::osl::DirectoryItem itemBaseFile;
+ ::osl::File::RC err2 = ::osl::DirectoryItem::get(baseSynchronizedURL, itemBaseFile);
+ if (err2 == ::osl::File::E_NOENT)
+ {
+ return true;
+
+ }
+ else if (err2 != ::osl::File::E_None)
+ {
+ OSL_ENSURE(0, "Cannot access file lastsynchronized in base layer");
+ return true; //sync just in case
+ }
+
+ //compare the modification time of the extension folder and the last
+ //modified file
+ ::osl::FileStatus statUser(FileStatusMask_ModifyTime);
+ ::osl::FileStatus statBase(FileStatusMask_ModifyTime);
+ if (itemUserFile.getFileStatus(statUser) == ::osl::File::E_None)
+ {
+ if (itemBaseFile.getFileStatus(statBase) == ::osl::File::E_None)
+ {
+ TimeValue timeUser = statUser.getModifyTime();
+ TimeValue timeBase = statBase.getModifyTime();
+
+ if (timeUser.Seconds < timeBase.Seconds)
+ bNeedsSync = true;
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ bNeedsSync = true;
+ }
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ bNeedsSync = true;
+ }
+
+ return bNeedsSync;
+}
+
+static ::rtl::OUString getBrandSharePreregBundledPathURL()
+{
+ ::rtl::OUString url(
+ RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/share/prereg/bundled"));
+
+ ::rtl::Bootstrap::expandMacros(url);
+ return url;
+}
+
+static ::rtl::OUString getUserBundledExtPathURL()
+{
+ ::rtl::OUString folder( RTL_CONSTASCII_USTRINGPARAM( "$BUNDLED_EXTENSIONS_USER" ));
+ ::rtl::Bootstrap::expandMacros(folder);
+
+ return folder;
+}
+
+static ::rtl::OUString getLastSyncFileURLFromBrandInstallation()
+{
+ ::rtl::OUString aURL = getBrandSharePreregBundledPathURL();
+ ::sal_Int32 nLastIndex = aURL.lastIndexOf('/');
+
+ ::rtl::OUStringBuffer aTmp( aURL );
+
+ if ( nLastIndex != aURL.getLength()-1 )
+ aTmp.appendAscii( "/" );
+ aTmp.appendAscii( pLastSyncFileName );
+
+ return aTmp.makeStringAndClear();
+}
+
+static ::rtl::OUString getLastSyncFileURLFromUserInstallation()
+{
+ ::rtl::OUString aUserBundledPathURL = getUserBundledExtPathURL();
+ ::sal_Int32 nLastIndex = aUserBundledPathURL.lastIndexOf('/');
+
+ ::rtl::OUStringBuffer aTmp( aUserBundledPathURL );
+
+ if ( nLastIndex != aUserBundledPathURL.getLength()-1 )
+ aTmp.appendAscii( "/" );
+ aTmp.appendAscii( pLastSyncFileName );
+
+ return aTmp.makeStringAndClear();
+}
+
+static osl::FileBase::RC copy_bundled_recursive(
+ const rtl::OUString& srcUnqPath,
+ const rtl::OUString& dstUnqPath,
+ sal_Int32 TypeToCopy )
+throw()
+{
+ osl::FileBase::RC err = osl::FileBase::E_None;
+
+ if( TypeToCopy == -1 ) // Document
+ {
+ err = osl::File::copy( srcUnqPath,dstUnqPath );
+ }
+ else if( TypeToCopy == +1 ) // Folder
+ {
+ osl::Directory aDir( srcUnqPath );
+ aDir.open();
+
+ err = osl::Directory::create( dstUnqPath );
+ osl::FileBase::RC next = err;
+ if( err == osl::FileBase::E_None ||
+ err == osl::FileBase::E_EXIST )
+ {
+ err = osl::FileBase::E_None;
+ sal_Int32 n_Mask = FileStatusMask_FileURL | FileStatusMask_FileName | FileStatusMask_Type;
+
+ osl::DirectoryItem aDirItem;
+
+ while( err == osl::FileBase::E_None && ( next = aDir.getNextItem( aDirItem ) ) == osl::FileBase::E_None )
+ {
+ sal_Bool IsDoc = false;
+ sal_Bool bFilter = false;
+ osl::FileStatus aFileStatus( n_Mask );
+ aDirItem.getFileStatus( aFileStatus );
+ if( aFileStatus.isValid( FileStatusMask_Type ) )
+ IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular;
+
+ // Getting the information for the next recursive copy
+ sal_Int32 newTypeToCopy = IsDoc ? -1 : +1;
+
+ rtl::OUString newSrcUnqPath;
+ if( aFileStatus.isValid( FileStatusMask_FileURL ) )
+ newSrcUnqPath = aFileStatus.getFileURL();
+
+ rtl::OUString newDstUnqPath = dstUnqPath;
+ rtl::OUString tit;
+ if( aFileStatus.isValid( FileStatusMask_FileName ) )
+ {
+ ::rtl::OUString aFileName = aFileStatus.getFileName();
+ tit = rtl::Uri::encode( aFileName,
+ rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8 );
+
+ // Special treatment for "lastsychronized" file. Must not be
+ // copied from the bundled folder!
+ if ( IsDoc && aFileName.equalsAscii( pLastSyncFileName ))
+ bFilter = true;
+ }
+
+ if( newDstUnqPath.lastIndexOf( sal_Unicode('/') ) != newDstUnqPath.getLength()-1 )
+ newDstUnqPath += rtl::OUString::createFromAscii( "/" );
+
+ newDstUnqPath += tit;
+
+ if (( newSrcUnqPath != dstUnqPath ) && !bFilter )
+ err = copy_bundled_recursive( newSrcUnqPath,newDstUnqPath, newTypeToCopy );
+ }
+
+ if( err == osl::FileBase::E_None && next != osl::FileBase::E_NOENT )
+ err = next;
+ }
+ aDir.close();
+ }
+
+ return err;
+}
+
Desktop::Desktop()
: m_bServicesRegistered( false )
, m_aBootstrapError( BE_OK )
@@ -477,6 +674,24 @@ void Desktop::Init()
RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::Init" );
SetBootstrapStatus(BS_OK);
+ // Check for lastsynchronized file for bundled extensions in the user directory
+ // and test if synchronzation is necessary!
+ {
+ ::rtl::OUString aUserLastSyncFilePathURL = getLastSyncFileURLFromUserInstallation();
+ ::rtl::OUString aPreregSyncFilePathURL = getLastSyncFileURLFromBrandInstallation();
+
+ if ( needsSynchronization( aPreregSyncFilePathURL, aUserLastSyncFilePathURL ))
+ {
+ rtl::OUString aUserPath = getUserBundledExtPathURL();
+ rtl::OUString aPreregBundledPath = getBrandSharePreregBundledPathURL();
+
+ // copy bundled folder to the user directory
+ osl::FileBase::RC rc = osl::Directory::createPath(aUserPath);
+ (void) rc;
+ copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 );
+ }
+ }
+
// create service factory...
Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager();
if( rSMgr.is() )
@@ -492,7 +707,12 @@ void Desktop::Init()
{
// prepare language
if ( !LanguageSelection::prepareLanguage() )
- SetBootstrapError( BE_LANGUAGE_MISSING );
+ {
+ if ( LanguageSelection::getStatus() == LanguageSelection::LS_STATUS_CANNOT_DETERMINE_LANGUAGE )
+ SetBootstrapError( BE_LANGUAGE_MISSING );
+ else
+ SetBootstrapError( BE_OFFICECONFIG_BROKEN );
+ }
}
if ( GetBootstrapError() == BE_OK )
@@ -873,6 +1093,17 @@ void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError )
FatalError( aMessage);
}
+ else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN )
+ {
+ OUString aMessage;
+ OUStringBuffer aDiagnosticMessage( 100 );
+ OUString aErrorMsg;
+ aErrorMsg = GetMsgString( STR_CONFIG_ERR_ACCESS_GENERAL,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "A general error occurred while accessing your central configuration." )) );
+ aDiagnosticMessage.append( aErrorMsg );
+ aMessage = MakeStartupErrorMessage( aDiagnosticMessage.makeStringAndClear() );
+ FatalError(aMessage);
+ }
else if ( aBootstrapError == BE_USERINSTALL_FAILED )
{
OUString aMessage;
@@ -1101,28 +1332,79 @@ sal_Bool Desktop::SaveTasks()
sal_False);
}
-#ifdef MACOSX
-static void DoRestart()
-{
- oslProcess process;
- oslProcessError error;
- OUString sExecutableFile;
-
- osl_getExecutableFile( &sExecutableFile.pData );
-
- error = osl_executeProcess(
- sExecutableFile.pData,
- NULL,
- 0,
- 0,
- NULL,
- NULL,
- NULL,
- 0,
- &process
- );
-}
+namespace {
+
+void restartOnMac(bool passArguments) {
+#if defined MACOSX
+ OfficeIPCThread::DisableOfficeIPCThread();
+ rtl::OUString execUrl;
+ OSL_VERIFY(osl_getExecutableFile(&execUrl.pData) == osl_Process_E_None);
+ rtl::OUString execPath;
+ rtl::OString execPath8;
+ if ((osl::FileBase::getSystemPathFromFileURL(execUrl, execPath)
+ != osl::FileBase::E_None) ||
+ !execPath.convertToString(
+ &execPath8, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ std::abort();
+ }
+ std::vector< rtl::OString > args;
+ args.push_back(execPath8);
+ bool wait = false;
+ if (passArguments) {
+ sal_uInt32 n = osl_getCommandArgCount();
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ rtl::OUString arg;
+ OSL_VERIFY(osl_getCommandArg(i, &arg.pData) == osl_Process_E_None);
+ if (arg.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("-accept="))) {
+ wait = true;
+ }
+ rtl::OString arg8;
+ if (!arg.convertToString(
+ &arg8, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ std::abort();
+ }
+ args.push_back(arg8);
+ }
+ }
+ std::vector< char const * > argPtrs;
+ for (std::vector< rtl::OString >::iterator i(args.begin()); i != args.end();
+ ++i)
+ {
+ argPtrs.push_back(i->getStr());
+ }
+ argPtrs.push_back(0);
+ execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+ if (errno == ENOTSUP) { // happens when multithreaded on OS X < 10.6
+ pid_t pid = fork();
+ if (pid == 0) {
+ execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+ } else if (pid > 0) {
+ // Two simultaneously running soffice processes lead to two dock
+ // icons, so avoid waiting here unless it must be assumed that the
+ // process invoking soffice itself wants to wait for soffice to
+ // finish:
+ if (!wait) {
+ return;
+ }
+ int stat;
+ if (waitpid(pid, &stat, 0) == pid && WIFEXITED(stat)) {
+ _exit(WEXITSTATUS(stat));
+ }
+ }
+ }
+ std::abort();
+#else
+ (void) passArguments; // avoid warnings
#endif
+}
+
+}
USHORT Desktop::Exception(USHORT nError)
{
@@ -1193,9 +1475,7 @@ USHORT Desktop::Exception(USHORT nError)
OfficeIPCThread::DisableOfficeIPCThread();
if( pSignalHandler )
DELETEZ( pSignalHandler );
-#ifdef MACOSX
- DoRestart();
-#endif
+ restartOnMac(false);
_exit( ExitHelper::E_CRASH_WITH_RESTART );
}
else
@@ -1278,6 +1558,9 @@ void Desktop::Main()
std::auto_ptr<SvtLanguageOptions> pLanguageOptions;
std::auto_ptr<SvtPathOptions> pPathOptions;
+ sal_Bool bRestartRequested( sal_False );
+ sal_Bool bUseSystemFileDialog(sal_True);
+ int nAcquireCount( 0 );
Reference < css::document::XEventListener > xGlobalBroadcaster;
try
{
@@ -1407,6 +1690,13 @@ void Desktop::Main()
( xSMgr->createInstance(
DEFINE_CONST_UNICODE( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY );
+ /* ensure existance of a default window that messages can be dispatched to
+ This is for the benefit of testtool which uses PostUserEvent extensively
+ and else can deadlock while creating this window from another tread while
+ the main thread is not yet in the event loop.
+ */
+ Application::GetDefaultDevice();
+
// initialize test-tool library (if available)
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ tools::InitTestToolLib" );
tools::InitTestToolLib();
@@ -1471,58 +1761,80 @@ void Desktop::Main()
impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" );
- if (
- (pCmdLineArgs->IsEmptyOrAcceptOnly() ) &&
- (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
- (!bExistsRecoveryData ) &&
- (!bExistsSessionData ) &&
- (!Application::AnyInput( INPUT_APPEVENT ) )
- )
+ Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
{
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
- Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
- if (xDesktopFrame.is())
+ ::comphelper::ComponentContext aContext( xSMgr );
+ xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
+ }
+
+ // check whether the shutdown is caused by restart
+ bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
+ if ( pCmdLineArgs->IsHeadless() )
+ {
+ // Ensure that we use not the system file dialogs as
+ // headless mode relies on Application::EnableHeadlessMode()
+ // which does only work for VCL dialogs!!
+ SvtMiscOptions aMiscOptions;
+ bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
+ aMiscOptions.SetUseSystemFileDialog( sal_False );
+ }
+
+ if ( !bRestartRequested )
+ {
+ if (
+ (pCmdLineArgs->IsEmptyOrAcceptOnly() ) &&
+ (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
+ (!bExistsRecoveryData ) &&
+ (!bExistsSessionData ) &&
+ (!Application::AnyInput( INPUT_APPEVENT ) )
+ )
{
-// SetSplashScreenProgress(60);
- Reference< XFrame > xBackingFrame;
- Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
-
- xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
- if (xBackingFrame.is())
- xContainerWindow = xBackingFrame->getContainerWindow();
- if (xContainerWindow.is())
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
+ Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+ if (xDesktopFrame.is())
{
- // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
- // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
- // otherwise documents loaded into this frame will later on miss functionality depending on the style.
- Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
- pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
-
- SetSplashScreenProgress(75);
- Sequence< Any > lArgs(1);
- lArgs[0] <<= xContainerWindow;
-
- Reference< XController > xBackingComp(
- xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
- UNO_QUERY);
-// SetSplashScreenProgress(80);
- if (xBackingComp.is())
+ // SetSplashScreenProgress(60);
+ Reference< XFrame > xBackingFrame;
+ Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
+
+ xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
+ if (xBackingFrame.is())
+ xContainerWindow = xBackingFrame->getContainerWindow();
+ if (xContainerWindow.is())
{
- Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
- // Attention: You MUST(!) call setComponent() before you call attachFrame().
- // Because the backing component set the property "IsBackingMode" of the frame
- // to true inside attachFrame(). But setComponent() reset this state everytimes ...
- xBackingFrame->setComponent(xBackingWin, xBackingComp);
- SetSplashScreenProgress(100);
- xBackingComp->attachFrame(xBackingFrame);
- CloseSplashScreen();
- xContainerWindow->setVisible(sal_True);
+ // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
+ // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
+ // otherwise documents loaded into this frame will later on miss functionality depending on the style.
+ Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
+ pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
+
+ SetSplashScreenProgress(75);
+ Sequence< Any > lArgs(1);
+ lArgs[0] <<= xContainerWindow;
+
+ Reference< XController > xBackingComp(
+ xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
+ UNO_QUERY);
+ // SetSplashScreenProgress(80);
+ if (xBackingComp.is())
+ {
+ Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
+ // Attention: You MUST(!) call setComponent() before you call attachFrame().
+ // Because the backing component set the property "IsBackingMode" of the frame
+ // to true inside attachFrame(). But setComponent() reset this state everytimes ...
+ xBackingFrame->setComponent(xBackingWin, xBackingComp);
+ SetSplashScreenProgress(100);
+ xBackingComp->attachFrame(xBackingFrame);
+ CloseSplashScreen();
+ xContainerWindow->setVisible(sal_True);
+ }
}
}
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
}
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
}
}
catch ( com::sun::star::lang::WrappedTargetException& wte )
@@ -1557,108 +1869,83 @@ void Desktop::Main()
aOptions.SetVCLSettings();
// SetSplashScreenProgress(60);
- Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
-
- sal_Bool bTerminateRequested = sal_False;
-
- // Preload function depends on an initialized sfx application!
- SetSplashScreenProgress(75);
-
- sal_Bool bUseSystemFileDialog(sal_True);
- if ( pCmdLineArgs->IsHeadless() )
+ if ( !bRestartRequested )
{
- // Ensure that we use not the system file dialogs as
- // headless mode relies on Application::EnableHeadlessMode()
- // which does only work for VCL dialogs!!
- SvtMiscOptions aMiscOptions;
- bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
- aMiscOptions.SetUseSystemFileDialog( sal_False );
- }
+ Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
- // use system window dialogs
- Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
+ sal_Bool bTerminateRequested = sal_False;
-// SetSplashScreenProgress(80);
+ // Preload function depends on an initialized sfx application!
+ SetSplashScreenProgress(75);
- if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
- !pCmdLineArgs->IsNoQuickstart() )
- InitializeQuickstartMode( xSMgr );
+ // use system window dialogs
+ Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
- RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
- try
- {
- Reference< XDesktop > xDesktop( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
- if ( xDesktop.is() )
- xDesktop->addTerminateListener( new OfficeIPCThreadController );
- SetSplashScreenProgress(100);
- }
- catch ( com::sun::star::uno::Exception& e )
- {
- FatalError( MakeStartupErrorMessage(e.Message) );
- return;
- }
- /*
- catch ( ... )
- {
- FatalError( MakeStartupErrorMessage(
- OUString::createFromAscii(
- "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
- return;
- }
- */
+ // SetSplashScreenProgress(80);
- // Release solar mutex just before we wait for our client to connect
- int nAcquireCount = 0;
- ::vos::IMutex& rMutex = Application::GetSolarMutex();
- if ( rMutex.tryToAcquire() )
- nAcquireCount = Application::ReleaseSolarMutex() - 1;
+ if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
+ !pCmdLineArgs->IsNoQuickstart() )
+ InitializeQuickstartMode( xSMgr );
- // Post user event to startup first application component window
- // We have to send this OpenClients message short before execute() to
- // minimize the risk that this message overtakes type detection contruction!!
- Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
+ RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
+ try
+ {
+ Reference< XDesktop > xDesktop( xSMgr->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+ if ( xDesktop.is() )
+ xDesktop->addTerminateListener( new OfficeIPCThreadController );
+ SetSplashScreenProgress(100);
+ }
+ catch ( com::sun::star::uno::Exception& e )
+ {
+ FatalError( MakeStartupErrorMessage(e.Message) );
+ return;
+ }
+ /*
+ catch ( ... )
+ {
+ FatalError( MakeStartupErrorMessage(
+ OUString::createFromAscii(
+ "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
+ return;
+ }
+ */
- // Post event to enable acceptors
- Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
+ // Post user event to startup first application component window
+ // We have to send this OpenClients message short before execute() to
+ // minimize the risk that this message overtakes type detection contruction!!
+ Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
- // The configuration error handler currently is only for startup
- aConfigErrHandler.deactivate();
+ // Post event to enable acceptors
+ Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
- // Acquire solar mutex just before we enter our message loop
- if ( nAcquireCount )
- Application::AcquireSolarMutex( nAcquireCount );
+ // The configuration error handler currently is only for startup
+ aConfigErrHandler.deactivate();
- // call Application::Execute to process messages in vcl message loop
- RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
+ // 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
- // the creation of a Java Virtual Machine fails
- com::sun::star::uno::ContextLayer layer2(
- new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
+ try
+ {
+ // The JavaContext contains an interaction handler which is used when
+ // the creation of a Java Virtual Machine fails
+ com::sun::star::uno::ContextLayer layer2(
+ new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
- ::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)
+ {
+ OfficeIPCThread::SetDowning();
+ FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
+ }
+ catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
+ {
+ OfficeIPCThread::SetDowning();
+ FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
+ }
}
- catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
- {
- OfficeIPCThread::SetDowning();
- FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
- }
- catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
- {
- OfficeIPCThread::SetDowning();
- 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;
@@ -1693,9 +1980,7 @@ void Desktop::Main()
RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::Main" );
if ( bRestartRequested )
{
-#ifdef MACOSX
- DoRestart();
-#endif
+ restartOnMac(true);
// wouldn't the solution be more clean if SalMain returns the exit code to the system?
_exit( ExitHelper::E_NORMAL_RESTART );
}
@@ -2352,8 +2637,6 @@ void Desktop::OpenClients()
aHelpURLBuffer.appendAscii("&System=UNX");
#elif defined WNT
aHelpURLBuffer.appendAscii("&System=WIN");
-#elif defined MAC
- aHelpURLBuffer.appendAscii("&System=MAC");
#elif defined OS2
aHelpURLBuffer.appendAscii("&System=OS2");
#endif
diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx
index f5cdc3e307..bf6bb8cc6c 100644
--- a/desktop/source/app/langselect.cxx
+++ b/desktop/source/app/langselect.cxx
@@ -64,10 +64,12 @@ namespace desktop {
static char const SOFFICE_BOOTSTRAP[] = "Bootstrap";
static char const SOFFICE_STARTLANG[] = "STARTLANG";
+
sal_Bool LanguageSelection::bFoundLanguage = sal_False;
OUString LanguageSelection::aFoundLanguage;
-const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US");
+LanguageSelection::LanguageSelectionStatus LanguageSelection::m_eStatus = LS_STATUS_OK;
+const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US");
static sal_Bool existsURL( OUString const& sURL )
{
@@ -122,6 +124,7 @@ Locale LanguageSelection::IsoStringToLocale(const OUString& str)
bool LanguageSelection::prepareLanguage()
{
+ m_eStatus = LS_STATUS_OK;
OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
Reference< XLocalizable > theConfigProvider;
@@ -131,7 +134,9 @@ bool LanguageSelection::prepareLanguage()
}
catch(const Exception&)
{
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
+
if(!theConfigProvider.is())
return false;
@@ -149,6 +154,7 @@ bool LanguageSelection::prepareLanguage()
}
catch(const Exception&)
{
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
// #i32939# use system locale to set document default locale
@@ -162,6 +168,7 @@ bool LanguageSelection::prepareLanguage()
}
catch (Exception&)
{
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
// get the selected UI language as string
@@ -350,8 +357,10 @@ OUString LanguageSelection::getLanguageString()
aFoundLanguage = usFallbackLanguage;
return aFoundLanguage;
}
+
// fallback didn't work use first installed language
aUserLanguage = getFirstInstalledLanguage();
+
bFoundLanguage = sal_True;
aFoundLanguage = aUserLanguage;
return aFoundLanguage;
@@ -455,7 +464,7 @@ sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bEx
// requested locale starts with the installed locale
// (i.e. installed locale has index 0 in requested locale)
bInstalled = sal_True;
- usLocale = seqLanguages[i];
+ usLocale = seqLanguages[i];
break;
}
}
@@ -484,10 +493,12 @@ OUString LanguageSelection::getUserLanguage()
}
catch ( NoSuchElementException const & )
{
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
catch ( WrappedTargetException const & )
{
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
}
@@ -506,10 +517,12 @@ OUString LanguageSelection::getSystemLanguage()
}
catch ( NoSuchElementException const & )
{
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
catch ( WrappedTargetException const & )
{
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
return OUString();
}
}
@@ -533,9 +546,13 @@ void LanguageSelection::resetUserLanguage()
{
OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
OSL_ENSURE(sal_False, aMsg.getStr());
+ m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN;
}
-
}
+LanguageSelection::LanguageSelectionStatus LanguageSelection::getStatus()
+{
+ return m_eStatus;
+}
} // namespace desktop
diff --git a/desktop/source/app/langselect.hxx b/desktop/source/app/langselect.hxx
index 536bff8928..cc1400bc6a 100644
--- a/desktop/source/app/langselect.hxx
+++ b/desktop/source/app/langselect.hxx
@@ -40,10 +40,24 @@ namespace desktop
class LanguageSelection
{
+public:
+ enum LanguageSelectionStatus
+ {
+ LS_STATUS_OK,
+ LS_STATUS_CANNOT_DETERMINE_LANGUAGE,
+ LS_STATUS_CONFIGURATIONACCESS_BROKEN
+ };
+
+ static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str);
+ static rtl::OUString getLanguageString();
+ static bool prepareLanguage();
+ static LanguageSelectionStatus getStatus();
+
private:
static const rtl::OUString usFallbackLanguage;
static rtl::OUString aFoundLanguage;
static sal_Bool bFoundLanguage;
+ static LanguageSelectionStatus m_eStatus;
static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate=sal_False);
@@ -55,11 +69,6 @@ private:
static rtl::OUString getSystemLanguage();
static void resetUserLanguage();
static void setDefaultLanguage(const rtl::OUString&);
-
-public:
- static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str);
- static rtl::OUString getLanguageString();
- static bool prepareLanguage();
};
} //namespace desktop
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 0bd9db40de..5f7e4be8c7 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -847,8 +847,6 @@ void SAL_CALL OfficeIPCThread::run()
aHelpURLBuffer.appendAscii("&System=UNX");
#elif defined WNT
aHelpURLBuffer.appendAscii("&System=WIN");
-#elif defined MAC
- aHelpURLBuffer.appendAscii("&System=MAC");
#elif defined OS2
aHelpURLBuffer.appendAscii("&System=OS2");
#endif
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 919ddb4346..9f5d400e68 100755..100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -372,11 +372,13 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long
if ( ! GetEntryData( nPos )->m_bLocked )
{
- if ( GetEntryData( nPos )->m_eState == REGISTERED )
- aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
- else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
- aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
-
+ if ( GetEntryData( nPos )->m_bUser )
+ {
+ if ( GetEntryData( nPos )->m_eState == REGISTERED )
+ aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
+ else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
+ aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
+ }
aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
}
@@ -1147,13 +1149,13 @@ void ExtMgrDialog::Resize()
{
ImplControlValue aValue;
bool bNativeOK;
- Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) );
- Region aNativeControlRegion, aNativeContentRegion;
+ Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() );
+ Rectangle aNativeControlRegion, aNativeContentRegion;
if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
CTRL_STATE_ENABLED, aValue, rtl::OUString(),
aNativeControlRegion, aNativeContentRegion ) ) != FALSE )
{
- nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ nProgressHeight = aNativeControlRegion.GetHeight();
}
}
@@ -1590,13 +1592,13 @@ void UpdateRequiredDialog::Resize()
{
ImplControlValue aValue;
bool bNativeOK;
- Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) );
- Region aNativeControlRegion, aNativeContentRegion;
+ Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() );
+ Rectangle aNativeControlRegion, aNativeContentRegion;
if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
CTRL_STATE_ENABLED, aValue, rtl::OUString(),
aNativeControlRegion, aNativeContentRegion ) ) != FALSE )
{
- nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ nProgressHeight = aNativeControlRegion.GetHeight();
}
}
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index 3cf6e48595..ab0baa78e3 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -1136,6 +1136,14 @@ sal_Bool ExtensionManager::synchronize(
bModified |= m_bundledRepository->synchronize(xAbortChannel, xCmdEnv);
progressBundled.update(OUSTR("\n\n"));
+ //Always determine the active extension. This is necessary for the
+ //first-start optimization. The setup creates the registration data for the
+ //bundled extensions (brand_layer/share/prereg/bundled), which is copied to the user
+ //installation (user_installation/extension/bundled) when a user starts OOo
+ //for the first time after running setup. All bundled extensions are registered
+ //at that moment. However, extensions with the same identifier can be in the
+ //shared or user repository, in which case the respective bundled extensions must
+ //be revoked.
try
{
const uno::Sequence<uno::Sequence<Reference<deploy::XPackage> > >
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
index 65f3d14c75..317ad3da78 100644
--- a/desktop/source/deployment/manager/dp_properties.cxx
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -2,7 +2,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx
index f135ff9977..45a0583d54 100644
--- a/desktop/source/deployment/manager/dp_properties.hxx
+++ b/desktop/source/deployment/manager/dp_properties.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 689e8cfd0d..c988e6494b 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -589,6 +589,11 @@ void TRACE(::rtl::OString const & sText)
void syncRepositories(Reference<ucb::XCommandEnvironment> const & xCmdEnv)
{
+ OUString sDisable;
+ ::rtl::Bootstrap::get( OUSTR( "DISABLE_EXTENSION_SYNCHRONIZATION" ), sDisable, OUString() );
+ if (sDisable.getLength() > 0)
+ return;
+
Reference<deployment::XExtensionManager> xExtensionManager;
//synchronize shared before bundled otherewise there are
//more revoke and registration calls.
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index c50e6bdf42..a2f81e19ce 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -359,16 +359,11 @@ void BackendImpl::configmgrini_verify_init(
do {
OUString token( line.getToken( 0, ' ', index ).trim() );
if (token.getLength() > 0) {
- // cleanup, check if existing:
- 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 );
- }
+ //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 );
}
}
while (index >= 0);
@@ -378,31 +373,15 @@ void BackendImpl::configmgrini_verify_init(
sal_Int32 index = sizeof ("DATA=") - 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 */ )) {
- //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
- {
- //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.");
- }
+ //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 );
}
}
while (index >= 0);
@@ -502,6 +481,8 @@ bool BackendImpl::removeFromConfigmgrIni(
{
//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)
+ //However, m_url (getURL()) contains the URL for the file in the actual
+ //extension installatation.
::boost::optional<ConfigurationBackendDb::Data> data = readDataFromDb(url_);
if (data)
i = std::find(rSet.begin(), rSet.end(), data->iniEntry);
@@ -757,10 +738,17 @@ void BackendImpl::PackageImpl::processPackage_(
}
that->m_registeredPackages->erase(i->first);
}
- ::ucbhelper::Content(
- makeURL( that->getCachePath(), OUSTR("registry") ),
- xCmdEnv ).executeCommand(
- OUSTR("delete"), Any( true /* delete physically */ ) );
+ try
+ {
+ ::ucbhelper::Content(
+ makeURL( that->getCachePath(), OUSTR("registry") ),
+ xCmdEnv ).executeCommand(
+ OUSTR("delete"), Any( true /* delete physically */ ) );
+ }
+ catch(Exception&)
+ {
+ OSL_ASSERT(0);
+ }
}
that->deleteDataFromDb(getURL());
diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
index 8665ef16a2..3dc4528972 100644
--- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
index 8e685660ca..6d6d3a2d0b 100644
--- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
+++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx
index 643553ad92..92c0a912db 100644
--- a/desktop/source/deployment/registry/dp_registry.cxx
+++ b/desktop/source/deployment/registry/dp_registry.cxx
@@ -129,7 +129,9 @@ public:
virtual Reference<deployment::XPackage> SAL_CALL bindPackage(
OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
- throw (deployment::DeploymentException, CommandFailedException,
+ throw (deployment::DeploymentException,
+ deployment::InvalidRemovedParameterException,
+ CommandFailedException,
lang::IllegalArgumentException, RuntimeException);
virtual Sequence< Reference<deployment::XPackageTypeInfo> > SAL_CALL
getSupportedPackageTypes() throw (RuntimeException);
@@ -461,7 +463,8 @@ void PackageRegistryImpl::update() throw (RuntimeException)
Reference<deployment::XPackage> PackageRegistryImpl::bindPackage(
OUString const & url, OUString const & mediaType_, sal_Bool bRemoved,
OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
- throw (deployment::DeploymentException, CommandFailedException,
+ throw (deployment::DeploymentException, deployment::InvalidRemovedParameterException,
+ CommandFailedException,
lang::IllegalArgumentException, RuntimeException)
{
check();
diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
index 90f0384067..67ffc0f719 100644
--- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
+++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
index 29f8f89dd6..ddb3a29447 100644
--- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
+++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
index cadddf82ec..c6a4fe91cb 100644
--- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
+++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
index a0468767fe..4fe99bd93b 100644
--- a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
+++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 649f85c8db..6209aad0d0 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -866,14 +866,10 @@ void BackendImpl::PackageImpl::processPackage_(
try {
xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv );
}
- catch (RuntimeException &) {
- throw;
- }
- catch (ucb::CommandAbortedException &) {
- throw;
- }
- catch (Exception &) {
- // CommandFailedException, DeploymentException:
+ catch (Exception &)
+ {
+ //We even try a rollback if the user cancelled the action (CommandAbortedException)
+ //in order to prevent invalid database entries.
Any exc( ::cppu::getCaughtException() );
// try to handle exception, notify:
bool approve = false, abort = false;
@@ -904,14 +900,8 @@ void BackendImpl::PackageImpl::processPackage_(
bundle[ pos ]->revokePackage(
xSubAbortChannel, xCmdEnv );
}
- catch (RuntimeException &) {
- throw;
- }
- catch (ucb::CommandAbortedException &) {
- throw;
- }
- catch (Exception &) {
- // bundle rollback error:
+ catch (Exception &)
+ {
OSL_ENSURE( 0, ::rtl::OUStringToOString(
::comphelper::anyToString(
::cppu::getCaughtException() ),
diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
index d8e47eecb4..6e732ccd58 100644
--- a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
+++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
index 6b6d4d364c..e09e721b27 100644
--- a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
+++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* 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
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 6396ef1091..6396ef1091 100755..100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
diff --git a/desktop/source/migration/services/cexportsoo3.cxx b/desktop/source/migration/services/cexportsoo3.cxx
index b33d78966f..2ac1a0bcbc 100755..100644
--- a/desktop/source/migration/services/cexportsoo3.cxx
+++ b/desktop/source/migration/services/cexportsoo3.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: cexports.cxx,v $
- * $Revision: 1.9 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx
index 578dda0c1b..a481857f91 100755..100644
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -1,14 +1,11 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: extensionmigration.cxx,v $
- * $Revision: 1.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx
index 124bc1b250..721a1bd704 100755..100644
--- a/desktop/source/migration/services/oo3extensionmigration.hxx
+++ b/desktop/source/migration/services/oo3extensionmigration.hxx
@@ -1,14 +1,11 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: extensionmigration.hxx,v $
- * $Revision: 1.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index 4b7b112e53..278a07b8c8 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -39,6 +39,7 @@
#include "osl/thread.h"
#include "osl/process.h"
#include "osl/conditn.hxx"
+#include "osl/file.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "comphelper/anytostring.hxx"
@@ -377,6 +378,29 @@ extern "C" int unopkg_main()
if (e != osl_File_E_None && e != osl_File_E_NOENT)
throw Exception(OUSTR("Could not delete ") + extensionUnorc, 0);
}
+ else if (subCommand.equals(OUSTR("sync")))
+ {
+ //sync is private!!!! Only for bundled extensions!!!
+ //For performance reasons unopkg sync is called during the setup and
+ //creates the registration data for the repository of the bundled
+ //extensions. It is then copied to the user installation during
+ //startup of OOo (userdata/extensions/bundled). The registration
+ //data is in the brand installation and must be removed when
+ //uninstalling OOo. We do this here, before UNO is
+ //bootstrapped. Otherwies files could be locked by this process.
+
+ //If there is no folder left in
+ //$BRAND_BASE_DIR/share/extensions
+ //then we can delete the registration data at
+ //$BUNDLED_EXTENSIONS_USER
+ if (hasNoFolder(OUSTR("$BRAND_BASE_DIR/share/extensions")))
+ {
+ removeFolder(OUSTR("$BUNDLED_EXTENSIONS_USER"));
+ //return otherwise we create the registration data again
+ return 0;
+ }
+
+ }
xComponentContext = getUNO(
disposeGuard, option_verbose, option_shared, subcmd_gui,
@@ -587,6 +611,15 @@ extern "C" int unopkg_main()
xDialog->startExecuteModal(xListener);
dialogEnded.wait();
}
+ else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("sync")))
+ {
+ //This sub command may be removed later and is only there to have a
+ //possibility to start extension synching without any output.
+ //This is just here so we do not get an error, because of an unknown
+ //sub-command. We do synching before
+ //the sub-commands are processed.
+
+ }
else
{
dp_misc::writeConsoleError(
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index 5ecf18d651..ec4bab433a 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -528,5 +528,110 @@ Reference<XComponentContext> getUNO(
return xComponentContext;
}
+//Determines if a folder does not contains a folder.
+//Return false may also mean that the status could not be determined
+//because some error occurred.
+bool hasNoFolder(OUString const & folderUrl)
+{
+ bool ret = false;
+ OUString url = folderUrl;
+ ::rtl::Bootstrap::expandMacros(url);
+ ::osl::Directory dir(url);
+ osl::File::RC rc = dir.open();
+ if (rc == osl::File::E_None)
+ {
+ bool bFolderExist = false;
+ osl::DirectoryItem i;
+ osl::File::RC rcNext = osl::File::E_None;
+ while ( (rcNext = dir.getNextItem(i)) == osl::File::E_None)
+ {
+ osl::FileStatus stat(FileStatusMask_Type);
+ if (i.getFileStatus(stat) == osl::File::E_None)
+ {
+ if (stat.getFileType() == osl::FileStatus::Directory)
+ {
+ bFolderExist = true;
+ break;
+ }
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ break;
+ }
+ i = osl::DirectoryItem();
+ }
+
+ if (rcNext == osl::File::E_NOENT ||
+ rcNext == osl::File::E_None)
+ {
+ if (!bFolderExist)
+ ret = true;
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ }
+
+ dir.close();
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ }
+ return ret;
}
+void removeFolder(OUString const & folderUrl)
+{
+ OUString url = folderUrl;
+ ::rtl::Bootstrap::expandMacros(url);
+ ::osl::Directory dir(url);
+ ::osl::File::RC rc = dir.open();
+ if (rc == osl::File::E_None)
+ {
+ ::osl::DirectoryItem i;
+ ::osl::File::RC rcNext = ::osl::File::E_None;
+ while ( (rcNext = dir.getNextItem(i)) == ::osl::File::E_None)
+ {
+ ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileURL);
+ if (i.getFileStatus(stat) == ::osl::File::E_None)
+ {
+ ::osl::FileStatus::Type t = stat.getFileType();
+ if (t == ::osl::FileStatus::Directory)
+ {
+ //remove folder
+ removeFolder(stat.getFileURL());
+ }
+ else if (t == ::osl::FileStatus::Regular)
+ {
+ //remove file
+ ::osl::File::remove(stat.getFileURL());
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ }
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ break;
+ }
+ i = ::osl::DirectoryItem();
+ }
+ dir.close();
+ ::osl::Directory::remove(url);
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while removing ") + url + OUSTR("\n"));
+ }
+}
+
+}
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h
index 8898e42d27..5af217ef41 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -178,5 +178,11 @@ css::uno::Reference<css::uno::XComponentContext> getUNO(
DisposeGuard & disposeGuard, bool verbose, bool shared, bool bGui,
css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext);
+bool hasNoFolder(::rtl::OUString const & folderUrl);
+
+void removeFolder(::rtl::OUString const & folderUrl);
+
}
+
+
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 566b378b58..db46035c4d 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -640,20 +640,18 @@ void SplashScreen::Paint( const Rectangle&)
ImplControlValue aValue( _iProgress * _barwidth / _iMax);
Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) );
- Region aControlRegion( aDrawRect );
- Region aNativeControlRegion, aNativeContentRegion;
+ Rectangle aNativeControlRegion, aNativeContentRegion;
- if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect,
CTRL_STATE_ENABLED, aValue, rtl::OUString(),
aNativeControlRegion, aNativeContentRegion ) )
{
- long nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ long nProgressHeight = aNativeControlRegion.GetHeight();
aDrawRect.Top() -= (nProgressHeight - _barheight)/2;
aDrawRect.Bottom() += (nProgressHeight - _barheight)/2;
- aControlRegion = Region( aDrawRect );
}
- if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect,
CTRL_STATE_ENABLED, aValue, _sProgressText )) != FALSE )
{
return;
diff --git a/desktop/test/deployment/boxt/makefile.mk b/desktop/test/deployment/boxt/makefile.mk
index 63f123fcc6..11d736448d 100644
--- a/desktop/test/deployment/boxt/makefile.mk
+++ b/desktop/test/deployment/boxt/makefile.mk
@@ -33,11 +33,9 @@ ENABLE_EXCEPTIONS = TRUE
.INCLUDE: settings.mk
.INCLUDE: rtlbootstrap.mk
+.INCLUDE: versionlist.mk
-#TODO: The underlying OOo base version needed here is currently only available
-# as instsetoo_native/util/openoffice.lst OOOBASEVERSION, so hard-coding it here
-# for now (see issue 110653):
-my_version = 3.3
+my_version = $(OOOBASEVERSIONMAJOR).$(OOOBASEVERSIONMINOR)
DLLPRE =
diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc
index f149ec6474..8bc39767f0 100644
--- a/desktop/util/ooverinfo2.rc
+++ b/desktop/util/ooverinfo2.rc
@@ -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,26 +25,26 @@
*
*************************************************************************/
-#define VERSION 3
-#define SUBVERSION 2
-//#define VERVARIANT 0
+#define VERSION 3
+#define SUBVERSION 3
+//#define VERVARIANT 0
// .0 + VER_CONCEPT
// .100 + VER_ALPHA
// .200 + VER_BETA
// .300 + VER_GAMMA
// .500 + VER_FINAL
-//#define VER_CONCEPT 0
-//#define VER_BETA 6
-#define VER_FINAL 0
+//#define VER_CONCEPT 0
+//#define VER_BETA 6
+#define VER_FINAL 0
-#define VER_DAY 1
-#define VER_MONTH 9
-#define VER_YEAR 2009
+#define VER_DAY 1
+#define VER_MONTH 1
+#define VER_YEAR 2010
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-// language/character set specification table
+// language/character set specification table
// -----------------------------------------------------------------------
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
index 59303f74ec..25ce0fa682 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
@@ -56,7 +56,7 @@ namespace drawinglayer
const basegfx::B2DHomMatrix& rTransformation,
const Primitive2DSequence& rChildren);
- // get data
+ /// data read access
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& getChartModel() const { return mxChartModel; }
const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
new file mode 100644
index 0000000000..19646d4822
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// DiscreteShadowPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteShadow data class
+
+ */
+ class DiscreteShadow
+ {
+ private:
+ /// the original shadow BitmapEx in a special form
+ BitmapEx maBitmapEx;
+
+ /// buffered extracted parts of CombinedShadow for easier usage
+ BitmapEx maTopLeft;
+ BitmapEx maTop;
+ BitmapEx maTopRight;
+ BitmapEx maRight;
+ BitmapEx maBottomRight;
+ BitmapEx maBottom;
+ BitmapEx maBottomLeft;
+ BitmapEx maLeft;
+
+ public:
+ /// constructor
+ DiscreteShadow(const BitmapEx& rBitmapEx);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+
+ /// compare operator
+ bool operator==(const DiscreteShadow& rCompare) const
+ {
+ return getBitmapEx() == rCompare.getBitmapEx();
+ }
+
+ /// helper accesses which create on-demand needed segments
+ const BitmapEx& getTopLeft() const;
+ const BitmapEx& getTop() const;
+ const BitmapEx& getTopRight() const;
+ const BitmapEx& getRight() const;
+ const BitmapEx& getBottomRight() const;
+ const BitmapEx& getBottom() const;
+ const BitmapEx& getBottomLeft() const;
+ const BitmapEx& getLeft() const;
+ };
+
+ /** DiscreteShadowPrimitive2D class
+
+ */
+ class DiscreteShadowPrimitive2D : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ // the object transformation of the rectangular object
+ basegfx::B2DHomMatrix maTransform;
+
+ // the bitmap shadow data
+ DiscreteShadow maDiscreteShadow;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ DiscreteShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const DiscreteShadow& rDiscreteShadow);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const DiscreteShadow& getDiscreteShadow() const { return maDiscreteShadow; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index ac450ed4ac..7f1c929a6e 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -90,17 +90,19 @@
#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47)
#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48)
#define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49)
-#define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50)
+#define PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50)
#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51)
#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
-#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
-#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
-#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
-#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
-#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
-#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
-#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
-#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
+#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
+#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
+#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
+#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
+#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
+#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
+#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
+#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
+#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
+#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
index b9c41b08cd..4a3c3134f9 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
@@ -101,7 +101,7 @@ namespace drawinglayer
double fShadowSlant,
const basegfx::B3DRange& rScene3DRange);
- /// get data
+ /// data read access
const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx
index f7b305b9d3..c3fc650909 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx
@@ -94,8 +94,8 @@ namespace drawinglayer
double fDiscreteDashLength);
/// data read access
- const basegfx::B2DPoint getPosition() const { return maPosition; }
- const basegfx::B2DVector getDirection() const { return maDirection; }
+ const basegfx::B2DPoint& getPosition() const { return maPosition; }
+ const basegfx::B2DVector& getDirection() const { return maDirection; }
HelplineStyle2D getStyle() const { return meStyle; }
const basegfx::BColor& getRGBColA() const { return maRGBColA; }
const basegfx::BColor& getRGBColB() const { return maRGBColB; }
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx
index 1e7b060e47..247a6b3f77 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx
@@ -189,7 +189,7 @@ namespace drawinglayer
const attribute::LineAttribute& rLineAttribute);
/// data read access
- basegfx::B2DPolygon getB2DPolygon() const { return maPolygon; }
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
index e0afa585e2..c8e88e5573 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
@@ -69,7 +69,7 @@ namespace drawinglayer
PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor);
/// data read access
- basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
const basegfx::BColor& getBColor() const { return maBColor; }
/// compare operator
@@ -123,7 +123,7 @@ namespace drawinglayer
double fDiscreteDashLength);
// data read access
- basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
double getDiscreteDashLength() const { return mfDiscreteDashLength; }
@@ -182,7 +182,7 @@ namespace drawinglayer
const attribute::LineAttribute& rLineAttribute);
/// data read access
- basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
index 22bf70eefd..6e13573486 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx
@@ -136,7 +136,7 @@ namespace drawinglayer
const basegfx::B2DHomMatrix& rObjectTransformation,
const geometry::ViewInformation3D& rViewInformation3D);
- /// data ead access
+ /// data read access
const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return maSdrSceneAttribute; }
const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return maSdrLightingAttribute; }
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
index 755a692085..93bcb27f6c 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -129,8 +129,8 @@ namespace drawinglayer
TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
TextRelief getTextRelief() const { return meTextRelief; }
- basegfx::BColor getOverlineColor() const { return maOverlineColor; }
- basegfx::BColor getTextlineColor() const { return maTextlineColor; }
+ const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
+ const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
bool getUnderlineAbove() const { return mbUnderlineAbove; }
bool getWordLineMode() const { return mbWordLineMode; }
bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index e863e47a3b..54f087d317 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -16,6 +16,8 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\borderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\borderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\chartprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\chartprimitive2d.hxx
..\inc\drawinglayer\primitive2d\controlprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\controlprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\discretebitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\discretebitmapprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\discreteshadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\discreteshadowprimitive2d.hxx
..\inc\drawinglayer\primitive2d\embedded3dprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\embedded3dprimitive2d.hxx
..\inc\drawinglayer\primitive2d\fillbitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\fillbitmapprimitive2d.hxx
..\inc\drawinglayer\primitive2d\fillgradientprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\fillgradientprimitive2d.hxx
diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
new file mode 100644
index 0000000000..17578b5e52
--- /dev/null
+++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * 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_drawinglayer.hxx"
+
+#include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ DiscreteShadow::DiscreteShadow(const BitmapEx& rBitmapEx)
+ : maBitmapEx(rBitmapEx),
+ maTopLeft(),
+ maTop(),
+ maTopRight(),
+ maRight(),
+ maBottomRight(),
+ maBottom(),
+ maBottomLeft(),
+ maLeft()
+ {
+ const Size& rBitmapSize = getBitmapEx().GetSizePixel();
+
+ if(rBitmapSize.Width() != rBitmapSize.Height() || rBitmapSize.Width() < 7)
+ {
+ OSL_ENSURE(false, "DiscreteShadowPrimitive2D: wrong bitmap format (!)");
+ maBitmapEx = BitmapEx();
+ }
+ }
+
+ const BitmapEx& DiscreteShadow::getTopLeft() const
+ {
+ if(maTopLeft.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maTopLeft = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maTopLeft.Crop(
+ Rectangle(Point(0,0),Size(nQuarter*2+1,nQuarter*2+1)));
+ }
+
+ return maTopLeft;
+ }
+
+ const BitmapEx& DiscreteShadow::getTop() const
+ {
+ if(maTop.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maTop = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maTop.Crop(
+ Rectangle(Point(nQuarter*2+1,0),Size(1,nQuarter+1)));
+ }
+
+ return maTop;
+ }
+
+ const BitmapEx& DiscreteShadow::getTopRight() const
+ {
+ if(maTopRight.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maTopRight = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maTopRight.Crop(
+ Rectangle(Point(nQuarter*2+2,0),Size(nQuarter*2+1,nQuarter*2+1)));
+ }
+
+ return maTopRight;
+ }
+
+ const BitmapEx& DiscreteShadow::getRight() const
+ {
+ if(maRight.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maRight = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maRight.Crop(
+ Rectangle(Point(nQuarter*3+2,nQuarter*2+1),Size(nQuarter+1,1)));
+ }
+
+ return maRight;
+ }
+
+ const BitmapEx& DiscreteShadow::getBottomRight() const
+ {
+ if(maBottomRight.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maBottomRight = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maBottomRight.Crop(
+ Rectangle(Point(nQuarter*2+2,nQuarter*2+2),Size(nQuarter*2+1,nQuarter*2+1)));
+ }
+
+ return maBottomRight;
+ }
+
+ const BitmapEx& DiscreteShadow::getBottom() const
+ {
+ if(maBottom.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maBottom = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maBottom.Crop(
+ Rectangle(Point(nQuarter*2+1,nQuarter*3+2),Size(1,nQuarter+1)));
+ }
+
+ return maBottom;
+ }
+
+ const BitmapEx& DiscreteShadow::getBottomLeft() const
+ {
+ if(maBottomLeft.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maBottomLeft = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maBottomLeft.Crop(
+ Rectangle(Point(0,nQuarter*2+2),Size(nQuarter*2+1,nQuarter*2+1)));
+ }
+
+ return maBottomLeft;
+ }
+
+ const BitmapEx& DiscreteShadow::getLeft() const
+ {
+ if(maLeft.IsEmpty())
+ {
+ const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const_cast< DiscreteShadow* >(this)->maLeft = getBitmapEx();
+ const_cast< DiscreteShadow* >(this)->maLeft.Crop(
+ Rectangle(Point(0,nQuarter*2+1),Size(nQuarter+1,1)));
+ }
+
+ return maLeft;
+ }
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence DiscreteShadowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence xRetval;
+
+ if(!getDiscreteShadow().getBitmapEx().IsEmpty())
+ {
+ const sal_Int32 nQuarter((getDiscreteShadow().getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const basegfx::B2DVector aScale(getTransform() * basegfx::B2DVector(1.0, 1.0));
+ const double fSingleX(getDiscreteUnit() / aScale.getX());
+ const double fSingleY(getDiscreteUnit() / aScale.getY());
+ const double fBorderX(fSingleX * nQuarter);
+ const double fBorderY(fSingleY * nQuarter);
+ const double fBigLenX((fBorderX * 2.0) + fSingleX);
+ const double fBigLenY((fBorderY * 2.0) + fSingleY);
+
+ xRetval.realloc(8);
+
+ // TopLeft
+ xRetval[0] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getTopLeft(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ -fBorderX,
+ -fBorderY)));
+
+ // Top
+ xRetval[1] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getTop(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ 1.0 - (2.0 * fBorderX) - fSingleX,
+ fBorderY + fSingleY,
+ fBorderX + fSingleX,
+ -fBorderY)));
+
+ // TopRight
+ xRetval[2] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getTopRight(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ 1.0 - fBorderX,
+ -fBorderY)));
+
+ // Right
+ xRetval[3] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getRight(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fBorderX + fSingleX,
+ 1.0 - (2.0 * fBorderY) - fSingleY,
+ 1.0,
+ fBorderY + fSingleY)));
+
+ // BottomRight
+ xRetval[4] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getBottomRight(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ 1.0 - fBorderX,
+ 1.0 - fBorderY)));
+
+ // Bottom
+ xRetval[5] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getBottom(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ 1.0 - (2.0 * fBorderX) - fSingleX,
+ fBorderY + fSingleY,
+ fBorderX + fSingleX,
+ 1.0)));
+
+ // BottomLeft
+ xRetval[6] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getBottomLeft(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ -fBorderX,
+ 1.0 - fBorderY)));
+
+ // Left
+ xRetval[7] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ getDiscreteShadow().getLeft(),
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fBorderX + fSingleX,
+ 1.0 - (2.0 * fBorderY) - fSingleY,
+ -fBorderX,
+ fBorderY + fSingleY)));
+
+ // put all in object transformation to get to target positions
+ const Primitive2DReference xTransformed(
+ new TransformPrimitive2D(
+ getTransform(),
+ xRetval));
+
+ xRetval = Primitive2DSequence(&xTransformed, 1);
+ }
+
+ return xRetval;
+ }
+
+ DiscreteShadowPrimitive2D::DiscreteShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const DiscreteShadow& rDiscreteShadow)
+ : DiscreteMetricDependentPrimitive2D(),
+ maTransform(rTransform),
+ maDiscreteShadow(rDiscreteShadow)
+ {
+ }
+
+ bool DiscreteShadowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const DiscreteShadowPrimitive2D& rCompare = (DiscreteShadowPrimitive2D&)rPrimitive;
+
+ return (getTransform() == rCompare.getTransform()
+ && getDiscreteShadow() == rCompare.getDiscreteShadow());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange DiscreteShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ if(getDiscreteShadow().getBitmapEx().IsEmpty())
+ {
+ // no graphics without valid bitmap definition
+ return basegfx::B2DRange();
+ }
+ else
+ {
+ // prepare normal objectrange
+ basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
+ aRetval.transform(getTransform());
+
+ // extract discrete shadow size and grow
+ const basegfx::B2DVector aScale(rViewInformation.getViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+ const sal_Int32 nQuarter((getDiscreteShadow().getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const double fGrowX((1.0 / aScale.getX()) * nQuarter);
+ const double fGrowY((1.0 / aScale.getY()) * nQuarter);
+ aRetval.grow(std::max(fGrowX, fGrowY));
+
+ return aRetval;
+ }
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(DiscreteShadowPrimitive2D, PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index bca5805ae6..720769a0ef 100644
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -46,6 +46,7 @@ SLOFILES= \
$(SLO)$/chartprimitive2d.obj \
$(SLO)$/controlprimitive2d.obj \
$(SLO)$/discretebitmapprimitive2d.obj \
+ $(SLO)$/discreteshadowprimitive2d.obj \
$(SLO)$/embedded3dprimitive2d.obj \
$(SLO)$/epsprimitive2d.obj \
$(SLO)$/fillbitmapprimitive2d.obj \
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 71e9b1c455..269c5cfe06 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -2301,35 +2301,48 @@ namespace
{
const Gradient& rGradient = pA->GetGradient();
const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient));
+ basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
if(aAttribute.getStartColor() == aAttribute.getEndColor())
{
// not really a gradient. Create filled rectangle
- const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
- createFillPrimitive(basegfx::B2DPolyPolygon(aOutline), rTargetHolders.Current(), rPropertyHolders.Current());
+ createFillPrimitive(
+ aOutline,
+ rTargetHolders.Current(),
+ rPropertyHolders.Current());
}
else
{
// really a gradient
aRange.transform(rPropertyHolders.Current().getTransformation());
+ drawinglayer::primitive2d::Primitive2DSequence xGradient(1);
if(rPropertyHolders.Current().isRasterOpInvert())
{
// use a special version of FillGradientPrimitive2D which creates
// non-overlapping geometry on decomposition to makethe old XOR
// paint 'trick' work.
- rTargetHolders.Current().append(
+ xGradient[0] = drawinglayer::primitive2d::Primitive2DReference(
new drawinglayer::primitive2d::NonOverlappingFillGradientPrimitive2D(
aRange,
aAttribute));
}
else
{
- rTargetHolders.Current().append(
+ xGradient[0] = drawinglayer::primitive2d::Primitive2DReference(
new drawinglayer::primitive2d::FillGradientPrimitive2D(
aRange,
aAttribute));
}
+
+ // #i112300# clip against polygon representing the rectangle from
+ // the action. This is implicitely done using a temp Clipping in VCL
+ // when a MetaGradientAction is executed
+ aOutline.transform(rPropertyHolders.Current().getTransformation());
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::MaskPrimitive2D(
+ aOutline,
+ xGradient));
}
}
}
diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
index 3d50eef4fb..dcd47069e7 100644
--- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
@@ -50,7 +50,7 @@ namespace drawinglayer
}
// provide unique ID
- ImplPrimitrive2DIDBlock(StructureTagPrimitive2D, PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D)
+ ImplPrimitrive2DIDBlock(StructureTagPrimitive2D, PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D)
} // end of namespace primitive2d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
index 48a26413df..13c0c17070 100644
--- a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
@@ -85,9 +85,13 @@ namespace drawinglayer
}
// prepare dest coor
+ const sal_uInt32 nDiscreteWidth(basegfx::fround(aOutlineRange.getMaxX()));
+ const sal_uInt32 nDiscreteHeight(basegfx::fround(aOutlineRange.getMaxY()));
const Rectangle aDestRectPixel(
- basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()),
- basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY()));
+ basegfx::fround(aOutlineRange.getMinX()),
+ basegfx::fround(aOutlineRange.getMinY()),
+ nDiscreteWidth > 0 ? nDiscreteWidth - 1 : 0,
+ nDiscreteHeight > 0 ? nDiscreteHeight - 1 : 0);
// paint it using GraphicManager
Graphic aGraphic(rBitmapEx);
@@ -106,9 +110,13 @@ namespace drawinglayer
// prepare dest coor. Necessary to expand since vcl's DrawBitmapEx draws one pix less
basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0);
aOutlineRange.transform(rTransform);
+ const sal_uInt32 nDiscreteWidth(basegfx::fround(aOutlineRange.getMaxX()));
+ const sal_uInt32 nDiscreteHeight(basegfx::fround(aOutlineRange.getMaxY()));
const Rectangle aDestRectPixel(
- basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()),
- basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY()));
+ basegfx::fround(aOutlineRange.getMinX()),
+ basegfx::fround(aOutlineRange.getMinY()),
+ nDiscreteWidth > 0 ? nDiscreteWidth - 1 : 0,
+ nDiscreteHeight > 0 ? nDiscreteHeight - 1 : 0);
// decompose matrix to check for shear, rotate and mirroring
basegfx::B2DVector aScale, aTranslate;
@@ -145,9 +153,13 @@ namespace drawinglayer
// process self with free transformation (containing shear and rotate). Get dest rect in pixels.
basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0);
aOutlineRange.transform(rTransform);
+ const sal_uInt32 nDiscreteWidth(basegfx::fround(aOutlineRange.getMaxX()));
+ const sal_uInt32 nDiscreteHeight(basegfx::fround(aOutlineRange.getMaxY()));
const Rectangle aDestRectLogic(
- basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()),
- basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY()));
+ basegfx::fround(aOutlineRange.getMinX()),
+ basegfx::fround(aOutlineRange.getMinY()),
+ nDiscreteWidth > 0 ? nDiscreteWidth - 1 : 0,
+ nDiscreteHeight > 0 ? nDiscreteHeight - 1 : 0);
const Rectangle aDestRectPixel(rOutDev.LogicToPixel(aDestRectLogic));
// #i96708# check if Metafile is recorded
@@ -161,18 +173,19 @@ namespace drawinglayer
if(!aCroppedRectPixel.IsEmpty())
{
- // as maximum for destination, orientate at SourceSizePixel, but
+ // as maximum for destination, orientate at aOutputRectPixel, but
// take a rotation of 45 degrees (sqrt(2)) as maximum expansion into account
const Size aSourceSizePixel(rBitmapEx.GetSizePixel());
const double fMaximumArea(
- (double)aSourceSizePixel.getWidth() *
- (double)aSourceSizePixel.getHeight() *
+ (double)aOutputRectPixel.getWidth() *
+ (double)aOutputRectPixel.getHeight() *
1.4142136); // 1.4142136 taken as sqrt(2.0)
// test if discrete view size (pixel) maybe too big and limit it
const double fArea(aCroppedRectPixel.getWidth() * aCroppedRectPixel.getHeight());
const bool bNeedToReduce(fArea > fMaximumArea);
double fReduceFactor(1.0);
+ const Size aDestSizePixel(aCroppedRectPixel.GetSize());
if(bNeedToReduce)
{
@@ -219,11 +232,6 @@ namespace drawinglayer
if(bNeedToReduce)
{
// paint in target size
- const double fFactor(1.0 / fReduceFactor);
- const Size aDestSizePixel(
- basegfx::fround(aCroppedRectPixel.getWidth() * fFactor),
- basegfx::fround(aCroppedRectPixel.getHeight() * fFactor));
-
if(bRecordToMetaFile)
{
rOutDev.DrawBitmapEx(
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index d2d68359cb..01cfe2ff8b 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -94,6 +94,147 @@
using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
+// #112245# definition for maximum allowed point count due to Metafile target.
+// To be on the safe side with the old tools polygon, use slightly less then
+// the theoretical maximum (bad experiences with tools polygon)
+
+#define MAX_POLYGON_POINT_COUNT_METAFILE (0x0000fff0)
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ // #112245# helper to split line polygon in half
+ void splitLinePolygon(
+ const basegfx::B2DPolygon& rBasePolygon,
+ basegfx::B2DPolygon& o_aLeft,
+ basegfx::B2DPolygon& o_aRight)
+ {
+ const sal_uInt32 nCount(rBasePolygon.count());
+
+ if(nCount)
+ {
+ const sal_uInt32 nHalfCount((nCount - 1) >> 1);
+
+ o_aLeft = basegfx::B2DPolygon(rBasePolygon, 0, nHalfCount + 1);
+ o_aLeft.setClosed(false);
+
+ o_aRight = basegfx::B2DPolygon(rBasePolygon, nHalfCount, nCount - nHalfCount);
+ o_aRight.setClosed(false);
+
+ if(rBasePolygon.isClosed())
+ {
+ o_aRight.append(rBasePolygon.getB2DPoint(0));
+
+ if(rBasePolygon.areControlPointsUsed())
+ {
+ o_aRight.setControlPoints(
+ o_aRight.count() - 1,
+ rBasePolygon.getPrevControlPoint(0),
+ rBasePolygon.getNextControlPoint(0));
+ }
+ }
+ }
+ else
+ {
+ o_aLeft.clear();
+ o_aRight.clear();
+ }
+ }
+
+ // #112245# helper to evtl. split filled polygons to maximum metafile point count
+ bool fillPolyPolygonNeededToBeSplit(basegfx::B2DPolyPolygon& rPolyPolygon)
+ {
+ bool bRetval(false);
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ if(nPolyCount)
+ {
+ basegfx::B2DPolyPolygon aSplitted;
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
+ const sal_uInt32 nPointCount(aCandidate.count());
+ bool bNeedToSplit(false);
+
+ if(aCandidate.areControlPointsUsed())
+ {
+ // compare with the maximum for bezier curved polygons
+ bNeedToSplit = nPointCount > ((MAX_POLYGON_POINT_COUNT_METAFILE / 3L) - 1L);
+ }
+ else
+ {
+ // compare with the maximum for simple point polygons
+ bNeedToSplit = nPointCount > (MAX_POLYGON_POINT_COUNT_METAFILE - 1);
+ }
+
+ if(bNeedToSplit)
+ {
+ // need to split the partial polygon
+ const basegfx::B2DRange aRange(aCandidate.getB2DRange());
+ const basegfx::B2DPoint aCenter(aRange.getCenter());
+
+ if(aRange.getWidth() > aRange.getHeight())
+ {
+ // clip in left and right
+ const basegfx::B2DPolyPolygon aLeft(
+ basegfx::tools::clipPolygonOnParallelAxis(
+ aCandidate,
+ false,
+ true,
+ aCenter.getX(),
+ false));
+ const basegfx::B2DPolyPolygon aRight(
+ basegfx::tools::clipPolygonOnParallelAxis(
+ aCandidate,
+ false,
+ false,
+ aCenter.getX(),
+ false));
+
+ aSplitted.append(aLeft);
+ aSplitted.append(aRight);
+ }
+ else
+ {
+ // clip in top and bottom
+ const basegfx::B2DPolyPolygon aTop(
+ basegfx::tools::clipPolygonOnParallelAxis(
+ aCandidate,
+ true,
+ true,
+ aCenter.getY(),
+ false));
+ const basegfx::B2DPolyPolygon aBottom(
+ basegfx::tools::clipPolygonOnParallelAxis(
+ aCandidate,
+ true,
+ false,
+ aCenter.getY(),
+ false));
+
+ aSplitted.append(aTop);
+ aSplitted.append(aBottom);
+ }
+ }
+ else
+ {
+ aSplitted.append(aCandidate);
+ }
+ }
+
+ if(aSplitted.count() != nPolyCount)
+ {
+ rPolyPolygon = aSplitted;
+ }
+ }
+
+ return bRetval;
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
@@ -982,26 +1123,65 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D :
{
- // direct draw of hairline; use default processing
- // also support SvtGraphicStroke MetaCommentAction
const primitive2d::PolygonHairlinePrimitive2D& rHairlinePrimitive = static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate);
- const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rHairlinePrimitive.getBColor()));
- SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rHairlinePrimitive.getB2DPolygon(), &aLineColor, 0, 0, 0, 0);
+ const basegfx::B2DPolygon& rBasePolygon = rHairlinePrimitive.getB2DPolygon();
+
+ if(rBasePolygon.count() > (MAX_POLYGON_POINT_COUNT_METAFILE - 1))
+ {
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. If there are more, split the polygon in half and call recursively
+ basegfx::B2DPolygon aLeft, aRight;
+ splitLinePolygon(rBasePolygon, aLeft, aRight);
+ const primitive2d::PolygonHairlinePrimitive2D aPLeft(aLeft, rHairlinePrimitive.getBColor());
+ const primitive2d::PolygonHairlinePrimitive2D aPRight(aRight, rHairlinePrimitive.getBColor());
+
+ processBasePrimitive2D(aPLeft);
+ processBasePrimitive2D(aPRight);
+ }
+ else
+ {
+ // direct draw of hairline; use default processing
+ // support SvtGraphicStroke MetaCommentAction
+ const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rHairlinePrimitive.getBColor()));
+ SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(
+ rHairlinePrimitive.getB2DPolygon(),
+ &aLineColor,
+ 0, 0, 0, 0);
- impStartSvtGraphicStroke(pSvtGraphicStroke);
- RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), false);
- impEndSvtGraphicStroke(pSvtGraphicStroke);
+ impStartSvtGraphicStroke(pSvtGraphicStroke);
+ RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), false);
+ impEndSvtGraphicStroke(pSvtGraphicStroke);
+ }
break;
}
case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D :
{
- // support SvtGraphicStroke MetaCommentAction
const primitive2d::PolygonStrokePrimitive2D& rStrokePrimitive = static_cast< const primitive2d::PolygonStrokePrimitive2D& >(rCandidate);
- SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokePrimitive.getB2DPolygon(), 0, &rStrokePrimitive.getLineAttribute(),
- &rStrokePrimitive.getStrokeAttribute(), 0, 0);
+ const basegfx::B2DPolygon& rBasePolygon = rStrokePrimitive.getB2DPolygon();
- if(true)
+ if(rBasePolygon.count() > (MAX_POLYGON_POINT_COUNT_METAFILE - 1))
+ {
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. If there are more, split the polygon in half and call recursively
+ basegfx::B2DPolygon aLeft, aRight;
+ splitLinePolygon(rBasePolygon, aLeft, aRight);
+ const primitive2d::PolygonStrokePrimitive2D aPLeft(
+ aLeft, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute());
+ const primitive2d::PolygonStrokePrimitive2D aPRight(
+ aRight, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute());
+
+ processBasePrimitive2D(aPLeft);
+ processBasePrimitive2D(aPRight);
+ }
+ else
{
+ // support SvtGraphicStroke MetaCommentAction
+ SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(
+ rBasePolygon, 0,
+ &rStrokePrimitive.getLineAttribute(),
+ &rStrokePrimitive.getStrokeAttribute(),
+ 0, 0);
+
impStartSvtGraphicStroke(pSvtGraphicStroke);
const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute();
@@ -1013,12 +1193,12 @@ namespace drawinglayer
if(0.0 == rStroke.getFullDotDashLen())
{
- aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon());
+ aHairLinePolyPolygon.append(rBasePolygon);
}
else
{
basegfx::tools::applyLineDashing(
- rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(),
+ rBasePolygon, rStroke.getDotDashArray(),
&aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen());
}
@@ -1048,93 +1228,52 @@ namespace drawinglayer
impEndSvtGraphicStroke(pSvtGraphicStroke);
}
- else
- {
- // Adapt OutDev's DrawMode if special ones were used
- const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode());
- adaptLineToFillDrawMode();
-
- impStartSvtGraphicStroke(pSvtGraphicStroke);
-
- // #i101491#
- // Change default of fat line generation for MetaFiles: Create MetaPolyLineAction
- // instead of decomposing all geometries when the polygon has more than given amount of
- // points; else the decomposition will get too expensive quiclky. OTOH
- // the decomposition provides the better quality e.g. taking edge roundings
- // into account which will NOT be taken into account with LineInfo-based actions
- const sal_uInt32 nSubPolygonCount(rStrokePrimitive.getB2DPolygon().count());
- bool bDone(0 == nSubPolygonCount);
-
- if(!bDone && nSubPolygonCount > 1000)
- {
- // create MetaPolyLineActions, but without LINE_DASH
- const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute();
-
- if(basegfx::fTools::more(rLine.getWidth(), 0.0))
- {
- const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute();
- basegfx::B2DPolyPolygon aHairLinePolyPolygon;
-
- if(0.0 == rStroke.getFullDotDashLen())
- {
- aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon());
- }
- else
- {
- basegfx::tools::applyLineDashing(
- rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(),
- &aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen());
- }
-
- const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLine.getColor()));
- mpOutputDevice->SetLineColor(Color(aHairlineColor));
- mpOutputDevice->SetFillColor();
-
- aHairLinePolyPolygon.transform(maCurrentTransformation);
-
- const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth()));
-
- for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)
- {
- const basegfx::B2DPolygon aCandidate(aHairLinePolyPolygon.getB2DPolygon(a));
-
- if(aCandidate.count() > 1)
- {
- const Polygon aToolsPolygon(aCandidate);
-
- mpMetaFile->AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo));
- }
- }
-
- bDone = true;
- }
- }
-
- if(!bDone)
- {
- // use decomposition (creates line geometry as filled polygon
- // geometry)
- process(rCandidate.get2DDecomposition(getViewInformation2D()));
- }
-
- impEndSvtGraphicStroke(pSvtGraphicStroke);
-
- // restore DrawMode
- mpOutputDevice->SetDrawMode(nOriginalDrawMode);
- }
break;
}
case PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D :
{
- // support SvtGraphicStroke MetaCommentAction
const primitive2d::PolygonStrokeArrowPrimitive2D& rStrokeArrowPrimitive = static_cast< const primitive2d::PolygonStrokeArrowPrimitive2D& >(rCandidate);
- SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokeArrowPrimitive.getB2DPolygon(), 0, &rStrokeArrowPrimitive.getLineAttribute(),
- &rStrokeArrowPrimitive.getStrokeAttribute(), &rStrokeArrowPrimitive.getStart(), &rStrokeArrowPrimitive.getEnd());
+ const basegfx::B2DPolygon& rBasePolygon = rStrokeArrowPrimitive.getB2DPolygon();
+
+ if(rBasePolygon.count() > (MAX_POLYGON_POINT_COUNT_METAFILE - 1))
+ {
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. If there are more, split the polygon in half and call recursively
+ basegfx::B2DPolygon aLeft, aRight;
+ splitLinePolygon(rBasePolygon, aLeft, aRight);
+ const attribute::LineStartEndAttribute aEmpty;
+ const primitive2d::PolygonStrokeArrowPrimitive2D aPLeft(
+ aLeft,
+ rStrokeArrowPrimitive.getLineAttribute(),
+ rStrokeArrowPrimitive.getStrokeAttribute(),
+ rStrokeArrowPrimitive.getStart(),
+ aEmpty);
+ const primitive2d::PolygonStrokeArrowPrimitive2D aPRight(
+ aRight,
+ rStrokeArrowPrimitive.getLineAttribute(),
+ rStrokeArrowPrimitive.getStrokeAttribute(),
+ aEmpty,
+ rStrokeArrowPrimitive.getEnd());
+
+ processBasePrimitive2D(aPLeft);
+ processBasePrimitive2D(aPRight);
+ }
+ else
+ {
+ // support SvtGraphicStroke MetaCommentAction
+ SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(
+ rBasePolygon, 0,
+ &rStrokeArrowPrimitive.getLineAttribute(),
+ &rStrokeArrowPrimitive.getStrokeAttribute(),
+ &rStrokeArrowPrimitive.getStart(),
+ &rStrokeArrowPrimitive.getEnd());
+
+ impStartSvtGraphicStroke(pSvtGraphicStroke);
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ impEndSvtGraphicStroke(pSvtGraphicStroke);
+ }
- impStartSvtGraphicStroke(pSvtGraphicStroke);
- process(rCandidate.get2DDecomposition(getViewInformation2D()));
- impEndSvtGraphicStroke(pSvtGraphicStroke);
break;
}
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
@@ -1146,16 +1285,26 @@ namespace drawinglayer
case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D :
{
// need to handle PolyPolygonBitmapPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
- SvtGraphicFill* pSvtGraphicFill = 0;
+ const primitive2d::PolyPolygonBitmapPrimitive2D& rBitmapCandidate = static_cast< const primitive2d::PolyPolygonBitmapPrimitive2D& >(rCandidate);
+ basegfx::B2DPolyPolygon aLocalPolyPolygon(rBitmapCandidate.getB2DPolyPolygon());
- if(!mnSvtGraphicFillCount)
+ if(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
{
- const primitive2d::PolyPolygonBitmapPrimitive2D& rBitmapCandidate = static_cast< const primitive2d::PolyPolygonBitmapPrimitive2D& >(rCandidate);
- basegfx::B2DPolyPolygon aLocalPolyPolygon(rBitmapCandidate.getB2DPolyPolygon());
- aLocalPolyPolygon.transform(maCurrentTransformation);
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. If there are more use the splitted polygon and call recursively
+ const primitive2d::PolyPolygonBitmapPrimitive2D aSplitted(
+ aLocalPolyPolygon,
+ rBitmapCandidate.getFillBitmap());
+
+ processBasePrimitive2D(aSplitted);
+ }
+ else
+ {
+ SvtGraphicFill* pSvtGraphicFill = 0;
- if(aLocalPolyPolygon.count())
+ if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
{
+ aLocalPolyPolygon.transform(maCurrentTransformation);
// calculate transformation. Get real object size, all values in FillBitmapAttribute
// are relative to the unified object
const attribute::FillBitmapAttribute& rFillBitmapAttribute = rBitmapCandidate .getFillBitmap();
@@ -1212,78 +1361,81 @@ namespace drawinglayer
0,
aFillGraphic);
}
- }
- // Do use decomposition; encapsulate with SvtGraphicFill
- impStartSvtGraphicFill(pSvtGraphicFill);
- process(rCandidate.get2DDecomposition(getViewInformation2D()));
- impEndSvtGraphicFill(pSvtGraphicFill);
+ // Do use decomposition; encapsulate with SvtGraphicFill
+ impStartSvtGraphicFill(pSvtGraphicFill);
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ impEndSvtGraphicFill(pSvtGraphicFill);
+ }
break;
}
case PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D :
{
// need to handle PolyPolygonHatchPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
- SvtGraphicFill* pSvtGraphicFill = 0;
const primitive2d::PolyPolygonHatchPrimitive2D& rHatchCandidate = static_cast< const primitive2d::PolyPolygonHatchPrimitive2D& >(rCandidate);
- const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch();
basegfx::B2DPolyPolygon aLocalPolyPolygon(rHatchCandidate.getB2DPolyPolygon());
+
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. Split polygon until there are less than that
+ while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
+ ;
+
+ SvtGraphicFill* pSvtGraphicFill = 0;
+ const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch();
aLocalPolyPolygon.transform(maCurrentTransformation);
- if(!mnSvtGraphicFillCount)
+ if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
{
- if(aLocalPolyPolygon.count())
- {
- // re-create a VCL hatch as base data
- SvtGraphicFill::HatchType eHatch(SvtGraphicFill::hatchSingle);
+ // re-create a VCL hatch as base data
+ SvtGraphicFill::HatchType eHatch(SvtGraphicFill::hatchSingle);
- switch(rFillHatchAttribute.getStyle())
+ switch(rFillHatchAttribute.getStyle())
+ {
+ default: // attribute::HATCHSTYLE_SINGLE :
{
- default: // attribute::HATCHSTYLE_SINGLE :
- {
- eHatch = SvtGraphicFill::hatchSingle;
- break;
- }
- case attribute::HATCHSTYLE_DOUBLE :
- {
- eHatch = SvtGraphicFill::hatchDouble;
- break;
- }
- case attribute::HATCHSTYLE_TRIPLE :
- {
- eHatch = SvtGraphicFill::hatchTriple;
- break;
- }
+ eHatch = SvtGraphicFill::hatchSingle;
+ break;
+ }
+ case attribute::HATCHSTYLE_DOUBLE :
+ {
+ eHatch = SvtGraphicFill::hatchDouble;
+ break;
+ }
+ case attribute::HATCHSTYLE_TRIPLE :
+ {
+ eHatch = SvtGraphicFill::hatchTriple;
+ break;
}
-
- SvtGraphicFill::Transform aTransform;
-
- // scale
- aTransform.matrix[0] *= rFillHatchAttribute.getDistance();
- aTransform.matrix[4] *= rFillHatchAttribute.getDistance();
-
- // rotate (was never correct in impgrfll anyways, use correct angle now)
- aTransform.matrix[0] *= cos(rFillHatchAttribute.getAngle());
- aTransform.matrix[1] *= -sin(rFillHatchAttribute.getAngle());
- aTransform.matrix[3] *= sin(rFillHatchAttribute.getAngle());
- aTransform.matrix[4] *= cos(rFillHatchAttribute.getAngle());
-
- pSvtGraphicFill = new SvtGraphicFill(
- PolyPolygon(aLocalPolyPolygon),
- Color(),
- 0.0,
- SvtGraphicFill::fillEvenOdd,
- SvtGraphicFill::fillHatch,
- aTransform,
- false,
- eHatch,
- Color(rFillHatchAttribute.getColor()),
- SvtGraphicFill::gradientLinear,
- Color(),
- Color(),
- 0,
- Graphic());
}
+
+ SvtGraphicFill::Transform aTransform;
+
+ // scale
+ aTransform.matrix[0] *= rFillHatchAttribute.getDistance();
+ aTransform.matrix[4] *= rFillHatchAttribute.getDistance();
+
+ // rotate (was never correct in impgrfll anyways, use correct angle now)
+ aTransform.matrix[0] *= cos(rFillHatchAttribute.getAngle());
+ aTransform.matrix[1] *= -sin(rFillHatchAttribute.getAngle());
+ aTransform.matrix[3] *= sin(rFillHatchAttribute.getAngle());
+ aTransform.matrix[4] *= cos(rFillHatchAttribute.getAngle());
+
+ pSvtGraphicFill = new SvtGraphicFill(
+ PolyPolygon(aLocalPolyPolygon),
+ Color(),
+ 0.0,
+ SvtGraphicFill::fillEvenOdd,
+ SvtGraphicFill::fillHatch,
+ aTransform,
+ false,
+ eHatch,
+ Color(rFillHatchAttribute.getColor()),
+ SvtGraphicFill::gradientLinear,
+ Color(),
+ Color(),
+ 0,
+ Graphic());
}
// Do use decomposition; encapsulate with SvtGraphicFill
@@ -1304,18 +1456,24 @@ namespace drawinglayer
basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800)));
impEndSvtGraphicFill(pSvtGraphicFill);
+
break;
}
case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D :
{
const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
+ basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
+
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. Split polygon until there are less than that
+ while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
+ ;
// for support of MetaCommentActions of the form XGRAD_SEQ_BEGIN, XGRAD_SEQ_END
// it is safest to use the VCL OutputDevice::DrawGradient method which creates those.
// re-create a VCL-gradient from FillGradientPrimitive2D and the needed tools PolyPolygon
Gradient aVCLGradient;
impConvertFillGradientAttributeToVCLGradient(aVCLGradient, rGradientCandidate.getFillGradient(), false);
- basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
aLocalPolyPolygon.transform(maCurrentTransformation);
// #i82145# ATM VCL printing of gradients using curved shapes does not work,
@@ -1373,13 +1531,20 @@ namespace drawinglayer
// NO usage of common own gradient randerer, not used ATM for VCL MetaFile, see text above
// RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate));
+
break;
}
case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
{
const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate));
- const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor()));
basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
+
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. Split polygon until there are less than that
+ while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
+ ;
+
+ const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor()));
aLocalPolyPolygon.transform(maCurrentTransformation);
// XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support
@@ -1547,6 +1712,13 @@ namespace drawinglayer
// single transparent PolyPolygon identified, use directly
const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor()));
basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon());
+
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. Split polygon until there are less than that
+ while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
+ ;
+
+ // now transform
aLocalPolyPolygon.transform(maCurrentTransformation);
// XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support
@@ -1796,7 +1968,7 @@ namespace drawinglayer
}
break;
}
- case PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D :
+ case PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D :
{
// structured tag primitive
const primitive2d::StructureTagPrimitive2D& rStructureTagCandidate = static_cast< const primitive2d::StructureTagPrimitive2D& >(rCandidate);
diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx
index 0e6ae868af..ca7d461114 100644
--- a/editeng/source/editeng/editattr.cxx
+++ b/editeng/source/editeng/editattr.cxx
@@ -266,10 +266,6 @@ EditCharAttribEscapement::EditCharAttribEscapement( const SvxEscapementItem& rAt
DBG_ASSERT( rAttr.Which() == EE_CHAR_ESCAPEMENT, "Kein Escapementattribut!" );
}
-#if defined( WIN ) && !defined( WNT )
-#pragma optimize ("", off)
-#endif
-
void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* )
{
USHORT nProp = ((const SvxEscapementItem*)GetItem())->GetProp();
@@ -283,11 +279,6 @@ void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* )
rFont.SetEscapement( nEsc );
}
-#if defined( WIN ) && !defined( WNT )
-#pragma optimize ("", on)
-#endif
-
-
// -------------------------------------------------------------------------
// class EditCharAttribOutline
// -------------------------------------------------------------------------
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index c892117d0b..decb2dda5a 100755
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1044,7 +1044,8 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
{
PopupMenu aPopupMenu( EditResId( RID_MENU_SPELL ) );
PopupMenu *pAutoMenu = aPopupMenu.GetPopupMenu( MN_AUTOCORR );
- PopupMenu *pInsertMenu = aPopupMenu.GetPopupMenu( MN_INSERT );
+ PopupMenu *pInsertMenu = aPopupMenu.GetPopupMenu( MN_INSERT ); // add word to user-dictionaries
+ pInsertMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); //! necessary to retrieve the correct dictionary names later
EditPaM aPaM2( aPaM );
aPaM2.GetIndex()++;
@@ -1261,7 +1262,12 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
}
else if ( nId >= MN_DICTSTART )
{
- Reference< XDictionary > xDic( pDic[nId - MN_DICTSTART], UNO_QUERY );
+ String aDicName ( pInsertMenu->GetItemText(nId) );
+
+ uno::Reference< linguistic2::XDictionary > xDic;
+ if (xDicList.is())
+ xDic = xDicList->getDictionaryByName( aDicName );
+
if (xDic.is())
xDic->add( aSelected, sal_False, String() );
// save modified user-dictionary if it is persistent
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index e0e780c784..fedfb0d367 100755
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -4209,18 +4209,8 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, USHORT
DBG_ERROR("svx::ImpEditEngine::GetXPos(), index out of range!");
}
-#if 0
+ // old code restored see #i112788 (which leaves #i74188 unfixed again)
long nPosInPortion = pLine->GetCharPosArray().GetObject( nPos );
-#else
- // #i74188# (positioning the cursor after deleting components of combined indic characters)
- SvxFont aTmpFont( pParaPortion->GetNode()->GetCharAttribs().GetDefFont() );
- SeekCursor( pParaPortion->GetNode(), nPos+1, aTmpFont );
- aTmpFont.SetPhysFont( GetRefDevice() );
- ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
- String sSegment(*pParaPortion->GetNode(), pLine->GetStart(), nPos+1);
- long nPosInPortion = aTmpFont.QuickGetTextSize( GetRefDevice(),
- sSegment, 0, nPos+1, NULL ).Width();
-#endif
if ( !pPortion->IsRightToLeft() )
{
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 6fc80acf06..9b09b563be 100755
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1458,7 +1458,11 @@ Reference< XSpellChecker1 > ImpEditEngine::GetSpeller()
SpellInfo * ImpEditEngine::CreateSpellInfo( const EditSelection &rSel, bool bMultipleDocs )
{
- pSpellInfo = new SpellInfo;
+ if (!pSpellInfo)
+ pSpellInfo = new SpellInfo;
+ else
+ *pSpellInfo = SpellInfo(); // reset to default values
+
pSpellInfo->bMultipleDoc = bMultipleDocs;
EditSelection aSentenceSel( SelectSentence( rSel ) );
// pSpellInfo->aSpellStart = CreateEPaM( aSentenceSel.Min() );
@@ -2023,7 +2027,6 @@ bool ImpEditEngine::SpellSentence(EditView& rEditView,
#else
bool bRet = false;
EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() );
- //the pSpellInfo has to be created on demand
if(!pSpellInfo)
pSpellInfo = CreateSpellInfo( aCurSel, true );
pSpellInfo->aCurSentenceStart = aCurSel.Min();
@@ -2191,8 +2194,12 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
{
#ifdef SVX_LIGHT
#else
+ // Note: rNewPortions.size() == 0 is valid and happens when the whole
+ // sentence got removed in the dialog
+
DBG_ASSERT(pSpellInfo, "pSpellInfo not initialized");
- if(pSpellInfo)
+ if (pSpellInfo &&
+ pSpellInfo->aLastSpellPortions.size() > 0) // no portions -> no text to be changed
{
// get current paragraph length to calculate later on how the sentence length changed,
// in order to place the cursor at the end of the sentence again
@@ -2202,6 +2209,10 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
UndoActionStart( EDITUNDO_INSERT );
if(pSpellInfo->aLastSpellPortions.size() == rNewPortions.size())
{
+ DBG_ASSERT( rNewPortions.size() > 0, "rNewPortions should not be empty here" );
+ DBG_ASSERT( pSpellInfo->aLastSpellPortions.size() == pSpellInfo->aLastSpellContentSelections.size(),
+ "aLastSpellPortions and aLastSpellContentSelections size mismatch" );
+
//the simple case: the same number of elements on both sides
//each changed element has to be applied to the corresponding source element
svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
@@ -2252,6 +2263,8 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
}
else
{
+ DBG_ASSERT( pSpellInfo->aLastSpellContentSelections.size() > 0, "aLastSpellContentSelections should not be empty here" );
+
//select the complete sentence
SpellContentSelections::const_iterator aCurrentEndPosition = pSpellInfo->aLastSpellContentSelections.end();
--aCurrentEndPosition;
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index e0440e424c..7f66d10d17 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -45,10 +45,6 @@
|*
*************************************************************************/
-#ifdef WIN
-#pragma optimize ( "", off )
-#endif
-
TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon,
USHORT nCacheSz, USHORT nLft, USHORT nRght, BOOL bSimpl, BOOL bInnr,
BOOL bVert ) :
@@ -97,10 +93,6 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const baseg
mpLinePolyPolygon = NULL;
}
-#ifdef WIN
-#pragma optimize ( "", on )
-#endif
-
/*************************************************************************
|*
|* TextRanger::~TextRanger()
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index 7aefa78f98..60ef854c56 100644..100755
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -1197,7 +1197,10 @@ uno::Reference< XDictionary > LinguMgr::GetStandard()
// add new dictionary to list
if (xTmp.is())
+ {
xTmpDicList->addDictionary( xTmp );
+ xTmp->setActive( sal_True );
+ }
xDic = uno::Reference< XDictionary > ( xTmp, UNO_QUERY );
}
#if OSL_DEBUG_LEVEL > 1
diff --git a/formula/inc/formula/errorcodes.hxx b/formula/inc/formula/errorcodes.hxx
index f9b04e012f..1593f710b4 100644
--- a/formula/inc/formula/errorcodes.hxx
+++ b/formula/inc/formula/errorcodes.hxx
@@ -64,7 +64,8 @@ const USHORT errInterpOverflow = 527;
// Not displayed, temporary for TrackFormulas,
// Cell depends on another cell that has errCircularReference
const USHORT errTrackFromCircRef = 528;
-// Interpreter internal: existing cell has no value but value queried
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// set as mnStringNoValueError no error is generated but 0 returned.
const USHORT errCellNoValue = 529;
// Interpreter: needed AddIn not found
const USHORT errNoAddin = 530;
@@ -74,6 +75,11 @@ const USHORT errNoMacro = 531;
const USHORT errDivisionByZero = 532; // #DIV/0!
// Compiler: a non-simple (str,err,val) value was put in an array
const USHORT errNestedArray = 533;
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// temporarily (!) set as mnStringNoValueError, the error is generated and can
+// be used to distinguish that condition from all other (inherited) errors. Do
+// not use for anything else! Never push or inherit the error otherwise!
+const USHORT errNotNumericString = 534;
// Interpreter: NA() not available condition, not a real error
const USHORT NOTAVAILABLE = 0x7fff;
diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
index 8ae2017935..a80c707c1a 100644
--- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
+++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
@@ -33,13 +33,13 @@
//------------------------------------------------------------------------
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <cppuhelper/interfacecontainer.h>
#include <osl/diagnose.h>
+#include <osl/process.h>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
#include <com/sun/star/uno/Any.hxx>
@@ -126,41 +126,8 @@ void SalGtkFilePicker::InitialMapping()
gtk_widget_set_size_request (m_pPreview, -1, -1);
}
-static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr)
-{
- static bool bSet = false;
- if (bSet)
- return;
-
- OUString sUILocale;
- try
- {
- uno::Reference<lang::XMultiServiceFactory> xConfigMgr =
- uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance(
- OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
- UNO_QUERY_THROW );
-
- Sequence< Any > theArgs(1);
- theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General");
-
- uno::Reference< container::XNameAccess > xNameAccess =
- uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments(
- OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ),
- UNO_QUERY_THROW );
-
- if (xNameAccess.is())
- xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale;
- } catch (...) {}
-
- if (sUILocale.getLength())
- {
- sUILocale = rtl::OUString::createFromAscii("LANGUAGE=") + sUILocale.replace('-', '_');
- putenv(strdup(rtl::OUStringToOString(sUILocale, osl_getThreadTextEncoding()).getStr()));
- }
- bSet = true;
-}
-
SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) :
+ SalGtkPicker(xServiceMgr),
cppu::WeakComponentImplHelper10<
XFilterManager,
XFilterGroupManager,
@@ -184,8 +151,6 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact
m_PreviewImageWidth( 256 ),
m_PreviewImageHeight( 256 )
{
- lcl_setGTKLanguage(xServiceMgr);
-
int i;
for( i = 0; i < TOGGLE_LAST; i++ )
@@ -935,6 +900,9 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw
{
static const OUString aStarDot = OUString::createFromAscii( "*." );
+ ::rtl::OUString aNewFilter;
+ ::rtl::OUString aOldFilter = getCurrentFilter();
+ sal_Bool bChangeFilter = sal_True;
for ( FilterList::iterator aListIter = m_pFilterList->begin();
aListIter != m_pFilterList->end();
++aListIter
@@ -942,11 +910,17 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw
{
if( aListIter->getFilter().indexOf( aStarDot+sExtension ) >= 0 )
{
- setCurrentFilter( aListIter->getTitle() );
+ if( !aNewFilter.getLength() )
+ aNewFilter = aListIter->getTitle();
+
+ if( aOldFilter == aListIter->getTitle() )
+ bChangeFilter = sal_False;
+
bExtensionTypedIn = true;
- break;
}
}
+ if( bChangeFilter )
+ setCurrentFilter( aNewFilter );
}
}
diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
index 956d3bfc5c..63f2659cc4 100644
--- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
+++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
@@ -84,7 +84,8 @@ namespace
// constructor
//-----------------------------------------------------------------------------------------
SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) :
- m_xServiceMgr( xServiceMgr )
+ SalGtkPicker(xServiceMgr),
+ m_xServiceMgr(xServiceMgr)
{
CResourceProvider aResProvider;
diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx
index c5a977bcbc..29bb3989fe 100644
--- a/fpicker/source/unx/gnome/SalGtkPicker.cxx
+++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
#include <com/sun/star/awt/SystemDependentXWindow.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <rtl/process.h>
@@ -202,6 +203,46 @@ gint RunDialog::run()
return nStatus;
}
+static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr)
+{
+ static bool bSet = false;
+ if (bSet)
+ return;
+
+ OUString sUILocale;
+ try
+ {
+ uno::Reference<lang::XMultiServiceFactory> xConfigMgr =
+ uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
+ UNO_QUERY_THROW );
+
+ Sequence< Any > theArgs(1);
+ theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General");
+
+ uno::Reference< container::XNameAccess > xNameAccess =
+ uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ),
+ UNO_QUERY_THROW );
+
+ if (xNameAccess.is())
+ xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale;
+ } catch (...) {}
+
+ if (sUILocale.getLength())
+ {
+ sUILocale = sUILocale.replace('-', '_');
+ rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("LANGUAGE"));
+ osl_setEnvironment(envVar.pData, sUILocale.pData);
+ }
+ bSet = true;
+}
+
+SalGtkPicker::SalGtkPicker(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) : m_pDialog(0)
+{
+ lcl_setGTKLanguage(xServiceMgr);
+}
+
SalGtkPicker::~SalGtkPicker()
{
if (m_pDialog)
diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx
index 87c0cb9ea0..2bab164725 100644
--- a/fpicker/source/unx/gnome/SalGtkPicker.hxx
+++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx
@@ -53,7 +53,7 @@
class SalGtkPicker
{
public:
- SalGtkPicker() : m_pDialog(0) {}
+ SalGtkPicker(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceMgr);
virtual ~SalGtkPicker();
protected:
osl::Mutex m_rbHelperMtx;
diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
index 31c251a31e..744e19f3ab 100644
--- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
@@ -46,6 +46,8 @@
#include <vcl/sysdata.hxx>
#include <vcl/syswin.hxx>
+#include "osl/file.h"
+
#include "KDE4FilePicker.hxx"
#include "FPServiceInfo.hxx"
@@ -246,7 +248,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles()
// kde file picker returns the file and directories for selectedFiles()
// when a file is double clicked
// make a true list of files
- const QString dir = "file://" + KUrl(rawFiles[0]).directory();
+ const QString dir = KUrl(rawFiles[0]).directory();
bool singleFile = true;
if (rawFiles.size() > 1)
@@ -262,7 +264,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles()
{
// if the raw file is not the base directory (see above kde bug)
// we add the file to list of avail files
- if ((dir + "/") != ("file://" + rawFiles[i]))
+ if ((dir + "/") != ( rawFiles[i]))
{
QString filename = KUrl(rawFiles[i]).fileName();
@@ -280,7 +282,11 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles()
// add all files and leading directory to outgoing OO sequence
uno::Sequence< ::rtl::OUString > seq(files.size());
for (int i = 0; i < files.size(); ++i)
- seq[i] = toOUString(files[i]);
+ {
+ rtl::OUString aFile(toOUString(files[i])), aURL;
+ osl_getFileURLFromSystemPath(aFile.pData, &aURL.pData );
+ seq[i] = aURL;
+ }
return seq;
}
diff --git a/framework/inc/macros/debug/memorymeasure.hxx b/framework/inc/macros/debug/memorymeasure.hxx
index e4106a3fa8..4ed1603b62 100644
--- a/framework/inc/macros/debug/memorymeasure.hxx
+++ b/framework/inc/macros/debug/memorymeasure.hxx
@@ -37,7 +37,7 @@
#ifdef ENABLE_MEMORYMEASURE
- #if !defined( WIN ) && !defined( WNT )
+ #if !defined( WNT )
#error "Macros to measure memory access not available under platforms different from windows!"
#endif
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index a865516b94..34c799f6d3 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -96,6 +96,8 @@
#include <svtools/acceleratorexecute.hxx>
+#include <stdio.h>
+
//_______________________________________________
// const
@@ -1248,7 +1250,6 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util:
const sal_Int32 c = aEvent.Changes.getLength();
sal_Int32 i = 0;
-
for (i=0; i<c; ++i)
{
const css::util::ElementChange& aChange = aEvent.Changes[i];
@@ -1264,27 +1265,25 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util:
aChange.Accessor >>= sOrgPath;
sPath = sOrgPath;
- ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sPrimarySecondary);
-
- ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sGlobalModules);
-
+ ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+ ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+
if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
{
::rtl::OUString sModule;
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- if ( sKey.getLength() )
+ sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+ if (( sKey.getLength() > 0 ) && ( sPath.getLength() > 0 ))
reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
}
else if ( sGlobalModules.equals(CFG_ENTRY_MODULES) )
{
- ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath);
- ::rtl::OUString sDropModule = ::rtl::OUString::createFromAscii("Module['") + sModule + ::rtl::OUString::createFromAscii("']");
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sDropModule);
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- if ( sKey.getLength() )
+ ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+ sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+
+ if (( sKey.getLength() > 0 ) && ( sPath.getLength() > 0 ))
+ {
reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
+ }
}
}
}
@@ -1385,8 +1384,8 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const
aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
else if (sToken[k].equalsAscii("MOD2"))
aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
- else if (sToken[k].equalsAscii("MOD3"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
+ else if (sToken[k].equalsAscii("MOD3"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
else
{
bValid = sal_False;
diff --git a/idl/source/cmptools/hash.cxx b/idl/source/cmptools/hash.cxx
index d4305a0b3b..ac6fe446ad 100644
--- a/idl/source/cmptools/hash.cxx
+++ b/idl/source/cmptools/hash.cxx
@@ -141,10 +141,6 @@ BOOL SvHashTable::Test_Insert( const void * pElement, BOOL bInsert,
SvStringHashTable::SvStringHashTable( UINT32 nMaxEntries )
: SvHashTable( nMaxEntries )
{
-#ifdef WIN
- DBG_ASSERT( (UINT32)nMaxEntries * sizeof( SvStringHashEntry ) <= 0xFF00,
- "Hash table size cannot exeed 64k byte" )
-#endif
pEntries = new SvStringHashEntry[ nMaxEntries ];
// RefCount auf eins setzen
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx
index a82da6cf5d..65df6d529d 100644
--- a/idl/source/cmptools/lex.cxx
+++ b/idl/source/cmptools/lex.cxx
@@ -146,11 +146,7 @@ SvToken & SvToken::operator = ( const SvToken & rObj )
*************************************************************************/
void SvTokenStream::InitCtor()
{
-#ifdef DOS
- SetCharSet( CHARSET_ANSI );
-#else
SetCharSet( gsl_getSystemTextEncoding() );
-#endif
aStrTrue = "TRUE";
aStrFalse = "FALSE";
nLine = nColumn = 0;
@@ -251,11 +247,7 @@ void SvTokenStream::SetCharSet( CharSet nSet )
{
nCharSet = nSet;
-#ifdef DOS
- pCharTab = SvChar::GetTable( nSet, CHARSET_ANSI );
-#else
pCharTab = SvChar::GetTable( nSet, gsl_getSystemTextEncoding() );
-#endif
}
/*************************************************************************
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index 320fd20cad..cc4e5d48c0 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -697,10 +697,8 @@ SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm )
*************************************************************************/
void SvIdlDataBase::Write( const ByteString & rText )
{
-#ifndef W31
if( nVerbosity != 0 )
fprintf( stdout, "%s", rText.GetBuffer() );
-#endif
}
/*************************************************************************
@@ -714,7 +712,6 @@ void SvIdlDataBase::WriteError( const ByteString & rErrWrn,
ULONG nRow, ULONG nColumn ) const
{
//Fehlerbehandlung
-#ifndef W31
fprintf( stderr, "\n%s --- %s: ( %ld, %ld )\n",
rFileName.GetBuffer(), rErrWrn.GetBuffer(), nRow, nColumn );
@@ -722,7 +719,6 @@ void SvIdlDataBase::WriteError( const ByteString & rErrWrn,
{ // Fehler gesetzt
fprintf( stderr, "\t%s\n", rErrorText.GetBuffer() );
}
-#endif
}
/*************************************************************************
@@ -733,7 +729,6 @@ void SvIdlDataBase::WriteError( const ByteString & rErrWrn,
void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
{
//Fehlerbehandlung
-#ifndef W31
String aFileName( rInStm.GetFileName() );
ByteString aErrorText;
ULONG nRow = 0, nColumn = 0;
@@ -793,7 +788,6 @@ void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
if( aN.Len() )
fprintf( stderr, "%s versus %s\n", pTok->GetString().GetBuffer(), aN.GetBuffer() );
}
-#endif
}
/****************** SvIdlWorkingBase ****************************************/
diff --git a/idl/source/prj/globals.cxx b/idl/source/prj/globals.cxx
index b943b56f22..f28b403253 100644
--- a/idl/source/prj/globals.cxx
+++ b/idl/source/prj/globals.cxx
@@ -35,15 +35,6 @@
#include <database.hxx>
/****************** G L O B A L S ****************************************/
-#ifdef DOS
-static IdlDll * pApp = NULL;
-IdlDll * GetIdlApp()
-{
- if( !pApp )
- pApp = new IdlDll();
- return pApp;
-}
-#else
IdlDll * GetIdlApp()
{
if( !(*(IdlDll**)GetAppData(SHL_IDL)) )
@@ -55,7 +46,6 @@ IdlDll * GetIdlApp()
}
return (*(IdlDll**)GetAppData(SHL_IDL));
}
-#endif
IdlDll::IdlDll()
: pHashTable( NULL )
diff --git a/idl/source/prj/makefile.mk b/idl/source/prj/makefile.mk
index 3e0a55a7fd..c33d2e9f3d 100644
--- a/idl/source/prj/makefile.mk
+++ b/idl/source/prj/makefile.mk
@@ -41,7 +41,6 @@ CDEFS+=-DIDL_COMPILER
OBJFILES= $(OBJ)$/command.obj \
$(OBJ)$/svidl.obj \
$(OBJ)$/globals.obj \
- $(OBJ)$/idldll.obj \
$(OBJ)$/database.obj
# --- Targets ------------------------------------------------------------
diff --git a/officecfg/registry/data/org/openoffice/Office/Math.xcu b/officecfg/registry/data/org/openoffice/Office/Math.xcu
index 3acc948129..b040267907 100644..100755
--- a/officecfg/registry/data/org/openoffice/Office/Math.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Math.xcu
@@ -48,6 +48,8 @@
<value>0</value>
</prop>
</node>
+
+ <!-- only used for symbols with the 'Greek' symbol set name -->
<node oor:name="Id2" oor:op="replace">
<prop oor:name="Name">
<value>OpenSymbol</value>
@@ -65,10 +67,11 @@
<value>0</value>
</prop>
<prop oor:name="Italic">
- <value>2</value>
+ <value>0</value>
</prop>
</node>
</node>
+
<node oor:name="SymbolList">
<node oor:name="alpha" oor:op="replace">
<prop oor:name="Char">
diff --git a/officecfg/registry/data/org/openoffice/Office/Paths.xcu b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
index 8fef51ca23..686682ff93 100644
--- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
@@ -169,7 +169,8 @@
<node oor:name="Fingerprint" oor:op="fuse" oor:mandatory="true">
<node oor:name="InternalPaths">
- <node oor:name="$(insturl)/share/fingerprint" oor:op="fuse" />
+ <node install:module="internallibtextcatdata" oor:name="$(insturl)/share/fingerprint" oor:op="fuse"/>
+ <node install:module="externallibtextcatdata" oor:name="${SYSTEM_LIBTEXTCAT_DATA}" oor:op="fuse"/>
</node>
</node>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 33e5109405..5c72d94843 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd">
<oor:component-data oor:name="CalcCommands" oor:package="org.openoffice.Office.UI" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="UserInterface">
@@ -160,6 +160,14 @@
<value xml:lang="en-US">~Select...</value>
</prop>
</node>
+ <node oor:name=".uno:TableEvents" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Sheet ~Events...</value>
+ </prop>
+ <prop oor:name="ContextLabel" oor:type="xs:string">
+ <value xml:lang="en-US">~Events...</value>
+ </prop>
+ </node>
<node oor:name=".uno:DataPilotFilter" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">DataPilot Filter</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 175867d07d..2efbaaa703 100644..100755
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1463,9 +1463,6 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Find Text</value>
</prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
</node>
<node oor:name=".uno:DownSearch" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
@@ -1487,9 +1484,6 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Focus to Findbar</value>
</prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
</node>
<node oor:name=".uno:ExtendedHelp" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
@@ -2139,9 +2133,6 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Sentence case</value>
</prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
</node>
<node oor:name=".uno:ChangeCaseToLower" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
@@ -2163,17 +2154,11 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Capitalize Every Word</value>
</prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
</node>
<node oor:name=".uno:ChangeCaseToToggleCase" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~tOGGLE cASE</value>
</prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
</node>
<node oor:name=".uno:ChangeCaseToHalfWidth" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
diff --git a/officecfg/registry/data/org/openoffice/Office/makefile.mk b/officecfg/registry/data/org/openoffice/Office/makefile.mk
index e65b03371d..2af1e8629b 100644
--- a/officecfg/registry/data/org/openoffice/Office/makefile.mk
+++ b/officecfg/registry/data/org/openoffice/Office/makefile.mk
@@ -87,6 +87,8 @@ MODULEFILES= \
Paths-macosx.xcu \
Paths-unxwnt.xcu \
Paths-unixdesktop.xcu \
+ Paths-internallibtextcatdata.xcu \
+ Paths-externallibtextcatdata.xcu \
Writer-cjk.xcu \
Impress-ogltrans.xcu \
Embedding-calc.xcu \
diff --git a/officecfg/registry/schema/org/openoffice/Office/Math.xcs b/officecfg/registry/schema/org/openoffice/Office/Math.xcs
index caa8726b7c..31f6e00a23 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Math.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Math.xcs
@@ -402,7 +402,28 @@
</info>
<value>false</value>
</prop>
- <prop oor:name="ScaleNormalBracket" oor:type="xs:boolean">
+ <prop oor:name="GreekCharStyle" oor:type="xs:short">
+ <!-- UIHints: n/a yet -->
+ <info>
+ <author>TL</author>
+ <desc>Specifies the default layout for symbols from the 'Greek' symbol set.</desc>
+ <label>Greek character style</label>
+ </info>
+ <constraints>
+ <minInclusive oor:value="0">
+ <info>
+ <desc>Specifies the minimum value allowed</desc>
+ </info>
+ </minInclusive>
+ <maxInclusive oor:value="2">
+ <info>
+ <desc>Specifies the maximum value allowed</desc>
+ </info>
+ </maxInclusive>
+ </constraints>
+ <value>0</value>
+ </prop>
+ <prop oor:name="ScaleNormalBracket" oor:type="xs:boolean">
<!-- OldPath: Math/StandardFormat -->
<!-- OldLocation: Soffice.cfg -->
<!-- UIHints: Format - Spacing - Category - Brackets - Scale all brackets -->
diff --git a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs
index 7b0b221f15..7ff9146472 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>2</value>
+ <value>1</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 6157d38079..2a9830568d 100644
--- a/oovbaapi/ooo/vba/XApplicationBase.idl
+++ b/oovbaapi/ooo/vba/XApplicationBase.idl
@@ -24,21 +24,15 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_XApplicationBase_idl__
#define __ooo_vba_XApplicationBase_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 ooo { module vba {
+//=============================================================================
interface XApplicationBase
{
@@ -47,8 +41,9 @@ interface XApplicationBase
[attribute] boolean ScreenUpdating;
[attribute] boolean DisplayStatusBar;
[attribute] boolean Interactive;
+ [attribute] boolean Visible;
+
[attribute, readonly] string Version;
- //mbn
[attribute, readonly] any VBE;
[attribute, readonly] any VBProjects;
@@ -61,6 +56,8 @@ interface XApplicationBase
void Undo();
};
+//=============================================================================
+
}; };
#endif
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index e7b9aee618..ac1f4c4ee0 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -64,6 +64,7 @@ interface XApplication
[attribute] any CutCopyMode;
[attribute] any StatusBar;
[attribute] long Cursor;
+ [attribute] boolean EnableEvents;
void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException);
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index f59c9eb345..07e9f23d4b 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -114,6 +114,7 @@ interface XWorksheet
XRange Rows([in] any aIndex);
XRange Columns([in] any aIndex);
any Hyperlinks( [in] any aIndex );
+ any Names( [in] any Index );
any Evaluate( [in] string Name);
diff --git a/oovbaapi/ooo/vba/excel/makefile.mk b/oovbaapi/ooo/vba/excel/makefile.mk
index 12dcf025e4..2515880867 100644
--- a/oovbaapi/ooo/vba/excel/makefile.mk
+++ b/oovbaapi/ooo/vba/excel/makefile.mk
@@ -29,7 +29,7 @@ PRJ=..$/..$/..
PRJNAME=oovapi
TARGET=excel
-PACKAGE=ooo$/vba$/Excel
+PACKAGE=ooo$/vba$/excel
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk
index 75f6465bf4..4f6d378cfe 100644
--- a/oovbaapi/ooo/vba/makefile.mk
+++ b/oovbaapi/ooo/vba/makefile.mk
@@ -61,9 +61,8 @@ IDLFILES=\
XFontBase.idl\
XDialogsBase.idl\
XDialogBase.idl\
- XPageSetupBase.idl \
- XVBAAppService.idl\
- XVBADocService.idl\
+ XPageSetupBase.idl
+
# ------------------------------------------------------------------
.ENDIF
.INCLUDE : target.mk
diff --git a/oovbaapi/ooo/vba/word/makefile.mk b/oovbaapi/ooo/vba/word/makefile.mk
index e3a19e6784..543e99f7c5 100644
--- a/oovbaapi/ooo/vba/word/makefile.mk
+++ b/oovbaapi/ooo/vba/word/makefile.mk
@@ -29,7 +29,7 @@ PRJ=..$/..$/..
PRJNAME=oovapi
TARGET=word
-PACKAGE=ooo$/vba$/Word
+PACKAGE=ooo$/vba$/word
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
diff --git a/oovbaapi/prj/d.lst b/oovbaapi/prj/d.lst
index ac5924e2d6..86e801a15d 100644
--- a/oovbaapi/prj/d.lst
+++ b/oovbaapi/prj/d.lst
@@ -8,7 +8,7 @@ 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\*.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
diff --git a/readlicense_oo/util/makefile.pmk b/readlicense_oo/util/makefile.pmk
index 30e0777945..0efd9712f1 100755
--- a/readlicense_oo/util/makefile.pmk
+++ b/readlicense_oo/util/makefile.pmk
@@ -57,7 +57,7 @@ $(MISC)$/readme_text.xsl : virtual
$(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual'
@@-$(MKDIRHIER) $(@:d)
- $(XSLTPROC) --nonet -o $@ \
+ $(XSLTPROC) --nonet --novalid -o $@ \
--stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \
--stringparam cp1 $(CPUNAME) --stringparam type html --stringparam lang1 $* \
..$/readme.xsl $(MERGEDXRM)
@@ -67,7 +67,7 @@ $(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual'
$(MISC)$/$(GUI)$/$(eq,$(GUI),OS2 readme README)_%.html : 'virtual'
@@-$(MKDIRHIER) $(@:d)
- $(XSLTPROC) --nonet -o $@ \
+ $(XSLTPROC) --nonet --novalid -o $@ \
--stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \
--stringparam cp1 $(CPUNAME) --stringparam type html --stringparam lang1 $* \
..$/readme.xsl $(MERGEDXRM)
@@ -75,7 +75,7 @@ $(MISC)$/$(GUI)$/$(eq,$(GUI),OS2 readme README)_%.html : 'virtual'
# no percent-rule to avoid ambiguous inference chains for README_<lang>.html
$(SYSTEXTDOCS) : $(MISC)$/readme_text.xsl
@@-$(MKDIRHIER) $(@:d)
- $(XSLTPROC) --nonet -o $@ \
+ $(XSLTPROC) --nonet --novalid -o $@ \
--stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \
--stringparam cp1 $(CPUNAME) --stringparam type text --stringparam lang1 $(@:b:s/readme_//:s/README_//) \
$< $(MERGEDXRM)
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 49c07a4787..e9e12993c4 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -766,6 +766,31 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
return xDialog;
}
+ Reference < XDialog > DialogProviderImpl::createDialogWithArguments(
+ const ::rtl::OUString& URL, const Sequence< NamedValue >& Arguments )
+ throw (IllegalArgumentException, RuntimeException)
+ {
+ ::comphelper::NamedValueCollection aArguments( Arguments );
+
+ Reference< XWindowPeer > xParentPeer;
+ if ( aArguments.has( "ParentWindow" ) )
+ {
+ const Any aParentWindow( aArguments.get( "ParentWindow" ) );
+ if ( !( aParentWindow >>= xParentPeer ) )
+ {
+ const Reference< XControl > xParentControl( aParentWindow, UNO_QUERY );
+ if ( xParentControl.is() )
+ xParentPeer = xParentControl->getPeer();
+ }
+ }
+
+ const Reference< XInterface > xHandler( aArguments.get( "EventHandler" ), UNO_QUERY );
+
+ Reference < XControl > xControl = DialogProviderImpl::createDialogImpl( URL, xHandler, xParentPeer, true );
+ Reference< XDialog > xDialog( xControl, UNO_QUERY );
+ return xDialog;
+ }
+
Reference< XWindow > DialogProviderImpl::createContainerWindow(
const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
const Reference< XWindowPeer >& xParent, const Reference< XInterface >& xHandler )
diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx
index 098e1d9378..82faef2f86 100644
--- a/scripting/source/dlgprov/dlgprov.hxx
+++ b/scripting/source/dlgprov/dlgprov.hxx
@@ -138,6 +138,11 @@ namespace dlgprov
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialogWithArguments(
+ const ::rtl::OUString& URL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createContainerWindow(
const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index 55c204f87d..6592a59d18 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -153,8 +153,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if len(textbody):
mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType)
- if mimeEncoding.find('charset=UTF-8') == -1:
- mimeEncoding = mimeEncoding + "; charset=UTF-8"
+ 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)
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index cd43e0989d..cdca4fe812 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -62,7 +62,6 @@ class Timer;
class SfxItemSet;
class DateTime;
class SvStringsDtor;
-class SvEaMgr;
#define S2BS(s) ByteString( s, RTL_TEXTENCODING_MS_1252 )
@@ -208,8 +207,6 @@ public:
SvStream* GetInStream();
SvStream* GetOutStream();
- SvEaMgr* GetEaMgr();
-
sal_Bool Commit();
sal_Bool IsStorage();
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index f2e6fb5c50..8e4dde2872 100755..100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -293,6 +293,7 @@ public:
sal_Bool IsReadOnlyUI() const;
void SetNoName();
sal_Bool IsInModalMode() const;
+ sal_Bool IsInPrepareClose() const;
//<!--Added by PengYunQuan for Validity Cell Range Picker
virtual sal_Bool AcceptStateUpdate() const;
//-->Added by PengYunQuan for Validity Cell Range Picker
@@ -346,6 +347,9 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
virtual void UpdateLinks();
+ // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
+ virtual sal_Bool QuerySlotExecutable( USHORT nSlotId );
+
sal_Bool SaveChildren(BOOL bObjectsOnly=FALSE);
sal_Bool SaveAsChildren( SfxMedium &rMedium );
sal_Bool SwitchChildrenPersistance(
diff --git a/sfx2/inc/sfx2/titledockwin.hxx b/sfx2/inc/sfx2/titledockwin.hxx
index f63d68525e..f173d6aac7 100644
--- a/sfx2/inc/sfx2/titledockwin.hxx
+++ b/sfx2/inc/sfx2/titledockwin.hxx
@@ -100,6 +100,11 @@ namespace sfx2
ToolBox& GetToolBox() { return m_aToolbox; }
const ToolBox& GetToolBox() const { return m_aToolbox; }
+ /** Return the border that is painted around the inner window as
+ decoration.
+ */
+ SvBorder GetDecorationBorder (void) const { return m_aBorder; }
+
protected:
// Window overridables
virtual void Paint( const Rectangle& i_rArea );
@@ -153,6 +158,11 @@ namespace sfx2
since the last Paint().
*/
bool m_bLayoutPending;
+
+ /** Height of the title bar. Calculated in impl_layout().
+ */
+ int m_nTitleBarHeight;
+
};
//......................................................................................................................
diff --git a/sfx2/qa/cppunit/makefile.mk b/sfx2/qa/cppunit/makefile.mk
index 2794c2ae92..dce0b86a06 100644
--- a/sfx2/qa/cppunit/makefile.mk
+++ b/sfx2/qa/cppunit/makefile.mk
@@ -35,6 +35,13 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
+#building with stlport, but cppunit was not built with stlport
+.IF "$(USE_SYSTEM_STL)"!="YES"
+.IF "$(SYSTEM_CPPUNIT)"=="YES"
+CFLAGSCXX+=-DADAPT_EXT_STL
+.ENDIF
+.ENDIF
+
CFLAGSCXX += $(CPPUNIT_CFLAGS)
DLLPRE = # no leading "lib" on .so files
diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx
index 903be69203..6a0be13a9c 100644
--- a/sfx2/qa/cppunit/test_metadatable.cxx
+++ b/sfx2/qa/cppunit/test_metadatable.cxx
@@ -27,10 +27,12 @@
#include "precompiled_sfx2.hxx"
+#include "preextstl.h"
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
+#include "postextstl.h"
#include <rtl/ustrbuf.hxx>
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index ca8062bcb7..de333ac5a7 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -129,7 +129,7 @@
#include <sfx2/mnuitem.hxx>
#endif
-#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+#if defined( WNT ) || defined( OS2 )
#define DDE_AVAILABLE
#endif
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 4cde428a57..3f724038e6 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -30,9 +30,6 @@
#include <basic/basmgr.hxx>
#include <basic/sbstar.hxx>
-#ifdef WIN
-#define _TL_LANG_SPECIAL
-#endif
#include <svl/svdde.hxx>
#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index 8db6fb93dd..fd642941b4 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sfx2.hxx"
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
#include <tools/svwin.h>
#endif
@@ -211,7 +211,7 @@ BOOL SvDDEObject::GetData( ::com::sun::star::uno::Any & rData /*out param*/,
BOOL SvDDEObject::Connect( SvBaseLink * pSvLink )
{
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
static BOOL bInWinExec = FALSE;
#endif
USHORT nLinkType = pSvLink->GetUpdateMode();
@@ -258,7 +258,7 @@ BOOL SvDDEObject::Connect( SvBaseLink * pSvLink )
// ansonsten unter Win/WinNT die Applikation direkt starten
}
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
// Server nicht da, starten und nochmal versuchen
if( !bInWinExec )
@@ -291,7 +291,7 @@ BOOL SvDDEObject::Connect( SvBaseLink * pSvLink )
}
}
else
-#endif // WIN / WNT
+#endif // WNT
{
nError = DDELINK_ERROR_APP;
}
diff --git a/sfx2/source/appl/makefile.mk b/sfx2/source/appl/makefile.mk
index 72ac94a9b3..30f7435507 100644
--- a/sfx2/source/appl/makefile.mk
+++ b/sfx2/source/appl/makefile.mk
@@ -101,7 +101,6 @@ SFX_OBJECTS = \
$(SLO)$/module.obj \
$(SLO)$/newhelp.obj \
$(SLO)$/opengrf.obj \
- $(SLO)$/sfxdll.obj \
$(SLO)$/sfxhelp.obj \
$(SLO)$/sfxpicklist.obj \
$(SLO)$/shutdownicon.obj \
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 521a6c3257..6c596bea3d 100755..100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1525,19 +1525,6 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent,
{
// Dateiname
String aFile( pInfoItem->GetValue() );
-#ifdef WIN
- if ( aFile.Len() <= 8 )
- {
- String sTmp( SfxResId( STR_NONAME ) );
- USHORT nLen = Min( (USHORT)8, sTmp.Len() );
-
- if ( sTmp.Copy( 0, nLen ).Lower() ==
- aFile.Copy( 0, nLen ).Lower() )
- {
- aFile = pInfoItem->GetValue();
- }
- }
-#endif
INetURLObject aURL;
aURL.SetSmartProtocol( INET_PROT_FILE );
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 0d76af8d26..07faf55df9 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1954,7 +1954,7 @@ void FileDialogHelper_Impl::addGraphicFilter()
}
}
-#if defined(WIN) || defined(WNT)
+#if defined(WNT)
if ( aExtensions.Len() > 240 )
aExtensions = DEFINE_CONST_UNICODE( FILEDIALOG_FILTER_ALL );
#endif
@@ -2748,7 +2748,7 @@ void FileDialogHelper::SetDisplayDirectory( const String& _rPath )
if ( sFolder.getLength() == 0 )
{
// _rPath is not a valid path -> fallback to home directory
- NAMESPACE_VOS( OSecurity ) aSecurity;
+ vos:: OSecurity aSecurity;
aSecurity.getHomeDir( sFolder );
}
mpImp->displayFolder( sFolder );
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index 5577170c90..4f9b41a0dd 100755..100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -245,6 +245,36 @@ SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const Sfx
m_aRecordChangesCB.SetStyle( m_aRecordChangesCB.GetStyle() | WB_EARLYTOGGLE );
m_aRecordChangesCB.SetToggleHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBToggleHdl ) );
m_aChangeProtectionPB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, ChangeProtectionPBHdl ) );
+
+
+ // #i112277: for the time being (OOO 3.3) the following options should not
+ // be available. In the long run however it is planned to implement the yet
+ // missing functionality. Thus now we hide them and move the remaining ones up.
+ m_aNewPasswordToOpenFL.Hide();
+ m_aNewPasswordToOpenFT.Hide();
+ m_aNewPasswordToOpenED.Hide();
+ m_aConfirmPasswordToOpenFT.Hide();
+ m_aConfirmPasswordToOpenED.Hide();
+ m_aNewPasswordInfoFT.Hide();
+ m_aNewPasswordToModifyFL.Hide();
+ m_aNewPasswordToModifyFT.Hide();
+ m_aNewPasswordToModifyED.Hide();
+ m_aConfirmPasswordToModifyFT.Hide();
+ m_aConfirmPasswordToModifyED.Hide();
+ const long nDelta = m_aOptionsFL.GetPosPixel().Y() - m_aNewPasswordToOpenFL.GetPosPixel().Y();
+ Point aPos;
+ aPos = m_aOptionsFL.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aOptionsFL.SetPosPixel( aPos );
+ aPos = m_aOpenReadonlyCB.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aOpenReadonlyCB.SetPosPixel( aPos );
+ aPos = m_aRecordChangesCB.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aRecordChangesCB.SetPosPixel( aPos );
+ aPos = m_aChangeProtectionPB.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aChangeProtectionPB.SetPosPixel( aPos );
}
diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src
index 4818068990..4818068990 100755..100644
--- a/sfx2/source/dialog/securitypage.src
+++ b/sfx2/source/dialog/securitypage.src
diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx
index b264561275..89a22ee062 100644
--- a/sfx2/source/dialog/titledockwin.cxx
+++ b/sfx2/source/dialog/titledockwin.cxx
@@ -51,6 +51,7 @@ namespace sfx2
,m_aContentWindow( this, WB_DIALOGCONTROL )
,m_aBorder( 3, 1, 3, 3 )
,m_bLayoutPending( false )
+ ,m_nTitleBarHeight(0)
{
impl_construct();
}
@@ -139,23 +140,23 @@ namespace sfx2
Size aWindowSize( GetOutputSizePixel() );
// position the tool box
- int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() );
- if ( aToolBoxSize.Height() > nTitleBarHeight )
- nTitleBarHeight = aToolBoxSize.Height();
+ m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight();
+ if ( aToolBoxSize.Height() > m_nTitleBarHeight )
+ m_nTitleBarHeight = aToolBoxSize.Height();
m_aToolbox.SetPosSizePixel(
Point(
aWindowSize.Width() - aToolBoxSize.Width(),
- ( nTitleBarHeight - aToolBoxSize.Height() ) / 2
+ ( m_nTitleBarHeight - aToolBoxSize.Height() ) / 2
),
aToolBoxSize
);
// Place the content window.
- if ( nTitleBarHeight < aToolBoxSize.Height() )
- nTitleBarHeight = aToolBoxSize.Height();
- aWindowSize.Height() -= nTitleBarHeight;
+ if ( m_nTitleBarHeight < aToolBoxSize.Height() )
+ m_nTitleBarHeight = aToolBoxSize.Height();
+ aWindowSize.Height() -= m_nTitleBarHeight;
m_aContentWindow.SetPosSizePixel(
- Point( m_aBorder.Left(), nTitleBarHeight + m_aBorder.Top() ),
+ Point( m_aBorder.Left(), m_nTitleBarHeight + m_aBorder.Top() ),
Size(
aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(),
aWindowSize.Height() - m_aBorder.Top() - m_aBorder.Bottom()
@@ -175,11 +176,6 @@ namespace sfx2
Push( PUSH_FONT | PUSH_FILLCOLOR | PUSH_LINECOLOR );
- int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() );
- const Size aToolBoxSize = m_aToolbox.CalcWindowSizePixel();
- if ( aToolBoxSize.Height() > nTitleBarHeight )
- nTitleBarHeight = aToolBoxSize.Height();
-
SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() );
SetLineColor();
@@ -194,7 +190,7 @@ namespace sfx2
int nInnerLeft = nOuterLeft + m_aBorder.Left() - 1;
int nOuterRight = aWindowSize.Width() - 1;
int nInnerRight = nOuterRight - m_aBorder.Right() + 1;
- int nInnerTop = nTitleBarHeight + m_aBorder.Top() - 1;
+ int nInnerTop = m_nTitleBarHeight + m_aBorder.Top() - 1;
int nOuterBottom = aWindowSize.Height() - 1;
int nInnerBottom = nOuterBottom - m_aBorder.Bottom() + 1;
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 795f5a20ca..28b6f22735 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -489,6 +489,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
case SID_SAVEASDOC:
case SID_SAVEDOC:
{
+ // derived class may decide to abort this
+ if( !QuerySlotExecutable( nId ) )
+ {
+ rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) );
+ return;
+ }
+
//!! detaillierte Auswertung eines Fehlercodes
SfxObjectShellRef xLock( this );
@@ -895,7 +902,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
rReq.Done();
}
-//--------------------------------------------------------------------
+//-------------------------------------------------------------------------
void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
{
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 8d0fea6811..ac048a24e2 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -195,6 +195,13 @@ sal_Bool SfxObjectShell::SaveAs( SfxMedium& rMedium )
//-------------------------------------------------------------------------
+sal_Bool SfxObjectShell::QuerySlotExecutable( USHORT /*nSlotId*/ )
+{
+ return sal_True;
+}
+
+//-------------------------------------------------------------------------
+
sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd )
{
const SfxPoolItem* pItem = NULL;
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 11268aeab5..a9a75831e2 100755..100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -526,6 +526,13 @@ SfxObjectShell* SfxObjectShell::Current()
return pFrame ? pFrame->GetObjectShell() : 0;
}
+//-------------------------------------------------------------------------
+
+sal_Bool SfxObjectShell::IsInPrepareClose() const
+{
+ return pImp->bInPrepareClose;
+}
+
//------------------------------------------------------------------------
struct BoolEnv_Impl
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 2486f4e9fb..8122e61147 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -977,6 +977,8 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
aArgs.remove( "BreakMacroSignature" );
aArgs.remove( "Stream" );
aArgs.remove( "InputStream" );
+ aArgs.remove( "URL" );
+ aArgs.remove( "Frame" );
// TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be removed here
@@ -988,6 +990,10 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
SfxAllItemSet aSet( pObjectShell->GetPool() );
TransformParameters( SID_OPENDOC, rArgs, aSet );
+ // the arguments are not allowed to reach the medium
+ aSet.ClearItem( SID_FILE_NAME );
+ aSet.ClearItem( SID_FILLFRAME );
+
pMedium->GetItemSet()->Put( aSet );
SFX_ITEMSET_ARG( &aSet, pItem, SfxStringItem, SID_FILTER_NAME, sal_False );
if ( pItem )
diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx
index 51dc9d8d66..42786a89ec 100644
--- a/sfx2/source/doc/syspathw32.cxx
+++ b/sfx2/source/doc/syspathw32.cxx
@@ -74,7 +74,7 @@ typedef unsigned short sal_uInt16;
extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize)
{
#ifdef WNT
- return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, pFolder, nSize );
+ return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, reinterpret_cast<LPWSTR>(pFolder), nSize );
#else
(void)pFolder;
(void)nSize;
diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx
index 8269611c97..c30a658f1f 100755
--- a/sfx2/source/menu/mnumgr.cxx
+++ b/sfx2/source/menu/mnumgr.cxx
@@ -578,6 +578,7 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra
return 0;
}
+
void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFrame, const Point& rPoint, Window* pWindow )
{
PopupMenu *pSVMenu = new PopupMenu( rResId );
@@ -622,6 +623,12 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram
SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() );
aPop.RemoveDisabledEntries();
aPop.Execute( rPoint, pWindow );
+
+ // #i112646 avoid crash when context menu is closed.
+ // the (manually inserted) sub-menu needs to be destroyed before
+ // aPop gets destroyed.
+ delete pThesSubMenu;
+ pThesSubMenu = 0;
}
delete pThesSubMenu;
@@ -631,3 +638,4 @@ Menu* SfxPopupMenuManager::GetSVMenu()
{
return (Menu*) GetMenu()->GetSVMenu();
}
+
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index c9876ce1f0..5b302047ac 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -280,10 +280,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewI
aLoadArgs = aArgs.getPropertyValues();
// load the doc into that frame
- ::rtl::OUString sLoaderURL( rDoc.GetModel()->getURL() );
- if ( sLoaderURL.getLength() == 0 )
- sLoaderURL = rDoc.GetFactory().GetFactoryURL();
-
+ ::rtl::OUString sLoaderURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) );
Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW );
xLoader->loadComponentFromURL(
sLoaderURL,
diff --git a/sfx2/source/view/userinputinterception.cxx b/sfx2/source/view/userinputinterception.cxx
index a710bb5bab..6fca09fb29 100644
--- a/sfx2/source/view/userinputinterception.cxx
+++ b/sfx2/source/view/userinputinterception.cxx
@@ -216,6 +216,13 @@ namespace sfx2
if ( e.Context == xHandler )
aIterator.remove();
}
+ catch( const RuntimeException& )
+ {
+ throw;
+ }
+ catch( const Exception& )
+ {
+ }
}
}
break;
@@ -247,6 +254,13 @@ namespace sfx2
if ( e.Context == xHandler )
aIterator.remove();
}
+ catch( const RuntimeException& )
+ {
+ throw;
+ }
+ catch( const Exception& )
+ {
+ }
}
}
break;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 21d10471fc..ee5bf56fdf 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -813,6 +813,13 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
xNewObj->SetModifyPasswordEntered( sal_False );
xNewObj->SetReadOnly();
}
+ else if ( rReq.GetSlot() == SID_EDITDOC && bForEdit && !xNewObj->IsReadOnlyMedium() )
+ {
+ // the filter might request setting of the document to readonly state
+ // but in case of SID_EDITDOC it should not happen if the document
+ // can be opened for editing
+ xNewObj->SetReadOnlyUI( sal_False );
+ }
if ( xNewObj->IsDocShared() )
{
@@ -1172,10 +1179,6 @@ void SfxViewFrame::DoActivate( sal_Bool bUI, SfxViewFrame* pOldFrame )
DBG_CHKTHIS(SfxViewFrame, 0);
SFX_APP();
-#ifdef WIN
- pSfxApp->TestFreeResources_Impl();
-#endif
-
pDispatcher->DoActivate_Impl( bUI, pOldFrame );
// Wenn ich einen parent habe und dieser ist kein parent des alten
@@ -1240,9 +1243,6 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame )
pFrame = pFrame->GetParentViewFrame();
}
}
-#ifdef WIN
- pSfxApp->TestFreeResources_Impl();
-#endif
}
//------------------------------------------------------------------------
@@ -2144,6 +2144,8 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc
aTransformLoadArgs.remove( "Hidden" );
::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) );
+ if ( !sURL.getLength() )
+ sURL = i_rDoc.GetFactory().GetFactoryURL();
Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW );
xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0,
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 1f7607ac0b..24dc647130 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -75,8 +75,8 @@ struct SfxViewShell_Impl
::svt::AcceleratorExecute* pAccExec;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts;
::rtl::Reference< SfxClipboardChangeListener > xClipboardListener;
- vcl::PrinterController* pPrinterController;
-
+ ::boost::shared_ptr< vcl::PrinterController > m_pPrinterController;
+
SfxViewShell_Impl();
};
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index b4e6b05f7b..43c9c8bf20 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -332,7 +332,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
mpObjectShell->EnableSetModified( m_bOrigStatus );
if ( mpViewShell )
- mpViewShell->pImp->pPrinterController = 0;
+ {
+ mpViewShell->pImp->m_pPrinterController.reset();
+ }
}
}
@@ -643,8 +645,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro
this,
rProps
) );
- pImp->pPrinterController = pController.get();
-
+ pImp->m_pPrinterController = pController;
+
SfxObjectShell *pObjShell = GetObjectShell();
pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ),
makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) );
@@ -661,7 +663,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro
Printer* SfxViewShell::GetActivePrinter() const
{
- return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0;
+ return (pImp->m_pPrinterController)
+ ? pImp->m_pPrinterController->getPrinter().get() : 0;
}
void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
@@ -697,6 +700,14 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
case SID_PRINTDOCDIRECT:
{
SfxObjectShell* pDoc = GetObjectShell();
+
+ // derived class may decide to abort this
+ if( !pDoc->QuerySlotExecutable( nId ) )
+ {
+ rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) );
+ return;
+ }
+
bool bDetectHidden = ( !bSilent && pDoc );
if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
break;
diff --git a/shell/inc/internal/utilities.hxx b/shell/inc/internal/utilities.hxx
index 7ae7de59be..598eed3375 100755
--- a/shell/inc/internal/utilities.hxx
+++ b/shell/inc/internal/utilities.hxx
@@ -84,6 +84,12 @@ bool HasOnlySpaces(const std::wstring& String);
Windows Locale Identifier corresponding to input LocaleSet.
*/
+//---------------------------------
+/** Convert a long path name using Windows api call GetShortPathName
+*/
+std::wstring getShortPathName( const std::wstring& aLongName );
+
+
#ifndef OS2
LCID LocaleSetToLCID( const LocaleSet_t & Locale );
#endif
diff --git a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
index f8db1e8eba..eccbf903b5 100644..100755
--- a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
+++ b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
@@ -152,14 +152,15 @@ HRESULT STDMETHODCALLTYPE CColumnInfo::GetColumnInfo(DWORD dwIndex, SHCOLUMNINFO
//
//-----------------------------
- HRESULT STDMETHODCALLTYPE CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
+HRESULT STDMETHODCALLTYPE CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData)
{
if (IsOOFileExtension(pscd->pwszExt))
{
try
{
+ std::wstring fname = getShortPathName( std::wstring( pscd->wszFile ) );
- CMetaInfoReader meta_info_accessor(WStringToString(pscd->wszFile));
+ CMetaInfoReader meta_info_accessor(WStringToString(fname));
VariantClear(pvarData);
diff --git a/shell/source/win32/shlxthandler/infotips/infotips.cxx b/shell/source/win32/shlxthandler/infotips/infotips.cxx
index 58f8a877b2..6ef6b57d8f 100644..100755
--- a/shell/source/win32/shlxthandler/infotips/infotips.cxx
+++ b/shell/source/win32/shlxthandler/infotips/infotips.cxx
@@ -352,14 +352,16 @@ HRESULT STDMETHODCALLTYPE CInfoTip::Load(LPCOLESTR pszFileName, DWORD /*dwMode*/
std::wstring::iterator end = fname.end();
m_FileNameOnly = std::wstring(begin, end);
-
+
+ fname = getShortPathName( fname );
+
std::string fnameA = WStringToString(fname);
// #115531#
// ZeroMemory because strncpy doesn't '\0'-terminates the destination
// string; reserve the last place in the buffer for the final '\0'
// that's why '(sizeof(m_szFileName) - 1)'
- ZeroMemory(m_szFileName, sizeof(m_szFileName));
+ ZeroMemory(m_szFileName, sizeof(m_szFileName));
strncpy(m_szFileName, fnameA.c_str(), (sizeof(m_szFileName) - 1));
return S_OK;
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index 89b0cc435d..07e1b06137 100755
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -657,7 +657,8 @@ SCODE STDMETHODCALLTYPE COooFilter::IsDirty()
SCODE STDMETHODCALLTYPE COooFilter::Load(LPCWSTR pszFileName, DWORD /*dwMode*/)
{
// Load just sets the filename for GetChunk to read and ignores the mode
- m_pwszFileName = pszFileName;
+ m_pwszFileName = getShortPathName( pszFileName );
+
// Open the file previously specified in call to IPersistFile::Load and get content.
try
{
diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
index cb5d7e2627..19699be01f 100644..100755
--- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
+++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -237,14 +237,14 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfM
try
{
pMetaInfoReader = new CMetaInfoReader( (void*)pStream, &z_filefunc );
+ LoadProperties( pMetaInfoReader );
+ delete pMetaInfoReader;
}
catch (const std::exception& e)
{
OutputDebugStringFormat( "CPropertyHdl::Initialize: Caught exception [%s]", e.what() );
return E_FAIL;
}
-
- LoadProperties( pMetaInfoReader );
/*
// load extended properties and search content
_LoadExtendedProperties();
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index b81461fcf9..536a49255c 100755
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -77,7 +77,7 @@ CPropertySheet::CPropertySheet(long RefCnt) :
//-----------------------------
CPropertySheet::~CPropertySheet()
-{
+{
OutputDebugStringFormat("CPropertySheet::DTor [%d], [%d]", m_RefCnt, g_DllRefCnt );
InterlockedDecrement(&g_DllRefCnt);
}
@@ -157,13 +157,26 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
NULL,
0)))
{
- DragQueryFileA(
- reinterpret_cast<HDROP>(medium.hGlobal),
- 0,
- m_szFileName,
- sizeof(m_szFileName));
-
- hr = S_OK;
+ UINT size = DragQueryFile( reinterpret_cast<HDROP>(medium.hGlobal), 0, 0, 0 );
+ if ( size != 0 )
+ {
+ TCHAR * buffer = new TCHAR[ size + 1 ];
+ UINT result_size = DragQueryFile( reinterpret_cast<HDROP>(medium.hGlobal),
+ 0, buffer, size + 1 );
+ if ( result_size != 0 )
+ {
+ std::wstring fname = getShortPathName( buffer );
+ std::string fnameA = WStringToString( fname );
+ ZeroMemory( m_szFileName, sizeof( m_szFileName ) );
+ strncpy( m_szFileName, fnameA.c_str(), ( sizeof( m_szFileName ) - 1 ) );
+ hr = S_OK;
+ }
+ else
+ hr = E_INVALIDARG;
+ delete [] buffer;
+ }
+ else
+ hr = E_INVALIDARG;
}
else
hr = E_INVALIDARG;
@@ -320,47 +333,53 @@ BOOL CALLBACK CPropertySheet::PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPAR
//##################################
void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
{
- CMetaInfoReader metaInfo(m_szFileName);
-
- SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), metaInfo.getTagData( META_INFO_AUTHOR ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), metaInfo.getTagData( META_INFO_SUBJECT ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() );
-
- // comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add
- // "\r" before "\n" to form "\r\n" in order to display return in Edit control.
- std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str();
- std::wstring::size_type itor = tempStr.find ( L"\n" , 0 );
- while (itor != std::wstring::npos)
+ try
+ {
+ CMetaInfoReader metaInfo(m_szFileName);
+
+ SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), metaInfo.getTagData( META_INFO_AUTHOR ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), metaInfo.getTagData( META_INFO_SUBJECT ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() );
+
+ // comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add
+ // "\r" before "\n" to form "\r\n" in order to display return in Edit control.
+ std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str();
+ std::wstring::size_type itor = tempStr.find ( L"\n" , 0 );
+ while (itor != std::wstring::npos)
+ {
+ tempStr.insert(itor, L"\r");
+ itor = tempStr.find(L"\n", itor + 2);
+ }
+ SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str());
+ }
+ catch (const std::exception&)
{
- tempStr.insert(itor, L"\r");
- itor = tempStr.find(L"\n", itor + 2);
}
- SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str());
-
}
//---------------------------------
/**
*/
void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
-{
- CMetaInfoReader metaInfo(m_szFileName);
-
- document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo);
-
- statistic_group_list_t sgl;
- doc_stat_reader->read(&sgl);
-
- list_view_builder_ptr lv_builder = create_list_view_builder(
- GetDlgItem(hwnd, IDC_STATISTICSLIST),
- GetResString(IDS_PROPERTY),
- GetResString(IDS_PROPERTY_VALUE));
-
- lv_builder->build(sgl);
-
-}
+{
+ try
+ {
+ CMetaInfoReader metaInfo(m_szFileName);
+ document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo);
+ statistic_group_list_t sgl;
+ doc_stat_reader->read(&sgl);
+ list_view_builder_ptr lv_builder = create_list_view_builder(
+ GetDlgItem(hwnd, IDC_STATISTICSLIST),
+ GetResString(IDS_PROPERTY),
+ GetResString(IDS_PROPERTY_VALUE));
+ lv_builder->build(sgl);
+ }
+ catch (const std::exception&)
+ {
+ }
+}
diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index 23831d07be..180f5c2f60 100644..100755
--- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -367,7 +367,8 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP *phBmpImage)
try
{
- std::auto_ptr<ZipFile> zipfile(new ZipFile(WStringToString(filename_)));
+ std::wstring fname = getShortPathName( filename_ );
+ std::auto_ptr<ZipFile> zipfile( new ZipFile( WStringToString( fname ) ) );
if (zipfile->HasContent(THUMBNAIL_CONTENT))
{
diff --git a/shell/source/win32/shlxthandler/util/fileextensions.cxx b/shell/source/win32/shlxthandler/util/fileextensions.cxx
index dd89a32853..16d537890c 100644..100755
--- a/shell/source/win32/shlxthandler/util/fileextensions.cxx
+++ b/shell/source/win32/shlxthandler/util/fileextensions.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_shell.hxx"
+#include "algorithm"
#include "internal/fileextensions.hxx"
//------------------------------------
@@ -87,10 +88,18 @@ std::string get_file_name_extension(const std::string& file_name)
/** Return the type of a file
*/
+char easytolower( char in )
+{
+ if( in<='Z' && in>='A' )
+ return in-('Z'-'z');
+ return in;
+}
+
File_Type_t get_file_type(const std::string& file_name)
{
std::string fext = get_file_name_extension(file_name);
-
+ std::transform(fext.begin(), fext.end(), fext.begin(), easytolower);
+
if (std::string::npos != WRITER_FILE_EXTENSIONS.find(fext))
return WRITER;
else if (std::string::npos != CALC_FILE_EXTENSIONS.find(fext))
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 55353e20f9..486abb0dd6 100644..100755
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -148,6 +148,28 @@ bool HasOnlySpaces(const std::wstring& String)
return true;
}
+//---------------------------------
+/** helper function to convert windows pathes to short form.
+ @returns
+ shortend path.
+*/
+
+std::wstring getShortPathName( const std::wstring& aLongName )
+{
+ std::wstring shortName = aLongName;
+ long length = GetShortPathName( aLongName.c_str(), NULL, 0 );
+
+ if ( length != 0 )
+ {
+ TCHAR* buffer = new TCHAR[ length+1 ];
+ length = GetShortPathName( aLongName.c_str(), buffer, length );
+ if ( length != 0 )
+ shortName = std::wstring( buffer );
+ delete [] buffer;
+ }
+ return shortName;
+}
+
/** convert LocaleSet pair into Microsoft List of Locale ID (LCID)
according to ISO-639 and ISO-3166.
http://etext.lib.virginia.edu/tei/iso639.html
diff --git a/svx/inc/svdstr.hrc b/svx/inc/svdstr.hrc
index 46417de887..f5997b030b 100644
--- a/svx/inc/svdstr.hrc
+++ b/svx/inc/svdstr.hrc
@@ -756,6 +756,7 @@
//BFS01#define SIP_SDRATTRSET_GRAF (SIP_Begin + 258)
#define SIP_SA_MARKERS (SIP_Begin + 258)
+#define SIP_SA_PAGESHADOW35X35 (SIP_Begin + 259)
#define SIP_SA_FINE_MARKERS (SIP_Begin + 260)
// #100499#
diff --git a/svx/inc/svimbase.hxx b/svx/inc/svimbase.hxx
index 58fb0c969c..7f4b4710f8 100644
--- a/svx/inc/svimbase.hxx
+++ b/svx/inc/svimbase.hxx
@@ -36,11 +36,7 @@
// - Defines -
// -----------
-#ifdef WIN
-#define _SVHUGE huge
-#else
#define _SVHUGE
-#endif
// ----------------
// - SimDepthType -
diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
index eb304d09f3..26cd56c2ef 100755
--- a/svx/inc/svx/dialogs.hrc
+++ b/svx/inc/svx/dialogs.hrc
@@ -956,7 +956,9 @@
#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 6)//?
#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 7)//?
-#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1190)
+#define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190)
+
+#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1191)
// ----------------------------------------------------------------------------
// if we have _a_lot_ time, we should group the resource ids by type, instead
diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx
index 29446b8a22..1aef4e4bbf 100644
--- a/svx/inc/svx/sdrmasterpagedescriptor.hxx
+++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx
@@ -35,6 +35,7 @@
// predeclarations
class SdrObject;
class SfxItemSet;
+class SdrPageProperties;
namespace sdr
{
@@ -89,6 +90,8 @@ namespace sdr
// operators
sal_Bool operator==(const MasterPageDescriptor& rCandidate) const;
sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const;
+
+ const SdrPageProperties* getCorrectSdrPageProperties() const;
};
} // end of namespace sdr
diff --git a/svx/inc/svx/svdedtv.hxx b/svx/inc/svx/svdedtv.hxx
index 6a3bbd1f75..88ea8fc715 100644
--- a/svx/inc/svx/svdedtv.hxx
+++ b/svx/inc/svx/svdedtv.hxx
@@ -208,7 +208,6 @@ public:
// verwendet. NotifyNewUndoAction() wird in diesem Fall erst beim letzten
// EndUndo() gerufen. NotifyNewUndoAction() wird nicht gerufen bei einer
// leeren Klammerung.
-#ifndef WIN
void BegUndo() { pMod->BegUndo(); } // Undo-Klammerung auf
void BegUndo(const String& rComment) { pMod->BegUndo(rComment); } // Undo-Klammerung auf
void BegUndo(const String& rComment, const String& rObjDescr, SdrRepeatFunc eFunc=SDRREPFUNC_OBJ_NONE) { pMod->BegUndo(rComment,rObjDescr,eFunc); } // Undo-Klammerung auf
@@ -218,17 +217,6 @@ public:
// nur nach dem 1. BegUndo oder vor dem letzten EndUndo:
void SetUndoComment(const String& rComment) { pMod->SetUndoComment(rComment); }
void SetUndoComment(const String& rComment, const String& rObjDescr) { pMod->SetUndoComment(rComment,rObjDescr); }
-#else // ifndef WIN
- void BegUndo();
- void BegUndo(const String& rComment);
- void BegUndo(const String& rComment, const String& rObjDescr, SdrRepeatFunc eFunc=SDRREPFUNC_OBJ_NONE);
- void BegUndo(SdrUndoGroup* pUndoGrp);
- void EndUndo(); // Undo-Klammerung zu (inkl BroadcastEdges)
- void AddUndo(SdrUndoAction* pUndo);
- // nur nach dem 1. BegUndo oder vor dem letzten EndUndo:
- void SetUndoComment(const String& rComment);
- void SetUndoComment(const String& rComment, const String& rObjDescr);
-#endif
bool IsUndoEnabled() const;
std::vector< SdrUndoAction* > CreateConnectorUndo( SdrObject& rO );
diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx
index a40f1c184a..a80908756f 100644
--- a/svx/inc/svx/svdmodel.hxx
+++ b/svx/inc/svx/svdmodel.hxx
@@ -53,11 +53,11 @@ class OutputDevice;
#include <vos/ref.hxx>
-#if defined(UNX) || defined(WIN) || defined(WNT)
+#if defined(UNX) || defined(WNT)
#define DEGREE_CHAR ((sal_Unicode)176) /* 0xB0 = Ansi */
#endif
-#if defined(DOS) || defined(OS2)
+#if defined(OS2)
#define DEGREE_CHAR ((sal_Unicode)248) /* 0xF8 = IBM PC (Erw. ASCII) */
#endif
@@ -276,7 +276,7 @@ public:
SdrOutlinerCache* mpOutlinerCache;
SdrModelImpl* mpImpl;
UINT16 mnCharCompressType;
- UINT16 nReserveUInt5;
+ UINT16 mnHandoutPageCount;
UINT16 nReserveUInt6;
UINT16 nReserveUInt7;
FASTBOOL mbModelLocked;
@@ -298,6 +298,10 @@ public:
SvNumberFormatter* mpNumberFormatter;
public:
const SvNumberFormatter& GetNumberFormatter() const;
+
+ UINT16 getHandoutPageCount() const { return mnHandoutPageCount; }
+ void setHandoutPageCount( UINT16 nHandoutPageCount ) { mnHandoutPageCount = nHandoutPageCount; }
+
protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx
index 435ab2fda1..c65c5eb5a6 100644
--- a/svx/inc/svx/svdpage.hxx
+++ b/svx/inc/svx/svdpage.hxx
@@ -448,6 +448,7 @@ private:
public:
SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; }
const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; }
+ const SdrPageProperties* getCorrectSdrPageProperties() const;
protected:
// new MasterPageDescriptorVector
diff --git a/svx/inc/svx/xpoly.hxx b/svx/inc/svx/xpoly.hxx
index 837d681afd..a8ccd34713 100644
--- a/svx/inc/svx/xpoly.hxx
+++ b/svx/inc/svx/xpoly.hxx
@@ -45,11 +45,7 @@ class OutputDevice;
#define XPOLYPOLY_APPEND 0xFFFF
#define XPOLY_APPEND 0xFFFF
-#ifdef WIN // Windows 16 Bit
-#define XPOLY_MAXPOINTS 8160 /* =0xFF00/sizeof(Point), also mit etwas Platz! */
-#else
#define XPOLY_MAXPOINTS 0xFFF0 /* Auch fuer die 32-Bitter etwas Luft lassen */
-#endif
/************************************************************************/
// Punktstile im XPolygon:
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 0bd03d0229..e5a55a6964 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -240,7 +240,7 @@ void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& /*rDefault*/)
#endif
// Fuer WIN95/NT die FP-Exceptions abschalten
-#if defined(WNT) || defined(WIN)
+#if defined(WNT)
#define SC_FPEXCEPTIONS_ON() _control87( _MCW_EM, 0 )
#define SC_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
SC_FPEXCEPTIONS_OFF();
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx
index 81474efbcd..7adf9236ae 100644
--- a/svx/source/gengal/gengal.cxx
+++ b/svx/source/gengal/gengal.cxx
@@ -241,8 +241,9 @@ void GalApp::Init()
#endif
rtl::OUString baseBinDir = fileName.copy( 0, lastSlash );
rtl::OUString installPrefix = baseBinDir + rtl::OUString::createFromAscii( "/../.." );
- rtl::OUString assignment = rtl::OUString::createFromAscii( "OOO_INSTALL_PREFIX=" ) + installPrefix;
- putenv( strdup( OUSTRING_CSTR( assignment )));
+
+ rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("OOO_INSTALL_PREFIX"));
+ osl_setEnvironment(envVar.pData, installPrefix.pData);
}
OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) );
diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
index 1f6801f394..15a22cdaae 100644
--- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
@@ -62,23 +62,7 @@ namespace sdr
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
drawinglayer::attribute::SdrFillAttribute aFill;
- const SdrPage* pCorrectPage = &GetMasterPageDescriptor().GetOwnerPage();
- const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties();
-
- if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
- {
- pCorrectPage = &GetMasterPageDescriptor().GetUsedPage();
- pCorrectProperties = &pCorrectPage->getSdrPageProperties();
- }
-
- if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet())
- {
- // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
- // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
- // MasterPages should have a StyleSheet excactly for this reason, but historically
- // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
- pCorrectProperties = 0;
- }
+ const SdrPageProperties* pCorrectProperties = GetMasterPageDescriptor().getCorrectSdrPageProperties();
if(pCorrectProperties)
{
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index 2eacc9083d..b8467266de 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -44,6 +44,10 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <vcl/lazydelete.hxx>
+#include "svdstr.hrc"
+#include "svdglob.hxx"
+#include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
#include <drawinglayer/attribute/sdrfillattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -131,31 +135,54 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
{
+ static bool bUseOldPageShadow(false);
const SdrPage& rPage = getPage();
basegfx::B2DHomMatrix aPageMatrix;
aPageMatrix.set(0, 0, (double)rPage.GetWdt());
aPageMatrix.set(1, 1, (double)rPage.GetHgt());
- // create page shadow polygon
- const double fPageBorderFactor(1.0 / 256.0);
- basegfx::B2DPolygon aPageShadowPolygon;
- aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
- aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
- aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
- aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
- aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
- aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
- aPageShadowPolygon.setClosed(true);
- aPageShadowPolygon.transform(aPageMatrix);
-
- // We have only the page information, not the view information. Use the
- // svtools::FONTCOLOR color for initialisation
- const svtools::ColorConfig aColorConfig;
- const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
- const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageShadowPolygon), aRGBShadowColor));
-
- return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ if(bUseOldPageShadow)
+ {
+ // create page shadow polygon
+ const double fPageBorderFactor(1.0 / 256.0);
+ basegfx::B2DPolygon aPageShadowPolygon;
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
+ aPageShadowPolygon.setClosed(true);
+ aPageShadowPolygon.transform(aPageMatrix);
+
+ // We have only the page information, not the view information. Use the
+ // svtools::FONTCOLOR color for initialisation
+ const svtools::ColorConfig aColorConfig;
+ const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+ const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPageShadowPolygon),
+ aRGBShadowColor));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ else
+ {
+ static vcl::DeleteOnDeinit<drawinglayer::primitive2d::DiscreteShadow>
+ aDiscreteShadow(new drawinglayer::primitive2d::DiscreteShadow(
+ BitmapEx(ResId(SIP_SA_PAGESHADOW35X35, *ImpGetResMgr()))));
+ if (aDiscreteShadow.get() != NULL)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
+ aPageMatrix,
+ *aDiscreteShadow.get()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
}
ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
@@ -313,11 +340,17 @@ namespace sdr
const SdrPage& rPage = getPage();
const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
- // We have only the page information, not the view information. Use the
- // svtools::FONTCOLOR color for initialisation
- const svtools::ColorConfig aColorConfig;
- const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
- const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
+ // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
+ // Added old case as fallback for HighContrast.
+ basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ const svtools::ColorConfig aColorConfig;
+ const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+
+ aRGBBorderColor = aBorderColor.getBColor();
+ }
if(rPage.getPageBorderOnlyLeftRight())
{
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index fb497d09d3..a1dcc0c2fe 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -273,9 +273,16 @@ namespace sdr
// init extractor, guarantee existance, set page there
mpExtractor->SetStartPage(pPage);
+ // #i105548# also need to copy the VOCRedirector for sub-content creation
+ mpExtractor->SetViewObjectContactRedirector(GetObjectContact().GetViewObjectContactRedirector());
+
// create page content
xPageContent = mpExtractor->createPrimitive2DSequenceForPage(rDisplayInfo);
+ // #i105548# reset VOCRedirector to not accidentially have a pointer to a
+ // temporary class, so calls to it are avoided safely
+ mpExtractor->SetViewObjectContactRedirector(0);
+
// reset recursion flag
bInCreatePrimitive2D = false;
}
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
index 803f9ef9b2..7b84753999 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
@@ -320,6 +320,12 @@ namespace sdr
return false;
}
+ // no page shadow for high contrast mode
+ if(GetObjectContact().isDrawModeHighContrast())
+ {
+ return false;
+ }
+
return true;
}
} // end of namespace contact
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 622e30ba54..2b8aa5c119 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -77,8 +77,16 @@ namespace
if(pPage && pPage->GetModel())
{
- const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount());
- nRetval = ((sal_Int16)nPageCount - 1) / 2;
+ if( (pPage->GetPageNum() == 0) && !pPage->IsMasterPage() )
+ {
+ // handout page!
+ return pPage->GetModel()->getHandoutPageCount();
+ }
+ else
+ {
+ const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount());
+ nRetval = ((sal_Int16)nPageCount - 1) / 2;
+ }
}
return nRetval;
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 0af0cadc47..7a040297c6 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -185,18 +185,21 @@ namespace sdr
{
SdrText* pText = rObj.getText( nCount );
OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
- rOutliner.SetText(*pParaObj);
- sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
-
- if(nParaCount)
+ if( pParaObj )
{
- ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL);
- rOutliner.RemoveAttribs(aSelection, sal_True, 0);
+ rOutliner.SetText(*pParaObj);
+ sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
- OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
- rOutliner.Clear();
+ if(nParaCount)
+ {
+ ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL);
+ rOutliner.RemoveAttribs(aSelection, sal_True, 0);
- rObj.NbcSetOutlinerParaObjectForText( pTemp, pText );
+ OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
+ rOutliner.Clear();
+
+ rObj.NbcSetOutlinerParaObjectForText( pTemp, pText );
+ }
}
}
}
diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx
index 9d6ba449d0..e3f5f34845 100644
--- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx
+++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx
@@ -113,6 +113,29 @@ namespace sdr
|| &maUsedPage != &rCandidate.maUsedPage
|| maVisibleLayers != rCandidate.maVisibleLayers);
}
+
+ const SdrPageProperties* MasterPageDescriptor::getCorrectSdrPageProperties() const
+ {
+ const SdrPage* pCorrectPage = &GetOwnerPage();
+ const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties();
+
+ if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ pCorrectPage = &GetUsedPage();
+ pCorrectProperties = &pCorrectPage->getSdrPageProperties();
+ }
+
+ if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet())
+ {
+ // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
+ // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
+ // MasterPages should have a StyleSheet excactly for this reason, but historically
+ // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
+ pCorrectProperties = 0;
+ }
+
+ return pCorrectProperties;
+ }
} // end of namespace sdr
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index de7a564ff1..08cf1ada74 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -1039,46 +1039,6 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO
////////////////////////////////////////////////////////////////////////////////////////////////////
-#ifdef WIN
-void SdrEditView::BegUndo() // Undo-Klammerung auf
-{
- pMod->BegUndo();
-}
-
-void SdrEditView::BegUndo(const String& rComment) // Undo-Klammerung auf
-{
- pMod->BegUndo(rComment);
-}
-
-void SdrEditView::BegUndo(const String& rComment, const String& rObjDescr,
- SdrRepeatFunc eFunc) // Undo-Klammerung auf
-{
- pMod->BegUndo(rComment,rObjDescr,eFunc);
-}
-
-void SdrEditView::BegUndo(SdrUndoGroup* pUndoGrp) // Undo-Klammerung auf
-{
- pMod->BegUndo(pUndoGrp);
-}
-
-void SdrEditView::AddUndo(SdrUndoAction* pUndo) // Action hinzufuegen
-{
- pMod->AddUndo(pUndo);
-}
- // nur nach dem 1. BegUndo oder vor dem letzten EndUndo:
-void SdrEditView::SetUndoComment(const String& rComment)
-{
- pMod->SetUndoComment(rComment);
-}
-
-
-void SdrEditView::SetUndoComment(const String& rComment,
- const String& rObjDescr)
-{
- pMod->SetUndoComment(rComment,rObjDescr);
-}
-#endif
-
bool SdrEditView::IsUndoEnabled() const
{
return pMod->IsUndoEnabled();
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 87dd8e8e89..1699622f6b 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -178,6 +178,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
mpOutlinerCache = NULL;
mbKernAsianPunctuation = sal_False;
mbAddExtLeading = sal_False;
+ mnHandoutPageCount = 0;
SvxAsianConfig aAsian;
mnCharCompressType = aAsian.GetCharDistanceCompression();
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 3d72ef276c..418a54925a 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1063,8 +1063,7 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
/** handle mouse over effects for handles */
BOOL SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
{
- const ULONG nHdlCount = aHdl.GetHdlCount();
- if( nHdlCount )
+ if(aHdl.GetHdlCount())
{
SdrHdl* pMouseOverHdl = 0;
if( !rMEvt.IsLeaveWindow() && pWin )
@@ -1074,6 +1073,8 @@ BOOL SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
}
// notify last mouse over handle that he lost the mouse
+ const ULONG nHdlCount = aHdl.GetHdlCount();
+
for(ULONG nHdl = 0; nHdl < nHdlCount; nHdl++ )
{
SdrHdl* pCurrentHdl = GetHdl(nHdl);
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 288cfcc593..58f4c6950d 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -171,10 +171,8 @@ FASTBOOL SdrCircObj::PaintNeedsXPolyCirc() const
// und wenn nicht WIN dann (erstmal) auch fuer Kreis-/Ellipsenausschnitte
// und Kreis-/Ellipsenboegen (wg. Genauigkeit)
FASTBOOL bNeed=aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || meCircleKind==OBJ_CCUT;
-#ifndef WIN
// Wenn nicht Win, dann fuer alle ausser Vollkreis (erstmal!!!)
if (meCircleKind!=OBJ_CIRC) bNeed=TRUE;
-#endif
const SfxItemSet& rSet = GetObjectItemSet();
if(!bNeed)
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 063a847b75..a96e6c272d 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2927,7 +2927,8 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::
aScale = aCorrectedRangeNoCurve.getRange();
// define matrix for move polygon to zero point
- aMoveToZeroMatrix.translate(-aCorrectedRangeNoCurve.getMinX(), aCorrectedRangeNoCurve.getMinY());
+ // #i112280# Added missing minus for Y-Translation
+ aMoveToZeroMatrix.translate(-aCorrectedRangeNoCurve.getMinX(), -aCorrectedRangeNoCurve.getMinY());
}
else
{
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index f9dc3c313d..dcf1543adb 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1979,6 +1979,18 @@ void SdrPage::ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew)
}
}
+const SdrPageProperties* SdrPage::getCorrectSdrPageProperties() const
+{
+ if(mpMasterPageDescriptor)
+ {
+ return mpMasterPageDescriptor->getCorrectSdrPageProperties();
+ }
+ else
+ {
+ return &getSdrPageProperties();
+ }
+}
+
//////////////////////////////////////////////////////////////////////////////
// use new redirector instead of pPaintProc
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 669ec8c49b..1ca0b0623f 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -580,10 +580,6 @@ void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, C
rOut.SetLineColor( aColor );
bool bMap0=rOut.IsMapModeEnabled();
-#ifdef WIN // SetPixel-Profiling fuer Windows
- COLORREF aWinColRef=PALETTERGB(aColor.GetRed()>>8,aColor.GetGreen()>>8,aColor.GetBlue()>>8);
- HDC aWinhDC=Sysdepen::GethDC(rOut);
-#endif
long nWrX=0;//aWriterPageOffset.X();
long nWrY=0;//aWriterPageOffset.Y();
diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src
index 6250983305..f665501a43 100644
--- a/svx/source/svdraw/svdstr.src
+++ b/svx/source/svdraw/svdstr.src
@@ -2746,6 +2746,11 @@ String SIP_SA_GRAFRESERVE4 { Text = "" ; };
String SIP_SA_GRAFRESERVE5 { Text = "" ; };
String SIP_SA_GRAFRESERVE6 { Text = "" ; };
+Bitmap SIP_SA_PAGESHADOW35X35
+{
+ File = "pageshadow35x35.png";
+};
+
Bitmap SIP_SA_MARKERS
{
File = "markers.bmp";
diff --git a/svx/source/tbxctrls/makefile.mk b/svx/source/tbxctrls/makefile.mk
index 73a178d975..a9ea745f3c 100644
--- a/svx/source/tbxctrls/makefile.mk
+++ b/svx/source/tbxctrls/makefile.mk
@@ -74,6 +74,7 @@ SRC1FILES = \
lboxctrl.src \
linectrl.src \
tbcontrl.src \
+ tbunosearchcontrollers.src \
tbxdraw.src \
grafctrl.src
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 407ef59149..5000f7e240 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -29,6 +29,8 @@
#include "precompiled_svx.hxx"
#include "tbunosearchcontrollers.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -91,8 +93,8 @@ FindTextFieldControl::~FindTextFieldControl()
void FindTextFieldControl::InitControls_Impl()
{
- SetText( String( ::rtl::OUString::createFromAscii("Find") ) );
- SetControlForeground(COL_GRAY);
+ SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
+ SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
EnableAutocomplete(TRUE, TRUE);
}
@@ -117,7 +119,7 @@ void FindTextFieldControl::Modify()
{
ComboBox::Modify();
- SetControlForeground( Color( COL_BLACK ) );
+ SetControlForeground( GetSettings().GetStyleSettings().GetWindowTextColor() );
}
long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
@@ -135,7 +137,10 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode();
if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode )
+ {
+ nRet = 1;
GrabFocusToDocument();
+ }
if ( KEY_RETURN == nCode )
{
@@ -154,6 +159,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
lArgs[1].Value <<= sal_False;
impl_executeSearch(m_xServiceManager, m_xFrame, lArgs);
+ nRet = 1;
}
break;
}
@@ -170,8 +176,8 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
case EVENT_LOSEFOCUS:
if ( GetText().Len() == 0 )
{
- SetText( String( ::rtl::OUString::createFromAscii("Find") ) );
- SetControlForeground(COL_GRAY);
+ SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
+ SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
m_bToClearTextField = sal_True;
}
break;
diff --git a/idl/source/prj/idldll.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.src
index f5fc8dab9c..ff1565e2d2 100644
--- a/idl/source/prj/idldll.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.src
@@ -25,55 +25,9 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_idl.hxx"
+#include <svx/dialogs.hrc>
-#ifdef WIN
-#include <svwin.h>
-
-#ifndef _SYSDEP_HXX
-#include <sysdep.hxx>
-#endif
-
-// Statische DLL-Verwaltungs-Variablen
-static HINSTANCE hDLLInst = 0; // HANDLE der DLL
-
-
-/***************************************************************************
-|*
-|* LibMain()
-|*
-|* Beschreibung Initialisierungsfunktion der DLL
-|* Ersterstellung TH 05.05.93
-|* Letzte Aenderung TH 05.05.93
-|*
-***************************************************************************/
-
-extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+String RID_SVXSTR_FINDBAR_FIND
{
-#ifndef WNT
- if ( nHeap )
- UnlockData( 0 );
-#endif
-
- hDLLInst = hDLL;
-
- return TRUE;
-}
-
-/***************************************************************************
-|*
-|* WEP()
-|*
-|* Beschreibung DLL-Deinitialisierung
-|* Ersterstellung TH 05.05.93
-|* Letzte Aenderung TH 05.05.93
-|*
-***************************************************************************/
-
-extern "C" int CALLBACK WEP( int )
-{
- return 1;
-}
-
-#endif
+ Text [ en-US ] = "Find" ;
+};
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 1c6a0a17eb..389db0454d 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -634,10 +634,16 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
{
if( rSettings.mbExportOnlyBackground )
{
- pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize()));
- pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet());
- pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE));
- aShapes.push_back(pTempBackgroundShape);
+ const SdrPageProperties* pCorrectProperties = pPage->getCorrectSdrPageProperties();
+
+ if(pCorrectProperties)
+ {
+ pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize()));
+ pTempBackgroundShape->SetMergedItemSet(pCorrectProperties->GetItemSet());
+ pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ pTempBackgroundShape->NbcSetStyleSheet(pCorrectProperties->GetStyleSheet(), true);
+ aShapes.push_back(pTempBackgroundShape);
+ }
}
else
{
diff --git a/svx/util/svxpch.cxx b/svx/util/svxpch.cxx
index 9e35443965..819fbfd7f4 100644
--- a/svx/util/svxpch.cxx
+++ b/svx/util/svxpch.cxx
@@ -29,7 +29,7 @@
#include "precompiled_svx.hxx"
#include <thread.hxx>
#include <sysdep.hxx>
-#if defined(WNT) || defined (WIN)
+#if defined(WNT)
#include <svwin.h>
#endif
#include <tlintl.hxx>
diff --git a/sysui/desktop/debian/makefile.mk b/sysui/desktop/debian/makefile.mk
index f0f4e42886..45e0f331f7 100644
--- a/sysui/desktop/debian/makefile.mk
+++ b/sysui/desktop/debian/makefile.mk
@@ -45,7 +45,7 @@ TARGET=debian
.IF "$(PKGFORMAT)"!="$(PKGFORMAT:s/deb//)"
-DEBFILES=$(foreach,i,{$(PRODUCTLIST)} $(PKGDIR)$/$i3.3-$(TARGET)-menus_$(PKGVERSION.$i)-$(PKGREV)_all.deb)
+DEBFILES=$(foreach,i,{$(PRODUCTLIST)} $(PKGDIR)$/$i3.4-$(TARGET)-menus_$(PKGVERSION.$i)-$(PKGREV)_all.deb)
.ENDIF
@@ -60,22 +60,22 @@ ALLTAR : $(DEBFILES)
%/DEBIAN/control : $$(@:f)
@$(MKDIRHIER) $(@:d) $*$/etc $*$/usr/share/applnk/Office $*$/usr/lib/menu
- ln -sf /opt/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//)) $*$/etc$/
- /bin/sh -c -x "cd $(COMMONMISC)$/$(*:f:s/-/ /:1:s/3.3//) && DESTDIR=$(shell @cd $*; pwd) ICON_PREFIX=$(ICONPREFIX) KDEMAINDIR=/usr GNOMEDIR=/usr create_tree.sh"
- @cat openoffice.org-debian-menus | sed -e 's/%PRODUCTNAME/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.3//)) $(PRODUCTVERSION.$(*:f:s/-/ /:1:s/3.3//))/' -e 's/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/' -e 's/%ICONPREFIX/$(ICONPREFIX.$(*:f:s/-/ /:1:s/3.3//))/' > $*$/usr/lib/menu/$(*:f:s/_/ /:1:s/3.3//)
- echo "Package: $(*:f:s/_/ /:1:s/3.3//)" > $@
- cat $(@:f) | tr -d "\015" | sed "s/%productname/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.3//))/" >> $@
- echo "Version: $(PKGVERSION.$(*:f:s/-/ /:1:s/3.3//))-$(PKGREV)" >> $@
+ ln -sf /opt/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//)) $*$/etc$/
+ /bin/sh -c -x "cd $(COMMONMISC)$/$(*:f:s/-/ /:1:s/3.4//) && DESTDIR=$(shell @cd $*; pwd) ICON_PREFIX=$(ICONPREFIX) KDEMAINDIR=/usr GNOMEDIR=/usr create_tree.sh"
+ @cat openoffice.org-debian-menus | sed -e 's/%PRODUCTNAME/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.4//)) $(PRODUCTVERSION.$(*:f:s/-/ /:1:s/3.4//))/' -e 's/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/' -e 's/%ICONPREFIX/$(ICONPREFIX.$(*:f:s/-/ /:1:s/3.4//))/' > $*$/usr/lib/menu/$(*:f:s/_/ /:1:s/3.4//)
+ echo "Package: $(*:f:s/_/ /:1:s/3.4//)" > $@
+ cat $(@:f) | tr -d "\015" | sed "s/%productname/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.4//))/" >> $@
+ echo "Version: $(PKGVERSION.$(*:f:s/-/ /:1:s/3.4//))-$(PKGREV)" >> $@
@du -k -s $* | awk -F ' ' '{ printf "Installed-Size: %s\n", $$1 ; }' >> $@
%/DEBIAN/postinst : $$(@:f)
- @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/g" > $@
+ @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/g" > $@
%/DEBIAN/postrm : $$(@:f)
- @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/g" > $@
+ @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/g" > $@
%/DEBIAN/prerm : $$(@:f)
- @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/g" > $@
+ @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/g" > $@
# --- packaging ---------------------------------------------------
diff --git a/sysui/desktop/productversion.mk b/sysui/desktop/productversion.mk
index 24b1a2db04..09141b2276 100644
--- a/sysui/desktop/productversion.mk
+++ b/sysui/desktop/productversion.mk
@@ -46,7 +46,7 @@ PKGDIR=$(BIN)
PRODUCTLIST = openoffice.org broffice.org
# default values to minimize maintainance effort
-PRODUCTVERSION = 3.3
+PRODUCTVERSION = 3.4
PRODUCTVERSIONSHORT = 3
PKGVERSION = $(PRODUCTVERSION)
# gnome-vfs treats everything behind the last '.' as an icon extension,
diff --git a/sysui/desktop/slackware/makefile.mk b/sysui/desktop/slackware/makefile.mk
index 6fde1caf65..eeeb141c63 100644
--- a/sysui/desktop/slackware/makefile.mk
+++ b/sysui/desktop/slackware/makefile.mk
@@ -40,7 +40,7 @@ TARGET=slackware
# --- Files --------------------------------------------------------
-MENUFILES=$(PKGDIR)$/{$(PRODUCTLIST)}3.3-$(TARGET)-menus-$(PKGVERSION)-noarch-$(PKGREV).tgz
+MENUFILES=$(PKGDIR)$/{$(PRODUCTLIST)}3.4-$(TARGET)-menus-$(PKGVERSION)-noarch-$(PKGREV).tgz
# --- Targets -------------------------------------------------------
@@ -59,26 +59,26 @@ $(MISC)/$(TARGET)/usr/share/applications/ :
# FIXME: removal of *-extension.* only to create identical packages to OOF680
%/usr/share/applications :
@$(MKDIRHIER) $@
- /bin/sh -c "cd $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.3//); DESTDIR=$(shell @cd $*; pwd) GNOMEDIR="" ICON_PREFIX=$(ICONPREFIX.$(*:b:s/-/ /:1:s/3.3//)) KDEMAINDIR=/opt/kde .$/create_tree.sh"
+ /bin/sh -c "cd $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.4//); DESTDIR=$(shell @cd $*; pwd) GNOMEDIR="" ICON_PREFIX=$(ICONPREFIX.$(*:b:s/-/ /:1:s/3.4//)) KDEMAINDIR=/opt/kde .$/create_tree.sh"
$(RM) $*$/opt$/kde$/share$/icons$/*$/*$/*$/*-extension.png
$(RM) $*$/opt$/kde$/share$/mimelnk$/application$/*-extension.desktop
$(RM) $*$/usr$/share$/applications$/*.desktop
$(RM) $*$/usr$/bin$/soffice
%$/install$/doinst.sh : update-script
- @echo "( cd etc ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//)) )" > $@
- @echo "( cd etc ; ln -snf /opt/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//):s/-//) $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//)) )" >> $@
+ @echo "( cd etc ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//)) )" > $@
+ @echo "( cd etc ; ln -snf /opt/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//):s/-//) $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//)) )" >> $@
@echo "( cd usr/bin ; rm -rf soffice )" >> $@
- @echo "( cd usr/bin ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))/program/soffice soffice )" >> $@
- @echo -e $(foreach,i,$(shell @cat $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.3//)/launcherlist) "\n( cd usr/share/applications ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))-$i )\n( cd usr/share/applications ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))/share/xdg/$i $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))-$i )") >> $@
+ @echo "( cd usr/bin ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))/program/soffice soffice )" >> $@
+ @echo -e $(foreach,i,$(shell @cat $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.4//)/launcherlist) "\n( cd usr/share/applications ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))-$i )\n( cd usr/share/applications ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))/share/xdg/$i $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))-$i )") >> $@
@cat $< >> $@
%$/install$/slack-desc : slack-desc
@$(MKDIRHIER) $(@:d)
- @sed -e "s/PKGNAME/$(*:b:s/-/ /:1:s/3.3//)-$(TARGET)-menus/g" -e "s/PKGVERSION/$(PKGVERSION.$(*:b:s/-/ /:1:s/3.3//))/g" \
- -e "s/LONGPRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.3//)) $(PRODUCTVERSION.$(*:b:s/-/ /:1:s/3.3//))/g" \
- -e "s/PRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.3//))/g" \
- -e "s/UNIXFILENAME/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))/g" $< > $@
+ @sed -e "s/PKGNAME/$(*:b:s/-/ /:1:s/3.4//)-$(TARGET)-menus/g" -e "s/PKGVERSION/$(PKGVERSION.$(*:b:s/-/ /:1:s/3.4//))/g" \
+ -e "s/LONGPRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.4//)) $(PRODUCTVERSION.$(*:b:s/-/ /:1:s/3.4//))/g" \
+ -e "s/PRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.4//))/g" \
+ -e "s/UNIXFILENAME/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))/g" $< > $@
# needed to satisfy the slackware package tools - they need
# the entries like this
diff --git a/ucb/source/core/cmdenv.cxx b/ucb/source/core/cmdenv.cxx
index 5f62cd62e0..e46418843d 100644..100755
--- a/ucb/source/core/cmdenv.cxx
+++ b/ucb/source/core/cmdenv.cxx
@@ -183,7 +183,7 @@ UcbCommandEnvironment::createServiceFactory(
const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
{
return uno::Reference< lang::XSingleServiceFactory >(
- cppu::createOneInstanceFactory(
+ cppu::createSingleFactory(
rxServiceMgr,
UcbCommandEnvironment::getImplementationName_Static(),
UcbCommandEnvironment_CreateInstance,
diff --git a/ucb/source/ucp/odma/odma_lib.cxx b/ucb/source/ucp/odma/odma_lib.cxx
index b6a0d3ada1..69142a7b0e 100644
--- a/ucb/source/ucp/odma/odma_lib.cxx
+++ b/ucb/source/ucp/odma/odma_lib.cxx
@@ -78,10 +78,6 @@ namespace odma
if (bLoaded)
return sal_True;
::rtl::OUString sPath;
- #ifdef WIN
- sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA.DLL"));
-
- #endif
#ifdef WNT
sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL"));
#endif
diff --git a/ucb/source/ucp/package/makefile.mk b/ucb/source/ucp/package/makefile.mk
index 8c6dcda318..a8cdf74307 100644
--- a/ucb/source/ucp/package/makefile.mk
+++ b/ucb/source/ucp/package/makefile.mk
@@ -68,6 +68,7 @@ SHL1IMPLIB=i$(TARGET)
SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1STDLIBS=\
+ $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx
index 12a54eeda5..4fa7418432 100644
--- a/ucb/source/ucp/package/pkguri.cxx
+++ b/ucb/source/ucp/package/pkguri.cxx
@@ -36,6 +36,7 @@
#include "rtl/ustrbuf.hxx"
#include "osl/diagnose.h"
+#include "comphelper/storagehelper.hxx"
#include "../inc/urihelper.hxx"
@@ -85,7 +86,7 @@ void PackageUri::init() const
if ( ( m_aUri.getLength() < PACKAGE_URL_SCHEME_LENGTH + 4 ) )
{
// error, but remember that we did a init().
- m_aPath = rtl::OUString::createFromAscii( "/" );
+ m_aPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
return;
}
@@ -100,7 +101,7 @@ void PackageUri::init() const
!= sal_Unicode( '/' ) ) )
{
// error, but remember that we did a init().
- m_aPath = rtl::OUString::createFromAscii( "/" );
+ m_aPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
return;
}
@@ -128,8 +129,8 @@ void PackageUri::init() const
{
m_aParam +=
( m_aParam.getLength()
- ? ::rtl::OUString::createFromAscii( "&purezip" )
- : ::rtl::OUString::createFromAscii( "?purezip" ) );
+ ? ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "&purezip" ) )
+ : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "?purezip" ) ) );
}
aPureUri = aPureUri.replaceAt( 0,
@@ -143,7 +144,7 @@ void PackageUri::init() const
// Only <scheme>:/// - Empty authority
// error, but remember that we did a init().
- m_aPath = rtl::OUString::createFromAscii( "/" );
+ m_aPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
return;
}
else if ( nEnd == ( aPureUri.getLength() - 1 ) )
@@ -154,7 +155,7 @@ void PackageUri::init() const
// Only <scheme>://// or <scheme>://<something>//
// error, but remember that we did a init().
- m_aPath = rtl::OUString::createFromAscii( "/" );
+ m_aPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
return;
}
@@ -175,7 +176,7 @@ void PackageUri::init() const
nStart, aPureUri.getLength() - nStart, aNormPackage );
m_aPackage
= ::ucb_impl::urihelper::decodeSegment( aNormPackage );
- m_aPath = rtl::OUString::createFromAscii( "/" );
+ m_aPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
m_aUri = m_aUri.replaceAt( 0,
( nParam >= 0 )
? nParam
@@ -193,16 +194,19 @@ void PackageUri::init() const
{
m_aPath = aPureUri.copy( nEnd + 1 );
- // Empty path segments or encoded slashes?
- if ( m_aPath.indexOf(
- rtl::OUString::createFromAscii( "//" ) ) != -1
- || m_aPath.indexOf(
- rtl::OUString::createFromAscii( "%2F" ) ) != -1
- || m_aPath.indexOf(
- rtl::OUString::createFromAscii( "%2f" ) ) != -1 )
+ // Unexpected sequences of characters:
+ // - empty path segments
+ // - encoded slashes
+ // - parent folder segments ".."
+ // - current folder segments "."
+ if ( m_aPath.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "//" ) ) ) != -1
+ || m_aPath.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "%2F" ) ) ) != -1
+ || m_aPath.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "%2f" ) ) ) != -1
+ || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".." ) ) )
+ || ::comphelper::OStorageHelper::PathHasSegment( m_aPath, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ) )
{
// error, but remember that we did a init().
- m_aPath = rtl::OUString::createFromAscii( "/" );
+ m_aPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
return;
}
@@ -239,7 +243,7 @@ void PackageUri::init() const
else
{
// error, but remember that we did a init().
- m_aPath = rtl::OUString::createFromAscii( "/" );
+ m_aPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
}
}
}
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 872d454057..e4617b7b9e 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -1201,8 +1201,7 @@ sal_Bool DAVResourceAccess::handleException( DAVException & e, int errorCount )
// if we have a bad connection try again. Up to three times.
case DAVException::DAV_HTTP_ERROR:
// retry up to three times, if not a client-side error.
- if ( e.getStatus() > 0 &&
- ( e.getStatus() < 400 || e.getStatus() > 499 ) &&
+ if ( ( e.getStatus() < 400 || e.getStatus() >= 500 ) &&
errorCount < 3 )
{
return sal_True;
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index 57c9ead3ad..fe326f6bdc 100755..100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -52,7 +52,6 @@
#include "logindlg.hxx"
#include "masterpasscrtdlg.hxx"
#include "masterpassworddlg.hxx"
-#include "passcrtdlg.hxx"
#include "passworddlg.hxx"
#include "iahndl.hxx"
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index e90a064993..7cfcc3688b 100755
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -89,6 +89,7 @@
#include "newerverwarn.hxx"
#include "iahndl.hxx"
+#include "nameclashdlg.hxx"
/** === begin UNO using === **/
using ::com::sun::star::uno::Sequence;
@@ -867,8 +868,6 @@ UUIInteractionHelper::handleRequest_impl(
if ( handleCertificateValidationRequest( rRequest ) )
return true;
-// @@@ Todo #i29340#: activate!
-#if 0
ucb::NameClashResolveRequest aNameClashResolveRequest;
if (aAnyRequest >>= aNameClashResolveRequest)
{
@@ -876,7 +875,7 @@ UUIInteractionHelper::handleRequest_impl(
rRequest->getContinuations());
return true;
}
-#endif
+
if ( handleMasterPasswordRequest( rRequest ) )
return true;
@@ -1188,40 +1187,26 @@ executeMessageBox(
return aResult;
}
-// @@@ Todo #i29340#: activate!
-#if 0
-enum NameClashResolveDialogResult { ABORT, RENAME, OVERWRITE };
-
-NameClashResolveDialogResult
-executeNameClashResolveDialog(
- Window * /*pParent*/,
- rtl::OUString const & /*rTargetFolderURL*/,
- rtl::OUString const & /*rClashingName*/,
- rtl::OUString & /*rProposedNewName*/)
+NameClashResolveDialogResult executeSimpleNameClashResolveDialog( Window *pParent,
+ rtl::OUString const & rTargetFolderURL,
+ rtl::OUString const & rClashingName,
+ rtl::OUString & rProposedNewName,
+ bool bAllowOverwrite )
{
- // @@@ Todo DV: execute overwrite-rename dialog, deliver result
- OSL_ENSURE( false,
- "executeNameClashResolveDialog not yet implemented!" );
- return ABORT;
-}
+ std::auto_ptr< ResMgr > xManager( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
+ if ( !xManager.get() )
+ return ABORT;
-NameClashResolveDialogResult
-executeSimpleNameClashResolveDialog(
- Window * /*pParent*/,
- rtl::OUString const & /*rTargetFolderURL*/,
- rtl::OUString const & /*rClashingName*/,
- rtl::OUString & /*rProposedNewName*/)
-{
- // @@@ Todo DV: execute rename-only dialog, deliver result
- OSL_ENSURE( false,
- "executeSimpleNameClashResolveDialog not yet implemented!" );
- return ABORT;
+ NameClashDialog aDialog( pParent, xManager.get(), rTargetFolderURL,
+ rClashingName, rProposedNewName, bAllowOverwrite );
+
+ NameClashResolveDialogResult eResult = (NameClashResolveDialogResult) aDialog.Execute();
+ rProposedNewName = aDialog.getNewName();
+ return eResult;
}
-#endif
+
} // namespace
-// @@@ Todo #i29340#: activate!
-#if 0
void
UUIInteractionHelper::handleNameClashResolveRequest(
ucb::NameClashResolveRequest const & rRequest,
@@ -1251,18 +1236,12 @@ UUIInteractionHelper::handleNameClashResolveRequest(
NameClashResolveDialogResult eResult = ABORT;
rtl::OUString aProposedNewName( rRequest.ProposedNewName );
- if ( xReplaceExistingData.is() )
- eResult = executeNameClashResolveDialog(
- getParentProperty(),
- rRequest.TargetFolderURL,
- rRequest.ClashingName,
- aProposedNewName);
- else
- eResult = executeSimpleNameClashResolveDialog(
- getParentProperty(),
- rRequest.TargetFolderURL,
- rRequest.ClashingName,
- aProposedNewName);
+
+ eResult = executeSimpleNameClashResolveDialog( getParentProperty(),
+ rRequest.TargetFolderURL,
+ rRequest.ClashingName,
+ aProposedNewName,
+ xReplaceExistingData.is() );
switch ( eResult )
{
@@ -1282,14 +1261,8 @@ UUIInteractionHelper::handleNameClashResolveRequest(
"No ReplaceExistingData continuation available!" );
xReplaceExistingData->select();
break;
-
- default:
- OSL_ENSURE( false, "Unknown NameClashResolveDialogResult value. "
- "Interaction Request not handled!" );
- break;
}
}
-#endif
void
UUIInteractionHelper::handleGenericErrorRequest(
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 0f54e9ee8a..b77032e3cf 100755
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -215,8 +215,6 @@ private:
com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
-// @@@ Todo #i29340#: activate!
-#if 0
void
handleNameClashResolveRequest(
com::sun::star::ucb::NameClashResolveRequest const & rRequest,
@@ -225,7 +223,6 @@ private:
com::sun::star::task::XInteractionContinuation > > const &
rContinuations)
SAL_THROW((com::sun::star::uno::RuntimeException));
-#endif
bool
handleMasterPasswordRequest(
diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc
index 2641c5d329..2228856101 100755..100644
--- a/uui/source/ids.hrc
+++ b/uui/source/ids.hrc
@@ -48,13 +48,14 @@
#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 DLG_SIMPLE_NAME_CLASH (RID_UUI_START + 13)
#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_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)
@@ -89,6 +90,9 @@
#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 STR_RENAME_OR_REPLACE (RID_UUI_START + 58)
+#define STR_NAME_CLASH_RENAME_ONLY (RID_UUI_START + 59)
+#define STR_SAME_NAME_USED (RID_UUI_START + 60)
#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0)
#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1)
@@ -176,7 +180,6 @@
#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)
@@ -189,6 +192,7 @@
#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)
+#define HID_DLG_SIMPLE_NAME_CLASH (HID_UUI_START +18)
// HID_UUI_END (aka HID_CHAOS_NEW_DATABASE) is reserved in
// sfx2/util/hidother.src
diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx
index ec1317dbd8..39bbfb7d82 100755..100644
--- a/uui/source/loginerr.hxx
+++ b/uui/source/loginerr.hxx
@@ -68,7 +68,7 @@ public:
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; }
+ 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 ); }
diff --git a/uui/source/makefile.mk b/uui/source/makefile.mk
index 5c20e59304..e09f5c01e9 100644..100755
--- a/uui/source/makefile.mk
+++ b/uui/source/makefile.mk
@@ -48,7 +48,6 @@ SLOFILES = \
$(SLO)$/masterpasscrtdlg.obj \
$(SLO)$/openlocked.obj \
$(SLO)$/passworddlg.obj \
- $(SLO)$/passcrtdlg.obj \
$(SLO)$/fltdlg.obj \
$(SLO)$/interactionhandler.obj \
$(SLO)$/requeststringresolver.obj \
@@ -60,6 +59,7 @@ SLOFILES = \
$(SLO)$/lockfailed.obj \
$(SLO)$/trylater.obj \
$(SLO)$/newerverwarn.obj \
+ $(SLO)$/nameclashdlg.obj \
$(SLO)$/passwordcontainer.obj
SRS1NAME=$(TARGET)
@@ -71,7 +71,6 @@ SRC1FILES = \
masterpasscrtdlg.src \
openlocked.src \
passworddlg.src \
- passcrtdlg.src \
passworderrs.src \
fltdlg.src \
unknownauthdlg.src\
@@ -81,6 +80,7 @@ SRC1FILES = \
alreadyopen.src\
lockfailed.src\
trylater.src\
+ nameclashdlg.src\
newerverwarn.src
.INCLUDE: target.mk
diff --git a/uui/source/nameclashdlg.cxx b/uui/source/nameclashdlg.cxx
new file mode 100755
index 0000000000..3393dff289
--- /dev/null
+++ b/uui/source/nameclashdlg.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * 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 "vcl/msgbox.hxx"
+#include "osl/file.hxx"
+
+#include "ids.hrc"
+#include "nameclashdlg.hrc"
+#include "nameclashdlg.hxx"
+
+// NameClashDialog ---------------------------------------------------------
+
+IMPL_LINK( NameClashDialog, ButtonHdl_Impl, PushButton *, pBtn )
+{
+ long nRet = (long) ABORT;
+ if ( &maBtnRename == pBtn )
+ {
+ nRet = (long) RENAME;
+ rtl::OUString aNewName = maEDNewName.GetText();
+ if ( ( aNewName == maNewName ) || !aNewName.getLength() )
+ {
+ ErrorBox aError( NULL, WB_OK, maSameName );
+ aError.Execute();
+ return 1;
+ }
+ maNewName = aNewName;
+ }
+ else if ( &maBtnOverwrite == pBtn )
+ nRet = (long) OVERWRITE;
+
+ EndDialog( nRet );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+NameClashDialog::NameClashDialog( Window* pParent, ResMgr* pResMgr,
+ rtl::OUString const & rTargetFolderURL,
+ rtl::OUString const & rClashingName,
+ rtl::OUString const & rProposedNewName,
+ bool bAllowOverwrite )
+ : ModalDialog( pParent, ResId( DLG_SIMPLE_NAME_CLASH, *pResMgr ) ),
+ maFTMessage ( this, ResId( FT_FILE_EXISTS_WARNING, *pResMgr ) ),
+ maEDNewName ( this, ResId( EDIT_NEW_NAME, *pResMgr ) ),
+ maBtnOverwrite ( this, ResId( BTN_OVERWRITE, *pResMgr ) ),
+ maBtnRename ( this, ResId( BTN_RENAME, *pResMgr ) ),
+ maBtnCancel ( this, ResId( BTN_CANCEL, *pResMgr ) ),
+ maBtnHelp ( this, ResId( BTN_HELP, *pResMgr ) ),
+ maNewName ( rClashingName )
+{
+ FreeResource();
+
+ Link aLink( LINK( this, NameClashDialog, ButtonHdl_Impl ) );
+ maBtnOverwrite.SetClickHdl( aLink );
+ maBtnRename.SetClickHdl( aLink );
+ maBtnCancel.SetClickHdl( aLink );
+
+ String aInfo;
+ if ( bAllowOverwrite )
+ {
+ aInfo = String( ResId( STR_RENAME_OR_REPLACE, *pResMgr ) );
+ }
+ else
+ {
+ aInfo = String( ResId( STR_NAME_CLASH_RENAME_ONLY, *pResMgr ) );
+ maBtnOverwrite.Hide();
+ }
+
+ rtl::OUString aPath;
+ if ( osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL( rTargetFolderURL, aPath ) )
+ aPath = rTargetFolderURL;
+
+ maSameName = String ( ResId( STR_SAME_NAME_USED, *pResMgr ) );
+
+ aInfo.SearchAndReplaceAscii( "%NAME", rClashingName );
+ aInfo.SearchAndReplaceAscii( "%FOLDER", aPath );
+ maFTMessage.SetText( aInfo );
+ if ( rProposedNewName.getLength() )
+ maEDNewName.SetText( rProposedNewName );
+ else
+ maEDNewName.SetText( rClashingName );
+}
+
diff --git a/uui/source/passcrtdlg.hrc b/uui/source/nameclashdlg.hrc
index 8e3740abf0..81d112f25d 100644..100755
--- a/uui/source/passcrtdlg.hrc
+++ b/uui/source/nameclashdlg.hrc
@@ -25,19 +25,17 @@
*
************************************************************************/
-#ifndef UUI_PASSCRTDLG_HRC
-#define UUI_PASSCRTDLG_HRC
+#ifndef UUI_NAMECLASHDLG_HRC
+#define UUI_NAMECLASHDLG_HRC
-// local identifiers
-#define BTN_PASSCRT_CANCEL 1
-#define ED_PASSWORD_CRT 2
-#define FT_PASSWORD_REPEAT 3
-#define FT_PASSWORD_WARNING 4
-#define ED_PASSWORD_REPEAT 5
-#define FL_FIXED_LINE_1 6
-#define BTN_PASSCRT_OK 7
-#define BTN_PASSCRT_HELP 8
-#define FT_PASSWORD_CRT 9
-#define FT_MSPASSWORD_WARNING 10
+//============================================================================
+
+#define FT_FILE_EXISTS_WARNING 20
+#define EDIT_NEW_NAME 21
+#define BTN_OVERWRITE 22
+#define BTN_RENAME 23
+#define BTN_CANCEL 24
+#define BTN_HELP 25
+
+#endif // UUI_NAMECLASHDLG_HRC
-#endif // UUI_PASSCRTDLG_HRC
diff --git a/uui/source/passcrtdlg.hxx b/uui/source/nameclashdlg.hxx
index 4e9d065ee1..346b1faafd 100644..100755
--- a/uui/source/passcrtdlg.hxx
+++ b/uui/source/nameclashdlg.hxx
@@ -25,39 +25,39 @@
*
************************************************************************/
-#ifndef UUI_PASSCRTDLG_HXX
-#define UUI_PASSCRTDLG_HXX
+#ifndef UUI_NAMECLASHDLG_HXX
+#define UUI_NAMECLASHDLG_HXX
-#include <com/sun/star/task/PasswordRequestMode.hpp>
-#include <svtools/stdctrl.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
+#include "vcl/button.hxx"
+#include "vcl/dialog.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/edit.hxx"
//============================================================================
-class PasswordCreateDialog : public ModalDialog
+
+enum NameClashResolveDialogResult { ABORT, RENAME, OVERWRITE };
+
+class NameClashDialog : public ModalDialog
{
- FixedText aFTPasswordCrt;
- Edit aEDPasswordCrt;
- FixedText aFTPasswordRepeat;
- Edit aEDPasswordRepeat;
- FixedText aFTWarning;
- FixedLine aFixedLine1;
- OKButton aOKBtn;
- CancelButton aCancelBtn;
- HelpButton aHelpBtn;
-
- ResMgr* pResourceMgr;
- sal_uInt16 nMinLen;
-
- DECL_LINK( OKHdl_Impl, OKButton * );
- DECL_LINK( EditHdl_Impl, Edit * );
+ FixedText maFTMessage;
+ Edit maEDNewName;
+ PushButton maBtnOverwrite;
+ PushButton maBtnRename;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+ rtl::OUString maSameName;
+ rtl::OUString maNewName;
-public:
- PasswordCreateDialog( Window* pParent, ResMgr * pResMgr, bool bMSCryptoMode = false );
+ DECL_LINK( ButtonHdl_Impl, PushButton * );
- String GetPassword() const { return aEDPasswordCrt.GetText(); }
+public:
+ NameClashDialog( Window* pParent, ResMgr* pResMgr,
+ rtl::OUString const & rTargetFolderURL,
+ rtl::OUString const & rClashingName,
+ rtl::OUString const & rProposedNewName,
+ bool bAllowOverwrite );
+ rtl::OUString getNewName() const { return maNewName; }
};
-#endif // UUI_PASSCRTDLG_HXX
+#endif // UUI_COOKIEDG_HXX
+
diff --git a/uui/source/nameclashdlg.src b/uui/source/nameclashdlg.src
new file mode 100755
index 0000000000..fe6276e2a7
--- /dev/null
+++ b/uui/source/nameclashdlg.src
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define __RSC
+
+#ifndef UUI_IDS_HRC
+#include "ids.hrc"
+#endif
+
+#ifndef UUI_NAMECLASHDLG_HRC
+#include "nameclashdlg.hrc"
+#endif
+
+#define DLG_WIDTH 250
+#define DLG_HEIGTH 75
+#define BORDER_OFFSET 6
+#define EDIT_HEIGTH 12
+#define BTN_WIDTH 50
+#define BTN_HEIGTH 14
+
+ModalDialog DLG_SIMPLE_NAME_CLASH
+{
+ HelpId = HID_DLG_SIMPLE_NAME_CLASH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGTH ) ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "File Exists" ;
+
+ FixedText FT_FILE_EXISTS_WARNING
+ {
+ Pos = MAP_APPFONT ( BORDER_OFFSET, BORDER_OFFSET ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH - 2*BORDER_OFFSET, DLG_HEIGTH - EDIT_HEIGTH - BTN_HEIGTH - 4*BORDER_OFFSET ) ;
+ WordBreak = TRUE ;
+ };
+
+ Edit EDIT_NEW_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( BORDER_OFFSET, DLG_HEIGTH - EDIT_HEIGTH - BTN_HEIGTH - 2*BORDER_OFFSET ) ;
+ Size = MAP_APPFONT ( DLG_WIDTH - 2*BORDER_OFFSET , EDIT_HEIGTH ) ;
+ };
+
+ PushButton BTN_OVERWRITE
+ {
+ Pos = MAP_APPFONT ( DLG_WIDTH - 3*(BTN_WIDTH + BORDER_OFFSET) , DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ;
+ Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Replace" ;
+ };
+
+ PushButton BTN_RENAME
+ {
+ Pos = MAP_APPFONT ( DLG_WIDTH - 2*(BTN_WIDTH + BORDER_OFFSET) , DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ;
+ Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Rename" ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( DLG_WIDTH - BTN_WIDTH - BORDER_OFFSET, DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ;
+ Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ;
+ TabStop = TRUE ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( BORDER_OFFSET, DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ;
+ Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ;
+ TabStop = TRUE ;
+ };
+};
+
+String STR_RENAME_OR_REPLACE
+{
+ Text = "A file with the name \"%NAME\" already exists in the location \"%FOLDER\".\nChoose Replace to overwrite the existing file or provide a new name.";
+};
+
+String STR_NAME_CLASH_RENAME_ONLY
+{
+ Text = "A file with the name \"%NAME\" already exists in the location \"%FOLDER\".\nPlease enter a new name.";
+};
+
+String STR_SAME_NAME_USED
+{
+ Text = "Please provide a different file name!";
+};
diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx
deleted file mode 100644
index 6dbaeedd93..0000000000
--- a/uui/source/passcrtdlg.cxx
+++ /dev/null
@@ -1,128 +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.
- *
- ************************************************************************/
-
-#include <svtools/filedlg.hxx>
-#include <vcl/msgbox.hxx>
-
-#ifndef UUI_IDS_HRC
-#include <ids.hrc>
-#endif
-#ifndef UUI_PASSCRTDLG_HRC
-#include <passcrtdlg.hrc>
-#endif
-#include <passcrtdlg.hxx>
-
-// PasswordCreateDialog---------------------------------------------------
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( PasswordCreateDialog, EditHdl_Impl, Edit *, EMPTYARG )
-{
- aOKBtn.Enable( aEDPasswordCrt.GetText().Len() >= nMinLen );
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( PasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG )
-{
- // compare both passwords and show message box if there are not equal!!
- if( aEDPasswordCrt.GetText() == aEDPasswordRepeat.GetText() )
- EndDialog( RET_OK );
- else
- {
- String aErrorMsg( ResId( STR_ERROR_PASSWORDS_NOT_IDENTICAL, *pResourceMgr ));
- ErrorBox aErrorBox( this, WB_OK, aErrorMsg );
- aErrorBox.Execute();
- aEDPasswordCrt.SetText( String() );
- aEDPasswordRepeat.SetText( String() );
- aEDPasswordCrt.GrabFocus();
- }
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr, bool bMSCryptoMode)
- :ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD_CRT, *pResMgr ) )
- ,aFTPasswordCrt ( this, ResId( FT_PASSWORD_CRT, *pResMgr ) )
- ,aEDPasswordCrt ( this, ResId( ED_PASSWORD_CRT, *pResMgr ) )
- ,aFTPasswordRepeat ( this, ResId( FT_PASSWORD_REPEAT, *pResMgr ) )
- ,aEDPasswordRepeat ( this, ResId( ED_PASSWORD_REPEAT, *pResMgr ) )
- ,aFTWarning ( this, ResId( bMSCryptoMode ? FT_MSPASSWORD_WARNING : FT_PASSWORD_WARNING, *pResMgr ) )
- ,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) )
- ,aOKBtn ( this, ResId( BTN_PASSCRT_OK, *pResMgr ) )
- ,aCancelBtn ( this, ResId( BTN_PASSCRT_CANCEL, *pResMgr ) )
- ,aHelpBtn ( this, ResId( BTN_PASSCRT_HELP, *pResMgr ) )
- ,pResourceMgr ( pResMgr )
- ,nMinLen(1) // if it should be changed for ODF, it must stay 1 for bMSCryptoMode
-{
- FreeResource();
-
- aOKBtn.SetClickHdl( LINK( this, PasswordCreateDialog, OKHdl_Impl ) );
- aEDPasswordCrt.SetModifyHdl( LINK( this, PasswordCreateDialog, EditHdl_Impl ) );
-
- aOKBtn.Enable( sal_False );
-
- if ( bMSCryptoMode )
- {
- aEDPasswordCrt.SetMaxTextLen( 15 );
- aEDPasswordRepeat.SetMaxTextLen( 15 );
- }
-
- long nLabelWidth = aFTWarning.GetSizePixel().Width();
- long nLabelHeight = aFTWarning.GetSizePixel().Height();
- long nTextWidth = aFTWarning.GetCtrlTextWidth( aFTWarning.GetText() );
- long nTextHeight = aFTWarning.GetTextHeight();
-
- Rectangle aLabelRect( aFTWarning.GetPosPixel(), aFTWarning.GetSizePixel() );
- Rectangle aRect = aFTWarning.GetTextRect( aLabelRect, aFTWarning.GetText() );
-
- long nNewLabelHeight = 0;
- for( nNewLabelHeight = ( nTextWidth / nLabelWidth + 1 ) * nTextHeight;
- nNewLabelHeight < aRect.GetHeight();
- nNewLabelHeight += nTextHeight ) {} ;
-
- long nDelta = nNewLabelHeight - nLabelHeight;
-
- Size aNewDlgSize = GetSizePixel();
- aNewDlgSize.Height() += nDelta;
- SetSizePixel( aNewDlgSize );
-
- Size aNewWarningSize = aFTWarning.GetSizePixel();
- aNewWarningSize.Height() = nNewLabelHeight;
- aFTWarning.SetPosSizePixel( aFTWarning.GetPosPixel(), aNewWarningSize );
-
- Window* pControls[] = { &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn };
- const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
- for ( int i = 0; i < nCCount; ++i )
- {
- Point aNewPos =(*pControls[i]).GetPosPixel();
- aNewPos.Y() += nDelta;
- pControls[i]->SetPosSizePixel( aNewPos, pControls[i]->GetSizePixel() );
- }
-}
diff --git a/uui/source/passcrtdlg.src b/uui/source/passcrtdlg.src
deleted file mode 100644
index b4ba3f2125..0000000000
--- a/uui/source/passcrtdlg.src
+++ /dev/null
@@ -1,108 +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.
- *
- ************************************************************************/
-
-#define __RSC
-
-#ifndef UUI_IDS_HRC
-#include <ids.hrc>
-#endif
-#ifndef UUI_PASSCRTDLG_HRC
-#include "passcrtdlg.hrc"
-#endif
-
-ModalDialog DLG_UUI_PASSWORD_CRT
-{
- HelpId = HID_DLG_PASSWORD_CRT ;
- Border = TRUE ;
- Moveable = TRUE ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT( 145, 129 );
- FixedText FT_PASSWORD_CRT
- {
- Pos = MAP_APPFONT( 3, 4 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Enter password";
- };
- Edit ED_PASSWORD_CRT
- {
- Border = TRUE ;
- Pos = MAP_APPFONT( 3, 17 );
- Size = MAP_APPFONT( 139, 13 );
- PassWord = TRUE ;
- };
- Edit ED_PASSWORD_REPEAT
- {
- Border = TRUE ;
- Pos = MAP_APPFONT( 3, 47 );
- Size = MAP_APPFONT( 139, 13 );
- PassWord = TRUE ;
- };
- OKButton BTN_PASSCRT_OK
- {
- Pos = MAP_APPFONT( 27, 110 );
- Size = MAP_APPFONT( 37, 15 );
- DefButton = TRUE ;
- };
- CancelButton BTN_PASSCRT_CANCEL
- {
- Pos = MAP_APPFONT( 66, 110 );
- Size = MAP_APPFONT( 37, 15 );
- };
- HelpButton BTN_PASSCRT_HELP
- {
- Pos = MAP_APPFONT( 105, 110 );
- Size = MAP_APPFONT( 37, 15 );
- };
- FixedText FT_PASSWORD_REPEAT
- {
- Pos = MAP_APPFONT( 3, 34 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Reenter password";
- };
- FixedText FT_PASSWORD_WARNING
- {
- Pos = MAP_APPFONT( 4, 64 );
- Size = MAP_APPFONT( 137, 40 );
- Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive.";
- WordBreak = TRUE;
- };
- FixedText FT_MSPASSWORD_WARNING
- {
- Pos = MAP_APPFONT( 4, 64 );
- Size = MAP_APPFONT( 137, 40 );
- Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at most fifteen characters long.";
- WordBreak = TRUE;
- };
- FixedLine FL_FIXED_LINE_1
- {
- Pos = MAP_APPFONT( 0, 104 );
- Size = MAP_APPFONT( 145, 6 );
- };
- Text [ en-US ] = "Enter Password";
-};
-
diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
index afbd896b2b..4ba494f83b 100644
--- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
@@ -53,18 +53,21 @@ public:
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 ::sal_Bool SAL_CALL getInteractive() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setInteractive( ::sal_Bool bInteractive ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( ::sal_Bool bVisible ) throw (css::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 css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBProjects() 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 void SAL_CALL OnTime( const css::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) throw (css::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);
-
+ virtual void SAL_CALL Undo() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Quit() 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 20b220c1f5..27ffa25eeb 100644
--- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
@@ -133,11 +133,12 @@ protected:
class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE
{
protected:
+ css::uno::WeakReference< ov::XHelperInterface > m_xParent;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
public:
- EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
+ EnumerationHelperImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
};
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
index 29335304db..b68eb06815 100644
--- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -52,9 +52,7 @@ public:
virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException);
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
-
+ virtual css::uno::Any SAL_CALL getVBProject() throw (css::uno::RuntimeException);
// Methods
virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
new file mode 100755
index 0000000000..b0dd184c1a
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * 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 VBAHELPER_VBAEVENTSHELPERBASE_HXX
+#define VBAHELPER_VBAEVENTSHELPERBASE_HXX
+
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <map>
+#include <deque>
+#include "vbahelper/vbahelper.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+} } }
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper2< css::script::vba::XVBAEventProcessor, css::lang::XEventListener > VbaEventsHelperBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase : public VbaEventsHelperBase_BASE
+{
+public:
+ VbaEventsHelperBase(
+ const css::uno::Sequence< css::uno::Any >& rArgs,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~VbaEventsHelperBase();
+
+ // XVBAEventProcessor
+ virtual sal_Bool SAL_CALL hasVbaEventHandler( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ virtual void SAL_CALL processVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::script::provider::ScriptFrameworkErrorException, css::util::VetoException, css::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aSource ) throw (css::uno::RuntimeException);
+
+protected:
+ // ------------------------------------------------------------------------
+
+ enum EventHandlerType { EVENTHANDLER_GLOBAL, EVENTHANDLER_DOCUMENT };
+ struct EventHandlerInfo
+ {
+ sal_Int32 mnEventId;
+ ::rtl::OUString maMacroName;
+ EventHandlerType meType;
+ sal_Int32 mnCancelIndex;
+ css::uno::Any maUserData;
+ };
+
+ /** Registers a supported event handler.
+
+ @param nEventId Event identifier from com.sun.star.script.vba.EventIdentifier.
+ @param pcMacroName Name of the associated VBA event handler macro.
+ @param eType Document event or global event.
+ @param nCancelIndex 0-based index of Cancel parameter, or -1.
+ @param rUserData User data for free usage in derived implementations. */
+ void registerEventHandler(
+ sal_Int32 nEventId,
+ const sal_Char* pcMacroName,
+ EventHandlerType eType = EVENTHANDLER_DOCUMENT,
+ sal_Int32 nCancelIndex = -1,
+ const css::uno::Any& rUserData = css::uno::Any() );
+
+ /** Throws, if the passed sequence does not contain a value at the specified index. */
+ static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( rArgs.getLength() <= nIndex ) throw css::lang::IllegalArgumentException(); }
+
+ /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */
+ template< typename Type >
+ static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( (rArgs.getLength() <= nIndex) || !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); }
+
+ // ------------------------------------------------------------------------
+
+ struct EventQueueEntry
+ {
+ sal_Int32 mnEventId;
+ css::uno::Sequence< css::uno::Any > maArgs;
+ inline /*implicit*/ EventQueueEntry( sal_Int32 nEventId ) : mnEventId( nEventId ) {}
+ inline EventQueueEntry( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) : mnEventId( nEventId ), maArgs( rArgs ) {}
+ };
+ typedef ::std::deque< EventQueueEntry > EventQueue;
+
+ /** Derived classes return whether event processing is enabled. Throws if
+ the instance is in an invalid state. */
+ virtual bool implEventsEnabled() throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes do additional prpeparations and return whether the
+ event handler has to be called. */
+ virtual bool implPrepareEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes have to return the argument list for the specified VBA event handler. */
+ virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException) = 0;
+
+ /** Derived classes may do additional postprocessing. Called even if the
+ event handler does not exist, or if an error occured during execution. */
+ virtual void implPostProcessEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ bool bSuccess,
+ bool bCancel ) throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes have to return the name of the Basic document module. */
+ virtual ::rtl::OUString implGetDocumentModuleName(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException) = 0;
+
+private:
+ /** Returns the event handler info struct for the specified event, or throws. */
+ const EventHandlerInfo& getEventHandlerInfo( sal_Int32 nEventId ) const throw (css::lang::IllegalArgumentException);
+
+ /** Searches the event handler in the document and returns its full script path. */
+ ::rtl::OUString getEventHandlerPath(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException);
+
+ /** Removes this instance from all broadcasters. */
+ void stopListening();
+
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ SfxObjectShell* mpShell;
+
+private:
+ typedef ::std::map< sal_Int32, EventHandlerInfo > EventHandlerMap;
+
+ EventHandlerMap maEvents;
+ bool mbDisposed;
+};
+
+// ============================================================================
+
+#endif
diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
index d2d0399c11..1394a7c749 100644
--- a/vbahelper/inc/vbahelper/vbaglobalbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
@@ -32,16 +32,16 @@
typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE;
class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
-
{
protected:
-
+ rtl::OUString msDocCtxName;
+
bool hasServiceName( const rtl::OUString& serviceName );
void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
public:
VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName );
- virtual ~VbaGlobalsBase(){};
+ virtual ~VbaGlobalsBase();
// XMultiServiceFactory
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) throw (css::uno::Exception, css::uno::RuntimeException);
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index 024b0d3aa8..538360899e 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -63,6 +63,7 @@ namespace ooo
throw css::lang::IllegalArgumentException();
return aSomething;
}
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell );
VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
index 45fb518572..315d28d093 100644
--- a/vbahelper/inc/vbahelper/vbahelperinterface.hxx
+++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
@@ -28,6 +28,8 @@
#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <ooo/vba/XHelperInterface.hpp>
#include <vbahelper/vbahelper.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -68,6 +70,7 @@ protected:
css::uno::Reference< css::uno::XComponentContext > mxContext;
public:
InheritedHelperInterfaceImpl() {}
+ InheritedHelperInterfaceImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxContext( xContext ) {}
InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
virtual rtl::OUString& getServiceImplName() = 0;
virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0;
@@ -86,7 +89,6 @@ public:
return xNameAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application" ) ) );
}
-
// XServiceInfo Methods
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException)
@@ -101,19 +103,39 @@ public:
}
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException)
{
- css::uno::Sequence< rtl::OUString > aNames = getServiceNames();;
+ css::uno::Sequence< rtl::OUString > aNames = getServiceNames();
return aNames;
}
};
template< typename Ifc1 >
class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
+public:
+ InheritedHelperInterfaceImpl1< Ifc1 >() {}
+ InheritedHelperInterfaceImpl1< Ifc1 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl1< Ifc1 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+template< typename Ifc1, typename Ifc2 >
+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl2 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > >
{
-typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > > Base;
public:
- InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >() {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+template< typename Ifc1, typename Ifc2, typename Ifc3 >
+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl3 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > > Base;
+public:
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >() {}
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
};
// ============================================================================
diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst
index d683e97c8b..2d20ab1f98 100644
--- a/vbahelper/prj/d.lst
+++ b/vbahelper/prj/d.lst
@@ -26,3 +26,4 @@ mkdir: %_DEST%\inc%_EXT%\basic
..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx
..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx
..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx
+..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index a273bb1952..78c8b25885 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -74,12 +74,20 @@ private:
public:
ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
{
- mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
-
- msNames.realloc( sXControls.getLength() );
- for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
- SetArrayElementTo( sXControls[ i ], i );
+ try
+ {
+ mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
+
+ msNames.realloc( sXControls.getLength() );
+ for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
+ SetArrayElementTo( sXControls[ i ], i );
+ }
+ catch( uno::Exception& )
+ {
+ // accept the case when the dialog already does not exist
+ // in this case the wrapper should work in dummy mode
+ }
}
static rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
@@ -186,7 +194,7 @@ ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent,
const css::uno::Reference< awt::XControl >& xDialog )
: ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) )
{
- mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
+ mxDialog.set( xDialog, uno::UNO_QUERY );
}
uno::Reference< container::XEnumeration >
@@ -349,13 +357,16 @@ void SAL_CALL ScVbaControls::Remove( const uno::Any& StringKeyOrIndex )
}
catch( uno::RuntimeException& )
{
- throw;
+ // the exceptions are not rethrown, impossibility to find or remove the control is currently not reported
+ // since in most cases it means just that the controls is already not there, the VBA seems to do it in the same way
+
+ // throw;
}
catch( uno::Exception& e )
{
- throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not create AXControl!" ) ),
- uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ // throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not create AXControl!" ) ),
+ // uno::Reference< uno::XInterface >(),
+ // uno::makeAny( e ) );
}
}
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 2c04ea6759..12422bc559 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -185,7 +185,9 @@ ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::Runtime
uno::Any SAL_CALL
ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
{
- uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
+ // if the dialog already closed we should do nothing, but the VBA will call methods of the Controls objects
+ // thus we have to provide a dummy object in this case
+ uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY );
uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) );
if ( index.hasValue() )
return uno::makeAny( xControls->Item( index, uno::Any() ) );
diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk
index 47ad44b3d0..22ed40a3ad 100644
--- a/vbahelper/source/vbahelper/makefile.mk
+++ b/vbahelper/source/vbahelper/makefile.mk
@@ -65,6 +65,8 @@ SLOFILES=\
$(SLO)$/vbashaperange.obj \
$(SLO)$/vbatextframe.obj \
$(SLO)$/vbapagesetupbase.obj \
+ $(SLO)$/vbaeventshelperbase.obj
+
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 13aa451a31..57e303893e 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -24,39 +24,37 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#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/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
#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/document/XEmbeddedScripts.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
-
-#include "vbacommandbars.hxx"
+#include <hash_map>
#include <filter/msfilter/msvbahelper.hxx>
#include <tools/datetime.hxx>
-// start basic includes
#include <basic/sbx.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbuno.hxx>
#include <basic/sbmeth.hxx>
#include <basic/sbmod.hxx>
-// end basic includes
-#include <hash_map>
+#include "vbacommandbars.hxx"
-using namespace com::sun::star;
-using namespace ooo::vba;
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
#define OFFICEVERSION "11.0"
@@ -162,6 +160,9 @@ typedef ::std::hash_map< VbaTimerInfo, VbaTimer*, VbaTimerInfoHash, ::std::equal
struct VbaApplicationBase_Impl
{
VbaTimerHashMap m_aTimerHash;
+ sal_Bool mbVisible;
+
+ inline VbaApplicationBase_Impl() : mbVisible( sal_True ) {}
virtual ~VbaApplicationBase_Impl()
{
@@ -185,7 +186,6 @@ VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentCon
VbaApplicationBase::~VbaApplicationBase()
{
- m_pImpl = 0;
delete m_pImpl;
}
@@ -268,6 +268,16 @@ void SAL_CALL VbaApplicationBase::setInteractive( ::sal_Bool bInteractive )
xWindow->setEnable( bInteractive );
}
+sal_Bool SAL_CALL VbaApplicationBase::getVisible() throw (uno::RuntimeException)
+{
+ return m_pImpl->mbVisible; // dummy implementation
+}
+
+void SAL_CALL VbaApplicationBase::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
+{
+ m_pImpl->mbVisible = bVisible; // dummy implementation
+}
+
uno::Any SAL_CALL
VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
{
@@ -407,63 +417,50 @@ 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;
+ try // return empty object on error
+ {
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
+ aArgs[ 1 ] <<= getCurrentDocument();
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XInterface > xVBE = xServiceManager->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBE" ) ), aArgs, mxContext );
+ return uno::Any( xVBE );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return uno::Any();
}
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;
-
-
-
+ try // return empty object on error
+ {
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
+ aArgs[ 1 ] <<= getCurrentDocument();
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XInterface > xVBProjects = xServiceManager->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBProjects" ) ), aArgs, mxContext );
+ return uno::Any( xVBProjects );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return uno::Any();
}
-
-
-
-rtl::OUString&
+rtl::OUString&
VbaApplicationBase::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaApplicationBase") );
return sImplName;
}
+
uno::Sequence<rtl::OUString>
VbaApplicationBase::getServiceNames()
{
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 2f21943d63..0eba699a07 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -24,9 +24,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <vbahelper/vbadocumentbase.hxx>
-#include <vbahelper/helperdecl.hxx>
-#include <comphelper/unwrapargs.hxx>
+
+#include "vbahelper/vbadocumentbase.hxx"
+#include "vbahelper/helperdecl.hxx"
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/util/XProtectable.hpp>
@@ -35,8 +35,8 @@
#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 <comphelper/unwrapargs.hxx>
#include <tools/urlobj.hxx>
#include <osl/file.hxx>
@@ -206,41 +206,26 @@ 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;
-
+ try // return empty object on error
+ {
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
+ aArgs[ 1 ] <<= mxModel;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XInterface > xVBProjects = xServiceManager->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBProject" ) ), aArgs, mxContext );
+ return uno::Any( xVBProjects );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return uno::Any();
}
-
-// ---- Michael E.Bohn End -----
-
-
-rtl::OUString&
+rtl::OUString&
VbaDocumentBase::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaDocumentBase") );
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
new file mode 100755
index 0000000000..ee6eccbdd6
--- /dev/null
+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * 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 "vbahelper/vbaeventshelperbase.hxx"
+#include <filter/msfilter/msvbahelper.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+// ============================================================================
+
+VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) :
+ mpShell( 0 ),
+ mbDisposed( false )
+{
+ try
+ {
+ mxModel = getXSomethingFromArgs< frame::XModel >( rArgs, 0, false );
+ mpShell = getSfxObjShell( mxModel );
+
+ // add dispose listener
+ uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY_THROW );
+ xComponent->addEventListener( this );
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+VbaEventsHelperBase::~VbaEventsHelperBase()
+{
+ stopListening();
+}
+
+sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ // getEventHandlerInfo() throws, if unknown event dentifier has been passed
+ const EventHandlerInfo& rInfo = getEventHandlerInfo( nEventId );
+ // getEventHandlerPath() searches for the macro in the document
+ return getEventHandlerPath( rInfo, rArgs ).getLength() > 0;
+}
+
+void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
+ throw (lang::IllegalArgumentException, script::provider::ScriptFrameworkErrorException, util::VetoException, uno::RuntimeException)
+{
+ /* Derived classes may add new event identifiers to be processed while
+ processing the original event. All unprocessed events are collected in
+ a queue. First element in the queue is the next event to be processed. */
+ EventQueue aEventQueue;
+ aEventQueue.push_back( EventQueueEntry( nEventId, rArgs ) );
+
+ /* bEnabled will track if event processing is enabled. Every event handler
+ may disable handling of other events. */
+ bool bEnabled = true;
+
+ /* bCancel will contain the current Cancel value. It is possible that
+ multiple events will try to modify the Cancel value. Every event
+ handler receives the Cancel value of the previous event handler. */
+ bool bCancel = false;
+
+ /* bSuccess will change to true if at least one event handler has been
+ executed successfully. */
+ bool bSuccess = false;
+
+ /* Loop as long as there are more events to be processed, and as event
+ handling is still enabled. Derived classes may add new events to be
+ processed in the virtual implPrepareEvent() function. */
+ while( bEnabled && !aEventQueue.empty() )
+ {
+ /* Check that all class members are available, and that we are not
+ disposed (this may have happened at any time during execution of
+ the last event handler). */
+ if( mbDisposed || !mxModel.is() || !mpShell )
+ throw uno::RuntimeException();
+
+ // get info for next event
+ const EventHandlerInfo& rInfo = getEventHandlerInfo( aEventQueue.front().mnEventId );
+ uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs;
+ aEventQueue.pop_front();
+
+ // let derived classes decide whether event processing is still enabled
+ bEnabled = implEventsEnabled();
+ // let derived classes prepare the event, they may add new events for next iteration
+ if( bEnabled && implPrepareEvent( aEventQueue, rInfo, aEventArgs ) )
+ {
+ // search the event handler macro in the document
+ ::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
+ bool bEventSuccess = false;
+ if( aMacroPath.getLength() > 0 )
+ {
+ // build the argument list
+ uno::Sequence< uno::Any > aVbaArgs = implBuildArgumentList( rInfo, aEventArgs );
+ // insert current cancel value
+ if( rInfo.mnCancelIndex >= 0 )
+ {
+ if( rInfo.mnCancelIndex >= aVbaArgs.getLength() )
+ throw lang::IllegalArgumentException();
+ aVbaArgs[ rInfo.mnCancelIndex ] <<= bCancel;
+ }
+ // execute the event handler
+ uno::Any aRet, aCaller;
+ bEventSuccess = executeMacro( mpShell, aMacroPath, aVbaArgs, aRet, aCaller );
+ // extract new cancel value
+ if( rInfo.mnCancelIndex >= 0 )
+ {
+ if( rInfo.mnCancelIndex >= aVbaArgs.getLength() )
+ throw lang::IllegalArgumentException();
+ // cancel value may be boolean or any integer type, Any(bool) does not extract to sal_Int32
+ bool bNewCancel = false;
+ sal_Int32 nNewCancel = 0;
+ if( aVbaArgs[ rInfo.mnCancelIndex ] >>= bNewCancel )
+ bCancel = bNewCancel;
+ else if( aVbaArgs[ rInfo.mnCancelIndex ] >>= nNewCancel )
+ bCancel = nNewCancel != 0;
+ }
+ }
+ // post processing (also, if event handler does not exist, or on error
+ implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel );
+ // global success, if at least one event handler succeeded
+ bSuccess |= bEventSuccess;
+ }
+ }
+
+ // if event handlers want to cancel the event, do so regardless of any errors
+ if( bCancel )
+ throw util::VetoException();
+
+ // if no event handler finished successfully, throw
+ if( !bSuccess )
+ throw script::provider::ScriptFrameworkErrorException();
+}
+
+void SAL_CALL VbaEventsHelperBase::disposing( const lang::EventObject& /*aSource*/ ) throw (uno::RuntimeException)
+{
+ OSL_TRACE( "VbaEventsHelperBase::disposing" );
+ stopListening();
+ mbDisposed = true;
+}
+
+// protected ------------------------------------------------------------------
+
+void VbaEventsHelperBase::registerEventHandler( sal_Int32 nEventId,
+ const sal_Char* pcMacroName, EventHandlerType eType, sal_Int32 nCancelIndex, const uno::Any& rUserData )
+{
+ EventHandlerInfo& rInfo = maEvents[ nEventId ];
+ rInfo.mnEventId = nEventId;
+ rInfo.maMacroName = ::rtl::OUString::createFromAscii( pcMacroName );
+ rInfo.meType = eType;
+ rInfo.mnCancelIndex = nCancelIndex;
+ rInfo.maUserData = rUserData;
+}
+
+// private --------------------------------------------------------------------
+
+const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandlerInfo(
+ sal_Int32 nEventId ) const throw (lang::IllegalArgumentException)
+{
+ EventHandlerMap::const_iterator aIt = maEvents.find( nEventId );
+ if( aIt == maEvents.end() )
+ throw lang::IllegalArgumentException();
+ return aIt->second;
+}
+
+::rtl::OUString VbaEventsHelperBase::getEventHandlerPath( const EventHandlerInfo& rInfo,
+ const uno::Sequence< uno::Any >& rArgs ) const throw (lang::IllegalArgumentException)
+{
+ ::rtl::OUString aMacroName;
+ switch( rInfo.meType )
+ {
+ case EVENTHANDLER_GLOBAL:
+ aMacroName = rInfo.maMacroName;
+ break;
+ case EVENTHANDLER_DOCUMENT:
+ aMacroName = ::rtl::OUStringBuffer( implGetDocumentModuleName( rInfo, rArgs ) ).
+ append( sal_Unicode( '.' ) ).append( rInfo.maMacroName ).makeStringAndClear();
+ break;
+ }
+ return resolveVBAMacro( mpShell, aMacroName ).ResolvedMacro();
+}
+
+void VbaEventsHelperBase::stopListening()
+{
+ if( !mbDisposed ) try
+ {
+ uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY_THROW );
+ xComponent->removeEventListener( this );
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+// ============================================================================
diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx
index adb0738a13..0388d145f2 100644
--- a/vbahelper/source/vbahelper/vbaglobalbase.cxx
+++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx
@@ -35,22 +35,50 @@ using namespace ooo::vba;
rtl::OUString sApplication( RTL_CONSTASCII_USTRINGPARAM("Application") );
+// special key to return the Application
+rtl::OUString sAppService( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.Application") );
+
VbaGlobalsBase::VbaGlobalsBase(
const uno::Reference< ov::XHelperInterface >& xParent,
-const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName )
-: Globals_BASE( xParent, xContext )
+const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName )
+: Globals_BASE( xParent, xContext ), msDocCtxName( sDocCtxName )
{
// overwrite context with custom one ( that contains the application )
+ // wrap the service manager as we don't want the disposing context to tear down the 'normal' ServiceManager ( or at least thats what the code appears like it wants to do )
+ uno::Any aSrvMgr;
+ if ( xContext.is() && xContext->getServiceManager().is() )
+ {
+ aSrvMgr = uno::makeAny( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.OServiceManagerWrapper") ), xContext ) );
+ }
+
::cppu::ContextEntry_Init aHandlerContextInfo[] =
{
::cppu::ContextEntry_Init( sApplication, uno::Any() ),
::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ),
+ ::cppu::ContextEntry_Init( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.lang.theServiceManager" ) ), aSrvMgr )
};
-
- mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xContext );
-
+ // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and
+ // some strange behavior
+ mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), NULL );
}
+VbaGlobalsBase::~VbaGlobalsBase()
+{
+ try
+ {
+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
+ if ( xNameContainer.is() )
+ {
+ // release document reference ( we don't wan't the component context trying to dispose that )
+ xNameContainer->removeByName( msDocCtxName );
+ // release application reference, as it is holding onto the context
+ xNameContainer->removeByName( sApplication );
+ }
+ }
+ catch ( const uno::Exception& )
+ {
+ }
+}
void
VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs )
@@ -74,19 +102,30 @@ uno::Reference< uno::XInterface > SAL_CALL
VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException)
{
uno::Reference< uno::XInterface > xReturn;
-
- if ( hasServiceName( aServiceSpecifier ) )
+ if ( aServiceSpecifier.equals( sAppService ) )
+ {
+ // try to extract the Application from the context
+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
+ xNameContainer->getByName( sApplication ) >>= xReturn;
+ }
+ else if ( hasServiceName( aServiceSpecifier ) )
xReturn = mxContext->getServiceManager()->createInstanceWithContext( aServiceSpecifier, mxContext );
return xReturn;
}
uno::Reference< uno::XInterface > SAL_CALL
-VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
+VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
{
uno::Reference< uno::XInterface > xReturn;
- if ( hasServiceName( ServiceSpecifier ) )
- xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( ServiceSpecifier, Arguments, mxContext );
+ if ( aServiceSpecifier.equals( sAppService ) )
+ {
+ // try to extract the Application from the context
+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
+ xNameContainer->getByName( sApplication ) >>= xReturn;
+ }
+ else if ( hasServiceName( aServiceSpecifier ) )
+ xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( aServiceSpecifier, Arguments, mxContext );
return xReturn;
}
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 8654e6cb6a..86d8e478cd 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -1403,7 +1403,27 @@ void UserFormGeometryHelper::setHeight( double nHeight )
double points = double( static_cast<double>(_hmm) / factor);
return points;
}
-
+
+ uno::Reference< uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell )
+ {
+ uno::Reference< uno::XInterface > xIf;
+ if ( pShell )
+ {
+ rtl::OUString sProj( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ BasicManager* pBasMgr = pShell->GetBasicManager();
+ if ( pBasMgr && pBasMgr->GetName().Len() )
+ sProj = pShell->GetBasicManager()->GetName();
+ StarBASIC* pBasic = pShell->GetBasicManager()->GetLib( sProj );
+ if ( pBasic )
+ {
+ SbModule* pMod = pBasic->FindModule( aModName );
+ if ( pMod )
+ xIf = pMod->GetUnoModule();
+ }
+ }
+ return xIf;
+ }
+
SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
{
SfxObjectShell* pFoundShell = NULL;
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 6adeb410bc..13c8e9848d 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3107,6 +3107,9 @@ namespace xmloff { namespace token {
XML_N_CHART_EXT,
XML_COORDINATE_REGION,
+ XML_DIAGONAL_BL_TR_WIDTHS,
+ XML_DIAGONAL_TL_BR_WIDTHS,
+
XML_TOKEN_END
};
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
index e88cb6b84b..f0e8b1dac0 100644
--- a/xmloff/source/core/RDFaExportHelper.cxx
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -37,6 +37,8 @@
#include <comphelper/stlunosequence.hxx>
#include <comphelper/stl_types.hxx>
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/rdf/Statement.hpp>
#include <com/sun/star/rdf/URIs.hpp>
#include <com/sun/star/rdf/URI.hpp>
@@ -85,6 +87,39 @@ makeCURIE(SvXMLExport * i_pExport,
return buf.makeStringAndClear();
}
+// #i112473# SvXMLExport::GetRelativeReference() not right for RDF on SaveAs
+// because the URIs in the repository are not rewritten on SaveAs, the
+// URI of the loaded document has to be used, not the URI of the target doc.
+static ::rtl::OUString
+getRelativeReference(SvXMLExport const& rExport, ::rtl::OUString const& rURI)
+{
+ uno::Reference< rdf::XURI > const xModelURI(
+ rExport.GetModel(), uno::UNO_QUERY_THROW );
+ ::rtl::OUString const baseURI( xModelURI->getStringValue() );
+
+ uno::Reference<uno::XComponentContext> const xContext(
+ rExport.GetComponentContext());
+ uno::Reference<lang::XMultiComponentFactory> const xServiceFactory(
+ xContext->getServiceManager(), uno::UNO_SET_THROW);
+ uno::Reference<uri::XUriReferenceFactory> const xUriFactory(
+ xServiceFactory->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.uri.UriReferenceFactory"), xContext),
+ uno::UNO_QUERY_THROW);
+
+ uno::Reference< uri::XUriReference > const xBaseURI(
+ xUriFactory->parse(baseURI), uno::UNO_SET_THROW );
+ uno::Reference< uri::XUriReference > const xAbsoluteURI(
+ xUriFactory->parse(rURI), uno::UNO_SET_THROW );
+ uno::Reference< uri::XUriReference > const xRelativeURI(
+ xUriFactory->makeRelative(xBaseURI, xAbsoluteURI, true, true, false),
+ uno::UNO_SET_THROW );
+ ::rtl::OUString const relativeURI(xRelativeURI->getUriReference());
+
+ return relativeURI;
+}
+
+
////////////////////////////////////////////////////////////////////////////
RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport)
@@ -145,7 +180,7 @@ RDFaExportHelper::AddRDFa(
static const sal_Unicode s_OpenBracket ('[');
static const sal_Unicode s_CloseBracket(']');
const ::rtl::OUString about( xSubjectURI.is()
- ? m_rExport.GetRelativeReference(xSubjectURI->getStringValue())
+ ? getRelativeReference(m_rExport, xSubjectURI->getStringValue())
: ::rtl::OUStringBuffer().append(s_OpenBracket).append(
LookupBlankNode(xSubjectBNode)).append(s_CloseBracket)
.makeStringAndClear()
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7dc3bc32f4..fd878dda3e 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3107,6 +3107,9 @@ namespace xmloff { namespace token {
TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ),
TOKEN( "coordinate-region", XML_COORDINATE_REGION ),
+ TOKEN( "diagonal-bl-tr-widths", XML_DIAGONAL_BL_TR_WIDTHS ),
+ TOKEN( "diagonal-tl-br-widths", XML_DIAGONAL_TL_BR_WIDTHS ),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, NULL, NULL, XML_TOKEN_END }
#else
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index 5d50cbecba..44625536aa 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -708,6 +708,7 @@ void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest
case '8' :
case '9' :
case '.' :
+ case '-' :
{
com::sun::star::drawing::EnhancedCustomShapeParameterPair aPair;
if ( GetNextParameter( aPair.First, nIndex, rValue ) &&
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 803f3c5473..74060049f9 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -116,6 +116,7 @@ XMLTextMarkImportContext::XMLTextMarkImportContext(
const OUString& rLocalName )
: SvXMLImportContext(rImport, nPrefix, rLocalName)
, m_rHelper(rHlp)
+ , m_bHaveAbout(false)
{
}