summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@novell.com>2011-04-28 00:12:58 +0200
committerThorsten Behrens <tbehrens@novell.com>2011-04-28 00:12:58 +0200
commitf51c3f66b1034c9f15171678d1239c25d64341ba (patch)
tree438eb4b3d4da31d276dcb227da6afce76e165f00
parentb8502c8251b0760f1bf03c968974f1fe3f288ae2 (diff)
parent86e7ed8c72184b7a04b836848743979aa3f5fd3d (diff)
Merge commit 'ooo/DEV300_m106' into integration/dev300_m106
Conflicts: avmedia/source/gstreamer/gstframegrabber.cxx avmedia/source/gstreamer/gstplayer.cxx avmedia/source/gstreamer/gstplayer.hxx basic/inc/basic/sbxdef.hxx basic/source/classes/sbxmod.cxx basic/source/comp/makefile.mk basic/source/comp/sbcomp.cxx basic/source/inc/namecont.hxx basic/source/inc/scriptcont.hxx basic/source/runtime/methods.cxx basic/source/runtime/runtime.cxx basic/source/runtime/stdobj.cxx basic/source/runtime/step1.cxx basic/source/uno/namecont.cxx basic/util/makefile.mk connectivity/source/commontools/predicateinput.cxx connectivity/source/drivers/dbase/DNoException.cxx connectivity/source/drivers/dbase/DTable.cxx connectivity/source/drivers/file/fcomp.cxx connectivity/source/drivers/jdbc/JConnection.cxx connectivity/source/drivers/odbcbase/OResultSet.cxx connectivity/source/drivers/odbcbase/OStatement.cxx connectivity/source/parse/sqlnode.cxx desktop/source/app/app.cxx drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx drawinglayer/source/processor2d/vclprocessor2d.cxx formula/inc/formula/token.hxx formula/source/core/api/token.cxx fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx fpicker/source/win32/filepicker/platform_vista.h framework/source/helper/persistentwindowstate.cxx framework/source/uielement/menubarmanager.cxx oovbaapi/ooo/vba/XFoundFiles.idl oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/msforms/XCheckBox.idl oovbaapi/ooo/vba/msforms/XComboBox.idl oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XGroupBox.idl oovbaapi/ooo/vba/msforms/XLabel.idl oovbaapi/ooo/vba/msforms/XListBox.idl oovbaapi/ooo/vba/msforms/XNewFont.idl oovbaapi/ooo/vba/msforms/XRadioButton.idl oovbaapi/ooo/vba/msforms/XTextBox.idl oovbaapi/ooo/vba/msforms/XToggleButton.idl scripting/source/dlgprov/dlgevtatt.cxx sfx2/source/control/unoctitm.cxx sfx2/source/doc/objstor.cxx sfx2/source/doc/objxtor.cxx svx/inc/svx/svdograf.hxx svx/source/form/fmpage.cxx svx/source/form/fmpgeimp.cxx svx/source/svdraw/svdedtv.cxx svx/source/svdraw/svdfmtf.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdouno.cxx svx/source/xml/xmlgrhlp.cxx uui/source/iahndl-ssl.cxx vbahelper/Library_msforms.mk vbahelper/Library_vbahelper.mk vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/prj/build.lst vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrols.cxx vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.hxx vbahelper/source/msforms/vbamultipage.cxx vbahelper/source/msforms/vbatogglebutton.cxx vbahelper/source/msforms/vbauserform.cxx vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrols.hxx vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbawindowbase.cxx xmloff/source/meta/xmlmetai.cxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprmap.cxx
-rwxr-xr-xavmedia/source/gstreamer/makefile.mk2
-rw-r--r--basic/inc/basic/sbxdef.hxx4
-rw-r--r--basic/inc/basic/vbahelper.hxx49
-rw-r--r--basic/source/basmgr/vbahelper.cxx158
-rw-r--r--basic/source/classes/sb.cxx38
-rw-r--r--basic/source/classes/sbunoobj.cxx39
-rw-r--r--basic/source/classes/sbxmod.cxx119
-rw-r--r--basic/source/comp/codegen.cxx2
-rw-r--r--basic/source/comp/dim.cxx7
-rwxr-xr-xbasic/source/comp/makefile.mk11
-rw-r--r--basic/source/comp/sbcomp.cxx675
-rw-r--r--basic/source/comp/symtbl.cxx1
-rw-r--r--basic/source/comp/token.cxx6
-rw-r--r--basic/source/inc/codegen.hxx3
-rw-r--r--basic/source/inc/namecont.hxx176
-rw-r--r--basic/source/inc/runtime.hxx2
-rw-r--r--basic/source/inc/sbtrace.hxx13
-rw-r--r--basic/source/inc/scriptcont.hxx16
-rw-r--r--basic/source/inc/symtbl.hxx3
-rw-r--r--basic/source/runtime/methods.cxx65
-rw-r--r--basic/source/runtime/methods1.cxx7
-rw-r--r--basic/source/runtime/rtlproto.hxx1
-rw-r--r--basic/source/runtime/runtime.cxx27
-rw-r--r--basic/source/runtime/stdobj.cxx2
-rw-r--r--basic/source/runtime/step0.cxx2
-rw-r--r--basic/source/runtime/step1.cxx11
-rw-r--r--basic/source/runtime/step2.cxx6
-rw-r--r--basic/source/uno/namecont.cxx233
-rwxr-xr-xbasic/util/makefile.mk3
-rw-r--r--connectivity/inc/connectivity/predicateinput.hxx8
-rw-r--r--connectivity/inc/connectivity/sqlnode.hxx2
-rwxr-xr-xconnectivity/qa/connectivity/tools/CRMDatabase.java5
-rwxr-xr-xconnectivity/qa/makefile.mk9
-rw-r--r--connectivity/source/commontools/FValue.cxx48
-rw-r--r--connectivity/source/commontools/predicateinput.cxx135
-rw-r--r--connectivity/source/drivers/ado/AColumn.cxx5
-rw-r--r--connectivity/source/drivers/ado/AConnection.cxx5
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx2
-rw-r--r--connectivity/source/drivers/ado/ado.xcu5
-rw-r--r--connectivity/source/drivers/dbase/DNoException.cxx15
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx2
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx13
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx17
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx5
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx18
-rw-r--r--connectivity/source/drivers/hsqldb/HTerminateListener.cxx1
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/jdbc.xcu5
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx1
-rw-r--r--connectivity/source/drivers/macab/MacabRecord.cxx2
-rw-r--r--connectivity/source/drivers/odbc/odbc.xcu5
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx22
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSet.cxx19
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx6
-rw-r--r--connectivity/source/drivers/odbcbase/OStatement.cxx14
-rw-r--r--connectivity/source/inc/hsqldb/HDriver.hxx1
-rw-r--r--connectivity/source/parse/PColumn.cxx16
-rwxr-xr-xconnectivity/source/parse/sqlbison.y474
-rwxr-xr-xconnectivity/source/parse/sqlflex.l27
-rw-r--r--connectivity/source/parse/sqliterator.cxx34
-rw-r--r--connectivity/source/parse/sqlnode.cxx2
-rw-r--r--desktop/source/app/app.cxx8
-rw-r--r--desktop/source/deployment/dp_services.cxx2
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx26
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx1
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/rendergraphicprimitive2d.hxx95
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx2
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx2
-rw-r--r--drawinglayer/prj/d.lst1
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx69
-rwxr-xr-xdrawinglayer/source/primitive2d/makefile.mk1
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx28
-rw-r--r--drawinglayer/source/primitive2d/rendergraphicprimitive2d.cxx92
-rw-r--r--drawinglayer/source/processor2d/hittestprocessor2d.cxx2
-rw-r--r--drawinglayer/source/processor2d/linegeometryextractor2d.cxx1
-rw-r--r--drawinglayer/source/processor2d/textaspolygonextractor2d.cxx1
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx9
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx7
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx71
-rw-r--r--editeng/source/editeng/impedit2.cxx22
-rwxr-xr-xformula/inc/formula/compiler.hrc126
-rw-r--r--formula/inc/formula/opcode.hxx4
-rw-r--r--formula/inc/formula/token.hxx20
-rw-r--r--formula/inc/formula/tokenarray.hxx4
-rw-r--r--formula/source/core/api/token.cxx67
-rw-r--r--formula/source/core/resource/core_resource.src24
-rw-r--r--fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx2
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePicker.cxx16
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx52
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx53
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx12
-rw-r--r--fpicker/source/win32/filepicker/WinFileOpenImpl.cxx33
-rw-r--r--fpicker/source/win32/filepicker/platform_vista.h1
-rw-r--r--fpicker/source/win32/filepicker/previewadapter.cxx2
-rw-r--r--framework/Library_fwe.mk2
-rw-r--r--framework/Library_fwk.mk2
-rw-r--r--framework/Package_inc.mk1
-rw-r--r--framework/inc/xml/imagesconfiguration.hxx (renamed from framework/inc/framework/imagesconfiguration.hxx)14
-rw-r--r--framework/inc/xml/imagesdocumenthandler.hxx10
-rw-r--r--framework/source/helper/persistentwindowstate.cxx5
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx8
-rw-r--r--framework/source/uiconfiguration/imagemanager.cxx3
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx3
-rw-r--r--framework/source/uiconfiguration/moduleimagemanager.cxx3
-rw-r--r--framework/source/uielement/menubarmanager.cxx60
-rw-r--r--framework/source/xml/imagesconfiguration.cxx (renamed from framework/source/fwe/xml/imagesconfiguration.cxx)3
-rw-r--r--framework/source/xml/imagesdocumenthandler.cxx (renamed from framework/source/fwe/xml/imagesdocumenthandler.cxx)0
-rw-r--r--officecfg/registry/data/org/openoffice/Setup.xcu2
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs47
-rw-r--r--oovbaapi/ooo/vba/XApplicationBase.idl1
-rwxr-xr-xoovbaapi/ooo/vba/XCollectionBase.idl56
-rw-r--r--oovbaapi/ooo/vba/XControlProvider.idl2
-rwxr-xr-xoovbaapi/ooo/vba/XExecutableDialog.idl58
-rw-r--r--oovbaapi/ooo/vba/excel/SheetObjects.idl26
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl4
-rwxr-xr-xoovbaapi/ooo/vba/makefile.mk2
-rw-r--r--oovbaapi/ooo/vba/msforms/XCheckBox.idl3
-rw-r--r--oovbaapi/ooo/vba/msforms/XComboBox.idl18
-rw-r--r--oovbaapi/ooo/vba/msforms/XCommandButton.idl56
-rw-r--r--oovbaapi/ooo/vba/msforms/XControl.idl2
-rwxr-xr-x[-rw-r--r--]oovbaapi/ooo/vba/msforms/XFrame.idl (renamed from oovbaapi/ooo/vba/msforms/XButton.idl)20
-rw-r--r--oovbaapi/ooo/vba/msforms/XGroupBox.idl6
-rw-r--r--oovbaapi/ooo/vba/msforms/XLabel.idl7
-rw-r--r--oovbaapi/ooo/vba/msforms/XListBox.idl11
-rwxr-xr-xoovbaapi/ooo/vba/msforms/XNewFont.idl57
-rw-r--r--oovbaapi/ooo/vba/msforms/XRadioButton.idl7
-rw-r--r--oovbaapi/ooo/vba/msforms/XTextBox.idl10
-rw-r--r--oovbaapi/ooo/vba/msforms/XToggleButton.idl7
-rw-r--r--oovbaapi/ooo/vba/msforms/XUserForm.idl2
-rwxr-xr-xoovbaapi/ooo/vba/msforms/makefile.mk5
-rwxr-xr-xreadlicense_oo/docs/readme.xsl58
-rwxr-xr-xreadlicense_oo/docs/readme/eval.xsl2
-rwxr-xr-xreadlicense_oo/docs/readme/readme.xrm4
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx25
-rw-r--r--sfx2/source/appl/appdata.cxx2
-rw-r--r--sfx2/source/appl/appinit.cxx11
-rw-r--r--sfx2/source/appl/appopen.cxx5
-rw-r--r--sfx2/source/appl/appquit.cxx2
-rw-r--r--sfx2/source/appl/sfx.src13
-rwxr-xr-xsfx2/source/appl/shutdowniconaqua.mm1
-rw-r--r--sfx2/source/config/evntconf.cxx2
-rw-r--r--sfx2/source/control/unoctitm.cxx2
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx2
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx10
-rw-r--r--sfx2/source/doc/guisaveas.cxx8
-rw-r--r--sfx2/source/doc/objstor.cxx42
-rw-r--r--sfx2/source/doc/objxtor.cxx97
-rw-r--r--sfx2/source/inc/appdata.hxx3
-rw-r--r--svx/inc/svx/svdograf.hxx2
-rwxr-xr-x[-rw-r--r--]svx/inc/svx/xoutbmp.hxx1
-rw-r--r--svx/source/dialog/_bmpmask.cxx3
-rw-r--r--svx/source/fmcomp/gridctrl.cxx12
-rw-r--r--svx/source/form/fmobj.cxx4
-rw-r--r--svx/source/form/fmpage.cxx3
-rw-r--r--svx/source/form/fmpgeimp.cxx76
-rw-r--r--svx/source/form/fmshell.cxx6
-rw-r--r--svx/source/gallery2/galtheme.cxx1
-rw-r--r--svx/source/inc/fmpgeimp.hxx4
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx3
-rw-r--r--svx/source/svdraw/svdedtv.cxx6
-rw-r--r--svx/source/svdraw/svdfmtf.cxx23
-rw-r--r--svx/source/svdraw/svdfmtf.hxx1
-rw-r--r--svx/source/svdraw/svdograf.cxx23
-rw-r--r--svx/source/svdraw/svdouno.cxx65
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx148
-rw-r--r--svx/source/xml/xmlgrhlp.cxx8
-rwxr-xr-x[-rw-r--r--]svx/source/xoutdev/_xoutbmp.cxx6
-rw-r--r--ucb/source/ucp/gvfs/gvfs_content.cxx2
-rw-r--r--uui/source/iahndl-ssl.cxx67
-rwxr-xr-xvbahelper/Library_msforms.mk12
-rwxr-xr-xvbahelper/Library_vbahelper.mk15
-rwxr-xr-xvbahelper/Package_inc.mk2
-rwxr-xr-xvbahelper/inc/vbahelper/collectionbase.hxx214
-rw-r--r--vbahelper/inc/vbahelper/vbaapplicationbase.hxx1
-rw-r--r--vbahelper/inc/vbahelper/vbacollectionimpl.hxx4
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentbase.hxx1
-rw-r--r--vbahelper/inc/vbahelper/vbaeventshelperbase.hxx68
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx121
-rw-r--r--vbahelper/inc/vbahelper/vbawindowbase.hxx37
-rwxr-xr-xvbahelper/inc/vbahelper/weakreference.hxx94
-rw-r--r--vbahelper/source/msforms/vbabutton.cxx53
-rw-r--r--vbahelper/source/msforms/vbabutton.hxx15
-rw-r--r--vbahelper/source/msforms/vbacheckbox.cxx9
-rw-r--r--vbahelper/source/msforms/vbacheckbox.hxx1
-rw-r--r--vbahelper/source/msforms/vbacombobox.cxx115
-rw-r--r--vbahelper/source/msforms/vbacombobox.hxx14
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx136
-rw-r--r--vbahelper/source/msforms/vbacontrol.hxx24
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx187
-rw-r--r--vbahelper/source/msforms/vbacontrols.hxx27
-rw-r--r--vbahelper/source/msforms/vbaframe.cxx75
-rw-r--r--vbahelper/source/msforms/vbaframe.hxx30
-rw-r--r--vbahelper/source/msforms/vbalabel.cxx9
-rw-r--r--vbahelper/source/msforms/vbalabel.hxx1
-rw-r--r--vbahelper/source/msforms/vbalistbox.cxx9
-rw-r--r--vbahelper/source/msforms/vbalistbox.hxx3
-rw-r--r--vbahelper/source/msforms/vbamultipage.cxx9
-rw-r--r--vbahelper/source/msforms/vbamultipage.hxx9
-rwxr-xr-xvbahelper/source/msforms/vbanewfont.cxx160
-rwxr-xr-xvbahelper/source/msforms/vbanewfont.hxx73
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.cxx8
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.hxx1
-rw-r--r--vbahelper/source/msforms/vbatextbox.cxx39
-rw-r--r--vbahelper/source/msforms/vbatextbox.hxx6
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.cxx52
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.hxx12
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx36
-rw-r--r--vbahelper/source/msforms/vbauserform.hxx14
-rwxr-xr-xvbahelper/source/vbahelper/collectionbase.cxx332
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx27
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.cxx70
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.hxx11
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.cxx27
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.hxx19
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarhelper.hxx1
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx16
-rw-r--r--vbahelper/source/vbahelper/vbaeventshelperbase.cxx247
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx406
-rw-r--r--vbahelper/source/vbahelper/vbawindowbase.cxx140
-rw-r--r--xmloff/inc/xmloff/PageMasterStyleMap.hxx17
-rw-r--r--xmloff/inc/xmloff/txtprmap.hxx8
-rw-r--r--xmloff/inc/xmloff/xmlmetai.hxx10
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx2
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx17
-rw-r--r--xmloff/source/forms/elementimport.cxx6
-rw-r--r--xmloff/source/meta/xmlmetai.cxx113
-rw-r--r--xmloff/source/style/PageMasterExportPropMapper.cxx44
-rw-r--r--xmloff/source/style/PageMasterImportPropMapper.cxx75
-rw-r--r--xmloff/source/style/PageMasterStyleMap.cxx25
-rw-r--r--xmloff/source/text/txtexppr.cxx121
-rw-r--r--xmloff/source/text/txtimppr.cxx78
-rw-r--r--xmloff/source/text/txtprmap.cxx23
233 files changed, 6438 insertions, 1833 deletions
diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk
index 0bea1330a099..c87d43afb24a 100755
--- a/avmedia/source/gstreamer/makefile.mk
+++ b/avmedia/source/gstreamer/makefile.mk
@@ -66,6 +66,8 @@ SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(PKGCONFIG_
SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+# on Solaris checkdll does not work: LD_LIBRARY_PATH breaks the 2 libxml2.so.2
+SHL1NOCHECK=t
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=exports.dxp
diff --git a/basic/inc/basic/sbxdef.hxx b/basic/inc/basic/sbxdef.hxx
index cc05e3dc1ff3..0eda93dcf102 100644
--- a/basic/inc/basic/sbxdef.hxx
+++ b/basic/inc/basic/sbxdef.hxx
@@ -114,6 +114,8 @@ enum SbxDataType {
const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
+const sal_uInt32 SBX_TYPE_VAR_TO_DIM_FLAG = 0x40000;
+
#endif
#ifndef _SBX_OPERATOR
@@ -261,6 +263,8 @@ typedef sal_uIntPtr SbxError; // Preserve old type
#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one
// is used for objects, the other for variables only
+#define SBX_VAR_TO_DIM 0x2000 // Same value as SBX_NO_BROADCAST, cannot conflict as
+ // used for variables without broadcaster only
// Broadcaster-IDs:
#define SBX_HINT_DYING SFX_HINT_DYING
diff --git a/basic/inc/basic/vbahelper.hxx b/basic/inc/basic/vbahelper.hxx
index 0d99387965fe..f83548f7e02c 100644
--- a/basic/inc/basic/vbahelper.hxx
+++ b/basic/inc/basic/vbahelper.hxx
@@ -28,7 +28,9 @@
#ifndef BASIC_VBAHELPR_HXX
#define BASIC_VBAHELPR_HXX
+#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <rtl/ustring.hxx>
namespace basic {
namespace vba {
@@ -39,6 +41,21 @@ namespace vba {
// ============================================================================
+/** Creates and returns an enumeration of all open documents of the same type
+ as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and all open documents with the
+ same type will be stored in an enumeration object.
+
+ @param rxModel
+ A document model determining the type of the documents.
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > createDocumentsEnumeration(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
+
+// ============================================================================
+
/** Locks or unlocks the controllers of all documents that have the same type
as the specified document.
@@ -80,6 +97,38 @@ void enableContainerWindowsOfAllDocuments(
// ============================================================================
+/** Registers the passed path as working directory for the application the
+ passed document belongs to.
+
+ @param rxModel
+ A document model determining the type of the application whose working
+ directory has been changed.
+
+ @param rPath
+ The new working directory.
+ */
+void registerCurrentDirectory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ const ::rtl::OUString& rPath );
+
+// ============================================================================
+
+/** Returns the working directory of the application the passed document
+ belongs to.
+
+ @param rxModel
+ A document model determining the type of the application whose working
+ directory is querried.
+
+ @return
+ The working directory of the specified application, or an empty string
+ on error (e.g. if the passed document reference is empty).
+ */
+::rtl::OUString getCurrentDirectory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
+
+// ============================================================================
+
} // namespace vba
} // namespace basic
diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx
index a09446f2e40b..0e9338b52c5e 100644
--- a/basic/source/basmgr/vbahelper.cxx
+++ b/basic/source/basmgr/vbahelper.cxx
@@ -28,13 +28,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#include "basic/vbahelper.hxx"
+#include <basic/vbahelper.hxx>
+
+#include <map>
+#include <vector>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/instance.hxx>
namespace basic {
namespace vba {
@@ -45,64 +50,71 @@ using namespace ::com::sun::star;
namespace {
-/** Creates the global module manager needed to identify the type of documents.
+/** Create an instance of a module manager.
*/
uno::Reference< frame::XModuleManager > lclCreateModuleManager()
{
uno::Reference< frame::XModuleManager > xModuleManager;
try
{
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
xModuleManager.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), uno::UNO_QUERY );
}
catch( uno::Exception& )
{
}
- OSL_ENSURE( xModuleManager.is(), "::basic::vba::lclCreateModuleManager - cannot create module manager" );
return xModuleManager;
}
// ----------------------------------------------------------------------------
-/** Returns the document service name of the specified document.
+/** Implementation of an enumeration of all open documents of the same type.
*/
-::rtl::OUString lclIdentifyDocument( const uno::Reference< frame::XModuleManager >& rxModuleManager, const uno::Reference< frame::XModel >& rxModel )
+class DocumentsEnumeration : public ::cppu::WeakImplHelper1< container::XEnumeration >
{
- ::rtl::OUString aServiceName;
- if( rxModuleManager.is() )
- {
- try
- {
- aServiceName = rxModuleManager->identify( rxModel );
- }
- catch( uno::Exception& )
- {
- }
- OSL_ENSURE( aServiceName.getLength() > 0, "::basic::vba::lclIdentifyDocument - cannot identify document" );
- }
- return aServiceName;
-}
-
-// ----------------------------------------------------------------------------
+public:
+ DocumentsEnumeration( const uno::Reference< frame::XModel >& rxModel );
+ virtual sal_Bool SAL_CALL hasMoreElements() throw (uno::RuntimeException);
+ virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+private:
+ typedef ::std::vector< uno::Reference< frame::XModel > > ModelVector;
+ ModelVector maModels;
+ ModelVector::iterator maModelIt;
+};
-/** Returns an enumeration of all open documents.
- */
-uno::Reference< container::XEnumeration > lclCreateDocumentEnumeration()
+DocumentsEnumeration::DocumentsEnumeration( const uno::Reference< frame::XModel >& rxModel )
{
- uno::Reference< container::XEnumeration > xEnumeration;
try
{
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW );
+ ::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), uno::UNO_QUERY_THROW );
uno::Reference< container::XEnumerationAccess > xComponentsEA( xDesktop->getComponents(), uno::UNO_SET_THROW );
- xEnumeration = xComponentsEA->createEnumeration();
-
+ uno::Reference< container::XEnumeration > xEnumeration( xComponentsEA->createEnumeration(), uno::UNO_SET_THROW );
+ while( xEnumeration->hasMoreElements() )
+ {
+ uno::Reference< frame::XModel > xCurrModel( xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
+ if( xModuleManager->identify( xCurrModel ) == aIdentifier )
+ maModels.push_back( xCurrModel );
+ }
}
catch( uno::Exception& )
{
}
- OSL_ENSURE( xEnumeration.is(), "::basic::vba::lclCreateDocumentEnumeration - cannot create enumeration of all documents" );
- return xEnumeration;
+ maModelIt = maModels.begin();
+}
+
+sal_Bool SAL_CALL DocumentsEnumeration::hasMoreElements() throw (uno::RuntimeException)
+{
+ return maModelIt != maModels.end();
+}
+
+uno::Any SAL_CALL DocumentsEnumeration::nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( maModelIt == maModels.end() )
+ throw container::NoSuchElementException();
+ return uno::Any( *maModelIt++ );
}
// ----------------------------------------------------------------------------
@@ -163,37 +175,39 @@ typedef void (*ModifyDocumentFunc)( const uno::Reference< frame::XModel >&, sal_
*/
void lclIterateDocuments( ModifyDocumentFunc pModifyDocumentFunc, const uno::Reference< frame::XModel >& rxModel, sal_Bool bModificator )
{
- uno::Reference< frame::XModuleManager > xModuleManager = lclCreateModuleManager();
- uno::Reference< container::XEnumeration > xDocumentsEnum = lclCreateDocumentEnumeration();
- ::rtl::OUString aIdentifier = lclIdentifyDocument( xModuleManager, rxModel );
- if( xModuleManager.is() && xDocumentsEnum.is() && (aIdentifier.getLength() > 0) )
+ uno::Reference< container::XEnumeration > xDocumentsEnum( new DocumentsEnumeration( rxModel ) );
+ // iterate over all open documents
+ while( xDocumentsEnum->hasMoreElements() ) try
{
- // iterate over all open documents
- while( xDocumentsEnum->hasMoreElements() )
- {
- try
- {
- uno::Reference< frame::XModel > xCurrModel( xDocumentsEnum->nextElement(), uno::UNO_QUERY_THROW );
- ::rtl::OUString aCurrIdentifier = lclIdentifyDocument( xModuleManager, xCurrModel );
- if( aCurrIdentifier == aIdentifier )
- pModifyDocumentFunc( xCurrModel, bModificator );
- }
- catch( uno::Exception& )
- {
- }
- }
+ uno::Reference< frame::XModel > xCurrModel( xDocumentsEnum->nextElement(), uno::UNO_QUERY_THROW );
+ pModifyDocumentFunc( xCurrModel, bModificator );
}
- else
+ catch( uno::Exception& )
{
- // no module manager, no documents enumeration, no identifier -> at least process the passed document
- pModifyDocumentFunc( rxModel, bModificator );
}
}
+// ----------------------------------------------------------------------------
+
+struct CurrDirPool
+{
+ ::osl::Mutex maMutex;
+ ::std::map< ::rtl::OUString, ::rtl::OUString > maCurrDirs;
+};
+
+struct StaticCurrDirPool : public ::rtl::Static< CurrDirPool, StaticCurrDirPool > {};
+
} // namespace
// ============================================================================
+uno::Reference< container::XEnumeration > createDocumentsEnumeration( const uno::Reference< frame::XModel >& rxModel )
+{
+ return new DocumentsEnumeration( rxModel );
+}
+
+// ============================================================================
+
void lockControllersOfAllDocuments( const uno::Reference< frame::XModel >& rxModel, sal_Bool bLockControllers )
{
lclIterateDocuments( &lclLockControllers, rxModel, bLockControllers );
@@ -208,5 +222,45 @@ void enableContainerWindowsOfAllDocuments( const uno::Reference< frame::XModel >
// ============================================================================
+void registerCurrentDirectory( const uno::Reference< frame::XModel >& rxModel, const ::rtl::OUString& rPath )
+{
+ if( rPath.getLength() > 0 )
+ {
+ CurrDirPool& rPool = StaticCurrDirPool::get();
+ ::osl::MutexGuard aGuard( rPool.maMutex );
+ try
+ {
+ uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW );
+ ::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
+ if( aIdentifier.getLength() > 0 )
+ rPool.maCurrDirs[ aIdentifier ] = rPath;
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+}
+
+// ============================================================================
+
+::rtl::OUString getCurrentDirectory( const uno::Reference< frame::XModel >& rxModel )
+{
+ ::rtl::OUString aPath;
+ CurrDirPool& rPool = StaticCurrDirPool::get();
+ ::osl::MutexGuard aGuard( rPool.maMutex );
+ try
+ {
+ uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW );
+ ::rtl::OUString aIdentifier = xModuleManager->identify( rxModel );
+ aPath = rPool.maCurrDirs[ aIdentifier ];
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return aPath;
+}
+
+// ============================================================================
+
} // namespace vba
} // namespace basic
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 5cfdc1dcea4f..10c1b5359947 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -40,6 +40,7 @@
#include <tools/shl.hxx>
#include <tools/rc.hxx>
#include <vcl/svapp.hxx>
+#include <comphelper/processfactory.hxx>
#include "sbunoobj.hxx"
#include "sbjsmeth.hxx"
#include "sbjsmod.hxx"
@@ -128,6 +129,7 @@ void DocBasicItem::startListening()
Any aThisComp;
mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp );
Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
+ mbDisposed = !xCloseBC.is();
if( xCloseBC.is() )
try { xCloseBC->addCloseListener( this ); } catch( uno::Exception& ) {}
}
@@ -433,7 +435,20 @@ SbxObject* SbiFactory::CreateObject( const String& rClass )
return new BasicCollection( aCollectionName );
}
else
- return NULL;
+ if( rClass.EqualsIgnoreCaseAscii( "FileSystemObject" ) )
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW );
+ ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.FileSystemObject" ) );
+ Reference< XInterface > xInterface( xFactory->createInstance( aServiceName ), UNO_SET_THROW );
+ return new SbUnoObject( aServiceName, uno::makeAny( xInterface ) );
+ }
+ catch( Exception& )
+ {}
+ }
+
+ return NULL;
}
@@ -929,8 +944,14 @@ void StarBASIC::SetModified( sal_Bool b )
SbxBase::SetModified( b );
}
+extern void lcl_closeTraceFile();
+
StarBASIC::~StarBASIC()
{
+#ifdef DBG_TRACE_BASIC
+ lcl_closeTraceFile();
+#endif
+
// Needs to be first action as it can trigger events
disposeComVariablesForBasic( this );
@@ -2264,7 +2285,22 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
SbxVariable* p = pPar_->Get( 1 );
sal_Int32 nIndex = implGetIndex( p );
if( nIndex >= 0 && nIndex < (sal_Int32)xItemArray->Count32() )
+ {
xItemArray->Remove32( nIndex );
+
+ // Correct for stack if necessary
+ SbiInstance* pInst = pINST;
+ SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
+ if( pRT )
+ {
+ SbiForStack* pStack = pRT->FindForStackItemForCollection( this );
+ if( pStack != NULL )
+ {
+ if( pStack->nCurCollectionIndex >= nIndex )
+ --pStack->nCurCollectionIndex;
+ }
+ }
+ }
else
SetError( SbERR_BAD_ARGUMENT );
}
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 7695f73a317f..014503587da6 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1761,8 +1761,7 @@ String getBasicObjectTypeName( SbxObject* pObj )
return aName;
}
-bool checkUnoObjectType( SbUnoObject* pUnoObj,
- const String& aClass )
+bool checkUnoObjectType( SbUnoObject* pUnoObj, const ::rtl::OUString& rClass )
{
Any aToInspectObj = pUnoObj->getUnoAny();
TypeClass eType = aToInspectObj.getValueType().getTypeClass();
@@ -1779,6 +1778,21 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY );
if( xTypeProvider.is() )
{
+ /* Although interfaces in the ooo.vba namespace obey the IDL rules and
+ have a leading 'X', in Basic we want to be able to do something
+ like 'Dim wb As Workbooks' or 'Dim lb As MSForms.Label'. Here we
+ add a leading 'X' to the class name and a leading dot to the entire
+ type name. This results e.g. in '.XWorkbooks' or '.MSForms.XLabel'
+ which matches the interface names 'ooo.vba.excel.XWorkbooks' or
+ 'ooo.vba.msforms.XLabel'.
+ */
+ ::rtl::OUString aClassName( sal_Unicode( '.' ) );
+ sal_Int32 nClassNameDot = rClass.lastIndexOf( '.' );
+ if( nClassNameDot >= 0 )
+ aClassName += rClass.copy( 0, nClassNameDot + 1 ) + ::rtl::OUString( sal_Unicode( 'X' ) ) + rClass.copy( nClassNameDot + 1 );
+ else
+ aClassName += ::rtl::OUString( sal_Unicode( 'X' ) ) + rClass;
+
Sequence< Type > aTypeSeq = xTypeProvider->getTypes();
const Type* pTypeArray = aTypeSeq.getConstArray();
sal_uInt32 nIfaceCount = aTypeSeq.getLength();
@@ -1792,8 +1806,8 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
OSL_FAIL("failed to get XIdlClass for type");
break;
}
- ::rtl::OUString sClassName = xClass->getName();
- if ( sClassName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.XAutomationObject" ) ) ) )
+ ::rtl::OUString aInterfaceName = xClass->getName();
+ if ( aInterfaceName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.XAutomationObject" ) ) ) )
{
// there is a hack in the extensions/source/ole/oleobj.cxx to return the typename of the automation object, lets check if it
// matches
@@ -1806,20 +1820,15 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
// can't check type, leave it pass
result = true;
else
- result = sTypeName.equals( aClass );
+ result = sTypeName.equals( rClass );
}
break; // finished checking automation object
}
- OSL_TRACE("Checking if object implements %s",
- OUStringToOString( defaultNameSpace + aClass,
- RTL_TEXTENCODING_UTF8 ).getStr() );
- // although interfaces in the ooo.vba.vba namespace
- // obey the idl rules and have a leading X, in basic we
- // want to be able to do something like
- // 'dim wrkbooks as WorkBooks'
- // so test assumes the 'X' has been dropped
- sal_Int32 indexLastDot = sClassName.lastIndexOf('.');
- if ( indexLastDot > -1 && sClassName.copy( indexLastDot + 1).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("X") ) + aClass ) )
+
+ // match interface name with passed class name
+ OSL_TRACE("Checking if object implements %s", OUStringToOString( aClassName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if ( (aClassName.getLength() < aInterfaceName.getLength()) &&
+ aInterfaceName.matchIgnoreAsciiCase( aClassName, aInterfaceName.getLength() - aClassName.getLength() ) )
{
result = true;
break;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 7e7304b6ce76..55460638e9b7 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -59,6 +59,7 @@
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/document/XVbaMethodParameter.hpp>
+#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
#include <com/sun/star/document/XEventListener.hpp>
@@ -86,10 +87,9 @@ using namespace com::sun::star;
#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;
using namespace com::sun::star::lang;
using namespace com::sun::star::reflection;
using namespace com::sun::star::beans;
@@ -105,6 +105,7 @@ using namespace com::sun::star::script;
#include <cppuhelper/implbase1.hxx>
#include <comphelper/anytostring.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <ooo/vba/VbQueryClose.hpp>
typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
@@ -448,24 +449,36 @@ TYPEINIT1(SbUserFormModule,SbObjModule)
typedef std::vector<HighlightPortion> HighlightPortions;
-bool getDefaultVBAMode( StarBASIC* pb )
+uno::Reference< frame::XModel > getDocumentModel( StarBASIC* pb )
{
- bool bResult = false;
- if ( pb && pb->IsDocBasic() )
+ uno::Reference< frame::XModel > xModel;
+ if( pb && pb->IsDocBasic() )
{
uno::Any aDoc;
- if ( pb->GetUNOConstant( "ThisComponent", aDoc ) )
- {
- uno::Reference< beans::XPropertySet > xProp( aDoc, uno::UNO_QUERY );
- if ( xProp.is() )
- {
- uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
- if ( xVBAMode.is() )
- bResult = xVBAMode->getVBACompatibilityMode() == sal_True;
- }
- }
+ if( pb->GetUNOConstant( "ThisComponent", aDoc ) )
+ xModel.set( aDoc, uno::UNO_QUERY );
+ }
+ return xModel;
+}
+
+uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno::Reference< frame::XModel >& rxModel )
+{
+ uno::Reference< vba::XVBACompatibility > xVBACompat;
+ try
+ {
+ uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW );
+ xVBACompat.set( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY );
+ }
+ catch( uno::Exception& )
+ {
}
- return bResult;
+ return xVBACompat;
+}
+
+bool getDefaultVBAMode( StarBASIC* pb )
+{
+ uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( getDocumentModel( pb ) );
+ return xVBACompat.is() && xVBACompat->getVBACompatibilityMode();
}
class AsyncQuitHandler
@@ -512,7 +525,6 @@ void VBAUnlockDocuments( StarBASIC* pBasic )
}
}
-
// A Basic module has set EXTSEARCH, so that the elements, that the modul contains,
// could be found from other module.
@@ -903,7 +915,7 @@ void SbModule::SetSource( const String& r )
void SbModule::SetSource32( const ::rtl::OUString& r )
{
// Default basic mode to library container mode, but.. allow Option VBASupport 0/1 override
- SetVBACompat( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) ) );
+ SetVBACompat( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) ) );
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
@@ -1104,6 +1116,8 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
sal_Bool bDelInst = sal_Bool( pINST == NULL );
bool bQuit = false;
StarBASICRef xBasic;
+ uno::Reference< frame::XModel > xModel;
+ uno::Reference< script::vba::XVBACompatibility > xVBACompat;
if( bDelInst )
{
// #32779: Hold Basic during the execution
@@ -1111,6 +1125,46 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
pINST = new SbiInstance( (StarBASIC*) GetParent() );
+ /* If a VBA script in a document is started, get the VBA compatibility
+ interface from the document Basic library container, and notify all
+ VBA script listeners about the started script. */
+ if( mbVBACompat )
+ {
+ StarBASIC* pBasic = static_cast< StarBASIC* >( GetParent() );
+ if( pBasic && pBasic->IsDocBasic() ) try
+ {
+ xModel.set( getDocumentModel( pBasic ), uno::UNO_SET_THROW );
+ xVBACompat.set( getVBACompatibility( xModel ), uno::UNO_SET_THROW );
+ xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::SCRIPT_STARTED, GetName() );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ // Launcher problem
+ // i80726 The Find below will genarate an error in Testtool so we reset it unless there was one before already
+ sal_Bool bWasError = SbxBase::GetError() != 0;
+ SbxVariable* pMSOMacroRuntimeLibVar = Find( aMSOMacroRuntimeLibName, SbxCLASS_OBJECT );
+ if ( !bWasError && (SbxBase::GetError() == SbxERR_PROC_UNDEFINED) )
+ SbxBase::ResetError();
+ if( pMSOMacroRuntimeLibVar )
+ {
+ StarBASIC* pMSOMacroRuntimeLib = PTR_CAST(StarBASIC,pMSOMacroRuntimeLibVar);
+ if( pMSOMacroRuntimeLib )
+ {
+ sal_uInt16 nGblFlag = pMSOMacroRuntimeLib->GetFlags() & SBX_GBLSEARCH;
+ pMSOMacroRuntimeLib->ResetFlag( SBX_GBLSEARCH );
+ SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( aMSOMacroRuntimeAppSymbol, SbxCLASS_METHOD );
+ pMSOMacroRuntimeLib->SetFlag( nGblFlag );
+ if( pAppSymbol )
+ {
+ pMSOMacroRuntimeLib->SetFlag( SBX_EXTSEARCH ); // Could have been disabled before
+ GetSbData()->pMSOMacroRuntimLib = pMSOMacroRuntimeLib;
+ }
+ }
+ }
+
// Delete the Error-Stack
SbErrorStack*& rErrStack = GetSbData()->pErrStack;
delete rErrStack;
@@ -1220,9 +1274,20 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
ResetCapturedAssertions();
#endif
- // VBA always ensures screenupdating is enabled after completing
- if ( mbVBACompat )
- VBAUnlockDocuments( PTR_CAST( StarBASIC, GetParent() ) );
+ if( xVBACompat.is() )
+ {
+ // notify all VBA script listeners about the stopped script
+ try
+ {
+ xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::SCRIPT_STOPPED, GetName() );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ // VBA always ensures screenupdating is enabled after completing
+ ::basic::vba::lockControllersOfAllDocuments( xModel, sal_False );
+ ::basic::vba::enableContainerWindowsOfAllDocuments( xModel, sal_True );
+ }
#ifdef DBG_TRACE_BASIC
dbg_DeInitTrace();
@@ -2320,7 +2385,7 @@ public:
if ( xVbaMethodParameter.is() )
{
sal_Int8 nCancel = 0;
- sal_Int8 nCloseMode = 0;
+ sal_Int8 nCloseMode = ::ooo::vba::VbQueryClose::vbFormControlMenu;
Sequence< Any > aParams;
aParams.realloc(2);
@@ -2445,14 +2510,14 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun )
Sequence< Any > aArguments;
triggerMethod( aMethodToRun, aArguments );
}
-void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
+
+void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments )
{
OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
// Search method
SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
if( pMeth )
{
-
if ( aArguments.getLength() > 0 ) // Setup parameters
{
SbxArrayRef xArray = new SbxArray;
@@ -2480,7 +2545,6 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
pMeth->SetParameters( NULL );
}
else
-
{
SbxValues aVals;
pMeth->Get( aVals );
@@ -2572,7 +2636,7 @@ void SbUserFormModule::Unload()
OSL_TRACE("** Unload() ");
sal_Int8 nCancel = 0;
- sal_Int8 nCloseMode = 1;
+ sal_Int8 nCloseMode = ::ooo::vba::VbQueryClose::vbFormCode;
Sequence< Any > aParams;
aParams.realloc(2);
@@ -2628,6 +2692,9 @@ void SbUserFormModule::InitObject()
SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
if ( m_xModel.is() && pGlobs )
{
+ // broadcast INITIALIZE_USERFORM script event before the dialog is created
+ Reference< script::vba::XVBACompatibility > xVBACompat( getVBACompatibility( m_xModel ), uno::UNO_SET_THROW );
+ xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::INITIALIZE_USERFORM, GetName() );
uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 249c37353c84..f5d820ecc51e 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -302,6 +302,8 @@ void SbiCodeGen::Save()
nUserData |= nDefaultId;
if( pPar->IsParamArray() )
nUserData |= PARAM_INFO_PARAMARRAY;
+ if( pPar->IsWithBrackets() )
+ nUserData |= PARAM_INFO_WITHBRACKETS;
if( nUserData )
{
SbxParamInfo* pParam = (SbxParamInfo*)pInfo->GetParam( i );
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index ed166530f319..e7f335d4f8ab 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -54,7 +54,11 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, sal_Bool bStatic, sal_Bool bC
SbiDimList* pDim = NULL;
// Brackets?
if( Peek() == LPAREN )
+ {
pDim = new SbiDimList( this );
+ if( !pDim->GetDims() )
+ pDef->SetWithBrackets();
+ }
pDef->SetType( t );
if( bStatic )
pDef->SetStatic();
@@ -385,6 +389,9 @@ void SbiParser::DefVar( SbiOpcode eOp, sal_Bool bStatic )
if( nFixedStringLength >= 0 )
nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (sal_uInt32(nFixedStringLength) << 17)); // len = all bits above 0x10000
+ if( pDim != NULL && pDim->GetDims() > 0 )
+ nOpnd2 |= SBX_TYPE_VAR_TO_DIM_FLAG;
+
aGen.Gen( eOp2, pDef->GetId(), nOpnd2 );
}
diff --git a/basic/source/comp/makefile.mk b/basic/source/comp/makefile.mk
index 5fe64ceae091..d8b03c12ac02 100755
--- a/basic/source/comp/makefile.mk
+++ b/basic/source/comp/makefile.mk
@@ -46,11 +46,12 @@ SLOFILES= \
$(SLO)$/token.obj
EXCEPTIONSFILES= \
- $(SLO)$/codegen.obj \
- $(SLO)$/dim.obj \
- $(SLO)$/exprtree.obj \
- $(SLO)$/parser.obj \
- $(SLO)$/scanner.obj
+ $(SLO)$/codegen.obj \
+ $(SLO)$/dim.obj \
+ $(SLO)$/exprtree.obj \
+ $(SLO)$/parser.obj \
+ $(SLO)$/scanner.obj \
+ $(SLO)$/sbcomp.obj
# --- Targets --------------------------------------------------------------
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index 8f5aa58bfe97..86557db46699 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -33,12 +33,18 @@
#include "sbcomp.hxx"
#include "image.hxx"
#include <basic/sbobjmod.hxx>
+#include <stdio.h>
// To activate tracing enable in sbtrace.hxx
#ifdef DBG_TRACE_BASIC
+// Trace ini file (set NULL to ignore)
+// can be overridden with the environment variable OOO_BASICTRACEINI
+static char GpTraceIniFile[] = "~/BasicTrace.ini";
+//static char* GpTraceIniFile = NULL;
+
// Trace Settings, used if no ini file / not found in ini file
-static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt";
+static char GpTraceFileNameDefault[] = "~/BasicTrace.txt";
static char* GpTraceFileName = GpTraceFileNameDefault;
// GbTraceOn:
@@ -52,6 +58,12 @@ static bool GbTraceOn = true;
// with TraceCommand( "PCodeOn" / "PCodeOff" ), see below
static bool GbIncludePCodes = false;
+// GbInitOnlyAtOfficeStart:
+// true = Tracing is only intialized onces after Office start when
+// Basic runs the first time. Further calls to Basic, e.g. via events
+// use the same output file. The trace ini file is not read again.
+static bool GbInitOnlyAtOfficeStart = false;
+
static int GnIndentPerCallLevel = 4;
static int GnIndentForPCode = 2;
@@ -73,6 +85,37 @@ static int GnIndentForPCode = 2;
long as it can be converted to string
*/
+#ifdef DBG_TRACE_PROFILING
+
+#include <algorithm>
+#include <stack>
+#include "canvas/elapsedtime.hxx"
+
+//*** Profiling ***
+// GbTimerOn:
+// true = including time stamps
+static bool GbTimerOn = true;
+
+// GbTimeStampForEachStep:
+// true = prints time stamp after each command / pcode (very slow)
+static bool GbTimeStampForEachStep = false;
+
+// GbBlockAllAfterFirstFunctionUsage:
+// true = everything (commands, pcodes, functions) is only printed
+// for the first usage (improves performance when tracing / pro-
+// filing large macros)
+static bool GbBlockAllAfterFirstFunctionUsage = false;
+
+// GbBlockStepsAfterFirstFunctionUsage:
+// true = commands / pcodes are only printed for the first time
+// a function is executed. Afterwards only the entering/leaving
+// messages are logged (improves performance when tracing / pro-
+// filing large macros)
+static bool GbBlockStepsAfterFirstFunctionUsage = false;
+
+#endif
+
+
static void lcl_skipWhites( char*& rpc )
{
while( *rpc == ' ' || *rpc == '\t' )
@@ -163,15 +206,643 @@ static void lcl_ReadIniFile( const char* pIniFileName )
if( strcmp( VarNameBuffer, "GbIncludePCodes") == 0 )
GbIncludePCodes = (strcmp( ValBuffer, "true" ) == 0);
else
+ if( strcmp( VarNameBuffer, "GbInitOnlyAtOfficeStart") == 0 )
+ GbInitOnlyAtOfficeStart = (strcmp( ValBuffer, "true" ) == 0);
+ else
if( strcmp( VarNameBuffer, "GnIndentPerCallLevel") == 0 )
GnIndentPerCallLevel = strtol( ValBuffer, NULL, 10 );
else
if( strcmp( VarNameBuffer, "GnIndentForPCode") == 0 )
GnIndentForPCode = strtol( ValBuffer, NULL, 10 );
+#ifdef DBG_TRACE_PROFILING
+ else
+ if( strcmp( VarNameBuffer, "GbTimerOn") == 0 )
+ GbTimerOn = (strcmp( ValBuffer, "true" ) == 0);
+ else
+ if( strcmp( VarNameBuffer, "GbTimeStampForEachStep") == 0 )
+ GbTimeStampForEachStep = (strcmp( ValBuffer, "true" ) == 0);
+ else
+ if( strcmp( VarNameBuffer, "GbBlockAllAfterFirstFunctionUsage") == 0 )
+ GbBlockAllAfterFirstFunctionUsage = (strcmp( ValBuffer, "true" ) == 0);
+ else
+ if( strcmp( VarNameBuffer, "GbBlockStepsAfterFirstFunctionUsage") == 0 )
+ GbBlockStepsAfterFirstFunctionUsage = (strcmp( ValBuffer, "true" ) == 0);
+#endif
}
fclose( pFile );
}
+
+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 FILE* GpGlobalFile = NULL;
+
+static void lcl_lineOut( const char* pStr, const char* pPreStr = NULL, const char* pPostStr = NULL )
+{
+ if( GpGlobalFile != NULL )
+ {
+ fprintf( GpGlobalFile, "%s%s%s\n", pPreStr ? pPreStr : "", pStr, pPostStr ? pPostStr : "" );
+ fflush( GpGlobalFile );
+ }
+}
+
+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 lcl_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 ( sal_uInt16 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 += '=';
+ SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
+ aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ else if( eType != SbxOBJECT )
+ 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
+static bool GbSavTraceOn = false;
+
+#ifdef DBG_TRACE_PROFILING
+static canvas::tools::ElapsedTime* GpTimer = NULL;
+static double GdStartTime = 0.0;
+static double GdLastTime = 0.0;
+static bool GbBlockSteps = false;
+static bool GbBlockAll = false;
+
+struct FunctionItem
+{
+ String m_aCompleteFunctionName;
+ double m_dTotalTime;
+ double m_dNetTime;
+ int m_nCallCount;
+ bool m_bBlockAll;
+ bool m_bBlockSteps;
+
+ FunctionItem( void )
+ : m_dTotalTime( 0.0 )
+ , m_dNetTime( 0.0 )
+ , m_nCallCount( 0 )
+ , m_bBlockAll( false )
+ , m_bBlockSteps( false )
+ {}
+};
+typedef std::hash_map< ::rtl::OUString, FunctionItem*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > FunctionItemMap;
+
+static std::stack< double > GaCallEnterTimeStack;
+static std::stack< FunctionItem* > GaFunctionItemStack;
+static FunctionItemMap GaFunctionItemMap;
+
+bool compareFunctionNetTime( FunctionItem* p1, FunctionItem* p2 )
+{
+ return (p1->m_dNetTime > p2->m_dNetTime);
+}
+
+void lcl_printTimeOutput( void )
+{
+ // Overall time output
+ lcl_lineOut( "" );
+ lcl_lineOut( "***** Time Output *****" );
+ char TimeBuffer[500];
+ double dTotalTime = GpTimer->getElapsedTime() - GdStartTime;
+ sprintf( TimeBuffer, "Total execution time = %f ms", dTotalTime*1000.0 );
+ lcl_lineOut( TimeBuffer );
+ lcl_lineOut( "" );
+
+ if( GbTimerOn )
+ {
+ lcl_lineOut( "Functions:" );
+
+ std::vector<FunctionItem*> avFunctionItems;
+
+ FunctionItemMap::iterator it;
+ for( it = GaFunctionItemMap.begin() ; it != GaFunctionItemMap.end() ; ++it )
+ {
+ FunctionItem* pFunctionItem = it->second;
+ if( pFunctionItem != NULL )
+ avFunctionItems.push_back( pFunctionItem );
+ }
+
+ std::sort( avFunctionItems.begin(), avFunctionItems.end(), compareFunctionNetTime );
+
+ std::vector<FunctionItem*>::iterator itv;
+ for( itv = avFunctionItems.begin() ; itv != avFunctionItems.end() ; ++itv )
+ {
+ FunctionItem* pFunctionItem = *itv;
+ if( pFunctionItem != NULL )
+ {
+ rtl::OUString aCompleteFunctionName = pFunctionItem->m_aCompleteFunctionName;
+ const char* pName = OUStringToOString( aCompleteFunctionName, RTL_TEXTENCODING_ASCII_US ).getStr();
+ int nNameLen = aCompleteFunctionName.getLength();
+
+ double dFctTotalTime = pFunctionItem->m_dTotalTime;
+ double dFctNetTime = pFunctionItem->m_dNetTime;
+ double dFctTotalTimePercent = 100.0 * dFctTotalTime / dTotalTime;
+ double dFctNetTimePercent = 100.0 * dFctNetTime / dTotalTime;
+ int nSpaceCount = 30 - nNameLen;
+ if( nSpaceCount < 0 )
+ nSpaceCount = 2;
+ sprintf( TimeBuffer, "%s:%sCalled %d times\t%f ms (%f%%) / net %f (%f%%) ms",
+ pName, lcl_getSpaces( nSpaceCount ), pFunctionItem->m_nCallCount,
+ dFctTotalTime*1000.0, dFctTotalTimePercent, dFctNetTime*1000.0, dFctNetTimePercent );
+ lcl_lineOut( TimeBuffer );
+ }
+ }
+ }
+}
+#endif
+
+
+static bool GbInitTraceAlreadyCalled = false;
+
+void dbg_InitTrace( void )
+{
+ if( GbInitOnlyAtOfficeStart && GbInitTraceAlreadyCalled )
+ {
+#ifdef DBG_TRACE_PROFILING
+ if( GbTimerOn )
+ GpTimer->continueTimer();
+#endif
+ GpGlobalFile = fopen( GpTraceFileName, "a+" );
+ return;
+ }
+ GbInitTraceAlreadyCalled = true;
+
+ if( const sal_Char* pcIniFileName = ::getenv( "OOO_BASICTRACEINI" ) )
+ lcl_ReadIniFile( pcIniFileName );
+ else if( GpTraceIniFile != NULL )
+ lcl_ReadIniFile( GpTraceIniFile );
+
+ GpGlobalFile = fopen( GpTraceFileName, "w" );
+ GbSavTraceOn = GbTraceOn;
+ if( !GbTraceOn )
+ lcl_lineOut( "### Program started with trace off ###" );
+
+#ifdef DBG_TRACE_PROFILING
+ GpTimer = new canvas::tools::ElapsedTime();
+ GdStartTime = GpTimer->getElapsedTime();
+ GdLastTime = GdStartTime;
+ GbBlockSteps = false;
+ GbBlockAll = false;
+#endif
+}
+
+void dbg_DeInitTrace( void )
+{
+ GbTraceOn = GbSavTraceOn;
+
+#ifdef DBG_TRACE_PROFILING
+ while( !GaCallEnterTimeStack.empty() )
+ GaCallEnterTimeStack.pop();
+ while( !GaFunctionItemStack.empty() )
+ GaFunctionItemStack.pop();
+
+ lcl_printTimeOutput();
+
+ for( FunctionItemMap::iterator it = GaFunctionItemMap.begin() ; it != GaFunctionItemMap.end() ; ++it )
+ delete it->second;
+ GaFunctionItemMap.clear();
+
+ if( GpGlobalFile )
+ {
+ fclose( GpGlobalFile );
+ GpGlobalFile = NULL;
+ }
+
+ if( GbInitOnlyAtOfficeStart )
+ {
+ if( GbTimerOn )
+ GpTimer->pauseTimer();
+ }
+ else
+ {
+ delete GpTimer;
+ }
+#endif
+}
+
+static sal_Int32 GnLastCallLvl = 0;
+
+void dbg_tracePrint( const String& aStr, sal_Int32 nCallLvl, bool bCallLvlRelativeToCurrent )
+{
+ if( bCallLvlRelativeToCurrent )
+ nCallLvl += GnLastCallLvl;
+
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+ lcl_lineOut( OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
+}
+
+void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
+{
+ if( !GbTraceOn )
+ return;
+
+#ifdef DBG_TRACE_PROFILING
+ if( GbBlockSteps || GbBlockAll )
+ return;
+
+ double dCurTime = 0.0;
+ bool bPrintTimeStamp = false;
+ if( GbTimerOn )
+ {
+ GpTimer->pauseTimer();
+ dCurTime = GpTimer->getElapsedTime();
+ bPrintTimeStamp = GbTimeStampForEachStep;
+ }
+#else
+ bool bPrintTimeStamp = false;
+#endif
+
+ GnLastCallLvl = 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( Buffer );
+ return;
+ }
+
+ PCToTextDataMap* pInnerMap = it->second;
+ if( pInnerMap == NULL )
+ {
+ lcl_lineOut( "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\"", (int)nPC, pModuleNameStr );
+ lcl_lineOut( Buffer );
+ return;
+ }
+
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+
+ const TraceTextData& rTraceTextData = itInner->second;
+ const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
+ bool bSTMT = false;
+ if( rStr_STMNT.getLength() )
+ bSTMT = true;
+
+ char TimeBuffer[200];
+#ifdef DBG_TRACE_PROFILING
+ if( bPrintTimeStamp )
+ {
+ double dDiffTime = dCurTime - GdLastTime;
+ GdLastTime = dCurTime;
+ sprintf( TimeBuffer, "\t\t// Time = %f ms / += %f ms", dCurTime*1000.0, dDiffTime*1000.0 );
+ }
+#endif
+
+ if( bSTMT )
+ {
+ lcl_lineOut( rStr_STMNT.getStr(), lcl_getSpaces( nIndent ),
+ (bPrintTimeStamp && !GbIncludePCodes) ? TimeBuffer : NULL );
+ }
+
+ if( !GbIncludePCodes )
+ {
+#ifdef DBG_TRACE_PROFILING
+ if( GbTimerOn )
+ GpTimer->continueTimer();
+#endif
+ return;
+ }
+
+ nIndent += GnIndentForPCode;
+ const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode;
+ if( rStr_PCode.getLength() )
+ {
+ lcl_lineOut( rStr_PCode.getStr(), lcl_getSpaces( nIndent ),
+ bPrintTimeStamp ? TimeBuffer : NULL );
+ }
+
+#ifdef DBG_TRACE_PROFILING
+ if( GbTimerOn )
+ GpTimer->continueTimer();
+#endif
+}
+
+
+void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallLvl, bool bLeave )
+{
+ static const char* pSeparator = "' ================================================================================";
+
+ if( !GbTraceOn )
+ return;
+
+#ifdef DBG_TRACE_PROFILING
+ double dCurTime = 0.0;
+ double dExecutionTime = 0.0;
+ if( GbTimerOn )
+ {
+ dCurTime = GpTimer->getElapsedTime();
+ GpTimer->pauseTimer();
+ }
+#endif
+
+ GnLastCallLvl = nCallLvl;
+
+ SbModule* pTraceMod = pModule;
+ SbClassModuleObject* pClassModuleObj = NULL;
+ if( pTraceMod->ISA(SbClassModuleObject) )
+ {
+ pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
+ pTraceMod = pClassModuleObj->getClassModule();
+ }
+
+ String aCompleteFunctionName = pTraceMod->GetName();
+ if( pMethod != NULL )
+ {
+ aCompleteFunctionName.AppendAscii( "::" );
+ String aMethodName = pMethod->GetName();
+ aCompleteFunctionName += aMethodName;
+ }
+ else
+ {
+ aCompleteFunctionName.AppendAscii( "/RunInit" );
+ }
+
+ bool bOwnBlockSteps = false;
+#ifdef DBG_TRACE_PROFILING
+ bool bOwnBlockAll = false;
+ FunctionItem* pFunctionItem = NULL;
+ if( GbTimerOn )
+ {
+ FunctionItemMap::iterator itFunctionItem = GaFunctionItemMap.find( aCompleteFunctionName );
+ if( itFunctionItem != GaFunctionItemMap.end() )
+ pFunctionItem = itFunctionItem->second;
+
+ if( pFunctionItem == NULL )
+ {
+ DBG_ASSERT( !bLeave, "No FunctionItem in leave!" );
+
+ pFunctionItem = new FunctionItem();
+ pFunctionItem->m_aCompleteFunctionName = aCompleteFunctionName;
+ GaFunctionItemMap[ aCompleteFunctionName ] = pFunctionItem;
+ }
+ else if( GbBlockAllAfterFirstFunctionUsage && !bLeave )
+ {
+ pFunctionItem->m_bBlockAll = true;
+ }
+ else if( GbBlockStepsAfterFirstFunctionUsage && !bLeave )
+ {
+ pFunctionItem->m_bBlockSteps = true;
+ }
+
+ if( bLeave )
+ {
+ bOwnBlockAll = GbBlockAll;
+ bOwnBlockSteps = GbBlockSteps;
+ GbBlockAll = false;
+ GbBlockSteps = false;
+
+ dExecutionTime = dCurTime - GaCallEnterTimeStack.top();
+ GaCallEnterTimeStack.pop();
+
+ pFunctionItem->m_dTotalTime += dExecutionTime;
+ pFunctionItem->m_dNetTime += dExecutionTime;
+ pFunctionItem->m_nCallCount++;
+
+ GaFunctionItemStack.pop();
+ if( !GaFunctionItemStack.empty() )
+ {
+ FunctionItem* pParentItem = GaFunctionItemStack.top();
+ if( pParentItem != NULL )
+ {
+ pParentItem->m_dNetTime -= dExecutionTime;
+
+ GbBlockSteps = pParentItem->m_bBlockSteps;
+ GbBlockAll = pParentItem->m_bBlockAll;
+ }
+ }
+ }
+ else
+ {
+ GbBlockSteps = bOwnBlockSteps = pFunctionItem->m_bBlockSteps;
+ GbBlockAll = bOwnBlockAll = pFunctionItem->m_bBlockAll;
+
+ GaCallEnterTimeStack.push( dCurTime );
+ GaFunctionItemStack.push( pFunctionItem );
+ }
+ }
+
+ if( bOwnBlockAll )
+ {
+ if( GbTimerOn )
+ GpTimer->continueTimer();
+ return;
+ }
+#endif
+
+ if( nCallLvl > 0 )
+ nCallLvl--;
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+ if( !bLeave && !bOwnBlockSteps )
+ {
+ lcl_lineOut( "" );
+ lcl_lineOut( pSeparator, lcl_getSpaces( nIndent ) );
+ }
+
+ String aStr;
+ if( bLeave )
+ {
+ if( !bOwnBlockSteps )
+ {
+ lcl_lineOut( "}", lcl_getSpaces( nIndent ) );
+ aStr.AppendAscii( "' Leaving " );
+ }
+ }
+ else
+ {
+ aStr.AppendAscii( "Entering " );
+ }
+ if( !bLeave || !bOwnBlockSteps )
+ aStr += aCompleteFunctionName;
+
+ if( !bOwnBlockSteps && pClassModuleObj != NULL )
+ {
+ aStr.AppendAscii( "[this=" );
+ aStr += pClassModuleObj->GetName();
+ aStr.AppendAscii( "]" );
+ }
+ if( !bLeave )
+ aStr += lcl_dumpMethodParameters( pMethod );
+
+ const char* pPostStr = NULL;
+#ifdef DBG_TRACE_PROFILING
+ char TimeBuffer[200];
+ if( GbTimerOn && bLeave )
+ {
+ sprintf( TimeBuffer, " // Execution Time = %f ms", dExecutionTime*1000.0 );
+ pPostStr = TimeBuffer;
+ }
+#endif
+ lcl_lineOut( (!bLeave || !bOwnBlockSteps) ? OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr() : "}",
+ lcl_getSpaces( nIndent ), pPostStr );
+ if( !bLeave )
+ lcl_lineOut( "{", lcl_getSpaces( nIndent ) );
+
+ if( bLeave && !bOwnBlockSteps )
+ lcl_lineOut( "" );
+
+#ifdef DBG_TRACE_PROFILING
+ if( GbTimerOn )
+ GpTimer->continueTimer();
+#endif
+}
+
+void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, sal_Int32 nCallLvl )
+{
+ if( !GbTraceOn )
+ return;
+#ifdef DBG_TRACE_PROFILING
+ if( GbBlockSteps || GbBlockAll )
+ return;
+#endif
+ GnLastCallLvl = 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( Buffer, lcl_getSpaces( nIndent ) );
+}
+
+void dbg_RegisterTraceTextForPC( SbModule* pModule, sal_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;
+}
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
{
@@ -223,7 +894,7 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
sprintf( Buffer, "### TRACE_PRINT: %s ###", pValStr );
int nIndent = GnLastCallLvl * GnIndentPerCallLevel;
- lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
+ lcl_lineOut( Buffer, lcl_getSpaces( nIndent ) );
if( eOld != SbxERR_OK )
SbxBase::SetError( eOld );
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 00c4b4cd6d87..128c4acf52fc 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -303,6 +303,7 @@ SbiSymDef::SbiSymDef( const String& rName ) : aName( rName )
bOpt =
bParamArray =
bWithEvents =
+ bWithBrackets =
bByVal =
bChained =
bGlobal = sal_False;
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 7452c775b916..df387eabc102 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -399,7 +399,8 @@ SbiToken SbiTokenizer::Next()
}
special:
// #i92642
- if( eCurTok != NIL && eCurTok != REM && eCurTok != EOLN && (tp->t == NAME || tp->t == LINE) )
+ bool bStartOfLine = (eCurTok == NIL || eCurTok == REM || eCurTok == EOLN);
+ if( !bStartOfLine && (tp->t == NAME || tp->t == LINE) )
return eCurTok = SYMBOL;
else if( tp->t == TEXT )
return eCurTok = SYMBOL;
@@ -466,6 +467,9 @@ special:
// #129904 Suppress system
if( eTok == STOP && aSym.CompareIgnoreCaseToAscii( "system" ) == COMPARE_EQUAL )
eCurTok = SYMBOL;
+
+ if( eTok == GET && bStartOfLine )
+ eCurTok = SYMBOL;
}
else
{
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
index 21d19312fd17..0f5699803945 100644
--- a/basic/source/inc/codegen.hxx
+++ b/basic/source/inc/codegen.hxx
@@ -88,7 +88,8 @@ public:
// #111897 PARAM_INFO flags start at 0x00010000 to not
// conflict with DefaultId in SbxParamInfo::nUserData
-#define PARAM_INFO_PARAMARRAY 0x0010000
+#define PARAM_INFO_PARAMARRAY 0x0010000
+#define PARAM_INFO_WITHBRACKETS 0x0020000
#endif
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 419230c1c2b6..e52c79b90f21 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -48,14 +48,23 @@
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/deployment/XPackage.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+#include <com/sun/star/script/vba/XVBAScriptListener.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
+
#include <osl/mutex.hxx>
#include <unotools/eventlisteneradapter.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/compbase8.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/component.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/basemutex.hxx>
#include <sot/storage.hxx>
+#include <comphelper/listenernotification.hxx>
#include <xmlscript/xmllib_imexp.hxx>
#include <com/sun/star/deployment/XPackage.hpp>
@@ -84,16 +93,12 @@ typedef ::cppu::WeakComponentImplHelper9<
typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
::com::sun::star::container::XContainer > NameContainerHelper;
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::util::XChangesNotifier > NameContainer_BASE;
-struct hashName_Impl
-{
- size_t operator()(const ::rtl::OUString Str) const
- {
- return (size_t)Str.hashCode();
- }
-};
-
-struct eqName_Impl
+class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE
{
sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
{
@@ -113,8 +118,6 @@ NameContainerNameMap;
//============================================================================
-class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
-{
NameContainerNameMap mHashMap;
::com::sun::star::uno::Sequence< ::rtl::OUString > mNames;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
@@ -123,14 +126,16 @@ class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
::com::sun::star::uno::Type mType;
::com::sun::star::uno::XInterface* mpxEventSource;
- ::cppu::OInterfaceContainerHelper maListenerContainer;
+ ::cppu::OInterfaceContainerHelper maContainerListeners;
+ ::cppu::OInterfaceContainerHelper maChangesListeners;
public:
NameContainer( const ::com::sun::star::uno::Type& rType )
: mnElementCount( 0 )
, mType( rType )
, mpxEventSource( NULL )
- , maListenerContainer( m_aMutex )
+ , maContainerListeners( m_aMutex )
+ , maChangesListeners( m_aMutex )
{}
void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource )
@@ -177,21 +182,18 @@ public:
virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
+
+ // Methods XChangesNotifier
+ virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XChangesListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XChangesListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
};
//============================================================================
-class SfxLibrary;
-
-enum InitMode
-{
- DEFAULT,
- CONTAINER_INIT_FILE,
- LIBRARY_INIT_FILE,
- OFFICE_DOCUMENT,
- OLD_BASIC_STORAGE
-};
-
class ModifiableHelper
{
private:
@@ -221,9 +223,42 @@ public:
}
};
-class SfxLibraryContainer :public LibraryContainerHelper
- ,public ::utl::OEventListenerAdapter
+//============================================================================
+
+typedef ::comphelper::OListenerContainerBase<
+ ::com::sun::star::script::vba::XVBAScriptListener,
+ ::com::sun::star::script::vba::VBAScriptEvent > VBAScriptListenerContainer_BASE;
+
+class VBAScriptListenerContainer : public VBAScriptListenerContainer_BASE
{
+public:
+ explicit VBAScriptListenerContainer( ::osl::Mutex& rMutex );
+
+private:
+ virtual bool implTypedNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& rxListener,
+ const ::com::sun::star::script::vba::VBAScriptEvent& rEvent )
+ throw (::com::sun::star::uno::Exception);
+};
+
+//============================================================================
+
+class SfxLibrary;
+
+typedef ::cppu::WeakComponentImplHelper8<
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::script::XStorageBasedLibraryContainer,
+ ::com::sun::star::script::XLibraryContainerPassword,
+ ::com::sun::star::script::XLibraryContainerExport,
+ ::com::sun::star::script::XLibraryContainer3,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::script::vba::XVBACompatibility,
+ ::com::sun::star::lang::XServiceInfo > SfxLibraryContainer_BASE;
+
+class SfxLibraryContainer : public SfxLibraryContainer_BASE, public ::utl::OEventListenerAdapter
+{
+ VBAScriptListenerContainer maVBAScriptListeners;
+ sal_Int32 mnRunningVBAScripts;
sal_Bool mbVBACompat;
rtl::OUString msProjectName;
protected:
@@ -251,7 +286,14 @@ protected:
BasicManager* mpBasMgr;
sal_Bool mbOwnBasMgr;
- InitMode meInitMode;
+ enum InitMode
+ {
+ DEFAULT,
+ CONTAINER_INIT_FILE,
+ LIBRARY_INIT_FILE,
+ OFFICE_DOCUMENT,
+ OLD_BASIC_STORAGE
+ } meInitMode;
void implStoreLibrary( SfxLibrary* pLib,
const ::rtl::OUString& aName,
@@ -517,8 +559,20 @@ public:
virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getRunningVBAScripts()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVBAScriptListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& Listener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVBAScriptListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& Listener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const ::rtl::OUString& rModuleName )
+ throw (::com::sun::star::uno::RuntimeException);
};
+//============================================================================
+
class LibraryContainerMethodGuard
{
private:
@@ -536,12 +590,12 @@ public:
}
};
-
//============================================================================
class SfxLibrary
: public ::com::sun::star::container::XNameContainer
, public ::com::sun::star::container::XContainer
+ , public ::com::sun::star::util::XChangesNotifier
, public ::cppu::BaseMutex
, public ::cppu::OComponentHelper
{
@@ -677,6 +731,14 @@ public:
::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
+ // Methods XChangesNotifier
+ virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XChangesListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XChangesListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
public:
struct LibraryContainerAccess { friend class SfxLibraryContainer; private: LibraryContainerAccess() { } };
void removeElementWithoutChecks( const ::rtl::OUString& _rElementName, LibraryContainerAccess )
@@ -688,18 +750,19 @@ protected:
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
};
-//===================================================================
+//============================================================================
+
class ScriptSubPackageIterator
{
- com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > m_xMainPackage;
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > m_xMainPackage;
- bool m_bIsValid;
- bool m_bIsBundle;
+ bool m_bIsValid;
+ bool m_bIsBundle;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
- < com::sun::star::deployment::XPackage > > m_aSubPkgSeq;
- sal_Int32 m_nSubPkgCount;
- sal_Int32 m_iNextSubPkg;
+ < com::sun::star::deployment::XPackage > > m_aSubPkgSeq;
+ sal_Int32 m_nSubPkgCount;
+ sal_Int32 m_iNextSubPkg;
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
implDetectScriptPackage( const com::sun::star::uno::Reference
@@ -711,13 +774,7 @@ public:
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > getNextScriptSubPackage( bool& rbPureDialogLib );
};
-enum IteratorState
-{
- USER_EXTENSIONS,
- SHARED_EXTENSIONS,
- BUNDLED_EXTENSIONS,
- END_REACHED
-};
+//============================================================================
class ScriptExtensionIterator
{
@@ -738,34 +795,37 @@ protected:
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
implGetNextBundledScriptPackage( bool& rbPureDialogLib );
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
- IteratorState m_eState;
+ enum IteratorState
+ {
+ USER_EXTENSIONS,
+ SHARED_EXTENSIONS,
+ BUNDLED_EXTENSIONS,
+ END_REACHED
+ } m_eState;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
- < com::sun::star::deployment::XPackage > > m_aUserPackagesSeq;
- bool m_bUserPackagesLoaded;
+ < com::sun::star::deployment::XPackage > > m_aUserPackagesSeq;
+ bool m_bUserPackagesLoaded;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
- < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
- bool m_bSharedPackagesLoaded;
+ < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
+ bool m_bSharedPackagesLoaded;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
- < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
- bool m_bBundledPackagesLoaded;
-
-
- int m_iUserPackage;
- int m_iSharedPackage;
- int m_iBundledPackage;
+ < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
+ bool m_bBundledPackagesLoaded;
+ int m_iUserPackage;
+ int m_iSharedPackage;
+ int m_iBundledPackage;
-
- ScriptSubPackageIterator* m_pScriptSubPackageIterator;
+ ScriptSubPackageIterator* m_pScriptSubPackageIterator;
}; // end class ScriptExtensionIterator
-
+//============================================================================
} // namespace basic
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 3ef1c3f849e6..9c3c9b1d0a7c 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -438,6 +438,8 @@ public:
SbxArray* GetParams();
SbxVariable* GetExternalCaller(){ return mpExtCaller; }
+ SbiForStack* FindForStackItemForCollection( class BasicCollection* pCollection );
+
SbxBase* FindElementExtern( const String& rName );
static bool isVBAEnabled();
diff --git a/basic/source/inc/sbtrace.hxx b/basic/source/inc/sbtrace.hxx
index 50e344fb63d2..1f450d542b5d 100644
--- a/basic/source/inc/sbtrace.hxx
+++ b/basic/source/inc/sbtrace.hxx
@@ -30,6 +30,19 @@
//#define DBG_TRACE_BASIC
+// ###############################################################################
+// ###
+// ### ATTENTION:
+// ###
+// ### - DBG_TRACE_PROFILING can only be activated together with DBG_TRACE_BASIC
+// ###
+// ### - If you activate DBG_TRACE_PROFILING you also need to uncomment line
+// ### # SHL1STDLIBS+=$(CANVASTOOLSLIB) in basic/util/makefile.mk (search
+// ### for DBG_TRACE_PROFILING there)
+// ###
+// ###############################################################################
+//#define DBG_TRACE_PROFILING
+
#ifdef DBG_TRACE_BASIC
void dbg_InitTrace( void );
void dbg_DeInitTrace( void );
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 0966c258380a..22723dfd64c2 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -36,11 +36,11 @@
class BasicManager;
-//============================================================================
-
namespace basic
{
+//============================================================================
+
class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
{
::rtl::OUString maScriptLanguage;
@@ -145,14 +145,14 @@ public:
//============================================================================
typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
-typedef ::cppu::ImplHelper1 < ::com::sun::star::script::vba::XVBAModuleInfo
- > SfxScriptLibrary_BASE;
+typedef ::cppu::ImplHelper1< ::com::sun::star::script::vba::XVBAModuleInfo > SfxScriptLibrary_BASE;
-class SfxScriptLibrary : public SfxLibrary
- , public SfxScriptLibrary_BASE
+class SfxScriptLibrary : public SfxLibrary, public SfxScriptLibrary_BASE
{
friend class SfxScriptLibraryContainer;
+ typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash > ModuleInfoMap;
+
sal_Bool mbLoadedSource;
sal_Bool mbLoadedBinary;
ModuleInfoMap mModuleInfos;
@@ -197,7 +197,9 @@ protected:
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
};
-} // namespace base
+//============================================================================
+
+} // namespace basic
#endif
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 1d70b0e49e40..a52d8c499a07 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -131,6 +131,7 @@ protected:
sal_Bool bGlobal : 1; // sal_True: Global-Variable
sal_Bool bParamArray : 1; // sal_True: ParamArray parameter
sal_Bool bWithEvents : 1; // sal_True: Declared WithEvents
+ sal_Bool bWithBrackets : 1; // sal_True: Followed by ()
sal_uInt16 nDefaultId; // Symbol number of default value
short nFixedStringLength; // String length in: Dim foo As String*Length
public:
@@ -157,6 +158,7 @@ public:
void SetOptional() { bOpt = sal_True; }
void SetParamArray() { bParamArray = sal_True; }
void SetWithEvents() { bWithEvents = sal_True; }
+ void SetWithBrackets(){ bWithBrackets = sal_True; }
void SetByVal( sal_Bool bByVal_ = sal_True )
{ bByVal = bByVal_; }
void SetStatic( sal_Bool bAsStatic = sal_True ) { bStatic = bAsStatic; }
@@ -168,6 +170,7 @@ public:
sal_Bool IsOptional() const{ return bOpt; }
sal_Bool IsParamArray() const{ return bParamArray; }
sal_Bool IsWithEvents() const{ return bWithEvents; }
+ sal_Bool IsWithBrackets() const{ return bWithBrackets; }
sal_Bool IsByVal() const { return bByVal; }
sal_Bool IsStatic() const { return bStatic; }
sal_Bool IsNew() const { return bNew; }
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 1f73c8a80745..fd871ecaa286 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -79,6 +79,7 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::io;
using namespace com::sun::star::script;
+using namespace com::sun::star::frame;
#include "stdobj.hxx"
#include <basic/sbstdobj.hxx>
@@ -89,6 +90,7 @@ using namespace com::sun::star::script;
#include "iosys.hxx"
#include "ddectrl.hxx"
#include <sbintern.hxx>
+#include <basic/vbahelper.hxx>
#include <list>
#include <math.h>
@@ -383,22 +385,48 @@ RTLFUNC(Asc)
}
}
-RTLFUNC(Chr)
+void implChr( SbxArray& rPar, bool bChrW )
{
- (void)pBasic;
- (void)bWrite;
-
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
SbxVariableRef pArg = rPar.Get( 1 );
- sal_Unicode aCh = (sal_Unicode)pArg->GetUShort();
- String aStr( aCh );
+
+ String aStr;
+ if( !bChrW && SbiRuntime::isVBAEnabled() )
+ {
+ sal_Char c = (sal_Char)pArg->GetByte();
+ ByteString s( c );
+ aStr = String( s, gsl_getSystemTextEncoding() );
+ }
+ else
+ {
+ sal_Unicode aCh = (sal_Unicode)pArg->GetUShort();
+ aStr = String( aCh );
+ }
rPar.Get(0)->PutString( aStr );
}
}
+RTLFUNC(Chr)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ bool bChrW = false;
+ implChr( rPar, bChrW );
+}
+
+RTLFUNC(ChrW)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ bool bChrW = true;
+ implChr( rPar, bChrW );
+}
+
#ifdef UNX
#define _MAX_PATH 260
@@ -481,11 +509,16 @@ RTLFUNC(CurDir)
RTLFUNC(ChDir)
{
- (void)pBasic;
(void)bWrite;
rPar.Get(0)->PutEmpty();
- if (rPar.Count() != 2)
+ if (rPar.Count() == 2)
+ {
+ // VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.)
+ if( SbiRuntime::isVBAEnabled() )
+ ::basic::vba::registerCurrentDirectory( getDocumentModel( pBasic ), rPar.Get(1)->GetString() );
+ }
+ else
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
@@ -689,7 +722,7 @@ void implRemoveDirRecursive( const String& aDirPath )
FileBase::RC nRet = DirectoryItem::get( aDirPath, aItem );
sal_Bool bExists = (nRet == FileBase::E_None);
- FileStatus aFileStatus( FileStatusMask_Type );
+ FileStatus aFileStatus( osl_FileStatus_Mask_Type );
nRet = aItem.getFileStatus( aFileStatus );
FileStatus::Type aType = aFileStatus.getFileType();
sal_Bool bFolder = isFolder( aType );
@@ -716,7 +749,7 @@ void implRemoveDirRecursive( const String& aDirPath )
break;
// Handle flags
- FileStatus aFileStatus2( FileStatusMask_Type | FileStatusMask_FileURL );
+ FileStatus aFileStatus2( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL );
nRet = aItem2.getFileStatus( aFileStatus2 );
::rtl::OUString aPath = aFileStatus2.getFileURL();
@@ -845,7 +878,7 @@ RTLFUNC(FileLen)
{
DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( aStr ), aItem );
- FileStatus aFileStatus( FileStatusMask_FileSize );
+ FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
aItem.getFileStatus( aFileStatus );
nLen = (sal_Int32)aFileStatus.getFileSize();
}
@@ -2459,7 +2492,7 @@ String getDirectoryPath( String aPathStr )
FileBase::RC nRet = DirectoryItem::get( aPathStr, aItem );
if( nRet == FileBase::E_None )
{
- FileStatus aFileStatus( FileStatusMask_Type );
+ FileStatus aFileStatus( osl_FileStatus_Mask_Type );
nRet = aItem.getFileStatus( aFileStatus );
if( nRet == FileBase::E_None )
{
@@ -2470,7 +2503,7 @@ String getDirectoryPath( String aPathStr )
}
else if( aType == FileStatus::Link )
{
- FileStatus aFileStatus2( FileStatusMask_LinkTargetURL );
+ FileStatus aFileStatus2( osl_FileStatus_Mask_LinkTargetURL );
nRet = aItem.getFileStatus( aFileStatus2 );
if( nRet == FileBase::E_None )
aRetStr = getDirectoryPath( aFileStatus2.getLinkTargetURL() );
@@ -2817,7 +2850,7 @@ RTLFUNC(Dir)
}
// Handle flags
- FileStatus aFileStatus( FileStatusMask_Type | FileStatusMask_FileName );
+ FileStatus aFileStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName );
nRet = aItem.getFileStatus( aFileStatus );
// Only directories?
@@ -2917,7 +2950,7 @@ RTLFUNC(GetAttr)
{
DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetString() ), aItem );
- FileStatus aFileStatus( FileStatusMask_Attributes | FileStatusMask_Type );
+ FileStatus aFileStatus( osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type );
aItem.getFileStatus( aFileStatus );
sal_uInt64 nAttributes = aFileStatus.getAttributes();
sal_Bool bReadOnly = (nAttributes & Attribute_ReadOnly) != 0;
@@ -2969,7 +3002,7 @@ RTLFUNC(FileDateTime)
{
DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( aPath ), aItem );
- FileStatus aFileStatus( FileStatusMask_ModifyTime );
+ FileStatus aFileStatus( osl_FileStatus_Mask_ModifyTime );
aItem.getFileStatus( aFileStatus );
TimeValue aTimeVal = aFileStatus.getModifyTime();
oslDateTime aDT;
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index c12924770fa1..fccdf5595e89 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1063,6 +1063,10 @@ sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
{
sal_uInt8 aByte;
*pStrm >> aByte;
+
+ if( bBinary && SbiRuntime::isVBAEnabled() && aByte == 1 && pStrm->IsEof() )
+ aByte = 0;
+
rVar.PutByte( aByte );
}
break;
@@ -1178,7 +1182,8 @@ void PutGet( SbxArray& rPar, sal_Bool bPut )
}
sal_Int16 nFileNo = rPar.Get(1)->GetInteger();
SbxVariable* pVar2 = rPar.Get(2);
- sal_Bool bHasRecordNo = (sal_Bool)(pVar2->GetType() != SbxEMPTY);
+ SbxDataType eType2 = pVar2->GetType();
+ sal_Bool bHasRecordNo = (sal_Bool)(eType2 != SbxEMPTY && eType2 != SbxERROR);
long nRecordNo = pVar2->GetLong();
if ( nFileNo < 1 || ( bHasRecordNo && nRecordNo < 1 ) )
{
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index ea83f89fdd36..469cd0f0afe6 100644
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -158,6 +158,7 @@ extern RTLFUNC(Abs);
extern RTLFUNC(Asc);
extern RTLFUNC(Atn);
extern RTLFUNC(Chr);
+extern RTLFUNC(ChrW);
extern RTLFUNC(Cos);
extern RTLFUNC(CurDir);
extern RTLFUNC(ChDir); // JSM
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 40258844adac..b40c962314c0 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -652,6 +652,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
// Methoden sind immer byval!
sal_Bool bByVal = v->IsA( TYPE(SbxMethod) );
SbxDataType t = v->GetType();
+ bool bTargetTypeIsArray = false;
if( p )
{
bByVal |= sal_Bool( ( p->eType & SbxBYREF ) == 0 );
@@ -660,9 +661,13 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
if( !bByVal && t != SbxVARIANT &&
(!v->IsFixed() || (SbxDataType)(v->GetType() & 0x0FFF ) != t) )
bByVal = sal_True;
+
+ bTargetTypeIsArray = (p->nUserData & PARAM_INFO_WITHBRACKETS) != 0;
}
if( bByVal )
{
+ if( bTargetTypeIsArray )
+ t = SbxOBJECT;
SbxVariable* v2 = new SbxVariable( t );
v2->SetFlag( SBX_READWRITE );
*v2 = *v;
@@ -1230,6 +1235,28 @@ void SbiRuntime::ClearForStack()
PopFor();
}
+SbiForStack* SbiRuntime::FindForStackItemForCollection( class BasicCollection* pCollection )
+{
+ SbiForStack* pRet = NULL;
+
+ SbiForStack* p = pForStk;
+ while( p )
+ {
+ SbxVariable* pVar = p->refEnd.Is() ? (SbxVariable*)p->refEnd : NULL;
+ if( p->eForType == FOR_EACH_COLLECTION && pVar != NULL &&
+ (pCollection = PTR_CAST(BasicCollection,pVar)) == pCollection )
+ {
+ pRet = p;
+ break;
+ }
+ }
+
+ return pRet;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//
// DLL-Aufrufe
void SbiRuntime::DllCall
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 919fd9c00626..53b2ae11c76b 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -148,7 +148,7 @@ static Methods aMethods[] = {
{ "Chr", SbxSTRING, 1 | _FUNCTION, RTLNAME(Chr),0 },
{ "string", SbxINTEGER, 0,NULL,0 },
-{ "ChrW", SbxSTRING, 1 | _FUNCTION | _COMPATONLY, RTLNAME(Chr),0},
+{ "ChrW", SbxSTRING, 1 | _FUNCTION | _COMPATONLY, RTLNAME(ChrW),0},
{ "string", SbxINTEGER, 0,NULL,0 },
{ "CInt", SbxINTEGER, 1 | _FUNCTION, RTLNAME(CInt),0 },
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 7743126835dc..bc3aeabf0255 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -802,6 +802,8 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
// auch Arrays ohne Dimensionsangaben zulassen (VB-komp.)
if( pDims )
{
+ refVar->ResetFlag( SBX_VAR_TO_DIM );
+
for( sal_uInt16 i = 1; i < pDims->Count(); )
{
sal_Int32 lb = pDims->Get( i++ )->GetLong();
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index 53b482b8f22e..8beddbc7b083 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -39,8 +39,7 @@
#include "sbunoobj.hxx"
#include "errobject.hxx"
-bool checkUnoObjectType( SbUnoObject* refVal,
- const String& aClass );
+bool checkUnoObjectType( SbUnoObject* refVal, const ::rtl::OUString& aClass );
// Laden einer numerischen Konstanten (+ID)
@@ -437,15 +436,15 @@ void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
// Check, ob TOS eine bestimmte Objektklasse ist (+StringID)
-bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
+bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::String& aClass )
{
bool bRet = true;
- if( aClass.Len() != 0 )
+ if( aClass.getLenth() != 0 )
{
bRet = pObj->IsClass( aClass );
if( !bRet )
- bRet = aClass.EqualsIgnoreCaseAscii( String( RTL_CONSTASCII_USTRINGPARAM("object") ) );
+ bRet = aClass.equalsIgnoreCaseAscii( String( RTL_CONSTASCII_USTRINGPARAM("object") ) );
if( !bRet )
{
String aObjClass = pObj->GetClassName();
@@ -463,7 +462,7 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
}
bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
- const String& aClass, bool bRaiseErrors, bool bDefault )
+ const ::rtl::OUString& aClass, bool bRaiseErrors, bool bDefault )
{
bool bOk = bDefault;
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index ebc012c36f99..e9ed8b533b40 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -621,7 +621,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
else if( bVBAEnabled ) // !pObj
{
SbxArray* pParam = pElem->GetParameters();
- if( pParam != NULL )
+ if( pParam != NULL && !pElem->IsSet( SBX_VAR_TO_DIM ) )
Error( SbERR_NO_OBJECT );
}
}
@@ -1131,6 +1131,10 @@ void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt3
aStr.Fill( nCount, 0 );
pVar->PutString( aStr );
}
+
+ bool bVarToDim = ((nOp2 & SBX_TYPE_VAR_TO_DIM_FLAG) != 0);
+ if( bVarToDim )
+ pVar->SetFlag( SBX_VAR_TO_DIM );
}
// Einrichten einer lokalen Variablen (+StringID+Typ)
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index e1e7fd3cf5f6..72208e516350 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -35,9 +35,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
-#ifndef __RSC //autogen
#include <tools/errinf.hxx>
-#endif
#include <osl/mutex.hxx>
#include <osl/diagnose.h>
#include <rtl/uri.hxx>
@@ -64,7 +62,8 @@
#include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/script/LibraryNotLoadedException.hpp>
-#include "com/sun/star/deployment/ExtensionManager.hpp"
+#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
+#include <com/sun/star/deployment/ExtensionManager.hpp>
#include <comphelper/storagehelper.hxx>
#include <comphelper/anytostring.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -167,25 +166,29 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement )
// Fire event
- ContainerEvent aEvent;
- aEvent.Source = mpxEventSource;
- aEvent.Accessor <<= aName;
- aEvent.Element = aElement;
- aEvent.ReplacedElement = aOldElement;
+ if( maContainerListeners.getLength() > 0 )
+ {
+ ContainerEvent aEvent;
+ aEvent.Source = mpxEventSource;
+ aEvent.Accessor <<= aName;
+ aEvent.Element = aElement;
+ aEvent.ReplacedElement = aOldElement;
+ maContainerListeners.notifyEach( &XContainerListener::elementReplaced, aEvent );
+ }
- OInterfaceIteratorHelper aIterator( maListenerContainer );
- while( aIterator.hasMoreElements() )
+ /* After the container event has been fired (one listener will update the
+ core Basic manager), fire change event. Listeners can rely that the
+ Basic source code of the core Basic manager is up-to-date. */
+ if( maChangesListeners.getLength() > 0 )
{
- Reference< XInterface > xIface = aIterator.next();
- Reference< XContainerListener > xListener( xIface, UNO_QUERY );
- try
- {
- xListener->elementReplaced( aEvent );
- }
- catch(RuntimeException&)
- {
- aIterator.remove();
- }
+ ChangesEvent aEvent;
+ aEvent.Source = mpxEventSource;
+ aEvent.Base <<= aEvent.Source;
+ aEvent.Changes.realloc( 1 );
+ aEvent.Changes[ 0 ].Accessor <<= aName;
+ aEvent.Changes[ 0 ].Element <<= aElement;
+ aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
+ maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
@@ -213,33 +216,35 @@ void NameContainer::insertByName( const OUString& aName, const Any& aElement )
mHashMap[ aName ] = nCount;
mnElementCount++;
-
// Fire event
- ContainerEvent aEvent;
- aEvent.Source = mpxEventSource;
- aEvent.Accessor <<= aName;
- aEvent.Element = aElement;
+ if( maContainerListeners.getLength() > 0 )
+ {
+ ContainerEvent aEvent;
+ aEvent.Source = mpxEventSource;
+ aEvent.Accessor <<= aName;
+ aEvent.Element = aElement;
+ maContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
+ }
- OInterfaceIteratorHelper aIterator( maListenerContainer );
- while( aIterator.hasMoreElements() )
+ /* After the container event has been fired (one listener will update the
+ core Basic manager), fire change event. Listeners can rely that the
+ Basic source code of the core Basic manager is up-to-date. */
+ if( maChangesListeners.getLength() > 0 )
{
- Reference< XInterface > xIface = aIterator.next();
- Reference< XContainerListener > xListener( xIface, UNO_QUERY );
- try
- {
- xListener->elementInserted( aEvent );
- }
- catch(RuntimeException&)
- {
- aIterator.remove();
- }
+ ChangesEvent aEvent;
+ aEvent.Source = mpxEventSource;
+ aEvent.Base <<= aEvent.Source;
+ aEvent.Changes.realloc( 1 );
+ aEvent.Changes[ 0 ].Accessor <<= aName;
+ aEvent.Changes[ 0 ].Element <<= aElement;
+ maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
-void NameContainer::removeByName( const OUString& Name )
+void NameContainer::removeByName( const OUString& aName )
throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
- NameContainerNameMap::iterator aIt = mHashMap.find( Name );
+ NameContainerNameMap::iterator aIt = mHashMap.find( aName );
if( aIt == mHashMap.end() )
{
throw NoSuchElementException();
@@ -261,26 +266,29 @@ void NameContainer::removeByName( const OUString& Name )
mValues.realloc( iLast );
mnElementCount--;
-
// Fire event
- ContainerEvent aEvent;
- aEvent.Source = mpxEventSource;
- aEvent.Accessor <<= Name;
- aEvent.Element = aOldElement;
+ if( maContainerListeners.getLength() > 0 )
+ {
+ ContainerEvent aEvent;
+ aEvent.Source = mpxEventSource;
+ aEvent.Accessor <<= aName;
+ aEvent.Element = aOldElement;
+ maContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
+ }
- OInterfaceIteratorHelper aIterator( maListenerContainer );
- while( aIterator.hasMoreElements() )
+ /* After the container event has been fired (one listener will update the
+ core Basic manager), fire change event. Listeners can rely that the
+ Basic source code of the core Basic manager is up-to-date. */
+ if( maChangesListeners.getLength() > 0 )
{
- Reference< XInterface > xIface = aIterator.next();
- Reference< XContainerListener > xListener( xIface, UNO_QUERY );
- try
- {
- xListener->elementRemoved( aEvent );
- }
- catch(RuntimeException&)
- {
- aIterator.remove();
- }
+ ChangesEvent aEvent;
+ aEvent.Source = mpxEventSource;
+ aEvent.Base <<= aEvent.Source;
+ aEvent.Changes.realloc( 1 );
+ aEvent.Changes[ 0 ].Accessor <<= aName;
+ // aEvent.Changes[ 0 ].Element remains empty (meaning "replaced with nothing")
+ aEvent.Changes[ 0 ].ReplacedElement = aOldElement;
+ maChangesListeners.notifyEach( &XChangesListener::changesOccurred, aEvent );
}
}
@@ -292,7 +300,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi
if( !xListener.is() )
throw RuntimeException();
Reference< XInterface > xIface( xListener, UNO_QUERY );
- maListenerContainer.addInterface( xIface );
+ maContainerListeners.addInterface( xIface );
}
void SAL_CALL NameContainer::removeContainerListener( const Reference< XContainerListener >& xListener )
@@ -301,7 +309,26 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine
if( !xListener.is() )
throw RuntimeException();
Reference< XInterface > xIface( xListener, UNO_QUERY );
- maListenerContainer.removeInterface( xIface );
+ maContainerListeners.removeInterface( xIface );
+}
+
+// Methods XChangesNotifier
+void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListener >& xListener )
+ throw (RuntimeException)
+{
+ if( !xListener.is() )
+ throw RuntimeException();
+ Reference< XInterface > xIface( xListener, UNO_QUERY );
+ maChangesListeners.addInterface( xIface );
+}
+
+void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesListener >& xListener )
+ throw (RuntimeException)
+{
+ if( !xListener.is() )
+ throw RuntimeException();
+ Reference< XInterface > xIface( xListener, UNO_QUERY );
+ maChangesListeners.removeInterface( xIface );
}
//============================================================================
@@ -322,12 +349,28 @@ void ModifiableHelper::setModified( sal_Bool _bModified )
//============================================================================
+VBAScriptListenerContainer::VBAScriptListenerContainer( ::osl::Mutex& rMutex ) :
+ VBAScriptListenerContainer_BASE( rMutex )
+{
+}
+
+bool VBAScriptListenerContainer::implTypedNotify( const Reference< vba::XVBAScriptListener >& rxListener, const vba::VBAScriptEvent& rEvent ) throw (Exception)
+{
+ rxListener->notifyVBAScriptEvent( rEvent );
+ return true; // notify all other listeners too
+}
+
+//============================================================================
+
// Implementation class SfxLibraryContainer
DBG_NAME( SfxLibraryContainer )
// Ctor
SfxLibraryContainer::SfxLibraryContainer( void )
- : LibraryContainerHelper( maMutex )
+ : SfxLibraryContainer_BASE( maMutex )
+
+ , maVBAScriptListeners( maMutex )
+ , mnRunningVBAScripts( 0 )
, mbVBACompat( sal_False )
, maModifiable( *this, maMutex )
, maNameContainer( getCppuType( (Reference< XNameAccess >*) NULL ) )
@@ -2628,6 +2671,9 @@ void SfxLibraryContainer::_disposing( const EventObject& _rSource )
// OComponentHelper
void SAL_CALL SfxLibraryContainer::disposing()
{
+ Reference< XModel > xModel = mxOwnerDocument;
+ EventObject aEvent( xModel.get() );
+ maVBAScriptListeners.disposing( aEvent );
stopAllComponentListening();
mxOwnerDocument = WeakReference< XModel >();
}
@@ -2817,7 +2863,7 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
*/
if( mbVBACompat ) try
{
- Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
+ Reference< XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
}
@@ -2839,6 +2885,43 @@ void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _proje
pBasMgr->SetName( msProjectName );
}
+sal_Int32 SAL_CALL SfxLibraryContainer::getRunningVBAScripts() throw (RuntimeException)
+{
+ LibraryContainerMethodGuard aGuard( *this );
+ return mnRunningVBAScripts;
+}
+
+void SAL_CALL SfxLibraryContainer::addVBAScriptListener( const Reference< vba::XVBAScriptListener >& rxListener ) throw (RuntimeException)
+{
+ maVBAScriptListeners.addTypedListener( rxListener );
+}
+
+void SAL_CALL SfxLibraryContainer::removeVBAScriptListener( const Reference< vba::XVBAScriptListener >& rxListener ) throw (RuntimeException)
+{
+ maVBAScriptListeners.removeTypedListener( rxListener );
+}
+
+void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifier, const ::rtl::OUString& rModuleName ) throw (RuntimeException)
+{
+ // own lock for accessing the number of running scripts
+ enterMethod();
+ switch( nIdentifier )
+ {
+ case vba::VBAScriptEventId::SCRIPT_STARTED:
+ ++mnRunningVBAScripts;
+ break;
+ case vba::VBAScriptEventId::SCRIPT_STOPPED:
+ --mnRunningVBAScripts;
+ break;
+ }
+ leaveMethod();
+
+ Reference< XModel > xModel = mxOwnerDocument; // weak-ref -> ref
+ Reference< XInterface > xSender( xModel, UNO_QUERY_THROW );
+ vba::VBAScriptEvent aEvent( xSender, nIdentifier, rModuleName );
+ maVBAScriptListeners.notify( aEvent );
+}
+
// Methods XServiceInfo
::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
throw (RuntimeException)
@@ -2919,11 +3002,14 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& rType )
{
Any aRet;
- aRet = Any( ::cppu::queryInterface( rType,
- static_cast< XContainer * >( this ),
- static_cast< XNameContainer * >( this ),
- static_cast< XNameAccess * >( this ) ) );
-
+ aRet = Any(
+ ::cppu::queryInterface(
+ rType,
+ static_cast< XContainer * >( this ),
+ static_cast< XNameContainer * >( this ),
+ static_cast< XNameAccess * >( this ),
+ static_cast< XElementAccess * >( this ),
+ static_cast< XChangesNotifier * >( this ) ) );
if( !aRet.hasValue() )
aRet = OComponentHelper::queryInterface( rType );
return aRet;
@@ -3064,6 +3150,7 @@ Sequence< Type > SfxLibrary::getTypes()
static OTypeCollection s_aTypes_NameContainer(
::getCppuType( (const Reference< XNameContainer > *)0 ),
::getCppuType( (const Reference< XContainer > *)0 ),
+ ::getCppuType( (const Reference< XChangesNotifier > *)0 ),
OComponentHelper::getTypes() );
s_pTypes_NameContainer = &s_aTypes_NameContainer;
}
@@ -3091,9 +3178,6 @@ Sequence< sal_Int8 > SfxLibrary::getImplementationId()
}
}
-
-//============================================================================
-
// Methods XContainer
void SAL_CALL SfxLibrary::addContainerListener( const Reference< XContainerListener >& xListener )
throw (RuntimeException)
@@ -3108,6 +3192,19 @@ void SAL_CALL SfxLibrary::removeContainerListener( const Reference< XContainerLi
maNameContainer.removeContainerListener( xListener );
}
+// Methods XChangesNotifier
+void SAL_CALL SfxLibrary::addChangesListener( const Reference< XChangesListener >& xListener )
+ throw (RuntimeException)
+{
+ maNameContainer.setEventSource( static_cast< XInterface* >( (OWeakObject*)this ) );
+ maNameContainer.addChangesListener( xListener );
+}
+
+void SAL_CALL SfxLibrary::removeChangesListener( const Reference< XChangesListener >& xListener )
+ throw (RuntimeException)
+{
+ maNameContainer.removeChangesListener( xListener );
+}
//============================================================================
// Implementation class ScriptExtensionIterator
diff --git a/basic/util/makefile.mk b/basic/util/makefile.mk
index 635b29369868..29564fddd125 100755
--- a/basic/util/makefile.mk
+++ b/basic/util/makefile.mk
@@ -64,6 +64,9 @@ SHL1STDLIBS= \
$(SOTLIB) \
$(XMLSCRIPTLIB)
+# Uncomment the following line if DBG_TRACE_PROFILING is active in source/inc/sbtrace.hxx
+# SHL1STDLIBS+=$(CANVASTOOLSLIB)
+
.IF "$(GUI)"=="WNT"
SHL1STDLIBS+= \
$(UWINAPILIB) \
diff --git a/connectivity/inc/connectivity/predicateinput.hxx b/connectivity/inc/connectivity/predicateinput.hxx
index 84202f85e7c2..c16a27af1258 100644
--- a/connectivity/inc/connectivity/predicateinput.hxx
+++ b/connectivity/inc/connectivity/predicateinput.hxx
@@ -105,6 +105,12 @@ namespace dbtools
::rtl::OUString* _pErrorMessage = NULL
) const;
+ ::rtl::OUString getPredicateValue(
+ const ::rtl::OUString& _sField
+ , const ::rtl::OUString& _rPredicateValue
+ , sal_Bool _bForStatementUse
+ , ::rtl::OUString* _pErrorMessage = NULL) const;
+
private:
::connectivity::OSQLParseNode* implPredicateTree(
::rtl::OUString& _rErrorMessage,
@@ -117,6 +123,8 @@ namespace dbtools
sal_Unicode& _rDecSep,
sal_Unicode& _rThdSep
) const;
+
+ ::rtl::OUString implParseNode(::connectivity::OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const;
};
//.........................................................................
diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx
index f7182c34df75..5b010bc03333 100644
--- a/connectivity/inc/connectivity/sqlnode.hxx
+++ b/connectivity/inc/connectivity/sqlnode.hxx
@@ -66,6 +66,8 @@ namespace rtl
{
class OUStringBuffer;
}
+#define ORDER_BY_CHILD_POS 5
+#define TABLE_EXPRESSION_CHILD_COUNT 9
namespace connectivity
{
diff --git a/connectivity/qa/connectivity/tools/CRMDatabase.java b/connectivity/qa/connectivity/tools/CRMDatabase.java
index a1b457884948..f9b6d52a8038 100755
--- a/connectivity/qa/connectivity/tools/CRMDatabase.java
+++ b/connectivity/qa/connectivity/tools/CRMDatabase.java
@@ -224,6 +224,7 @@ public class CRMDatabase
// --------------------------------------------------------------------------------------------------------
private void validateUnparseable()
{
+ /*
// The "unparseable" query should be indeed be unparseable by OOo (though a valid HSQL query)
XSingleSelectQueryComposer composer;
QueryDefinition unparseableQuery;
@@ -253,6 +254,7 @@ public class CRMDatabase
if ( !caughtExpected )
throw new RuntimeException( "Somebody improved the parser! This is bad :), since we need an unparsable query here!" );
+ */
}
// --------------------------------------------------------------------------------------------------------
@@ -284,9 +286,10 @@ public class CRMDatabase
m_database.getDataSource().createQuery( "parseable", "SELECT * FROM \"customers\"" );
m_database.getDataSource().createQuery( "parseable native", "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VIEWS", false );
+/*
m_database.getDataSource().createQuery( "unparseable",
"SELECT {fn DAYOFMONTH ('2001-01-01')} AS \"ID_VARCHAR\" FROM \"products\"", false );
-
+*/
validateUnparseable();
}
}
diff --git a/connectivity/qa/makefile.mk b/connectivity/qa/makefile.mk
index ee41cab63554..c087ab98bd7d 100755
--- a/connectivity/qa/makefile.mk
+++ b/connectivity/qa/makefile.mk
@@ -35,9 +35,16 @@ PACKAGE = complex/connectivity
#----- compile .java files -----------------------------------------
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar hsqldb.jar
JAVAFILES := $(shell @$(FIND) complex -name "*.java")
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+
+.IF "$(SYSTEM_HSQLDB)" == "YES"
+EXTRAJARFILES = $(HSQLDB_JAR)
+.ELSE
+JARFILES += hsqldb.jar
+.ENDIF
+
#----- make a jar from compiled files ------------------------------
JARCLASSDIRS = $(PACKAGE)
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 797cad9de343..0a8b5bd1b972 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -788,12 +788,30 @@ sal_Bool operator==(const DateTime& _rLH,const DateTime& _rRH)
bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
{
- if(m_eTypeKind != _rRH.m_eTypeKind)
- return false;
- if ( m_bSigned != _rRH.m_bSigned )
- return false;
- if(m_bNull != _rRH.isNull())
+ if ( m_eTypeKind != _rRH.m_eTypeKind )
+ {
+ switch(m_eTypeKind)
+ {
+ case DataType::FLOAT:
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ return getDouble() == _rRH.getDouble();
+ default:
+ switch(_rRH.m_eTypeKind)
+ {
+ case DataType::FLOAT:
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ return getDouble() == _rRH.getDouble();
+ default:
+ break;
+ }
+ break;
+ }
return false;
+ }
+ if ( m_bNull != _rRH.isNull() )
+ return false;
if(m_bNull && _rRH.isNull())
return true;
@@ -803,16 +821,28 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
{
case DataType::VARCHAR:
case DataType::CHAR:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
case DataType::LONGVARCHAR:
{
::rtl::OUString aVal1(m_aValue.m_pString);
::rtl::OUString aVal2(_rRH.m_aValue.m_pString);
- bRet = aVal1 == aVal2;
- break;
+ return aVal1 == aVal2;
}
+ default:
+ if ( m_bSigned != _rRH.m_bSigned )
+ return false;
+ break;
+ }
+ switch(m_eTypeKind)
+ {
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ {
+ ::rtl::OUString aVal1(m_aValue.m_pString);
+ ::rtl::OUString aVal2(_rRH.m_aValue.m_pString);
+ bRet = aVal1 == aVal2;
+ }
+ break;
case DataType::FLOAT:
bRet = *(float*)m_aValue.m_pValue == *(float*)_rRH.m_aValue.m_pValue;
break;
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index b53be005a019..06c743d65561 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -32,8 +32,10 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <osl/diagnose.h>
#include <connectivity/sqlnode.hxx>
+#include <connectivity/PColumn.hxx>
#include <comphelper/numbers.hxx>
//.........................................................................
@@ -326,63 +328,116 @@ namespace dbtools
::rtl::OUString sError;
OSQLParseNode* pParseNode = implPredicateTree( sError, sValue, _rxField );
- if ( _pErrorMessage ) *_pErrorMessage = sError;
+ if ( _pErrorMessage )
+ *_pErrorMessage = sError;
- if ( pParseNode )
+ sReturn = implParseNode(pParseNode,_bForStatementUse);
+ }
+
+ return sReturn;
+ }
+
+ ::rtl::OUString OPredicateInputController::getPredicateValue(
+ const ::rtl::OUString& _sField, const ::rtl::OUString& _rPredicateValue, sal_Bool _bForStatementUse, ::rtl::OUString* _pErrorMessage ) const
+ {
+ ::rtl::OUString sReturn = _rPredicateValue;
+ ::rtl::OUString sError;
+ ::rtl::OUString sField = _sField;
+ sal_Int32 nIndex = 0;
+ sField = sField.getToken(0,'(',nIndex);
+ if(nIndex == -1)
+ sField = _sField;
+ sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType(sField,&m_aParser.getContext());
+ if ( nType == DataType::OTHER || !sField.getLength() )
+ {
+ // first try the international version
+ ::rtl::OUString sSql;
+ sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT * "));
+ sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM x WHERE "));
+ sSql += sField;
+ sSql += _rPredicateValue;
+ ::std::auto_ptr<OSQLParseNode> pParseNode( const_cast< OSQLParser& >( m_aParser ).parseTree( sError, sSql, sal_True ) );
+ nType = DataType::DOUBLE;
+ if ( pParseNode.get() )
{
- OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec );
- if ( pOdbcSpec )
+ OSQLParseNode* pColumnRef = pParseNode->getByRule(OSQLParseNode::column_ref);
+ if ( pColumnRef )
{
- if ( !_bForStatementUse )
- {
- if ( ( pOdbcSpec->count() >= 2 )
- && ( SQL_NODE_STRING == pOdbcSpec->getChild(1)->getNodeType() )
- )
- {
+ }
+ }
+ }
- sReturn = pOdbcSpec->getChild(1)->getTokenValue();
- }
- else
- OSL_FAIL( "OPredicateInputController::getPredicateValue: unknown/invalid structure (odbc + param use)!" );
- }
- else
- {
- OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent();
- OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" );
- if ( pFuncSpecParent )
- pFuncSpecParent->parseNodeToStr(
- sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
- );
- }
+ Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ parse::OParseColumn* pColumn = new parse::OParseColumn( sField,
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ ColumnValue::NULLABLE_UNKNOWN,
+ 0,
+ 0,
+ nType,
+ sal_False,
+ sal_False,
+ xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
+ Reference<XPropertySet> xColumn = pColumn;
+ pColumn->setFunction(sal_True);
+ pColumn->setRealName(sField);
+
+ OSQLParseNode* pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn );
+ if ( _pErrorMessage )
+ *_pErrorMessage = sError;
+ return pParseNode ? implParseNode(pParseNode,_bForStatementUse) : sReturn;
+ }
+
+ ::rtl::OUString OPredicateInputController::implParseNode(OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const
+ {
+ ::rtl::OUString sReturn;
+ if ( pParseNode )
+ {
+ ::std::auto_ptr<OSQLParseNode> pTemp(pParseNode);
+ OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec );
+ if ( pOdbcSpec )
+ {
+ if ( _bForStatementUse )
+ {
+ OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent();
+ OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" );
+ if ( pFuncSpecParent )
+ pFuncSpecParent->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True);
}
else
{
- if ( pParseNode->count() >= 3 )
+ OSQLParseNode* pValueNode = pOdbcSpec->getChild(1);
+ if ( SQL_NODE_STRING == pValueNode->getNodeType() )
+ sReturn = pValueNode->getTokenValue();
+ else
+ pValueNode->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True);
+ }
+ }
+ else
+ {
+ if ( pParseNode->count() >= 3 )
+ {
+ OSQLParseNode* pValueNode = pParseNode->getChild(2);
+ OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" );
+ if ( !_bForStatementUse )
{
- OSQLParseNode* pValueNode = pParseNode->getChild(2);
- OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" );
- if ( !_bForStatementUse )
- {
- if ( SQL_NODE_STRING == pValueNode->getNodeType() )
- sReturn = pValueNode->getTokenValue();
- else
- pValueNode->parseNodeToStr(
- sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
- );
- }
+ if ( SQL_NODE_STRING == pValueNode->getNodeType() )
+ sReturn = pValueNode->getTokenValue();
else
pValueNode->parseNodeToStr(
sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
);
}
else
- OSL_FAIL( "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" );
+ pValueNode->parseNodeToStr(
+ sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
+ );
}
-
- delete pParseNode;
+ else
+ OSL_FAIL( "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" );
}
}
-
return sReturn;
}
//.........................................................................
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index 7ac506d99cae..8d0a3347bdd3 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -168,7 +168,8 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
{
sal_Int32 nVal=0;
rValue >>= nVal;
- m_aColumn.put_NumericScale((sal_Int8)nVal);
+ if ( !m_IsCurrency )
+ m_aColumn.put_NumericScale((sal_Int8)nVal);
}
break;
case PROPERTY_ID_ISNULLABLE:
@@ -215,6 +216,8 @@ void OAdoColumn::fillPropertyValues()
DataTypeEnum eType = m_aColumn.get_Type();
m_IsCurrency = (eType == adCurrency);
+ if ( m_IsCurrency && !m_Scale)
+ m_Scale = 4;
m_Type = ADOS::MapADOType2Jdbc(eType);
sal_Bool bForceTo = sal_True;
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 200884e4de98..0ab23e892db1 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -469,6 +469,11 @@ void OConnection::buildTypeInfo() throw( SQLException)
aInfo->aSimpleType.aLocalTypeName = ADOS::getField(pRecordset,nPos++).get_Value();
aInfo->aSimpleType.nMinimumScale = ADOS::getField(pRecordset,nPos++).get_Value();
aInfo->aSimpleType.nMaximumScale = ADOS::getField(pRecordset,nPos++).get_Value();
+ if ( adCurrency == aInfo->eType && !aInfo->aSimpleType.nMaximumScale)
+ {
+ aInfo->aSimpleType.nMinimumScale = 4;
+ aInfo->aSimpleType.nMaximumScale = 4;
+ }
aInfo->aSimpleType.nNumPrecRadix = ADOS::getField(pRecordset,nPos++).get_Value();
// Now that we have the type info, save it
// in the Hashtable if we don't already have an
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index e8c7a41cd0bc..42c32e577158 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -401,7 +401,7 @@ void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
if(first())
- previous();
+ m_bOnFirstAfterOpen = !previous();
}
// -------------------------------------------------------------------------
void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu
index e95e1a676c12..58bfcf8975a9 100644
--- a/connectivity/source/drivers/ado/ado.xcu
+++ b/connectivity/source/drivers/ado/ado.xcu
@@ -117,6 +117,11 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="RespectDriverResultSetType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">
diff --git a/connectivity/source/drivers/dbase/DNoException.cxx b/connectivity/source/drivers/dbase/DNoException.cxx
index b130547e9265..357b2baad44a 100644
--- a/connectivity/source/drivers/dbase/DNoException.cxx
+++ b/connectivity/source/drivers/dbase/DNoException.cxx
@@ -225,7 +225,7 @@ void ODbaseTable::AllocBuffer()
}
// If no buffer available: allocate
- if (m_pBuffer == NULL && nSize)
+ if (m_pBuffer == NULL && nSize > 0)
{
m_nBufferSize = nSize;
m_pBuffer = new sal_uInt8[m_nBufferSize+1];
@@ -484,11 +484,14 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r
sal_uIntPtr nTell = rStream.Tell() % 512;
sal_uInt16 nBufferSize = rStream.GetBufferSize();
sal_uIntPtr nSize = nBufferSize - nTell;
- char* pEmptyData = new char[nSize];
- memset(pEmptyData,0x00,nSize);
- rStream.Write((sal_uInt8*)pEmptyData,nSize);
- rStream.Seek(nTell);
- delete [] pEmptyData;
+ if ( nSize <= nBufferSize )
+ {
+ char* pEmptyData = new char[nSize];
+ memset(pEmptyData,0x00,nSize);
+ rStream.Write((sal_uInt8*)pEmptyData,nSize);
+ rStream.Seek(nTell);
+ delete [] pEmptyData;
+ }
}
return rStream;
}
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 5630800b47f2..e17c2ee59bc3 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2775,7 +2775,7 @@ void ODbaseTable::AllocBuffer()
}
// if there is no buffer available: allocate:
- if (m_pBuffer == NULL && nSize)
+ if (m_pBuffer == NULL && nSize > 0)
{
m_nBufferSize = nSize;
m_pBuffer = new sal_uInt8[m_nBufferSize+1];
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index 590eb5b46fae..b2fea12ab294 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -883,11 +883,14 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r
sal_uIntPtr nTell = rStream.Tell() % PAGE_SIZE;
sal_uInt16 nBufferSize = rStream.GetBufferSize();
sal_uIntPtr nRemainSize = nBufferSize - nTell;
- char* pEmptyData = new char[nRemainSize];
- memset(pEmptyData,0x00,nRemainSize);
- rStream.Write((sal_uInt8*)pEmptyData,nRemainSize);
- rStream.Seek(nTell);
- delete [] pEmptyData;
+ if ( nRemainSize <= nBufferSize )
+ {
+ char* pEmptyData = new char[nRemainSize];
+ memset(pEmptyData,0x00,nRemainSize);
+ rStream.Write((sal_uInt8*)pEmptyData,nRemainSize);
+ rStream.Seek(nTell);
+ delete [] pEmptyData;
+ }
}
return rStream;
}
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index bd920d356034..903fecd21524 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -97,7 +97,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
OSQLParseNode * pTableExp = pSQLParseNode->getChild(3);
DBG_ASSERT(pTableExp != NULL,"Fehler im Parse Tree");
DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree");
- DBG_ASSERT(pTableExp->count() == 5,"Fehler im Parse Tree");
+ DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Fehler im Parse Tree");
// check that we don't use anything other than count(*) as function
OSQLParseNode* pSelection = pSQLParseNode->getChild(2);
@@ -115,7 +115,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
pWhereClause = pTableExp->getChild(1);
- pOrderbyClause = pTableExp->getChild(4);
+ pOrderbyClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
(void)pOrderbyClause;
}
else if (SQL_ISRULE(pSQLParseNode,update_statement_searched))
@@ -295,10 +295,19 @@ OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw(
OSQLParseNode* pAtom = pPart2->getChild(pPart2->count()-2);
OSQLParseNode* pOptEscape = pPart2->getChild(pPart2->count()-1);
- if (!(pAtom->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(pAtom,parameter)))
+ if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
+ SQL_ISRULE(pAtom,parameter) ||
+ // odbc date
+ SQL_ISRULE(pAtom,set_fct_spec) ||
+ SQL_ISRULE(pAtom,position_exp) ||
+ SQL_ISRULE(pAtom,char_substring_fct) ||
+ // upper, lower etc.
+ SQL_ISRULE(pAtom,fold)) )
{
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL);
+ m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
+ return NULL;
}
+
if (pOptEscape->count() != 0)
{
if (pOptEscape->count() != 2)
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index c4638889d15e..584838ad6446 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -160,7 +160,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
}
++nRowCount;
}
- while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding));
+ while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding) && !m_pFileStream->IsEof());
for (xub_StrLen i = 0; i < nFieldCount; i++)
{
@@ -495,7 +495,8 @@ String OFlatTable::getEntry()
// name and extension have to coincide
if ( m_pConnection->matchesExtension( sExt ) )
{
- sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString());
+ if ( sExt.getLength() )
+ sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString());
if ( sName == m_Name )
{
Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 622ba2c5a7d8..fcb3408a3c52 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
#include "HTerminateListener.hxx"
#include "hsqldb/HCatalog.hxx"
#include "diagnose_ex.h"
@@ -73,6 +74,7 @@ namespace connectivity
using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::task;
+ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::reflection;
namespace hsqldb
@@ -619,6 +621,22 @@ namespace connectivity
m_bInShutDownConnections = sal_True;
}
//------------------------------------------------------------------
+ void ODriverDelegator::flushConnections()
+ {
+ TWeakPairVector::iterator aEnd = m_aConnections.end();
+ for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
+ {
+ try
+ {
+ Reference<XFlushable> xCon(i->second.second.first.get(),UNO_QUERY);
+ xCon->flush();
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+ //------------------------------------------------------------------
void SAL_CALL ODriverDelegator::preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx b/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
index 070d5e8be5cb..739132cf9035 100644
--- a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
+++ b/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
@@ -52,6 +52,7 @@ throw( RuntimeException )
void SAL_CALL OConnectionController::queryTermination( const EventObject& /*aEvent*/ )
throw( TerminationVetoException, RuntimeException )
{
+ m_pDriver->flushConnections();
}
void SAL_CALL OConnectionController::notifyTermination( const EventObject& /*aEvent*/ )
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 90209d8c528b..14cb26fa9f95 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -823,7 +823,7 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url,
static const char * cSignature = "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;";
static const char * cMethodName = "connect";
// Java-Call
- static jmethodID mID = NULL;
+ jmethodID mID = NULL;
if ( !mID )
mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature );
if ( mID )
diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu
index f4f599a701d9..2afaa54a9e90 100644
--- a/connectivity/source/drivers/jdbc/jdbc.xcu
+++ b/connectivity/source/drivers/jdbc/jdbc.xcu
@@ -147,6 +147,11 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="RespectDriverResultSetType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index 2faf420524ad..b2841391eec9 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -152,6 +152,7 @@ java_util_Properties* connectivity::createStringPropertyArray(const Sequence< Pr
&& pBegin->Name.compareToAscii( "Authentication" )
&& pBegin->Name.compareToAscii( "PreferDosLikeLineEnds" )
&& pBegin->Name.compareToAscii( "PrimaryKeySupport" )
+ && pBegin->Name.compareToAscii( "RespectDriverResultSetType" )
)
{
::rtl::OUString aStr;
diff --git a/connectivity/source/drivers/macab/MacabRecord.cxx b/connectivity/source/drivers/macab/MacabRecord.cxx
index d3521663e9e1..b3be998aa6fa 100644
--- a/connectivity/source/drivers/macab/MacabRecord.cxx
+++ b/connectivity/source/drivers/macab/MacabRecord.cxx
@@ -203,7 +203,7 @@ sal_Int32 MacabRecord::compareFields(const macabfield *_field1, const macabfield
result = CFStringCompare(
(CFStringRef) _field1->value,
(CFStringRef) _field2->value,
- 0); // 0 = no options (like ignore case)
+ kCFCompareLocalized); // Specifies that the comparison should take into account differences related to locale, such as the thousands separator character.
break;
case kABDateProperty:
diff --git a/connectivity/source/drivers/odbc/odbc.xcu b/connectivity/source/drivers/odbc/odbc.xcu
index 74ba8815d021..c0d3939aa0e0 100644
--- a/connectivity/source/drivers/odbc/odbc.xcu
+++ b/connectivity/source/drivers/odbc/odbc.xcu
@@ -152,6 +152,11 @@
<value>true</value>
</prop>
</node>
+ <node oor:name="RespectDriverResultSetType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
</node>
<node oor:name="MetaData">
<node oor:name="SupportsTableCreation" oor:op="replace">
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index 55f7548d5f70..6df4f2c0275a 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -979,7 +979,8 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
+ if ( catalog.hasValue() )
+ aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding);
aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
@@ -1013,7 +1014,8 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog,
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
+ if ( catalog.hasValue() )
+ aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding);
aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
@@ -1081,7 +1083,8 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog,
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
+ if ( catalog.hasValue() )
+ aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding);
aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
@@ -1116,7 +1119,8 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const ::rtl:
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
+ if ( catalog.hasValue() )
+ aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding);
@@ -1146,6 +1150,7 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any&
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
+ if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding);
@@ -1236,7 +1241,8 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const ::rtl
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
+ if ( catalog.hasValue() )
+ aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
@@ -1265,7 +1271,8 @@ void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const :
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN;
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
+ if ( catalog.hasValue() )
+ aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
@@ -1295,7 +1302,8 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const ::rtl:
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN;
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
+ if ( catalog.hasValue() )
+ aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index e789f4bd111b..dbe77cd21e48 100644
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx
@@ -1368,15 +1368,24 @@ sal_Bool OResultSet::isBookmarkable() const
//------------------------------------------------------------------------------
void OResultSet::setFetchDirection(sal_Int32 _par0)
{
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
+ OSL_ENSURE(_par0>0,"Illegal fetch direction!");
+ if ( _par0 > 0 )
+ {
+ N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
+ }
}
//------------------------------------------------------------------------------
void OResultSet::setFetchSize(sal_Int32 _par0)
{
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
- delete m_pRowStatusArray;
- m_pRowStatusArray = new SQLUSMALLINT[_par0];
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
+ OSL_ENSURE(_par0>0,"Illegal fetch size!");
+ if ( _par0 > 0 )
+ {
+ N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
+ delete m_pRowStatusArray;
+
+ m_pRowStatusArray = new SQLUSMALLINT[_par0];
+ N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
+ }
}
// -------------------------------------------------------------------------
IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
diff --git a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
index 34f60939f9f8..1eb6796c5b08 100644
--- a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
@@ -61,7 +61,11 @@ OResultSetMetaData::~OResultSetMetaData()
);
::rtl::OUString sValue;
if ( nRet == SQL_SUCCESS )
+ {
+ if ( nRealLen < 0 )
+ nRealLen = BUFFER_LEN;
sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
+ }
delete [] pName;
OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
if(nRealLen > BUFFER_LEN)
@@ -75,7 +79,7 @@ OResultSetMetaData::~OResultSetMetaData()
&nRealLen,
NULL
);
- if ( nRet == SQL_SUCCESS )
+ if ( nRet == SQL_SUCCESS && nRealLen > 0)
sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
delete [] pName;
OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
diff --git a/connectivity/source/drivers/odbcbase/OStatement.cxx b/connectivity/source/drivers/odbcbase/OStatement.cxx
index 8a92fa87911c..3ae95c951954 100644
--- a/connectivity/source/drivers/odbcbase/OStatement.cxx
+++ b/connectivity/source/drivers/odbcbase/OStatement.cxx
@@ -877,13 +877,15 @@ void OStatement_Base::setFetchDirection(sal_Int32 _par0)
void OStatement_Base::setFetchSize(sal_Int32 _par0)
{
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
+ OSL_ENSURE(_par0>0,"Illegal fetch size!");
+ if ( _par0 > 0 )
+ {
+ SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
- SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
-
- delete m_pRowStatusArray;
- m_pRowStatusArray = new SQLUSMALLINT[_par0];
- nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
- OSL_UNUSED( nRetCode );
+ delete m_pRowStatusArray;
+ m_pRowStatusArray = new SQLUSMALLINT[_par0];
+ nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
+ }
}
//------------------------------------------------------------------------------
void OStatement_Base::setMaxFieldSize(sal_Int32 _par0)
diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx
index 2ef4164899c7..4fce57fb6878 100644
--- a/connectivity/source/inc/hsqldb/HDriver.hxx
+++ b/connectivity/source/inc/hsqldb/HDriver.hxx
@@ -124,6 +124,7 @@ namespace connectivity
virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
void shutdownConnections();
+ void flushConnections();
protected:
/// dtor
virtual ~ODriverDelegator();
diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx
index cff8c5d93fd9..a709976d1dd3 100644
--- a/connectivity/source/parse/PColumn.cxx
+++ b/connectivity/source/parse/PColumn.cxx
@@ -156,13 +156,15 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe
_rxResMetaData->isCurrency( _nColumnPos ),
_rxDBMetaData->supportsMixedCaseQuotedIdentifiers()
);
- pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData,
- _rxResMetaData->getCatalogName( _nColumnPos ),
- _rxResMetaData->getSchemaName( _nColumnPos ),
- _rxResMetaData->getTableName( _nColumnPos ),
- sal_False,
- eComplete
- ) );
+ const ::rtl::OUString sTableName = _rxResMetaData->getTableName( _nColumnPos );
+ if ( sTableName.getLength() )
+ pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData,
+ _rxResMetaData->getCatalogName( _nColumnPos ),
+ _rxResMetaData->getSchemaName( _nColumnPos ),
+ sTableName,
+ sal_False,
+ eComplete
+ ) );
pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) );
pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos ));
pColumn->setLabel(sLabel);
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index dbfbd7ad1322..7abcacd6f736 100755
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -218,6 +218,14 @@ using namespace connectivity;
%token <pParseNode> SQL_TOKEN_VALUE SQL_TOKEN_CURRENT_CATALOG SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP SQL_TOKEN_CURRENT_PATH SQL_TOKEN_CURRENT_ROLE SQL_TOKEN_CURRENT_SCHEMA SQL_TOKEN_CURRENT_USER
%token <pParseNode> SQL_TOKEN_SESSION_USER SQL_TOKEN_SYSTEM_USER SQL_TOKEN_VARCHAR SQL_TOKEN_VARBINARY SQL_TOKEN_VARYING SQL_TOKEN_OBJECT SQL_TOKEN_NCLOB SQL_TOKEN_NATIONAL
%token <pParseNode> SQL_TOKEN_LARGE SQL_TOKEN_CLOB SQL_TOKEN_BLOB SQL_TOKEN_BIGINT SQL_TOKEN_BINARY SQL_TOKEN_WITHOUT SQL_TOKEN_BOOLEAN SQL_TOKEN_INTERVAL
+// window function
+%token <pParseNode> SQL_TOKEN_OVER SQL_TOKEN_ROW_NUMBER SQL_TOKEN_NTILE SQL_TOKEN_LEAD SQL_TOKEN_LAG SQL_TOKEN_RESPECT SQL_TOKEN_IGNORE SQL_TOKEN_NULLS
+%token <pParseNode> SQL_TOKEN_FIRST_VALUE SQL_TOKEN_LAST_VALUE SQL_TOKEN_NTH_VALUE SQL_TOKEN_FIRST SQL_TOKEN_LAST
+%token <pParseNode> SQL_TOKEN_EXCLUDE SQL_TOKEN_OTHERS SQL_TOKEN_TIES SQL_TOKEN_FOLLOWING SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING SQL_TOKEN_RANGE SQL_TOKEN_ROWS
+%token <pParseNode> SQL_TOKEN_PARTITION SQL_TOKEN_WINDOW SQL_TOKEN_NO
+// LIMIT and OFFSEt
+%token <pParseNode> SQL_TOKEN_LIMIT SQL_TOKEN_OFFSET SQL_TOKEN_NEXT SQL_TOKEN_ONLY
+
/* operators */
%left SQL_TOKEN_NAME
%left <pParseNode> SQL_TOKEN_OR
@@ -272,7 +280,7 @@ using namespace connectivity;
%type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist
%type <pParseNode> /*bit_concatenation*/ bit_value_exp bit_factor bit_primary collate_clause char_value_fct unique_spec value_exp_commalist in_predicate_value unique_test update_source
%type <pParseNode> function_arg_commalist3 string_function_3Argument function_arg_commalist4 string_function_4Argument function_arg_commalist2 string_function_1Argument string_function_2Argument
-%type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument date_function_3Argument
+%type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument
%type <pParseNode> all query_primary sql_not for_length upper_lower comparison column_val cross_union /*opt_schema_element_list*/
%type <pParseNode> /*op_authorization op_schema*/ nil_fkt schema_element base_table_def base_table_element base_table_element_commalist
%type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement
@@ -287,6 +295,16 @@ using namespace connectivity;
%type <pParseNode> binary_string_type numeric_type boolean_type datetime_type interval_type opt_paren_precision paren_char_length opt_paren_char_large_length paren_character_large_object_length
%type <pParseNode> large_object_length opt_multiplier character_large_object_type national_character_large_object_type binary_large_object_string_type opt_with_or_without_time_zone
%type <pParseNode> approximate_numeric_type exact_numeric_type opt_paren_precision_scale
+/* window function rules */
+%type <pParseNode> window_function window_function_type ntile_function number_of_tiles lead_or_lag_function lead_or_lag lead_or_lag_extent offset default_expression null_treatment
+%type <pParseNode> first_or_last_value_function first_or_last_value nth_value_function nth_row from_first_or_last window_name_or_specification in_line_window_specification opt_lead_or_lag_function
+%type <pParseNode> opt_null_treatment opt_from_first_or_last simple_value_specification dynamic_parameter_specification window_name window_clause window_definition_list window_definition
+%type <pParseNode> new_window_name window_specification_details existing_window_name window_partition_clause window_partition_column_reference_list window_partition_column_reference window_frame_clause
+%type <pParseNode> window_frame_units window_frame_extent window_frame_start window_frame_preceding window_frame_between window_frame_bound_1 window_frame_bound_2 window_frame_bound window_frame_following window_frame_exclusion
+%type <pParseNode> opt_window_frame_clause opt_window_partition_clause opt_existing_window_name window_specification opt_window_frame_exclusion opt_window_clause opt_offset
+%type <pParseNode> opt_fetch_first_row_count fetch_first_clause offset_row_count fetch_first_row_count first_or_next row_or_rows opt_result_offset_clause result_offset_clause
+/* LIMIT and OFFSET */
+%type <pParseNode> opt_limit_offset_clause limit_offset_clause opt_fetch_first_clause
%%
/* Parse Tree an OSQLParser zurueckliefern
@@ -921,19 +939,89 @@ selection:
}
| scalar_exp_commalist
;
+opt_result_offset_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | result_offset_clause
+ ;
+result_offset_clause:
+ SQL_TOKEN_OFFSET offset_row_count row_or_rows
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+opt_fetch_first_row_count:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | fetch_first_row_count
+ ;
+first_or_next:
+ SQL_TOKEN_FIRST
+ | SQL_TOKEN_NEXT
+ ;
+row_or_rows:
+ SQL_TOKEN_ROW
+ | SQL_TOKEN_ROWS
+ ;
+opt_fetch_first_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | fetch_first_clause
+ ;
+fetch_first_clause:
+ SQL_TOKEN_FETCH first_or_next opt_fetch_first_row_count row_or_rows SQL_TOKEN_ONLY
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ $$->append($4);
+ $$->append($5);
+ }
+ ;
+offset_row_count:
+ literal
+ ;
+fetch_first_row_count:
+ literal
+ ;
+opt_limit_offset_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | limit_offset_clause
+ ;
+opt_offset:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | SQL_TOKEN_OFFSET SQL_TOKEN_INTNUM
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+limit_offset_clause:
+ SQL_TOKEN_LIMIT SQL_TOKEN_INTNUM opt_offset
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
table_exp:
- from_clause
- opt_where_clause
- opt_group_by_clause
- opt_having_clause
- opt_order_by_clause
- {$$ = SQL_NEW_RULE;
+ from_clause opt_where_clause opt_group_by_clause opt_having_clause opt_window_clause opt_order_by_clause opt_limit_offset_clause opt_result_offset_clause opt_fetch_first_clause
+ {
+ $$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
$$->append($4);
- $$->append($5);}
+ $$->append($5);
+ $$->append($6);
+ $$->append($7);
+ $$->append($8);
+ $$->append($9);
+ }
;
from_clause:
@@ -1852,10 +1940,10 @@ function_name12:
;
function_name23:
SQL_TOKEN_LOCATE
+ | SQL_TOKEN_DATEDIFF
;
function_name3:
string_function_3Argument
- | date_function_3Argument
;
function_name:
string_function
@@ -1913,8 +2001,6 @@ date_function_1Argument:
| SQL_TOKEN_TIMEVALUE
| SQL_TOKEN_DATEVALUE
;
-date_function_3Argument:
- SQL_TOKEN_DATEDIFF
date_function:
SQL_TOKEN_TIMESTAMPADD
@@ -1952,6 +2038,362 @@ numeric_function:
SQL_TOKEN_RAND
| SQL_TOKEN_TRUNCATE
;
+
+window_function:
+ window_function_type SQL_TOKEN_OVER window_name_or_specification
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+window_function_type :
+ rank_function_type '(' ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ | SQL_TOKEN_ROW_NUMBER '(' ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ | general_set_fct
+ | ntile_function
+ | lead_or_lag_function
+ | first_or_last_value_function
+ | nth_value_function
+;
+ntile_function :
+ SQL_TOKEN_NTILE '(' number_of_tiles ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ ;
+dynamic_parameter_specification:
+ parameter
+ ;
+simple_value_specification:
+ literal
+ ;
+number_of_tiles :
+ simple_value_specification
+ | dynamic_parameter_specification
+ ;
+opt_lead_or_lag_function:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | ',' offset
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($2);
+ }
+ | ',' offset ',' default_expression
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($2);
+ $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($4);
+ }
+ ;
+opt_null_treatment:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | null_treatment
+ ;
+
+lead_or_lag_function:
+ lead_or_lag '(' lead_or_lag_extent opt_lead_or_lag_function ')' opt_null_treatment
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4);
+ $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION));
+ $$->append($6);
+ }
+ ;
+lead_or_lag:
+ SQL_TOKEN_LEAD
+ | SQL_TOKEN_LAG
+ ;
+lead_or_lag_extent:
+ value_exp
+ ;
+offset:
+ SQL_TOKEN_INTNUM
+ ;
+default_expression:
+ value_exp
+ ;
+null_treatment:
+ SQL_TOKEN_RESPECT SQL_TOKEN_NULLS
+ | SQL_TOKEN_IGNORE SQL_TOKEN_NULLS
+ ;
+first_or_last_value_function:
+ first_or_last_value '(' value_exp ')' opt_null_treatment
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));
+ $$->append($5);
+ }
+ ;
+first_or_last_value :
+ SQL_TOKEN_FIRST_VALUE
+ | SQL_TOKEN_LAST_VALUE
+ ;
+opt_from_first_or_last:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | from_first_or_last
+ ;
+nth_value_function:
+ SQL_TOKEN_NTH_VALUE '(' value_exp ',' nth_row ')' opt_from_first_or_last opt_null_treatment
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($5);
+ $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));
+ $$->append($7);
+ $$->append($8);
+ }
+ ;
+nth_row:
+ simple_value_specification
+ | dynamic_parameter_specification
+ ;
+from_first_or_last:
+ SQL_TOKEN_FROM SQL_TOKEN_FIRST
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | SQL_TOKEN_FROM SQL_TOKEN_LAST
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_name:
+ SQL_TOKEN_NAME
+ ;
+window_name_or_specification:
+ window_name
+ | in_line_window_specification
+ ;
+in_line_window_specification:
+ window_specification
+ ;
+opt_window_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_clause
+ ;
+window_clause:
+ SQL_TOKEN_WINDOW window_definition_list
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_definition_list:
+ window_definition_list ',' window_definition
+ {$1->append($3);
+ $$ = $1;}
+ | window_definition
+ {$$ = SQL_NEW_COMMALISTRULE;
+ $$->append($1);}
+ ;
+window_definition:
+ new_window_name SQL_TOKEN_AS window_specification
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+new_window_name:
+ window_name
+ ;
+window_specification:
+ '(' window_specification_details ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($2);
+ $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ ;
+opt_existing_window_name:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | existing_window_name
+ ;
+opt_window_partition_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_partition_clause
+ ;
+opt_window_frame_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_frame_clause
+ ;
+window_specification_details:
+ opt_existing_window_name
+ opt_window_partition_clause
+ opt_order_by_clause
+ opt_window_frame_clause
+ ;
+existing_window_name:
+ window_name
+ ;
+window_partition_clause:
+ SQL_TOKEN_PARTITION SQL_TOKEN_BY window_partition_column_reference_list
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+window_partition_column_reference_list:
+ window_partition_column_reference_list ',' window_partition_column_reference
+ {$1->append($3);
+ $$ = $1;}
+ | window_partition_column_reference
+ {$$ = SQL_NEW_COMMALISTRULE;
+ $$->append($1);}
+ ;
+window_partition_column_reference:
+ column_ref opt_collate_clause
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+opt_window_frame_exclusion:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_frame_exclusion
+ ;
+window_frame_clause:
+ window_frame_units window_frame_extent opt_window_frame_exclusion
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+window_frame_units:
+ SQL_TOKEN_ROWS
+ | SQL_TOKEN_RANGE
+ ;
+window_frame_extent:
+ window_frame_start
+ | window_frame_between
+ ;
+window_frame_start:
+ SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | window_frame_preceding
+ | SQL_TOKEN_CURRENT SQL_TOKEN_ROW
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_frame_preceding:
+ unsigned_value_spec SQL_TOKEN_PRECEDING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_frame_between:
+ SQL_TOKEN_BETWEEN window_frame_bound_1 SQL_TOKEN_AND window_frame_bound_2
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ $$->append($4);
+ }
+ ;
+window_frame_bound_1:
+ window_frame_bound
+ ;
+window_frame_bound_2:
+ window_frame_bound
+ ;
+window_frame_bound:
+ window_frame_start
+ | SQL_TOKEN_UNBOUNDED SQL_TOKEN_FOLLOWING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | window_frame_following
+ ;
+window_frame_following:
+ unsigned_value_spec SQL_TOKEN_FOLLOWING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_frame_exclusion:
+ SQL_TOKEN_EXCLUDE SQL_TOKEN_CURRENT SQL_TOKEN_ROW
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ | SQL_TOKEN_EXCLUDE SQL_TOKEN_GROUP
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | SQL_TOKEN_EXCLUDE SQL_TOKEN_TIES
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | SQL_TOKEN_EXCLUDE SQL_TOKEN_NO SQL_TOKEN_OTHERS
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
op_parameter:
{$$ = SQL_NEW_RULE;}
| '?' SQL_EQUAL
@@ -2006,11 +2448,16 @@ odbc_fct_spec:
$$->append($1);
$$->append($2);
}
+ | SQL_TOKEN_FN set_fct_spec
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
;
odbc_fct_type:
- SQL_TOKEN_FN
- | SQL_TOKEN_D
+ SQL_TOKEN_D
| SQL_TOKEN_T
| SQL_TOKEN_TS
;
@@ -2316,6 +2763,7 @@ value_exp_primary:
| set_fct_spec
| scalar_subquery
| case_expression
+ | window_function
| '(' value_exp ')'
{
$$ = SQL_NEW_RULE;
diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l
index c959230c0da9..85296a863381 100755
--- a/connectivity/source/parse/sqlflex.l
+++ b/connectivity/source/parse/sqlflex.l
@@ -212,15 +212,19 @@ END {SQL_NEW_KEYWORD(SQL_TOKEN_END); }
EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); }
ESCAPE {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); }
EXCEPT {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); }
+EXCLUDE {SQL_NEW_KEYWORD(SQL_TOKEN_EXCLUDE); }
EXISTS {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); }
EXP {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); }
EXTRACT {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); }
FALSE {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); }
FETCH {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); }
+FIRST {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST); }
+FIRST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST_VALUE); }
FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); }
FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); }
FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); }
+FOLLOWING {SQL_NEW_KEYWORD(SQL_TOKEN_FOLLOWING); }
FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); }
FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); }
FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); }
@@ -234,6 +238,7 @@ GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); }
HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); }
HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); }
+IGNORE {SQL_NEW_KEYWORD(SQL_TOKEN_IGNORE); }
IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); }
INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); }
INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); }
@@ -249,12 +254,17 @@ JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); }
KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); }
+LAG {SQL_NEW_KEYWORD(SQL_TOKEN_LAG); }
LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); }
+LAST {SQL_NEW_KEYWORD(SQL_TOKEN_LAST); }
+LAST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_LAST_VALUE); }
LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); }
+LEAD {SQL_NEW_KEYWORD(SQL_TOKEN_LEAD); }
LEADING {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); }
LEFT {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); }
LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); }
LIKE {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); }
+LIMIT {SQL_NEW_KEYWORD(SQL_TOKEN_LIMIT); }
LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); }
LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); }
LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); }
@@ -276,29 +286,40 @@ NATURAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); }
NCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); }
NCLOB {SQL_NEW_KEYWORD(SQL_TOKEN_NCLOB); }
NEW {SQL_NEW_KEYWORD(SQL_TOKEN_NEW); }
+NEXT {SQL_NEW_KEYWORD(SQL_TOKEN_NEXT); }
+NO {SQL_NEW_KEYWORD(SQL_TOKEN_NO); }
NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); }
NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); }
+NTH_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_NTH_VALUE); }
+NTILE {SQL_NEW_KEYWORD(SQL_TOKEN_NTILE); }
NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); }
NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); }
+NULLS {SQL_NEW_KEYWORD(SQL_TOKEN_NULLS); }
NUMERIC {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); }
OBJECT {SQL_NEW_KEYWORD(SQL_TOKEN_OBJECT); }
OCTET_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); }
OF {SQL_NEW_KEYWORD(SQL_TOKEN_OF); }
+OFFSET {SQL_NEW_KEYWORD(SQL_TOKEN_OFFSET); }
OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); }
OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); }
ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); }
+ONLY {SQL_NEW_KEYWORD(SQL_TOKEN_ONLY); }
OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); }
OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); }
ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); }
+OTHERS {SQL_NEW_KEYWORD(SQL_TOKEN_OTHERS); }
OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); }
+OVER {SQL_NEW_KEYWORD(SQL_TOKEN_OVER); }
+PARTITION {SQL_NEW_KEYWORD(SQL_TOKEN_PARTITION); }
PERCENT_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENT_RANK); }
PERCENTILE_CONT {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_CONT); }
PERCENTILE_DISC {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_DISC); }
PI {SQL_NEW_KEYWORD(SQL_TOKEN_PI); }
POSITION {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); }
POWER {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); }
+PRECEDING {SQL_NEW_KEYWORD(SQL_TOKEN_PRECEDING); }
PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); }
PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); }
PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); }
@@ -309,16 +330,20 @@ QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); }
RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); }
RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); }
+RANGE {SQL_NEW_KEYWORD(SQL_TOKEN_RANGE); }
RANK {SQL_NEW_KEYWORD(SQL_TOKEN_RANK); }
REAL {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); }
REFERENCES {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); }
REFERENCING {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCING); }
REPEAT {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); }
REPLACE {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); }
+RESPECT {SQL_NEW_KEYWORD(SQL_TOKEN_RESPECT); }
ROLLBACK {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); }
ROUND {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); }
ROUNDMAGIC {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); }
ROW {SQL_NEW_KEYWORD(SQL_TOKEN_ROW); }
+ROWS {SQL_NEW_KEYWORD(SQL_TOKEN_ROWS); }
+ROW_NUMBER {SQL_NEW_KEYWORD(SQL_TOKEN_ROW_NUMBER); }
RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); }
RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); }
@@ -345,6 +370,7 @@ SYSTEM_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SYSTEM_USER); }
TABLE {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); }
TAN {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); }
THEN {SQL_NEW_KEYWORD(SQL_TOKEN_THEN); }
+TIES {SQL_NEW_KEYWORD(SQL_TOKEN_TIES); }
TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); }
TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); }
TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); }
@@ -363,6 +389,7 @@ TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); }
T {SQL_NEW_KEYWORD(SQL_TOKEN_T); }
UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); }
+UNBOUNDED {SQL_NEW_KEYWORD(SQL_TOKEN_UNBOUNDED); }
UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); }
UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); }
UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); }
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 82677e870aae..0c3b6a0cd958 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1069,9 +1069,9 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
- sal_uInt32 nPos = ( _bOrder ? 4 : 2 );
+ sal_uInt32 nPos = ( _bOrder ? ORDER_BY_CHILD_POS : 2 );
OSQLParseNode * pOptByClause = pTableExp->getChild(nPos);
OSL_ENSURE(pOptByClause != NULL,"OSQLParseTreeIterator: error in parse tree!");
@@ -1234,7 +1234,7 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
} else if (SQL_ISRULE(pSelectNode,update_statement_searched)) {
@@ -1452,7 +1452,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
- ,const OSQLParseNode* _pColumnRef
+ ,const OSQLParseNode* _pParentNode
,const ::rtl::OUString& _aColumnName
,const ::rtl::OUString& _aTableRange
,const ::rtl::OUString& _rColumnAlias)
@@ -1491,18 +1491,18 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
}
// found a parameter
- if ( _pColumnRef && (SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec)) )
+ if ( _pParentNode && (SQL_ISRULE(_pParentNode,general_set_fct) || SQL_ISRULE(_pParentNode,set_fct_spec)) )
{// found a function as column_ref
::rtl::OUString sFunctionName;
- _pColumnRef->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
- const sal_uInt32 nCount = _pColumnRef->count();
+ _pParentNode->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
+ const sal_uInt32 nCount = _pParentNode->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
- if ( _pColumnRef->getChild(i) == _pParseNode )
+ if ( _pParentNode->getChild(i) == _pParseNode )
break;
}
- sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pColumnRef->getParent()->getChild(0)->getTokenID(), i+1);
+ sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pParentNode->getChild(0)->getTokenID(), i-1);
OParseColumn* pColumn = new OParseColumn( sParameterName,
::rtl::OUString(),
@@ -1553,14 +1553,14 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
if ( bNotFound )
{
sal_Int32 nType = DataType::VARCHAR;
- OSQLParseNode* pParent = _pColumnRef ? _pColumnRef->getParent() : NULL;
+ OSQLParseNode* pParent = _pParentNode ? _pParentNode->getParent() : NULL;
if ( pParent && (SQL_ISRULE(pParent,general_set_fct) || SQL_ISRULE(pParent,set_fct_spec)) )
{
- const sal_uInt32 nCount = _pColumnRef->count();
+ const sal_uInt32 nCount = _pParentNode->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
- if ( _pColumnRef->getChild(i) == _pParseNode )
+ if ( _pParentNode->getChild(i) == _pParseNode )
break;
}
nType = ::connectivity::OSQLParser::getFunctionParameterType( pParent->getChild(0)->getTokenID(), i+1);
@@ -1968,7 +1968,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
}
@@ -1998,9 +1998,9 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
- pOrderClause = pTableExp->getChild(4);
+ pOrderClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pOrderClause->count() != 3)
pOrderClause = NULL;
@@ -2020,7 +2020,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pGroupClause = pTableExp->getChild(2);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
@@ -2041,7 +2041,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pHavingClause = pTableExp->getChild(3);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index c69017e0744b..599128dd5936 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -2470,7 +2470,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode
if (rString.getLength())
rString.appendAscii(" ");
- const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, &rParam.m_rContext);
+ const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, rParam.bInternational ? &rParam.m_rContext : NULL);
rString.append(::rtl::OStringToOUString(sT,RTL_TEXTENCODING_UTF8));
} break;
case SQL_NODE_STRING:
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 22ac1988636b..bf05c1a15938 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1724,6 +1724,14 @@ int Desktop::Main()
if ( bAbort )
return EXIT_FAILURE;
+ {
+ ::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
+ pExecGlobals->bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
Migration::migrateSettingsIfNecessary();
// keep a language options instance...
diff --git a/desktop/source/deployment/dp_services.cxx b/desktop/source/deployment/dp_services.cxx
index 16372bfbe0b9..3f7f8ca9f293 100644
--- a/desktop/source/deployment/dp_services.cxx
+++ b/desktop/source/deployment/dp_services.cxx
@@ -85,8 +85,6 @@ bool singleton_entries( uno::Reference<registry::XRegistryKey> const& );
extern "C" {
-struct uno_Environment;
-
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** )
{
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 4591ff4fd101..6bf37364803f 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1924,17 +1924,23 @@ void BackendImpl::ComponentsPackageImpl::processPackage_(
if (doRegisterPackage) {
ComponentBackendDb::Data data;
data.javaTypeLibrary = false;
- std::vector< css::uno::Reference< css::uno::XInterface > > factories;
- css::uno::Reference< css::uno::XComponentContext > context(
- that->getObject(url), css::uno::UNO_QUERY);
- if (!context.is()) {
- context.set(
- that->insertObject(
- url,
- raise_uno_process(
- that->getComponentContext(), abortChannel)),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::uno::XComponentContext > context;
+ if (startup) {
+ context = that->getComponentContext();
+ } else {
+ context.set(that->getObject(url), css::uno::UNO_QUERY);
+ if (!context.is()) {
+ context.set(
+ that->insertObject(
+ url,
+ raise_uno_process(
+ that->getComponentContext(), abortChannel)),
+ css::uno::UNO_QUERY_THROW);
+ }
}
+
+ std::vector< css::uno::Reference< css::uno::XInterface > > factories;
+
css::uno::Reference< css::registry::XSimpleRegistry > registry(
css::uno::Reference< css::lang::XMultiComponentFactory >(
that->getComponentContext()->getServiceManager(),
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index c90546148b9b..7862ae261d39 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -105,6 +105,7 @@
#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
+#define PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 64)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/rendergraphicprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/rendergraphicprimitive2d.hxx
new file mode 100644
index 000000000000..190439442917
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/rendergraphicprimitive2d.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * 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_RENDERGRAPHICPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_RENDERGRAPHICPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/rendergraphic.hxx>
+#include <memory>
+
+//////////////////////////////////////////////////////////////////////////////
+// RenderGraphicPrimitive2D class
+
+namespace vcl { class RenderGraphicRasterizer; }
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** RenderGraphicPrimitive2D class
+
+ This class is the central primitive for RenderGraphic-based primitives.
+ */
+ class RenderGraphicPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the RenderGraphic data
+ vcl::RenderGraphic maRenderGraphic;
+ mutable std::auto_ptr< vcl::RenderGraphicRasterizer > mapCurrentRasterizer;
+
+ /** the object transformation from unit coordinates, defining
+ size, shear, rotate and position
+ */
+ basegfx::B2DHomMatrix maTransform;
+
+ public:
+ /// constructor
+ RenderGraphicPrimitive2D(
+ const vcl::RenderGraphic& rRenderGraphic,
+ const basegfx::B2DHomMatrix& rTransform);
+
+ /// data read access
+ inline const vcl::RenderGraphic& getRenderGraphic() const { return maRenderGraphic; }
+ inline const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+
+ // access to latest used vcl::GraphicRasterizer for possibly reusing
+ // an already rendered vcl::RenderGraphic with the same transform
+ // properties during the next rendering process
+ void setCurrentRasterizer() const;
+ void setCurrentRasterizer( const vcl::RenderGraphicRasterizer& rCurrentGraphicRasterizer ) const;
+ inline const vcl::RenderGraphicRasterizer* getCurrentRasterizer() const { return( mapCurrentRasterizer.get() ); }
+
+ /// 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_RENDERGRAPHICPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
index ca300484f017..0cf9549b6b6a 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
@@ -57,6 +57,7 @@ namespace drawinglayer { namespace primitive2d {
class MetafilePrimitive2D;
class TextSimplePortionPrimitive2D;
class BitmapPrimitive2D;
+ class RenderGraphicPrimitive2D;
class TransparencePrimitive2D;
class PolygonStrokePrimitive2D;
class FillBitmapPrimitive2D;
@@ -109,6 +110,7 @@ namespace drawinglayer
void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate);
void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void impRenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate);
void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate);
void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive);
void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D);
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
index e25ba9f55b14..ef288f047ed6 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -42,6 +42,7 @@ namespace drawinglayer { namespace primitive2d {
class TextSimplePortionPrimitive2D;
class PolygonHairlinePrimitive2D;
class BitmapPrimitive2D;
+ class RenderGraphicPrimitive2D;
class FillBitmapPrimitive2D;
class PolyPolygonGradientPrimitive2D;
class PolyPolygonBitmapPrimitive2D;
@@ -98,6 +99,7 @@ namespace drawinglayer
void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased);
void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void RenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate);
void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate);
void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate);
void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate);
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index 375889e5a12e..2aa924663fa3 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -13,6 +13,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx
..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx
..\inc\drawinglayer\primitive2d\bitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\bitmapprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx
..\inc\drawinglayer\primitive2d\borderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\borderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\chartprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\chartprimitive2d.hxx
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index 2ea9018460f6..c6a8e35682b0 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -32,6 +32,7 @@
#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
#include <drawinglayer/animation/animationtiming.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/animatedprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
@@ -47,6 +48,7 @@
#include <vcl/graph.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/metaact.hxx>
//////////////////////////////////////////////////////////////////////////////
// includes for testing MetafilePrimitive2D::create2DDecomposition
@@ -247,7 +249,9 @@ namespace drawinglayer
aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
aSuppressGraphicAttr.SetRotation(0);
aSuppressGraphicAttr.SetMirrorFlags(0);
- const Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr));
+
+ const GraphicObject& rGraphicObject = getGraphicObject();
+ const Graphic aTransformedGraphic(rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr));
switch(aTransformedGraphic.GetType())
{
@@ -291,34 +295,43 @@ namespace drawinglayer
case GRAPHIC_GDIMETAFILE :
{
// create MetafilePrimitive2D
- const Graphic aGraphic(getGraphicObject().GetGraphic());
const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile();
- xPrimitive = Primitive2DReference(
- new MetafilePrimitive2D(
- aTransform,
- rMetafile));
-
- // #i100357# find out if clipping is needed for this primitive. Unfortunately,
- // there exist Metafiles who's content is bigger than the proposed PrefSize set
- // at them. This is an error, but we need to work around this
- const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
- const Size aMetaFileRealSize(
- const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
- *Application::GetDefaultDevice()).GetSize());
-
- if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
- || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
+ if( aTransformedGraphic.IsRenderGraphic() )
+ {
+ xPrimitive = Primitive2DReference(
+ new RenderGraphicPrimitive2D(
+ static_cast< MetaRenderGraphicAction* >(rMetafile.GetAction(0))->GetRenderGraphic(),
+ aTransform));
+ }
+ else
{
- // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
- const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
- basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon());
- aMaskPolygon.transform(aTransform);
-
xPrimitive = Primitive2DReference(
- new MaskPrimitive2D(
- basegfx::B2DPolyPolygon(aMaskPolygon),
- aChildContent));
+ new MetafilePrimitive2D(
+ aTransform,
+ rMetafile));
+
+ // #i100357# find out if clipping is needed for this primitive. Unfortunately,
+ // there exist Metafiles who's content is bigger than the proposed PrefSize set
+ // at them. This is an error, but we need to work around this
+ const Size aMetaFilePrefSize(rMetafile.GetPrefSize());
+ const Size aMetaFileRealSize(
+ const_cast< GDIMetaFile& >(rMetafile).GetBoundRect(
+ *Application::GetDefaultDevice()).GetSize());
+
+ if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth()
+ || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight())
+ {
+ // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon
+ const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1);
+ basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon());
+ aMaskPolygon.transform(aTransform);
+
+ xPrimitive = Primitive2DReference(
+ new MaskPrimitive2D(
+ basegfx::B2DPolyPolygon(aMaskPolygon),
+ aChildContent));
+ }
}
break;
@@ -353,16 +366,16 @@ namespace drawinglayer
{
const MapMode aMapMode100thmm(MAP_100TH_MM);
- Size aBitmapSize(getGraphicObject().GetPrefSize());
+ Size aBitmapSize(rGraphicObject.GetPrefSize());
// #i95968# better support PrefMapMode; special for MAP_PIXEL was missing
- if(MAP_PIXEL == getGraphicObject().GetPrefMapMode().GetMapUnit())
+ if(MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit())
{
aBitmapSize = Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, aMapMode100thmm);
}
else
{
- aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, getGraphicObject().GetPrefMapMode(), aMapMode100thmm);
+ aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
}
const double fDivX(aBitmapSize.Width() - getGraphicAttr().GetLeftCrop() - getGraphicAttr().GetRightCrop());
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index 092612f7923f..039be2c690b5 100755
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -42,6 +42,7 @@ SLOFILES= \
$(SLO)$/baseprimitive2d.obj \
$(SLO)$/backgroundcolorprimitive2d.obj \
$(SLO)$/bitmapprimitive2d.obj \
+ $(SLO)$/rendergraphicprimitive2d.obj \
$(SLO)$/borderlineprimitive2d.obj \
$(SLO)$/clippedborderlineprimitive2d.obj \
$(SLO)$/chartprimitive2d.obj \
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 5d3e5181855d..79754917f4ee 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -64,6 +64,7 @@
#include <drawinglayer/primitive2d/textlineprimitive2d.hxx>
#include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <numeric>
//////////////////////////////////////////////////////////////////////////////
@@ -3069,6 +3070,33 @@ namespace
break;
}
+ case META_RENDERGRAPHIC_ACTION :
+ {
+ const MetaRenderGraphicAction* pA = (const MetaRenderGraphicAction*)pAction;
+ const Rectangle aRectangle(pA->GetPoint(), pA->GetSize());
+
+ if(!aRectangle.IsEmpty())
+ {
+ // create object transform
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, aRectangle.GetWidth());
+ aObjectTransform.set(1, 1, aRectangle.GetHeight());
+ aObjectTransform.set(0, 2, aRectangle.Left());
+ aObjectTransform.set(1, 2, aRectangle.Top());
+
+ // add current transformation
+ aObjectTransform = rPropertyHolders.Current().getTransformation() * aObjectTransform;
+
+ // embed using EpsPrimitive
+ rTargetHolders.Current().append(
+ new drawinglayer::primitive2d::RenderGraphicPrimitive2D(
+ pA->GetRenderGraphic(),
+ aObjectTransform ) );
+ }
+
+ break;
+ }
case META_COMMENT_ACTION :
{
/** CHECKED, WORKS WELL */
diff --git a/drawinglayer/source/primitive2d/rendergraphicprimitive2d.cxx b/drawinglayer/source/primitive2d/rendergraphicprimitive2d.cxx
new file mode 100644
index 000000000000..439937f5d0f5
--- /dev/null
+++ b/drawinglayer/source/primitive2d/rendergraphicprimitive2d.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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/rendergraphicprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ RenderGraphicPrimitive2D::RenderGraphicPrimitive2D(
+ const vcl::RenderGraphic& rRenderGraphic,
+ const basegfx::B2DHomMatrix& rTransform)
+ : BasePrimitive2D(),
+ maRenderGraphic(rRenderGraphic),
+ maTransform(rTransform)
+ {
+ }
+
+ void RenderGraphicPrimitive2D::setCurrentRasterizer() const
+ {
+ mapCurrentRasterizer.reset();
+ }
+
+ void RenderGraphicPrimitive2D::setCurrentRasterizer( const vcl::RenderGraphicRasterizer& rCurrentRasterizer ) const
+ {
+ mapCurrentRasterizer.reset( new vcl::RenderGraphicRasterizer( rCurrentRasterizer ) );
+ }
+
+ bool RenderGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BasePrimitive2D::operator==(rPrimitive))
+ {
+ const RenderGraphicPrimitive2D& rCompare = (RenderGraphicPrimitive2D&)rPrimitive;
+
+ return (getRenderGraphic() == rCompare.getRenderGraphic()
+ && getTransform() == rCompare.getTransform());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange RenderGraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
+ aRetval.transform(maTransform);
+ return aRetval;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(RenderGraphicPrimitive2D, PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 387bdfbf6814..7106cd62e503 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -529,6 +529,8 @@ namespace drawinglayer
case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D :
case PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D :
case PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D :
+ case PRIMITIVE2D_ID_MEDIAPRIMITIVE2D:
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D:
{
if(!getHitTextOnly())
{
diff --git a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
index 8a2461010b4a..db9244da3554 100644
--- a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
+++ b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx
@@ -124,6 +124,7 @@ namespace drawinglayer
case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{
diff --git a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
index ec31aa97d8de..3cb805bb1f04 100644
--- a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
+++ b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx
@@ -215,6 +215,7 @@ namespace drawinglayer
case PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D :
case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D :
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index c7e856a63eb2..bcb4655b3ddf 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -39,6 +39,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
@@ -866,7 +867,7 @@ namespace drawinglayer
// I have now moved describePDFControl to toolkit, thus i can implement the PDF
// form control support now as follows
::std::auto_ptr< ::vcl::PDFWriter::AnyWidget > pPDFControl;
- ::toolkitform::describePDFControl(rXControl, pPDFControl);
+ ::toolkitform::describePDFControl( rXControl, pPDFControl, *mpPDFExtOutDevData );
if(pPDFControl.get())
{
@@ -1288,6 +1289,12 @@ namespace drawinglayer
RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
+ {
+ // direct draw of transformed RenderGraphic primitive; use default processing
+ RenderRenderGraphicPrimitive2D(static_cast< const primitive2d::RenderGraphicPrimitive2D& >(rCandidate));
+ break;
+ }
case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D :
{
// need to handle PolyPolygonBitmapPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 6b7e977f4f98..6c5ba31774f7 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -36,6 +36,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
@@ -194,6 +195,12 @@ namespace drawinglayer
RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
+ case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
+ {
+ // direct draw of transformed BitmapEx primitive
+ RenderRenderGraphicPrimitive2D(static_cast< const primitive2d::RenderGraphicPrimitive2D& >(rCandidate));
+ break;
+ }
case PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D :
{
// direct draw of fillBitmapPrimitive
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 5c5dc918b2a8..c774ac950e72 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -36,6 +36,7 @@
#include <vcl/outdev.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <vclhelperbitmaptransform.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <vclhelperbitmaprender.hxx>
@@ -61,6 +62,7 @@
#include <vcl/metric.hxx>
#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
+#include <vcl/rendergraphicrasterizer.hxx>
//////////////////////////////////////////////////////////////////////////////
// control support
@@ -449,6 +451,75 @@ namespace drawinglayer
}
}
+ void VclProcessor2D::RenderRenderGraphicPrimitive2D(const primitive2d::RenderGraphicPrimitive2D& rRenderGraphicCandidate)
+ {
+ // create local transform
+ basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rRenderGraphicCandidate.getTransform());
+ vcl::RenderGraphic aRenderGraphic(rRenderGraphicCandidate.getRenderGraphic());
+ bool bPainted(false);
+
+ if(maBColorModifierStack.count())
+ {
+ // !!! TODO
+ // aRenderGraphic = impModifyRenderGraphic(maBColorModifierStack, aRenderGraphic);
+
+ if(aRenderGraphic.IsEmpty())
+ {
+ // color gets completely replaced, get it
+ const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
+ basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
+ aPolygon.transform(aLocalTransform);
+
+ mpOutputDevice->SetFillColor(Color(aModifiedColor));
+ mpOutputDevice->SetLineColor();
+ mpOutputDevice->DrawPolygon(aPolygon);
+
+ bPainted = true;
+ }
+ }
+
+ if(!bPainted)
+ {
+ // decompose matrix to check for shear, rotate and mirroring
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0);
+
+ if( basegfx::fTools::equalZero( fRotate ) )
+ {
+ aOutlineRange.transform( aLocalTransform );
+ }
+ else
+ {
+ // !!! TODO
+ // if rotated, create the unrotated output rectangle for the GraphicManager paint
+ /*
+ const basegfx::B2DHomMatrix aSimpleObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
+ fabs(aScale.getX()), fabs(aScale.getY()),
+ aTranslate.getX(), aTranslate.getY()));
+
+ aOutlineRange.transform(aSimpleObjectMatrix);
+ */
+ }
+
+ // prepare dest coordinates
+ const Point aPoint( basegfx::fround(aOutlineRange.getMinX() ),
+ basegfx::fround(aOutlineRange.getMinY() ) );
+ const Size aSize( basegfx::fround(aOutlineRange.getWidth() ),
+ basegfx::fround(aOutlineRange.getHeight() ) );
+ const Size aSizePixel( mpOutputDevice->LogicToPixel( aSize ) );
+ const vcl::RenderGraphicRasterizer aRasterizer( aRenderGraphic );
+ const BitmapEx aBitmapEx( aRasterizer.Rasterize( aSizePixel, fRotate, fShearX ) );
+
+ if( !aBitmapEx.IsEmpty() )
+ {
+ mpOutputDevice->DrawBitmapEx( aPoint, aSize, aBitmapEx );
+ }
+ }
+ }
+
void VclProcessor2D::RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate)
{
const attribute::FillBitmapAttribute& rFillBitmapAttribute(rFillBitmapCandidate.getFillBitmap());
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 2988942e7b7c..473e5917c8a7 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2698,7 +2698,10 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
// get word boundaries in order to clear possible WrongList entries
// and invalidate all the necessary text (everything after and including the
// start of the word)
- EditSelection aCurWord( SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ) );
+ // #i107201# do the expensive SelectWord call only if online spelling is active
+ EditSelection aCurWord;
+ if ( GetStatus().DoOnlineSpelling() )
+ aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD );
XubString aText( rStr );
aText.ConvertLineEnd( LINEEND_LF );
@@ -2752,12 +2755,17 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
OSL_ENSURE( pPortion, "Blind Portion in InsertText" );
- // now remove the Wrongs (red spell check marks) from both words...
- WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList();
- if (pWrongs && pWrongs->HasWrongs())
- pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() );
- // ... and mark both words as 'to be checked again'
- pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() );
+ if ( GetStatus().DoOnlineSpelling() )
+ {
+ // now remove the Wrongs (red spell check marks) from both words...
+ WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList();
+ if (pWrongs && pWrongs->HasWrongs())
+ pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() );
+ // ... and mark both words as 'to be checked again'
+ pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() );
+ }
+ else
+ pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() );
}
if ( nEnd < aText.Len() )
aPaM = ImpInsertParaBreak( aPaM );
diff --git a/formula/inc/formula/compiler.hrc b/formula/inc/formula/compiler.hrc
index e4dc05aca4e9..5c58d9d3e068 100755
--- a/formula/inc/formula/compiler.hrc
+++ b/formula/inc/formula/compiler.hrc
@@ -130,67 +130,71 @@
#define SC_OPCODE_ARC_COS_HYP 95
#define SC_OPCODE_ARC_TAN_HYP 96
#define SC_OPCODE_ARC_COT_HYP 97
-#define SC_OPCODE_EXP 98
-#define SC_OPCODE_LN 99
-#define SC_OPCODE_SQRT 100
-#define SC_OPCODE_FACT 101
-#define SC_OPCODE_GET_YEAR 102 /* date and time */
-#define SC_OPCODE_GET_MONTH 103
-#define SC_OPCODE_GET_DAY 104
-#define SC_OPCODE_GET_HOUR 105
-#define SC_OPCODE_GET_MIN 106
-#define SC_OPCODE_GET_SEC 107
-#define SC_OPCODE_PLUS_MINUS 108 /* miscellaneous */
-#define SC_OPCODE_ABS 109
-#define SC_OPCODE_INT 110
-#define SC_OPCODE_PHI 111
-#define SC_OPCODE_GAUSS 112
-#define SC_OPCODE_IS_EMPTY 113 /* obtain type */
-#define SC_OPCODE_IS_STRING 114
-#define SC_OPCODE_IS_NON_STRING 115
-#define SC_OPCODE_IS_LOGICAL 116
-#define SC_OPCODE_TYPE 117
-#define SC_OPCODE_IS_REF 118
-#define SC_OPCODE_IS_VALUE 119
-#define SC_OPCODE_IS_FORMULA 120
-#define SC_OPCODE_IS_NV 121
-#define SC_OPCODE_IS_ERR 122
-#define SC_OPCODE_IS_ERROR 123
-#define SC_OPCODE_IS_EVEN 124
-#define SC_OPCODE_IS_ODD 125
-#define SC_OPCODE_N 126
-#define SC_OPCODE_GET_DATE_VALUE 127 /* string functions */
-#define SC_OPCODE_GET_TIME_VALUE 128
-#define SC_OPCODE_CODE 129
-#define SC_OPCODE_TRIM 130
-#define SC_OPCODE_UPPER 131
-#define SC_OPCODE_PROPPER 132
-#define SC_OPCODE_LOWER 133
-#define SC_OPCODE_LEN 134
-#define SC_OPCODE_T 135 /* miscellaneous, part 21 */
-#define SC_OPCODE_VALUE 136
-#define SC_OPCODE_CLEAN 137
-#define SC_OPCODE_CHAR 138
-#define SC_OPCODE_LOG10 139
-#define SC_OPCODE_EVEN 140
-#define SC_OPCODE_ODD 141
-#define SC_OPCODE_STD_NORM_DIST 142
-#define SC_OPCODE_FISHER 143
-#define SC_OPCODE_FISHER_INV 144
-#define SC_OPCODE_S_NORM_INV 145
-#define SC_OPCODE_GAMMA_LN 146
-#define SC_OPCODE_ERROR_TYPE 147
-#define SC_OPCODE_ERR_CELL 148
-#define SC_OPCODE_FORMULA 149
-#define SC_OPCODE_ARABIC 150
-#define SC_OPCODE_INFO 151
-#define SC_OPCODE_BAHTTEXT 152
-#define SC_OPCODE_JIS 153
-#define SC_OPCODE_ASC 154
-#define SC_OPCODE_UNICODE 155
-#define SC_OPCODE_UNICHAR 156
-#define SC_OPCODE_GAMMA 157
-#define SC_OPCODE_STOP_1_PAR 158
+#define SC_OPCODE_COSECANT 98
+#define SC_OPCODE_SECANT 99
+#define SC_OPCODE_COSECANT_HYP 100
+#define SC_OPCODE_SECANT_HYP 101
+#define SC_OPCODE_EXP 102
+#define SC_OPCODE_LN 103
+#define SC_OPCODE_SQRT 104
+#define SC_OPCODE_FACT 105
+#define SC_OPCODE_GET_YEAR 106 /* date and time */
+#define SC_OPCODE_GET_MONTH 107
+#define SC_OPCODE_GET_DAY 108
+#define SC_OPCODE_GET_HOUR 109
+#define SC_OPCODE_GET_MIN 110
+#define SC_OPCODE_GET_SEC 111
+#define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */
+#define SC_OPCODE_ABS 113
+#define SC_OPCODE_INT 114
+#define SC_OPCODE_PHI 115
+#define SC_OPCODE_GAUSS 116
+#define SC_OPCODE_IS_EMPTY 117 /* obtain type */
+#define SC_OPCODE_IS_STRING 118
+#define SC_OPCODE_IS_NON_STRING 119
+#define SC_OPCODE_IS_LOGICAL 120
+#define SC_OPCODE_TYPE 121
+#define SC_OPCODE_IS_REF 122
+#define SC_OPCODE_IS_VALUE 123
+#define SC_OPCODE_IS_FORMULA 124
+#define SC_OPCODE_IS_NV 125
+#define SC_OPCODE_IS_ERR 126
+#define SC_OPCODE_IS_ERROR 127
+#define SC_OPCODE_IS_EVEN 128
+#define SC_OPCODE_IS_ODD 129
+#define SC_OPCODE_N 130
+#define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */
+#define SC_OPCODE_GET_TIME_VALUE 132
+#define SC_OPCODE_CODE 133
+#define SC_OPCODE_TRIM 134
+#define SC_OPCODE_UPPER 135
+#define SC_OPCODE_PROPPER 136
+#define SC_OPCODE_LOWER 137
+#define SC_OPCODE_LEN 138
+#define SC_OPCODE_T 139 /* miscellaneous, part 21 */
+#define SC_OPCODE_VALUE 140
+#define SC_OPCODE_CLEAN 141
+#define SC_OPCODE_CHAR 142
+#define SC_OPCODE_LOG10 143
+#define SC_OPCODE_EVEN 144
+#define SC_OPCODE_ODD 145
+#define SC_OPCODE_STD_NORM_DIST 146
+#define SC_OPCODE_FISHER 147
+#define SC_OPCODE_FISHER_INV 148
+#define SC_OPCODE_S_NORM_INV 149
+#define SC_OPCODE_GAMMA_LN 150
+#define SC_OPCODE_ERROR_TYPE 151
+#define SC_OPCODE_ERR_CELL 152
+#define SC_OPCODE_FORMULA 153
+#define SC_OPCODE_ARABIC 154
+#define SC_OPCODE_INFO 155
+#define SC_OPCODE_BAHTTEXT 156
+#define SC_OPCODE_JIS 157
+#define SC_OPCODE_ASC 158
+#define SC_OPCODE_UNICODE 159
+#define SC_OPCODE_UNICHAR 160
+#define SC_OPCODE_GAMMA 161
+#define SC_OPCODE_STOP_1_PAR 162
/*** Functions with more than one parameters ***/
#define SC_OPCODE_START_2_PAR 201
diff --git a/formula/inc/formula/opcode.hxx b/formula/inc/formula/opcode.hxx
index 240f97401314..fc9a9b7cf525 100644
--- a/formula/inc/formula/opcode.hxx
+++ b/formula/inc/formula/opcode.hxx
@@ -122,6 +122,10 @@ enum OpCodeEnum
ocArcCosHyp = SC_OPCODE_ARC_COS_HYP,
ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP,
ocArcCotHyp = SC_OPCODE_ARC_COT_HYP,
+ ocCosecant = SC_OPCODE_COSECANT,
+ ocSecant = SC_OPCODE_SECANT,
+ ocCosecantHyp = SC_OPCODE_COSECANT_HYP,
+ ocSecantHyp = SC_OPCODE_SECANT_HYP,
ocExp = SC_OPCODE_EXP,
ocLn = SC_OPCODE_LN,
ocSqrt = SC_OPCODE_SQRT,
diff --git a/formula/inc/formula/token.hxx b/formula/inc/formula/token.hxx
index b47147d833e8..bc6cfc2c2793 100644
--- a/formula/inc/formula/token.hxx
+++ b/formula/inc/formula/token.hxx
@@ -70,6 +70,7 @@ enum StackVarEnum
svExternalSingleRef,
svExternalDoubleRef,
svExternalName,
+ svSubroutine, // A token with a subroutine token array.
svError, // error token
svMissing = 0x70, // 0 or ""
svSep, // separator, ocSep, ocOpen, ocClose
@@ -89,6 +90,8 @@ class FormulaToken;
typedef ::boost::intrusive_ptr<FormulaToken> FormulaTokenRef;
typedef ::boost::intrusive_ptr<const FormulaToken> FormulaConstTokenRef;
+class FormulaTokenArray;
+
class FORMULA_DLLPUBLIC FormulaToken : public IFormulaToken
{
OpCode eOp;
@@ -374,6 +377,23 @@ public:
};
+class FORMULA_DLLPUBLIC FormulaSubroutineToken : public FormulaToken
+{
+public:
+ /** Takes ownership of pArray and deletes it upon destruction! */
+ FormulaSubroutineToken( const FormulaTokenArray* pArray ) :
+ FormulaToken( svSubroutine, ocCall ), mpArray( pArray) {}
+ FormulaSubroutineToken( const FormulaSubroutineToken& r );
+ virtual ~FormulaSubroutineToken();
+ virtual FormulaToken* Clone() const { return new FormulaSubroutineToken(*this); }
+ virtual bool operator==( const FormulaToken& rToken ) const;
+ const FormulaTokenArray* GetTokenArray() const;
+
+private:
+ const FormulaTokenArray* mpArray;
+};
+
+
class FORMULA_DLLPUBLIC FormulaUnknownToken : public FormulaToken
{
public:
diff --git a/formula/inc/formula/tokenarray.hxx b/formula/inc/formula/tokenarray.hxx
index 626c958471ad..8ec6a56f9f0f 100644
--- a/formula/inc/formula/tokenarray.hxx
+++ b/formula/inc/formula/tokenarray.hxx
@@ -259,6 +259,7 @@ public:
void Reset();
const FormulaToken* First();
const FormulaToken* Next();
+ const FormulaToken* PeekNextOperator();
bool IsEndOfPath() const; /// if a jump or subroutine path is done
bool HasStacked() const { return pCur->pNext != 0; }
short GetPC() const { return pCur->nPC; }
@@ -279,6 +280,9 @@ public:
void Jump( short nStart, short nNext, short nStop = SHRT_MAX );
void Push( const FormulaTokenArray* );
void Pop();
+
+private:
+ const FormulaToken* GetNonEndOfPathToken( short nIdx ) const;
};
// =============================================================================
} // formula
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index cec4f58ee9dd..4b3811f6437c 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1258,15 +1258,7 @@ const FormulaToken* FormulaTokenIterator::First()
const FormulaToken* FormulaTokenIterator::Next()
{
- const FormulaToken* t = NULL;
- ++pCur->nPC;
- if( pCur->nPC < pCur->pArr->nRPN && pCur->nPC < pCur->nStop )
- {
- t = pCur->pArr->pRPN[ pCur->nPC ];
- // such an OpCode ends an IF() or CHOOSE() path
- if( t->GetOpCode() == ocSep || t->GetOpCode() == ocClose )
- t = NULL;
- }
+ const FormulaToken* t = GetNonEndOfPathToken( ++pCur->nPC );
if( !t && pCur->pNext )
{
Pop();
@@ -1275,6 +1267,25 @@ const FormulaToken* FormulaTokenIterator::Next()
return t;
}
+const FormulaToken* FormulaTokenIterator::PeekNextOperator()
+{
+ const FormulaToken* t = NULL;
+ short nIdx = pCur->nPC;
+ while (!t && ((t = GetNonEndOfPathToken( ++nIdx)) != NULL))
+ {
+ if (t->GetOpCode() == ocPush)
+ t = NULL; // ignore operands
+ }
+ if (!t && pCur->pNext)
+ {
+ ImpTokenIterator* pHere = pCur;
+ pCur = pCur->pNext;
+ t = PeekNextOperator();
+ pCur = pHere;
+ }
+ return t;
+}
+
//! The nPC counts after a Push() are -1
void FormulaTokenIterator::Jump( short nStart, short nNext, short nStop )
@@ -1288,17 +1299,22 @@ void FormulaTokenIterator::Jump( short nStart, short nNext, short nStop )
}
}
-bool FormulaTokenIterator::IsEndOfPath() const
+const FormulaToken* FormulaTokenIterator::GetNonEndOfPathToken( short nIdx ) const
{
- sal_uInt16 nTest = pCur->nPC + 1;
- if( nTest < pCur->pArr->nRPN && nTest < pCur->nStop )
+ if (nIdx < pCur->pArr->nRPN && nIdx < pCur->nStop)
{
- const FormulaToken* t = pCur->pArr->pRPN[ nTest ];
+ const FormulaToken* t = pCur->pArr->pRPN[ nIdx ];
// such an OpCode ends an IF() or CHOOSE() path
- return t->GetOpCode() == ocSep || t->GetOpCode() == ocClose;
+ return (t->GetOpCode() == ocSep || t->GetOpCode() == ocClose) ? NULL : t;
}
- return true;
+ return NULL;
}
+
+bool FormulaTokenIterator::IsEndOfPath() const
+{
+ return GetNonEndOfPathToken( pCur->nPC + 1) != NULL;
+}
+
// -----------------------------------------------------------------------------
// ==========================================================================
// real implementations of virtual functions
@@ -1360,6 +1376,27 @@ bool FormulaMissingToken::operator==( const FormulaToken& r ) const
}
+FormulaSubroutineToken::FormulaSubroutineToken( const FormulaSubroutineToken& r ) :
+ FormulaToken( r ),
+ mpArray( r.mpArray->Clone())
+{
+}
+FormulaSubroutineToken::~FormulaSubroutineToken()
+{
+ delete mpArray;
+}
+const FormulaTokenArray* FormulaSubroutineToken::GetTokenArray() const
+{
+ return mpArray;
+}
+bool FormulaSubroutineToken::operator==( const FormulaToken& r ) const
+{
+ // Arrays don't equal..
+ return FormulaToken::operator==( r ) &&
+ (mpArray == static_cast<const FormulaSubroutineToken&>(r).mpArray);
+}
+
+
bool FormulaUnknownToken::operator==( const FormulaToken& r ) const
{
return FormulaToken::operator==( r );
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index d2996e78fba7..b8a5f1250941 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -88,6 +88,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; };
String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; };
String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; };
+ String SC_OPCODE_COSECANT { Text = "CSC" ; };
+ String SC_OPCODE_SECANT { Text = "SEC" ; };
+ String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; };
+ String SC_OPCODE_SECANT_HYP { Text = "SECH" ; };
String SC_OPCODE_EXP { Text = "EXP" ; };
String SC_OPCODE_LN { Text = "LN" ; };
String SC_OPCODE_SQRT { Text = "SQRT" ; };
@@ -412,6 +416,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; };
String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; };
String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; };
+ String SC_OPCODE_COSECANT { Text = "CSC" ; };
+ String SC_OPCODE_SECANT { Text = "SEC" ; };
+ String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; };
+ String SC_OPCODE_SECANT_HYP { Text = "SECH" ; };
String SC_OPCODE_EXP { Text = "EXP" ; };
String SC_OPCODE_LN { Text = "LN" ; };
String SC_OPCODE_SQRT { Text = "SQRT" ; };
@@ -830,6 +838,22 @@ Resource RID_STRLIST_FUNCTION_NAMES
{
Text [ en-US ] = "ACOTH" ;
};
+ String SC_OPCODE_COSECANT
+ {
+ Text = "CSC" ;
+ };
+ String SC_OPCODE_SECANT
+ {
+ Text = "SEC" ;
+ };
+ String SC_OPCODE_COSECANT_HYP
+ {
+ Text = "CSCH" ;
+ };
+ String SC_OPCODE_SECANT_HYP
+ {
+ Text = "SECH" ;
+ };
String SC_OPCODE_EXP
{
Text [ en-US ] = "EXP";
diff --git a/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx b/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx
index a03e6f3fe23c..2414a6ff1229 100644
--- a/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx
+++ b/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx
@@ -67,6 +67,8 @@ class IVistaFilePickerInternalNotify
public:
virtual void onAutoExtensionChanged (bool bChecked) = 0;
+
+ virtual bool onFileTypeChanged( UINT nTypeIndex ) = 0;
};
}}}
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 83b040f7edff..edb40f2e099b 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -225,7 +225,7 @@ void SAL_CALL VistaFilePicker::setTitle(const ::rtl::OUString& sTitle)
//-----------------------------------------------------------------------------------------
void SAL_CALL VistaFilePicker::appendFilter(const ::rtl::OUString& sTitle ,
- const ::rtl::OUString& sFilter)
+ const ::rtl::OUString& sFilter)
throw(css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
@@ -264,17 +264,15 @@ void SAL_CALL VistaFilePicker::setCurrentFilter(const ::rtl::OUString& sTitle)
//-----------------------------------------------------------------------------------------
void SAL_CALL VistaFilePicker::appendFilterGroup(const ::rtl::OUString& /*sGroupTitle*/,
- const css::uno::Sequence< css::beans::StringPair >& lFilters )
+ const css::uno::Sequence< css::beans::StringPair >& rFilters )
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
- ::sal_Int32 c = lFilters.getLength();
- ::sal_Int32 i = 0;
- for (i=0; i<c; ++i)
- {
- const css::beans::StringPair& rFilter = lFilters[i];
- appendFilter(rFilter.First, rFilter.Second);
- }
+ RequestRef rRequest(new Request());
+ rRequest->setRequest (VistaFilePickerImpl::E_APPEND_FILTERGROUP);
+ rRequest->setArgument(PROP_FILTER_GROUP, rFilters);
+
+ m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
}
//-----------------------------------------------------------------------------------------
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx
index 541d1a166687..a0aa8ad0b8cf 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx
@@ -264,33 +264,16 @@ STDMETHODIMP VistaFilePickerEventHandler::OnShareViolation(IFileDialog*
}
//-----------------------------------------------------------------------------------------
-STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* /*pDialog*/)
+STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* pDialog)
{
- /*
- IFileDialogCustomize *iCustomize;
- pDialog->QueryInterface(IID_IFileDialogCustomize, (void**)(&iCustomize));
+ UINT nFileTypeIndex;
+ HRESULT hResult = pDialog->GetFileTypeIndex( &nFileTypeIndex );
- BOOL bValue = FALSE;
- HRESULT hResult = iCustomize->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue);
-
- if ( bValue )
+ if ( hResult == S_OK )
{
- UINT nIndex;
-
- pDialog->GetFileTypeIndex( &nIndex );
-
- LPCWSTR lpFilterExt = lFilters[nIndex].pszSpec;
-
- lpFilterExt = wcschr( lpFilterExt, '.' );
- if ( lpFilterExt )
- lpFilterExt++;
- pDialog->SetDefaultExtension( lpFilterExt );
+ if ( m_pInternalNotify->onFileTypeChanged( nFileTypeIndex ))
+ impl_sendEvent(E_CONTROL_STATE_CHANGED, css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER);
}
- return S_OK;
-
- */
-
- impl_sendEvent(E_CONTROL_STATE_CHANGED, css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER);
return S_OK;
}
@@ -329,32 +312,9 @@ STDMETHODIMP VistaFilePickerEventHandler::OnCheckButtonToggled(IFileDialogCustom
DWORD nIDCtl ,
BOOL bChecked )
{
- /*
- if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
- {
- LPCWSTR lpFilterExt = 0;
- if ( bChecked )
- {
- UINT nIndex;
- if (m_pDialog)
- {
- m_pDialog->GetFileTypeIndex( &nIndex );
- lpFilterExt = lFilters[nIndex].pszSpec;
- lpFilterExt = wcschr( lpFilterExt, '.' );
- if ( lpFilterExt )
- lpFilterExt++;
- }
- }
-
- if (m_pDialog)
- m_pDialog->SetDefaultExtension( lpFilterExt );
- }
- */
-
if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
m_pInternalNotify->onAutoExtensionChanged(bChecked);
-
impl_sendEvent(E_CONTROL_STATE_CHANGED, static_cast<sal_Int16>( nIDCtl));
return S_OK;
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index 1c48976a9951..6cc0d522b920 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/beans/StringPair.hpp>
#include <comphelper/sequenceasvector.hxx>
#include <osl/file.hxx>
#include <osl/mutex.hxx>
@@ -43,6 +44,8 @@
#endif
#include "..\misc\WinImplHelper.hxx"
+#include <Shlguid.h>
+
inline bool is_current_process_window(HWND hwnd)
{
DWORD pid;
@@ -200,6 +203,10 @@ void VistaFilePickerImpl::doRequest(const RequestRef& rRequest)
impl_sta_appendFilter(rRequest);
break;
+ case E_APPEND_FILTERGROUP :
+ impl_sta_appendFilterGroup(rRequest);
+ break;
+
case E_SET_CURRENT_FILTER :
impl_sta_setCurrentFilter(rRequest);
break;
@@ -332,6 +339,28 @@ void VistaFilePickerImpl::impl_sta_appendFilter(const RequestRef& rRequest)
}
//-------------------------------------------------------------------------------
+void VistaFilePickerImpl::impl_sta_appendFilterGroup(const RequestRef& rRequest)
+{
+ const css::uno::Sequence< css::beans::StringPair > aFilterGroup =
+ rRequest->getArgumentOrDefault(PROP_FILTER_GROUP, css::uno::Sequence< css::beans::StringPair >());
+
+ // SYNCHRONIZED->
+ ::rtl::OUString aEmpty;
+ ::osl::ResettableMutexGuard aLock(m_aMutex);
+
+ if ( m_lFilters.numFilter() > 0 && aFilterGroup.getLength() > 0 )
+ m_lFilters.addFilter( STRING_SEPARATOR, aEmpty, sal_True );
+
+ ::sal_Int32 c = aFilterGroup.getLength();
+ ::sal_Int32 i = 0;
+ for (i=0; i<c; ++i)
+ {
+ const css::beans::StringPair& rFilter = aFilterGroup[i];
+ m_lFilters.addFilter(rFilter.First, rFilter.Second);
+ }
+}
+
+//-------------------------------------------------------------------------------
void VistaFilePickerImpl::impl_sta_setCurrentFilter(const RequestRef& rRequest)
{
const ::rtl::OUString sTitle = rRequest->getArgumentOrDefault(PROP_FILTER_TITLE, ::rtl::OUString());
@@ -942,7 +971,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
return;
impl_sta_getSelectedFiles(rRequest);
- rRequest->setArgument(PROP_DIALOG_SHOW_RESULT, (::sal_Bool)sal_True);
+ rRequest->setArgument(PROP_DIALOG_SHOW_RESULT, sal_True);
}
//-------------------------------------------------------------------------------
@@ -1180,6 +1209,23 @@ void VistaFilePickerImpl::impl_SetDefaultExtension( const rtl::OUString& current
}
}
+static void impl_refreshFileDialog( TFileDialog iDialog )
+{
+ if ( SUCCEEDED(iDialog->SetFileName(L"")) &&
+ SUCCEEDED(iDialog->SetFileName(L"*.*")) )
+ {
+ IOleWindow* iOleWindow;
+ if (SUCCEEDED(iDialog->QueryInterface(IID_PPV_ARGS(&iOleWindow))))
+ {
+ HWND hwnd;
+ if (SUCCEEDED(iOleWindow->GetWindow(&hwnd)))
+ {
+ PostMessage(hwnd, WM_COMMAND, IDOK, 0);
+ }
+ iOleWindow->Release();
+ }
+ }
+}
//-------------------------------------------------------------------------------
void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
@@ -1208,6 +1254,11 @@ void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
iDialog->SetDefaultExtension( pExt );
}
+bool VistaFilePickerImpl::onFileTypeChanged( UINT /*nTypeIndex*/ )
+{
+ return true;
+}
+
} // namespace vista
} // namespace win32
} // namespace fpicker
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
index 1149c9657f22..14bf9fd8bfe0 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
@@ -105,12 +105,14 @@ static const ::rtl::OUString PROP_TEMPLATE_DESCR(RTL_CONSTASCII_USTRINGPARAM("te
static const ::rtl::OUString PROP_FILTER_TITLE(RTL_CONSTASCII_USTRINGPARAM("filter_title" )); // [OUString]
static const ::rtl::OUString PROP_FILTER_VALUE(RTL_CONSTASCII_USTRINGPARAM("filter_value" )); // [OUString]
static const ::rtl::OUString PROP_FORCE(RTL_CONSTASCII_USTRINGPARAM("force" )); // [sal_Bool]
+static const ::rtl::OUString PROP_FILTER_GROUP(RTL_CONSTASCII_USTRINGPARAM("filter-group" )); // [seq< css:beans::StringPair >] contains a group of filters
static const ::rtl::OUString PROP_CONTROL_ID(RTL_CONSTASCII_USTRINGPARAM("control_id" )); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_ACTION(RTL_CONSTASCII_USTRINGPARAM("control_action" )); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_VALUE(RTL_CONSTASCII_USTRINGPARAM("control_value" )); // [Any]
static const ::rtl::OUString PROP_CONTROL_LABEL(RTL_CONSTASCII_USTRINGPARAM("control_label" )); // [OUString]
static const ::rtl::OUString PROP_CONTROL_ENABLE(RTL_CONSTASCII_USTRINGPARAM("control_enable" )); // [sal_Bool] true=ON, false=OFF
+static const ::rtl::OUString STRING_SEPARATOR(RTL_CONSTASCII_USTRINGPARAM("------------------------------------------" ));
//-----------------------------------------------------------------------------
/** native implementation of the file picker on Vista and upcoming windows versions.
@@ -150,7 +152,8 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
E_GET_CONTROL_VALUE,
E_SET_CONTROL_LABEL,
E_GET_CONTROL_LABEL,
- E_ENABLE_CONTROL
+ E_ENABLE_CONTROL,
+ E_APPEND_FILTERGROUP
};
public:
@@ -170,7 +173,10 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
virtual void after();
//---------------------------------------------------------------------
+ // IVistaFilePickerInternalNotify
+ //---------------------------------------------------------------------
virtual void onAutoExtensionChanged (bool bChecked);
+ virtual bool onFileTypeChanged( UINT nTypeIndex );
private:
@@ -187,6 +193,10 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
void impl_sta_appendFilter(const RequestRef& rRequest);
//---------------------------------------------------------------------
+ /// implementation of request E_APPEND_FILTERGROUP
+ void impl_sta_appendFilterGroup(const RequestRef& rRequest);
+
+ //---------------------------------------------------------------------
/// implementation of request E_SET_CURRENT_FILTER
void impl_sta_setCurrentFilter(const RequestRef& rRequest);
diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
index 7b0db4a451d9..6d8423910949 100644
--- a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
+++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
@@ -315,11 +315,24 @@ void SAL_CALL CWinFileOpenImpl::appendFilterGroup(const rtl::OUString& sGroupTit
// XExtendedFilePicker
//=================================================================================================================
+// #i90917: Due to a different feature set for the system-dependent file pickers
+// it's possible that generic code (e.g. sfx2) provides control ids
+// (see ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR) which are NOT
+// available on all platforms. This filter function should filter out control ids
+// which are only available on KDE/GTK file pickers.
+static bool filterControlCommand( sal_Int16 nControlId )
+{
+ if ( nControlId == LISTBOX_FILTER_SELECTOR )
+ return true;
+ return false;
+}
+
void SAL_CALL CWinFileOpenImpl::setValue(sal_Int16 aControlId, sal_Int16 aControlAction, const uno::Any& aValue)
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
- m_FilePickerState->setValue(aControlId, aControlAction, aValue);
+ if ( !filterControlCommand( aControlId ))
+ m_FilePickerState->setValue(aControlId, aControlAction, aValue);
}
//-----------------------------------------------------------------------------------------
@@ -331,7 +344,10 @@ uno::Any SAL_CALL CWinFileOpenImpl::getValue(sal_Int16 aControlId, sal_Int16 aCo
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
- return m_FilePickerState->getValue(aControlId, aControlAction);
+ if ( !filterControlCommand( aControlId ))
+ return m_FilePickerState->getValue(aControlId, aControlAction);
+ else
+ return uno::Any();
}
//-----------------------------------------------------------------------------------------
@@ -342,7 +358,8 @@ void SAL_CALL CWinFileOpenImpl::enableControl(sal_Int16 ControlID, sal_Bool bEna
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
- m_FilePickerState->enableControl(ControlID, bEnable);
+ if ( !filterControlCommand( ControlID ))
+ m_FilePickerState->enableControl(ControlID, bEnable);
}
//-----------------------------------------------------------------------------------------
@@ -352,7 +369,9 @@ void SAL_CALL CWinFileOpenImpl::enableControl(sal_Int16 ControlID, sal_Bool bEna
void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const rtl::OUString& aLabel )
throw (uno::RuntimeException)
{
- m_FilePickerState->setLabel(aControlId, aLabel);
+ OSL_ASSERT(m_FilePickerState);
+ if ( !filterControlCommand( aControlId ))
+ m_FilePickerState->setLabel(aControlId, aLabel);
}
//-----------------------------------------------------------------------------------------
@@ -362,7 +381,11 @@ void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const rtl::OUStr
rtl::OUString SAL_CALL CWinFileOpenImpl::getLabel( sal_Int16 aControlId )
throw (uno::RuntimeException)
{
- return m_FilePickerState->getLabel(aControlId);
+ OSL_ASSERT(m_FilePickerState);
+ if ( !filterControlCommand( aControlId ))
+ return m_FilePickerState->getLabel(aControlId);
+ else
+ return rtl::OUString();
}
//-----------------------------------------------------------------------------------------
diff --git a/fpicker/source/win32/filepicker/platform_vista.h b/fpicker/source/win32/filepicker/platform_vista.h
index c6fd8688bbd7..a17f817163cd 100644
--- a/fpicker/source/win32/filepicker/platform_vista.h
+++ b/fpicker/source/win32/filepicker/platform_vista.h
@@ -48,7 +48,6 @@
#pragma warning(pop)
#endif
-
#if defined _M_IX86
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
diff --git a/fpicker/source/win32/filepicker/previewadapter.cxx b/fpicker/source/win32/filepicker/previewadapter.cxx
index 7f4ee5d05d79..994a8ee6538e 100644
--- a/fpicker/source/win32/filepicker/previewadapter.cxx
+++ b/fpicker/source/win32/filepicker/previewadapter.cxx
@@ -307,7 +307,7 @@ void SAL_CALL CPreviewAdapterImpl::rearrangeLayout()
// style bit of the FileOpen dialog must be set after that
// message
LONG lStyle = GetWindowLong(prvwnd,GWL_STYLE);
- sal_Bool bIsVisible = (sal_Bool)(lStyle & WS_VISIBLE);
+ bool bIsVisible = ((lStyle & WS_VISIBLE) != 0);
int cx = 0;
diff --git a/framework/Library_fwe.mk b/framework/Library_fwe.mk
index f0e234a9376e..6c87f86d1542 100644
--- a/framework/Library_fwe.mk
+++ b/framework/Library_fwe.mk
@@ -81,8 +81,6 @@ $(eval $(call gb_Library_add_exception_objects,fwe,\
framework/source/fwe/interaction/preventduplicateinteraction \
framework/source/fwe/xml/eventsconfiguration \
framework/source/fwe/xml/eventsdocumenthandler \
- framework/source/fwe/xml/imagesconfiguration \
- framework/source/fwe/xml/imagesdocumenthandler \
framework/source/fwe/xml/menuconfiguration \
framework/source/fwe/xml/menudocumenthandler \
framework/source/fwe/xml/saxnamespacefilter \
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index 948af2325dcb..fc6fb1fce59d 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -182,6 +182,8 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/uifactory/windowcontentfactorymanager \
framework/source/xml/acceleratorconfigurationreader \
framework/source/xml/acceleratorconfigurationwriter \
+ framework/source/xml/imagesconfiguration \
+ framework/source/xml/imagesdocumenthandler \
))
# vim: set noet sw=4 ts=4:
diff --git a/framework/Package_inc.mk b/framework/Package_inc.mk
index 6d1c03a5975b..d72dd52128b8 100644
--- a/framework/Package_inc.mk
+++ b/framework/Package_inc.mk
@@ -39,7 +39,6 @@ $(eval $(call gb_Package_add_file,framework_inc,inc/framework/undomanagerhelper.
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imutex.hxx,framework/imutex.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/iguard.hxx,framework/iguard.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imageproducer.hxx,framework/imageproducer.hxx))
-$(eval $(call gb_Package_add_file,framework_inc,inc/framework/imagesconfiguration.hxx,framework/imagesconfiguration.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/interaction.hxx,framework/interaction.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/menuconfiguration.hxx,framework/menuconfiguration.hxx))
$(eval $(call gb_Package_add_file,framework_inc,inc/framework/menuextensionsupplier.hxx,framework/menuextensionsupplier.hxx))
diff --git a/framework/inc/framework/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx
index 2083a86945c8..169116c7a911 100644
--- a/framework/inc/framework/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -26,8 +26,8 @@
*
************************************************************************/
-#ifndef __FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
-#define __FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
+#ifndef FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
+#define FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
#include <framework/fwedllapi.h>
#include <svl/svarray.hxx>
@@ -50,7 +50,7 @@ enum ImageMaskMode
ImageMaskMode_Bitmap
};
-struct FWE_DLLPUBLIC ImageItemDescriptor
+struct ImageItemDescriptor
{
ImageItemDescriptor() : nIndex( -1 ) {}
@@ -58,7 +58,7 @@ struct FWE_DLLPUBLIC ImageItemDescriptor
long nIndex; // index of the bitmap inside the bitmaplist
};
-struct FWE_DLLPUBLIC ExternalImageItemDescriptor
+struct ExternalImageItemDescriptor
{
String aCommandURL; // URL command to dispatch
String aURL; // a URL to an external bitmap
@@ -70,7 +70,7 @@ SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10, 2)
typedef ExternalImageItemDescriptor* ExternalImageItemDescriptorPtr;
SV_DECL_PTRARR_DEL( ExternalImageItemListDescriptor, ExternalImageItemDescriptorPtr, 10, 2)
-struct FWE_DLLPUBLIC ImageListItemDescriptor
+struct ImageListItemDescriptor
{
ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ),
pImageItemList( 0 ) {}
@@ -89,7 +89,7 @@ struct FWE_DLLPUBLIC ImageListItemDescriptor
typedef ImageListItemDescriptor* ImageListItemDescriptorPtr;
SV_DECL_PTRARR_DEL( ImageListDescriptor, ImageListItemDescriptorPtr, 10, 2)
-struct FWE_DLLPUBLIC ImageListsDescriptor
+struct ImageListsDescriptor
{
ImageListsDescriptor() : pImageList( 0 ),
pExternalImageList( 0 ) {}
@@ -99,7 +99,7 @@ struct FWE_DLLPUBLIC ImageListsDescriptor
ExternalImageItemListDescriptor* pExternalImageList;
};
-class FWE_DLLPUBLIC ImagesConfiguration
+class ImagesConfiguration
{
public:
static sal_Bool LoadImages(
diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx
index f679ed925bd7..fc9ebbc7e861 100644
--- a/framework/inc/xml/imagesdocumenthandler.hxx
+++ b/framework/inc/xml/imagesdocumenthandler.hxx
@@ -26,8 +26,8 @@
*
************************************************************************/
-#ifndef __FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
-#define __FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
+#ifndef FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
+#define FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
#include <framework/fwedllapi.h>
@@ -40,7 +40,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#include <framework/imagesconfiguration.hxx>
+#include <xml/imagesconfiguration.hxx>
#include <threadhelp/threadhelpbase.hxx>
#include <rtl/ustring.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -58,7 +58,7 @@ namespace framework{
//*****************************************************************************************************************
// Hash code function for using in all hash maps of follow implementation.
-class FWE_DLLPUBLIC OReadImagesDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
+class OReadImagesDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses.
public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
{
public:
@@ -159,7 +159,7 @@ class FWE_DLLPUBLIC OReadImagesDocumentHandler : private ThreadHelpBase, // S
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
};
-class FWE_DLLPUBLIC OWriteImagesDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
+class OWriteImagesDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
{
public:
OWriteImagesDocumentHandler(
diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx
index 23765a6dd455..7deeaa09168f 100644
--- a/framework/source/helper/persistentwindowstate.cxx
+++ b/framework/source/helper/persistentwindowstate.cxx
@@ -58,6 +58,7 @@
#include <toolkit/unohlp.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
+#include <rtl/string.hxx>
//_________________________________________________________________________________________________________________
// namespace
@@ -338,7 +339,9 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere
if (pWorkWindow->IsMinimized())
return;
- pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8));
+ ::rtl::OUString sOldWindowState = ::rtl::OStringToOUString( pSystemWindow->GetWindowState(), RTL_TEXTENCODING_ASCII_US );
+ if ( sOldWindowState != sWindowState )
+ pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8));
// <- SOLAR SAFE ------------------------
}
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index cde360d18436..597066fbbb22 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -422,6 +422,14 @@ bool ToolbarLayoutManager::requestToolbar( const ::rtl::OUString& rResourceURL )
bool bMustCallCreate( false );
uno::Reference< ui::XUIElement > xUIElement;
+ ReadGuard aReadLock( m_aLock );
+ uno::Reference< frame::XFrame > xFrame( m_xFrame );
+ aReadLock.unlock();
+
+ uno::Reference< frame::XModel > xModel( impl_getModelFromFrame( xFrame ));
+ if ( implts_isPreviewModel( xModel ))
+ return false; // no toolbars for preview frame!
+
UIElement aRequestedToolbar = impl_findToolbar( rResourceURL );
if ( aRequestedToolbar.m_aName != rResourceURL )
{
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx
index 325b6bf45aae..ba0b7fea77da 100644
--- a/framework/source/uiconfiguration/imagemanager.cxx
+++ b/framework/source/uiconfiguration/imagemanager.cxx
@@ -28,9 +28,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
+
#include <uiconfiguration/imagemanager.hxx>
#include <threadhelp/resetableguard.hxx>
-#include <framework/imagesconfiguration.hxx>
+#include <xml/imagesconfiguration.hxx>
#include <uiconfiguration/graphicnameaccess.hxx>
#include <services.h>
#include "imagemanagerimpl.hxx"
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 4b7722c43abe..6a1c2627bf4d 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -28,9 +28,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
+
#include <imagemanagerimpl.hxx>
#include <threadhelp/resetableguard.hxx>
-#include <framework/imagesconfiguration.hxx>
+#include <xml/imagesconfiguration.hxx>
#include <uiconfiguration/graphicnameaccess.hxx>
#include <services.h>
diff --git a/framework/source/uiconfiguration/moduleimagemanager.cxx b/framework/source/uiconfiguration/moduleimagemanager.cxx
index 86540e1949fd..4273e86850c8 100644
--- a/framework/source/uiconfiguration/moduleimagemanager.cxx
+++ b/framework/source/uiconfiguration/moduleimagemanager.cxx
@@ -28,10 +28,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
+
#include <rtl/logfile.hxx>
#include <uiconfiguration/moduleimagemanager.hxx>
#include <threadhelp/resetableguard.hxx>
-#include <framework/imagesconfiguration.hxx>
+#include <xml/imagesconfiguration.hxx>
#include <uiconfiguration/graphicnameaccess.hxx>
#include <services.h>
#include "imagemanagerimpl.hxx"
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 4c9a190e3221..3284067a5804 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -130,16 +130,20 @@ static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
static const char ITEM_DESCRIPTOR_MODULEIDENTIFIER[] = "ModuleIdentifier";
static const char ITEM_DESCRIPTOR_DISPATCHPROVIDER[] = "DispatchProvider";
-static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
-
-const sal_Int32 LEN_DESCRIPTOR_COMMANDURL = 10;
-const sal_Int32 LEN_DESCRIPTOR_HELPURL = 7;
-const sal_Int32 LEN_DESCRIPTOR_CONTAINER = 23;
-const sal_Int32 LEN_DESCRIPTOR_LABEL = 5;
-const sal_Int32 LEN_DESCRIPTOR_TYPE = 4;
-const sal_Int32 LEN_DESCRIPTOR_MODULEIDENTIFIER = 16;
-const sal_Int32 LEN_DESCRIPTOR_DISPATCHPROVIDER = 16;
-static const sal_Int32 ITEM_DESCRIPTOR_STYLE_LEN = 5;
+static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
+static const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible";
+static const char ITEM_DESCRIPTOR_ENABLED[] = "Enabled";
+
+static const sal_Int32 LEN_DESCRIPTOR_COMMANDURL = 10;
+static const sal_Int32 LEN_DESCRIPTOR_HELPURL = 7;
+static const sal_Int32 LEN_DESCRIPTOR_CONTAINER = 23;
+static const sal_Int32 LEN_DESCRIPTOR_LABEL = 5;
+static const sal_Int32 LEN_DESCRIPTOR_TYPE = 4;
+static const sal_Int32 LEN_DESCRIPTOR_MODULEIDENTIFIER = 16;
+static const sal_Int32 LEN_DESCRIPTOR_DISPATCHPROVIDER = 16;
+static const sal_Int32 LEN_DESCRIPTOR_STYLE = 5;
+static const sal_Int32 LEN_DESCRIPTOR_ISVISIBLE = 9;
+static const sal_Int32 LEN_DESCRIPTOR_ENABLED = 7;
const sal_uInt16 ADDONMENU_MERGE_ITEMID_START = 1500;
@@ -1731,6 +1735,8 @@ void MenuBarManager::FillMenu(
rtl::OUString aLabel;
rtl::OUString aHelpURL;
rtl::OUString aModuleIdentifier( rModuleIdentifier );
+ sal_Bool bShow(sal_True);
+ sal_Bool bEnabled(sal_True);
sal_uInt16 nType = 0;
Reference< XIndexAccess > xIndexContainer;
Reference< XDispatchProvider > xDispatchProvider( rDispatchProvider );
@@ -1742,29 +1748,26 @@ void MenuBarManager::FillMenu(
for ( int i = 0; i < aProp.getLength(); i++ )
{
rtl::OUString aPropName = aProp[i].Name;
- if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL,
- LEN_DESCRIPTOR_COMMANDURL ))
+ if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL, LEN_DESCRIPTOR_COMMANDURL ))
aProp[i].Value >>= aCommandURL;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL,
- LEN_DESCRIPTOR_HELPURL ))
+ else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL, LEN_DESCRIPTOR_HELPURL ))
aProp[i].Value >>= aHelpURL;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER,
- LEN_DESCRIPTOR_CONTAINER ))
+ else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER, LEN_DESCRIPTOR_CONTAINER ))
aProp[i].Value >>= xIndexContainer;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_LABEL,
- LEN_DESCRIPTOR_LABEL ))
+ else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_LABEL, LEN_DESCRIPTOR_LABEL ))
aProp[i].Value >>= aLabel;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_TYPE,
- LEN_DESCRIPTOR_TYPE ))
+ else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_TYPE, LEN_DESCRIPTOR_TYPE ))
aProp[i].Value >>= nType;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_MODULEIDENTIFIER,
- LEN_DESCRIPTOR_MODULEIDENTIFIER ))
+ else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_MODULEIDENTIFIER, LEN_DESCRIPTOR_MODULEIDENTIFIER ))
aProp[i].Value >>= aModuleIdentifier;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER,
- LEN_DESCRIPTOR_DISPATCHPROVIDER ))
+ else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER, LEN_DESCRIPTOR_DISPATCHPROVIDER ))
aProp[i].Value >>= xDispatchProvider;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_STYLE, ITEM_DESCRIPTOR_STYLE_LEN ))
+ else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_STYLE, LEN_DESCRIPTOR_STYLE ))
aProp[i].Value >>= nStyle;
+ else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_ISVISIBLE, LEN_DESCRIPTOR_ISVISIBLE ))
+ aProp[i].Value >>= bShow;
+ else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_ENABLED, LEN_DESCRIPTOR_ENABLED ))
+ aProp[i].Value >>= bEnabled;
}
if ( nType == ::com::sun::star::ui::ItemType::DEFAULT )
@@ -1783,6 +1786,13 @@ void MenuBarManager::FillMenu(
nBits |= MIB_RADIOCHECK;
pMenu->SetItemBits( nId, nBits );
}
+
+ if ( !bShow )
+ pMenu->HideItem( nId );
+
+ if ( !bEnabled)
+ pMenu->EnableItem( nId, sal_False );
+
if ( xIndexContainer.is() )
{
PopupMenu* pNewPopupMenu = new PopupMenu;
diff --git a/framework/source/fwe/xml/imagesconfiguration.cxx b/framework/source/xml/imagesconfiguration.cxx
index ebf4cff30e4c..5f4b5f98408c 100644
--- a/framework/source/fwe/xml/imagesconfiguration.cxx
+++ b/framework/source/xml/imagesconfiguration.cxx
@@ -28,7 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
-#include <framework/imagesconfiguration.hxx>
+
+#include <xml/imagesconfiguration.hxx>
#include <services.h>
#include <xml/imagesdocumenthandler.hxx>
diff --git a/framework/source/fwe/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index 2de8f244f778..2de8f244f778 100644
--- a/framework/source/fwe/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu
index 8dbccb20cfb2..e72e61b8f02b 100644
--- a/officecfg/registry/data/org/openoffice/Setup.xcu
+++ b/officecfg/registry/data/org/openoffice/Setup.xcu
@@ -348,7 +348,7 @@
<value >swform</value>
</prop>
<prop oor:name="ooSetupFactoryUIName">
- <value>Base: Form Design</value>
+ <value>Base: Database Form</value>
</prop>
<prop oor:name="ooSetupFactoryWindowStateConfigRef">
<value >WriterFormWindowState</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 668e740e0f63..c5616abd4f28 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2401,9 +2401,23 @@
<desc>ODFVER_LATEST</desc>
</info>
</enumeration>
- </constraints>
- <value>3</value>
- </prop>
+ </constraints>
+ <value>3</value>
+ </prop>
+ <prop oor:name="UseSHA1InODF12" oor:type="xs:boolean">
+ <info>
+ <author>MAV</author>
+ <desc>Specifies whether SHA1 algorithm instead of SHA256 should be used in ODF12 for StartKey and Checksum generation during encryption.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="UseBlowfishInODF12" oor:type="xs:boolean">
+ <info>
+ <author>MAV</author>
+ <desc>Specifies whether Blowfish algorithm instead of AES should be used in ODF12 for encryption.</desc>
+ </info>
+ <value>false</value>
+ </prop>
</group>
</group>
<group oor:name="Load">
@@ -4842,6 +4856,33 @@
<value>1</value>
</prop>
</group>
+ <group oor:name="SVG">
+ <info>
+ <author>KA</author>
+ <desc>Specifies default settings of SVG export dialog.</desc>
+ </info>
+ <prop oor:name="TinyMode" oor:type="xs:boolean">
+ <info>
+ <author>KA</author>
+ <desc>Specifies if SVG Tiny profile should be used for export.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="EmbedFonts" oor:type="xs:boolean">
+ <info>
+ <author>KA</author>
+ <desc>Specifies if fonts should be embedded into SVG file.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="UseNativeTextDecoration" oor:type="xs:boolean">
+ <info>
+ <author>KA</author>
+ <desc>Specifies if text decoration like underlining and strike-through be drawm by using SVG attributes (true) or by drawing SVG primitives (false).</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ </group>
</group>
</group>
<group oor:name="HTML">
diff --git a/oovbaapi/ooo/vba/XApplicationBase.idl b/oovbaapi/ooo/vba/XApplicationBase.idl
index 44ec45625bc0..d46eb2446e31 100644
--- a/oovbaapi/ooo/vba/XApplicationBase.idl
+++ b/oovbaapi/ooo/vba/XApplicationBase.idl
@@ -45,7 +45,6 @@ interface XApplicationBase
[attribute, readonly] string Version;
[attribute, readonly] any VBE;
- [attribute, readonly] any VBProjects;
void Quit();
diff --git a/oovbaapi/ooo/vba/XCollectionBase.idl b/oovbaapi/ooo/vba/XCollectionBase.idl
new file mode 100755
index 000000000000..245b252f7856
--- /dev/null
+++ b/oovbaapi/ooo/vba/XCollectionBase.idl
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * Copyright 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ ************************************************************************/
+
+#ifndef OOO_VBA_XOLLECTIONBASE_IDL
+#define OOO_VBA_XOLLECTIONBASE_IDL
+
+#include <com/sun/star/container/XEnumerationAccess.idl>
+#include <com/sun/star/script/XDefaultMethod.idl>
+
+//=============================================================================
+
+module ooo { module vba {
+
+//=============================================================================
+
+/** Base interface for VBA collections.
+
+ Every VBA collection provides the number of items, an enumeration access of
+ all collection items (e.g. for the "For Each" loop), and a way to access
+ single items, usually via the method "Item".
+
+ The various VBA collection objects expect a specific number of arguments in
+ the "Item" method, therefore this method is not part of this base interface
+ but has to be specified seperately in every derived interface.
+ */
+interface XCollectionBase
+{
+ //-------------------------------------------------------------------------
+ /** Provides an enumeration of all items in this collection.
+ */
+ interface ::com::sun::star::container::XEnumerationAccess;
+
+ //-------------------------------------------------------------------------
+ /** Provides the name of the default item access method.
+
+ Usually this method is called "Item". The access method has to be
+ specified and implemented separately by every derived class.
+ */
+ interface ::com::sun::star::script::XDefaultMethod;
+
+ //-------------------------------------------------------------------------
+ /** Returns the number of items contained in this collection.
+ */
+ [attribute, readonly] long Count;
+
+ //-------------------------------------------------------------------------
+};
+
+//=============================================================================
+
+}; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/XControlProvider.idl b/oovbaapi/ooo/vba/XControlProvider.idl
index ecd73d496770..9918b4235dc7 100644
--- a/oovbaapi/ooo/vba/XControlProvider.idl
+++ b/oovbaapi/ooo/vba/XControlProvider.idl
@@ -38,8 +38,6 @@ module ooo { module vba {
interface XControlProvider
{
::ooo::vba::msforms::XControl createControl( [in] ::com::sun::star::drawing::XControlShape xControl, [in] ::com::sun::star::frame::XModel xDocOwner );
- ::ooo::vba::msforms::XControl createUserformControl( [in] ::com::sun::star::awt::XControl xControl, [in] ::com::sun::star::awt::XControl xDialog, [in] ::com::sun::star::frame::XModel xDocOwner );
-
};
}; };
diff --git a/oovbaapi/ooo/vba/XExecutableDialog.idl b/oovbaapi/ooo/vba/XExecutableDialog.idl
new file mode 100755
index 000000000000..8754c8071348
--- /dev/null
+++ b/oovbaapi/ooo/vba/XExecutableDialog.idl
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_XExecutableDialog_idl__
+#define __ooo_vba_XExecutableDialog_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+
+//=============================================================================
+
+module ooo { module vba {
+
+/** The VBA equivalent to the UNO interface
+ <type scope="com::sun::star::ui::dialogs">XExecutableDialog</type>.
+ */
+interface XExecutableDialog
+{
+ /** Executes the dialog.
+
+ @return
+ The return value is dependent on the calling context. Usually, on
+ cancelling the dialog the implementation will return <FALSE/>,
+ otherwise the return value will contain the expected result.
+ */
+ any execute();
+};
+
+//=============================================================================
+
+}; };
+
+#endif
+
+
diff --git a/oovbaapi/ooo/vba/excel/SheetObjects.idl b/oovbaapi/ooo/vba/excel/SheetObjects.idl
index 5947c52ff4a0..0a2a3fd9ffe9 100644
--- a/oovbaapi/ooo/vba/excel/SheetObjects.idl
+++ b/oovbaapi/ooo/vba/excel/SheetObjects.idl
@@ -74,10 +74,10 @@ interface XGraphicObjects : com::sun::star::uno::XInterface
/** Adds a new graphic object to the sheet this collection belongs to. The
type of the object is determined by the type of the collection.
- @param fLeft Position of the left border in points (1/72 inch).
- @param fTop Position of the top border in points (1/72 inch).
- @param fWidth Width of the object in points (1/72 inch).
- @param fHeight Height of the object in points (1/72 inch).
+ @param Left Position of the left border in points (1/72 inch).
+ @param Top Position of the top border in points (1/72 inch).
+ @param Width Width of the object in points (1/72 inch).
+ @param Height Height of the object in points (1/72 inch).
@return The created graphic object.
*/
@@ -102,10 +102,10 @@ interface XLineObjects : com::sun::star::uno::XInterface
/** Adds a new line object to the sheet this collection belongs to. The
type of the object is determined by the type of the collection.
- @param fX1 Position of the first X coordinate in points (1/72 inch).
- @param fY1 Position of the first Y coordinate in points (1/72 inch).
- @param fX2 Position of the last X coordinate in points (1/72 inch).
- @param fY2 Position of the last Y coordinate in points (1/72 inch).
+ @param X1 Position of the first X coordinate in points (1/72 inch).
+ @param Y1 Position of the first Y coordinate in points (1/72 inch).
+ @param X2 Position of the last X coordinate in points (1/72 inch).
+ @param Y2 Position of the last Y coordinate in points (1/72 inch).
@return The created line object.
*/
@@ -123,11 +123,11 @@ interface XDrawings : com::sun::star::uno::XInterface
{
/** Adds a new polygon object to the sheet this collection belongs to.
- @param fX1 Position of the first X coordinate in points (1/72 inch).
- @param fY1 Position of the first Y coordinate in points (1/72 inch).
- @param fX2 Position of the last X coordinate in points (1/72 inch).
- @param fY2 Position of the last Y coordinate in points (1/72 inch).
- @param bClosed True = outline closed (last and first point connected).
+ @param X1 Position of the first X coordinate in points (1/72 inch).
+ @param Y1 Position of the first Y coordinate in points (1/72 inch).
+ @param X2 Position of the last X coordinate in points (1/72 inch).
+ @param Y2 Position of the last Y coordinate in points (1/72 inch).
+ @param Closed True = outline closed (last and first point connected).
@return The created polygon object.
*/
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index 640f18529895..e9bee9bae44d 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -70,7 +70,7 @@ interface XApplication
[attribute] any CutCopyMode;
[attribute] any StatusBar;
[attribute] long Cursor;
- [attribute] boolean EnableEvents;
+ [attribute] boolean EnableEvents;
[attribute] boolean Visible;
[attribute] boolean Iteration;
[attribute] long EnableCancelKey;
@@ -115,5 +115,3 @@ interface XApplication
}; }; };
#endif
-
-
diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk
index bacb05fb6ffa..10281a645196 100755
--- a/oovbaapi/ooo/vba/makefile.mk
+++ b/oovbaapi/ooo/vba/makefile.mk
@@ -39,6 +39,7 @@ PACKAGE=ooo$/vba
IDLFILES=\
XErrObject.idl \
XCollection.idl\
+ XCollectionBase.idl\
XVBAToOOEventDescGen.idl\
XPropValue.idl\
XHelperInterface.idl\
@@ -58,6 +59,7 @@ IDLFILES=\
XGlobalsBase.idl\
XDocumentProperty.idl\
XDocumentProperties.idl\
+ XExecutableDialog.idl\
XFontBase.idl\
XDialogsBase.idl\
XDialogBase.idl\
diff --git a/oovbaapi/ooo/vba/msforms/XCheckBox.idl b/oovbaapi/ooo/vba/msforms/XCheckBox.idl
index 301d23a7b396..ec2c7136383e 100644
--- a/oovbaapi/ooo/vba/msforms/XCheckBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XCheckBox.idl
@@ -28,6 +28,8 @@
#define __ooo_vba_msforms_XCheckBox_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <ooo/vba/msforms/XNewFont.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
@@ -37,6 +39,7 @@ interface XCheckBox: com::sun::star::uno::XInterface
{
[attribute] string Caption;
[attribute] any Value;
+ [attribute, readonly] XNewFont Font;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XComboBox.idl b/oovbaapi/ooo/vba/msforms/XComboBox.idl
index 286383a5d89b..77b5e950d938 100644
--- a/oovbaapi/ooo/vba/msforms/XComboBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XComboBox.idl
@@ -24,24 +24,34 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_msforms_XComboBox_idl__
#define __ooo_vba_msforms_XComboBox_idl__
#include <com/sun/star/uno/XInterface.idl>
-
+#include <ooo/vba/msforms/XNewFont.idl>
//=============================================================================
module ooo { module vba { module msforms {
-
//=============================================================================
-interface XComboBox: ::com::sun::star::uno::XInterface
+
+interface XComboBox
{
[attribute] any Value;
[attribute] any ListIndex;
- [attribute, readonly ] long ListCount;
+ [attribute, readonly] long ListCount;
[attribute] string Text;
+ [attribute] long Style;
+ [attribute] long DropButtonStyle;
+ [attribute] long DragBehavior;
+ [attribute] long EnterFieldBehavior;
+ [attribute] long ListStyle;
+ [attribute] long TextAlign;
+ [attribute, readonly] long TextLength;
+ [attribute, readonly] XNewFont Font;
+
void AddItem( [in] any pvargItem, [in] any pvargIndex );
void removeItem( [in] any index );
void Clear();
diff --git a/oovbaapi/ooo/vba/msforms/XCommandButton.idl b/oovbaapi/ooo/vba/msforms/XCommandButton.idl
new file mode 100644
index 000000000000..0e7697cbd162
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/XCommandButton.idl
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_msforms_XCommandButton_idl__
+#define __ooo_vba_msforms_XCommandButton_idl__
+
+#include <ooo/vba/msforms/XNewFont.idl>
+
+//=============================================================================
+
+module ooo { module vba { module msforms {
+
+//=============================================================================
+
+interface XCommandButton
+{
+ [attribute] string Caption;
+ [attribute] boolean AutoSize;
+ [attribute] boolean Cancel;
+ [attribute] boolean Default;
+ [attribute] long BackColor;
+ [attribute] long ForeColor;
+ [attribute, readonly] XNewFont Font;
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
+
+
diff --git a/oovbaapi/ooo/vba/msforms/XControl.idl b/oovbaapi/ooo/vba/msforms/XControl.idl
index 5b59999f2fc1..5ece205ee465 100644
--- a/oovbaapi/ooo/vba/msforms/XControl.idl
+++ b/oovbaapi/ooo/vba/msforms/XControl.idl
@@ -55,7 +55,7 @@ interface XControl
[attribute] string Name;
[attribute] string ControlTipText;
[attribute] string Tag;
- [attribute] long ForeColor;
+ [attribute] long TabIndex;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XButton.idl b/oovbaapi/ooo/vba/msforms/XFrame.idl
index c88018a0ad18..6038b61dd3bd 100644..100755
--- a/oovbaapi/ooo/vba/msforms/XButton.idl
+++ b/oovbaapi/ooo/vba/msforms/XFrame.idl
@@ -24,24 +24,32 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef __ooo_vba_msforms_XButton_idl__
-#define __ooo_vba_msforms_XButton_idl__
-#include <com/sun/star/uno/XInterface.idl>
+#ifndef __ooo_vba_msforms_XFrame_idl__
+#define __ooo_vba_msforms_XFrame_idl__
+
+#include <ooo/vba/msforms/XNewFont.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
//=============================================================================
-interface XButton: com::sun::star::uno::XInterface
+
+interface XFrame
{
[attribute] string Caption;
+ [attribute] long SpecialEffect;
+ [attribute] long BorderStyle;
+ [attribute, readonly] XNewFont Font;
+
+ any Controls( [in] any Index );
};
//=============================================================================
}; }; };
-#endif
-
+//=============================================================================
+#endif
diff --git a/oovbaapi/ooo/vba/msforms/XGroupBox.idl b/oovbaapi/ooo/vba/msforms/XGroupBox.idl
index 4680da630818..ad62a6a171d4 100644
--- a/oovbaapi/ooo/vba/msforms/XGroupBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XGroupBox.idl
@@ -24,17 +24,23 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_msforms_XGroupBox_idl__
#define __ooo_vba_msforms_XGroupBox_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <ooo/vba/msforms/XNewFont.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
+
//=============================================================================
+
interface XGroupBox
{
[attribute] string Caption;
+ [attribute, readonly] XNewFont Font;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XLabel.idl b/oovbaapi/ooo/vba/msforms/XLabel.idl
index cead2221575c..10a92dc20184 100644
--- a/oovbaapi/ooo/vba/msforms/XLabel.idl
+++ b/oovbaapi/ooo/vba/msforms/XLabel.idl
@@ -24,20 +24,25 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_msforms_XLabel_idl__
#define __ooo_vba_msforms_XLabel_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <ooo/vba/msforms/XNewFont.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
//=============================================================================
-interface XLabel: com::sun::star::uno::XInterface
+
+interface XLabel
{
[attribute] string Caption;
[attribute] any Value;
[attribute] string Accelerator;
+ [attribute, readonly] XNewFont Font;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XListBox.idl b/oovbaapi/ooo/vba/msforms/XListBox.idl
index 27b6f86bbfbf..98ce26e68a3e 100644
--- a/oovbaapi/ooo/vba/msforms/XListBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XListBox.idl
@@ -24,23 +24,28 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_msforms_XListBox_idl__
#define __ooo_vba_msforms_XListBox_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <ooo/vba/msforms/XNewFont.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
-
//=============================================================================
-interface XListBox: com::sun::star::uno::XInterface
+
+interface XListBox
{
[attribute] any Value;
[attribute] string Text;
[attribute] long MultiSelect;
[attribute] any ListIndex;
- [attribute, readonly ] long ListCount;
+ [attribute, readonly] long ListCount;
+ [attribute, readonly] XNewFont Font;
+
void AddItem( [in] any pvargItem, [in] any pvargIndex );
void removeItem( [in] any index );
void Clear();
diff --git a/oovbaapi/ooo/vba/msforms/XNewFont.idl b/oovbaapi/ooo/vba/msforms/XNewFont.idl
new file mode 100755
index 000000000000..755dd510b63a
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/XNewFont.idl
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_msforms_XNewFont_idl__
+#define __ooo_vba_msforms_XNewFont_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+
+//=============================================================================
+
+module ooo { module vba { module msforms {
+
+//=============================================================================
+
+interface XNewFont
+{
+ [attribute] string Name;
+ [attribute] double Size;
+ [attribute] short Charset;
+ [attribute] short Weight;
+ [attribute] boolean Bold;
+ [attribute] boolean Italic;
+ [attribute] boolean Underline;
+ [attribute] boolean Strikethrough;
+};
+
+//=============================================================================
+
+}; }; };
+
+//=============================================================================
+
+#endif
diff --git a/oovbaapi/ooo/vba/msforms/XRadioButton.idl b/oovbaapi/ooo/vba/msforms/XRadioButton.idl
index 1c54d6d570c2..162aa1fdf28b 100644
--- a/oovbaapi/ooo/vba/msforms/XRadioButton.idl
+++ b/oovbaapi/ooo/vba/msforms/XRadioButton.idl
@@ -24,19 +24,24 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_msforms_XRadioButton_idl__
#define __ooo_vba_msforms_XRadioButton_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <ooo/vba/msforms/XNewFont.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
//=============================================================================
-interface XRadioButton: com::sun::star::uno::XInterface
+
+interface XRadioButton
{
[attribute] string Caption;
[attribute] any Value;
+ [attribute, readonly] XNewFont Font;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XTextBox.idl b/oovbaapi/ooo/vba/msforms/XTextBox.idl
index e10ad3fb1bae..75aaf836817f 100644
--- a/oovbaapi/ooo/vba/msforms/XTextBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XTextBox.idl
@@ -24,21 +24,29 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_msforms_XTextBox_idl__
#define __ooo_vba_msforms_XTextBox_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <ooo/vba/msforms/XNewFont.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
//=============================================================================
-interface XTextBox: com::sun::star::uno::XInterface
+
+interface XTextBox
{
[attribute] string Text;
[attribute] any Value;
[attribute] long MaxLength;
[attribute] boolean Multiline;
+ [attribute] long SpecialEffect;
+ [attribute] long BorderStyle;
+ [attribute, readonly] long TextLength;
+ [attribute, readonly] XNewFont Font;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XToggleButton.idl b/oovbaapi/ooo/vba/msforms/XToggleButton.idl
index e47e106423e8..a441740cb5f1 100644
--- a/oovbaapi/ooo/vba/msforms/XToggleButton.idl
+++ b/oovbaapi/ooo/vba/msforms/XToggleButton.idl
@@ -24,18 +24,23 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_msforms_XToggleButton_idl__
#define __ooo_vba_msforms_XToggleButton_idl__
#include <ooo/vba/msforms/XButton.idl>
#include <com/sun/star/uno/XInterface.idl>
+#include <ooo/vba/msforms/XCommandButton.idl>
+
//=============================================================================
module ooo { module vba { module msforms {
+
//=============================================================================
+
interface XToggleButton
{
- interface XButton;
+ interface XCommandButton;
[attribute] any Value;
};
diff --git a/oovbaapi/ooo/vba/msforms/XUserForm.idl b/oovbaapi/ooo/vba/msforms/XUserForm.idl
index 4d413777e30a..28bb8ed988ab 100644
--- a/oovbaapi/ooo/vba/msforms/XUserForm.idl
+++ b/oovbaapi/ooo/vba/msforms/XUserForm.idl
@@ -35,6 +35,8 @@ interface XUserForm
//interface ::ooo::vba::XHelperInterface;
interface ::com::sun::star::script::XInvocation;
[attribute] string Caption;
+ [attribute] double InnerWidth;
+ [attribute] double InnerHeight;
void Show();
void Hide();
void RePaint();
diff --git a/oovbaapi/ooo/vba/msforms/makefile.mk b/oovbaapi/ooo/vba/msforms/makefile.mk
index ebf4d2ee891a..2717d0409da6 100755
--- a/oovbaapi/ooo/vba/msforms/makefile.mk
+++ b/oovbaapi/ooo/vba/msforms/makefile.mk
@@ -38,10 +38,13 @@ PACKAGE=ooo$/vba$/msforms
IDLFILES=\
MSFormReturnTypes.idl \
+ XCheckBox.idl \
XComboBox.idl \
- XButton.idl \
+ XCommandButton.idl \
XControl.idl \
+ XFrame.idl \
XLabel.idl \
+ XNewFont.idl \
XTextBox.idl \
XRadioButton.idl \
XCheckBox.idl \
diff --git a/readlicense_oo/docs/readme.xsl b/readlicense_oo/docs/readme.xsl
index 4e77fa522c3d..e63e319cf502 100755
--- a/readlicense_oo/docs/readme.xsl
+++ b/readlicense_oo/docs/readme.xsl
@@ -34,6 +34,13 @@
</xsl:if>
</xsl:param>
+ <xsl:param name="lf">
+ <xsl:choose>
+ <xsl:when test="$platform='WIN'"><xsl:text>&#xD;&#xA;</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:text>&#xA;</xsl:text></xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$type='html'">
@@ -115,59 +122,50 @@
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="name(.)='li'">
- <xsl:text>
-</xsl:text>* <xsl:apply-templates/>
+ <xsl:value-of select="$lf"/>* <xsl:apply-templates/>
</xsl:when>
<xsl:when test="name(.)='ul'">
- <xsl:text>
-</xsl:text>
+ <xsl:value-of select="$lf"/>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="name(.)='ol'">
- <xsl:text>
-</xsl:text>
+ <xsl:value-of select="$lf"/>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="name(.)='p'">
<xsl:if test="(not(name(..)='li') and (count(a) = 0))">
- <xsl:text>
-
-</xsl:text>
+ <xsl:value-of select="$lf"/>
+ <xsl:value-of select="$lf"/>
</xsl:if>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="name(.)='h1'">
- <xsl:text>
-
-======================================================================
-</xsl:text>
+ <xsl:value-of select="$lf"/>
+ <xsl:text>======================================================================</xsl:text>
+ <xsl:value-of select="$lf"/>
<xsl:apply-templates/>
- <xsl:text>
-======================================================================</xsl:text>
+ <xsl:value-of select="$lf"/>
+ <xsl:text>======================================================================</xsl:text>
+ <xsl:value-of select="$lf"/>
</xsl:when>
<xsl:when test="name(.)='h2'">
- <xsl:text>
-
-----------------------------------------------------------------------
-</xsl:text>
+ <xsl:value-of select="$lf"/>
+ <xsl:value-of select="$lf"/>
+ <xsl:text>----------------------------------------------------------------------</xsl:text>
+ <xsl:value-of select="$lf"/>
<xsl:apply-templates/>
- <xsl:text>
-----------------------------------------------------------------------</xsl:text>
-
+ <xsl:value-of select="$lf"/>
+ <xsl:text>----------------------------------------------------------------------</xsl:text>
</xsl:when>
<xsl:when test="name(.)='h3'">
- <xsl:text>
-
-</xsl:text>
+ <xsl:value-of select="$lf"/>
+ <xsl:value-of select="$lf"/>
<xsl:apply-templates/>
- <xsl:text>
-----------------------------------------------------------------------</xsl:text>
-
+ <xsl:value-of select="$lf"/>
+ <xsl:text>----------------------------------------------------------------------</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
-
-
</xsl:stylesheet>
diff --git a/readlicense_oo/docs/readme/eval.xsl b/readlicense_oo/docs/readme/eval.xsl
index e8830d43015c..613e61d673f9 100755
--- a/readlicense_oo/docs/readme/eval.xsl
+++ b/readlicense_oo/docs/readme/eval.xsl
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="html" />
+ <xsl:output method="text" />
<xsl:template match="/Readme">
<html>
<head>
diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm
index a760bffdf2a8..8bcf7ca698e8 100755
--- a/readlicense_oo/docs/readme/readme.xrm
+++ b/readlicense_oo/docs/readme/readme.xrm
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
@@ -30,6 +29,7 @@
<div id="Installation">
<h2 id="rr3fgf42r" xml:lang="en-US">Notes on Installation</h2>
+ <p class="note" id="javaneeded" xml:lang="en-US">${PRODUCTNAME} requires a recent version of JAVA for full functionality which is part of the ${PRODUCTNAME} installation package.</p>
<h3 id="sdfsdfgf42r" xml:lang="en-US">System Requirements</h3>
<div class="MAC" id="SystemRequirements_OSX">
<ul>
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index 02eb6495b464..608b437a1814 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -47,14 +47,13 @@
#include <com/sun/star/script/provider/XScriptProvider.hpp>
#include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/lang/NoSuchMethodException.hpp>
#include <com/sun/star/reflection/XIdlMethod.hpp>
#include <com/sun/star/beans/MethodConcept.hpp>
#include <com/sun/star/beans/XMaterialHolder.hpp>
#include <ooo/vba/XVBAToOOEventDescGen.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <vbahelper/vbaaccesshelper.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::awt;
@@ -178,19 +177,17 @@ namespace dlgprov
// handler for Script & ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.UNO:"))
listernersForTypes[ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.UNO")) ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode );
listernersForTypes[ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script")) ] = new DialogSFScriptListenerImpl( rxContext, rxModel );
- // Note: in a future cws ( npower13_ObjectModule ) it will be possible
- // to determine the vba mode from the basiclibrary container, the tunnel hack
- // below can then be replaced
- SfxObjectShell* pFoundShell = NULL;
- if ( rxModel.is() )
+
+ // determine the VBA compatibility mode from the Basic library container
+ try
+ {
+ uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBACompat(
+ xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY_THROW );
+ mbUseFakeVBAEvents = xVBACompat->getVBACompatibilityMode();
+ }
+ catch( uno::Exception& )
{
- uno::Reference< lang::XUnoTunnel > xObjShellTunnel( rxModel, uno::UNO_QUERY );
- if ( xObjShellTunnel.is() )
- {
- pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()));
- if ( pFoundShell )
- mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ) || ooo::vba::isAlienWordDoc( *pFoundShell ) ;
- }
}
if ( mbUseFakeVBAEvents )
listernersForTypes[ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VBAInterop")) ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName );
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 3b53636f1c45..bd3c1b3f846b 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -97,6 +97,8 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) :
pTopFrames( new SfxFrameArr_Impl ),
pInitLinkList(0),
pMatcher( 0 ),
+ pBasicResMgr( 0 ),
+ pSvtResMgr( 0 ),
pAppDispatch(NULL),
pTemplates( 0 ),
pPool(0),
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index d718166878cc..c52009fb4ffb 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -257,12 +257,11 @@ bool SfxApplication::Initialize_Impl()
// not processed are given to SFX as Errorcode 1.
new SimpleErrorHandler;
#endif
- new SfxErrorHandler(RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1);
-
- new SfxErrorHandler(
- RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END);
- new SfxErrorHandler(
- RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END );
+ pAppData_Impl->pBasicResMgr = CreateResManager("sb");
+ pAppData_Impl->pSvtResMgr = CreateResManager("svt");
+ new SfxErrorHandler( RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1 );
+ new SfxErrorHandler( RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END, pAppData_Impl->pSvtResMgr );
+ new SfxErrorHandler( RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END, pAppData_Impl->pBasicResMgr );
// diverse Pointer
SfxPickList::GetOrCreate( SvtHistoryOptions().GetSize( ePICKLIST ) );
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index fe56ba2c500b..c644e5dcb30f 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -288,8 +288,9 @@ private:
}
catch( const uno::Exception& )
{
- // unknown error, do not try to ask again
- eResult = ::comphelper::DocPasswordVerifierResult_ABORT;
+ // unknown error, report it as wrong password
+ // TODO/LATER: we need an additional way to report unknown problems in this case
+ eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
}
return eResult;
}
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index b6b31cde6f30..fa5d2c8356d2 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -154,6 +154,8 @@ void SfxApplication::Deinitialize()
//TODO/CLEANTUP
//ReleaseArgs could be used instead!
pAppData_Impl->pPool = NULL;
+ DELETEZ(pAppData_Impl->pBasicResMgr);
+ DELETEZ(pAppData_Impl->pSvtResMgr);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/sfx.src b/sfx2/source/appl/sfx.src
index 3bca517c5fd5..746b4c9688d6 100644
--- a/sfx2/source/appl/sfx.src
+++ b/sfx2/source/appl/sfx.src
@@ -27,19 +27,6 @@
#include <sfx2/sfx.hrc>
-String STR_STYLE_FILTER_USED
-{
- Text [ en-US ] = "Applied Styles" ;
-};
-String STR_STYLE_FILTER_USERDEF
-{
- Text [ en-US ] = "Custom Styles" ;
-};
-String STR_STYLE_FILTER_ALL
-{
- Text [ en-US ] = "All Styles" ;
-};
-
String STR_ACCTITLE_PRODUCTIVITYTOOLS
{
Text [ en-US ] = "%PRODUCTNAME";
diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm
index f30f940e8bac..481447fe7f1a 100755
--- a/sfx2/source/appl/shutdowniconaqua.mm
+++ b/sfx2/source/appl/shutdowniconaqua.mm
@@ -116,6 +116,7 @@ using namespace ::com::sun::star::util;
-(void)dockIconClicked: (NSObject*)pSender
{
+ (void)pSender;
// start start module
ShutdownIcon::OpenURL( OUString( RTL_CONSTASCII_USTRINGPARAM( STARTMODULE_URL ) ), OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) );
}
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index eb13788aba94..88e284ea4e27 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -60,7 +60,7 @@
// -----------------------------------------------------------------------
TYPEINIT1(SfxEventHint, SfxHint);
TYPEINIT1(SfxEventNamesItem, SfxPoolItem);
-TYPEINIT1(SfxViewEventHint, SfxHint);
+TYPEINIT1(SfxViewEventHint, SfxEventHint);
using namespace com::sun::star;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index ebb1635afae4..e512340443a3 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -131,7 +131,7 @@ void SfxUnoControllerItem::UnBind()
void SAL_CALL SfxUnoControllerItem::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvent) throw ( ::com::sun::star::uno::RuntimeException )
{
SolarMutexGuard aGuard;
- DBG_ASSERT( pCtrlItem, "Dispatch has not removed the StatusListener!" );
+ DBG_ASSERT( pCtrlItem, "dispatch implementation didn't respect our previous removeStatusListener call!" );
if ( rEvent.Requery )
{
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 237699757a45..01e6e70e87f8 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1487,7 +1487,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
// the item should remain only if it was set by the dialog
rpSet->ClearItem( SID_SELECTION );
- if( mbExport )
+ if( mbExport && mbHasSelectionBox )
{
try
{
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 6d6f251f8df6..7da63d650dfd 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -679,11 +679,11 @@ writeStream(struct DocumentMetadataAccess_Impl & i_rImpl,
buf.append(dir).append(static_cast<sal_Unicode>('/'));
writeStream(i_rImpl, xDir, i_xGraphName, rest,
buf.makeStringAndClear());
- }
- const uno::Reference<embed::XTransactedObject> xTransaction(
- i_xStorage, uno::UNO_QUERY);
- if (xTransaction.is()) {
- xTransaction->commit();
+ uno::Reference<embed::XTransactedObject> const xTransaction(
+ xDir, uno::UNO_QUERY);
+ if (xTransaction.is()) {
+ xTransaction->commit();
+ }
}
} catch (uno::RuntimeException &) {
throw;
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 87fb028cd1f3..c23ddde17f51 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -671,6 +671,10 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
//-------------------------------------------------------------------------
sal_Int8 ModelData_Impl::CheckStateForSave()
{
+ // if the document is readonly or a new one a SaveAs operation must be used
+ if ( !GetStorable()->hasLocation() || GetStorable()->isReadonly() )
+ return STATUS_SAVEAS;
+
// check acceptable entries for media descriptor
sal_Bool bVersInfoNeedsStore = sal_False;
::comphelper::SequenceAsHashMap aAcceptedArgs;
@@ -707,10 +711,6 @@ sal_Int8 ModelData_Impl::CheckStateForSave()
return STATUS_NO_ACTION;
}
- // if the document is readonly or a new one a SaveAs operation must be used
- if ( !GetStorable()->hasLocation() || GetStorable()->isReadonly() )
- return STATUS_SAVEAS;
-
// check that the old filter is acceptable
::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault(
aFilterNameString,
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index d570e0b3e028..d5104a0f7a56 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -66,9 +66,12 @@
#include <com/sun/star/embed/XLinkageSupport.hpp>
#include <com/sun/star/embed/EntryInitModes.hpp>
#include <com/sun/star/embed/XOptimizedStorage.hpp>
+#include <com/sun/star/embed/XEncryptionProtectedStorage.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -356,24 +359,51 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto
const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
- ::rtl::OUString aVersion;
SvtSaveOptions aSaveOpt;
SvtSaveOptions::ODFDefaultVersion nDefVersion = aSaveOpt.GetODFDefaultVersion();
- // older versions can not have this property set, it exists only starting from ODF1.2
- if ( nDefVersion >= SvtSaveOptions::ODFVER_012 )
- aVersion = ODFVER_012_TEXT;
+ uno::Sequence< beans::NamedValue > aEncryptionAlgs( 3 );
+ aEncryptionAlgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StartKeyGenerationAlgorithm" ) );
+ aEncryptionAlgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionAlgorithm" ) );
+ aEncryptionAlgs[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ChecksumAlgorithm" ) );
+ // the default values, that should be used for ODF1.1 and older formats
+ aEncryptionAlgs[0].Value <<= xml::crypto::DigestID::SHA1;
+ aEncryptionAlgs[1].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
+ aEncryptionAlgs[2].Value <<= xml::crypto::DigestID::SHA1_1K;
- if ( aVersion.getLength() )
+ if ( nDefVersion >= SvtSaveOptions::ODFVER_012 )
{
try
{
- xProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Version")), uno::makeAny( aVersion ) );
+ // older versions can not have this property set, it exists only starting from ODF1.2
+ xProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Version" )), uno::makeAny( ODFVER_012_TEXT ) );
}
catch( uno::Exception& )
{
}
+
+ if ( !aSaveOpt.IsUseSHA1InODF12() )
+ {
+ aEncryptionAlgs[0].Value <<= xml::crypto::DigestID::SHA256;
+ aEncryptionAlgs[2].Value <<= xml::crypto::DigestID::SHA256_1K;
+ }
+ if ( !aSaveOpt.IsUseBlowfishInODF12() )
+ aEncryptionAlgs[1].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ }
+
+ try
+ {
+ // set the encryption algorithms accordingly;
+ // the setting does not trigger encryption,
+ // it just provides the format for the case that contents should be encrypted
+ uno::Reference< embed::XEncryptionProtectedStorage > xEncr( xStorage, uno::UNO_QUERY_THROW );
+ xEncr->setEncryptionAlgorithms( aEncryptionAlgs );
}
+ catch( uno::Exception& )
+ {
+ const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ }
+
}
}
}
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 5802606fb635..a6c8473bee5c 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -30,6 +30,7 @@
#include "precompiled_sfx2.hxx"
#include "arrdecl.hxx"
+#include <map>
#include <cppuhelper/implbase1.hxx>
@@ -123,42 +124,37 @@ DBG_NAME(SfxObjectShell)
#define DocumentInfo
#include "sfxslots.hxx"
+namespace {
+
static WeakReference< XInterface > s_xCurrentComponent;
-void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bool bClear = false )
+// remember all registered components for VBA compatibility, to be able to remove them on disposing the model
+typedef ::std::map< XInterface*, ::rtl::OString > VBAConstantNameMap;
+static VBAConstantNameMap s_aRegisteredVBAConstants;
+
+::rtl::OString lclGetVBAGlobalConstName( const Reference< XInterface >& rxComponent )
{
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- if ( pAppMgr )
- {
- uno::Reference< beans::XPropertySet > xProps( _rxComponent, uno::UNO_QUERY );
- if ( xProps.is() )
- {
- try
- {
- // ThisVBADocObj contains a PropertyValue
- // Name is ( the name of the VBA global to insert )
- // Value is the Object to insert.
- // ( note: at the moment the Value is actually the model so
- // it strictly is not necessary, however we do intend to store
- // not the model in basic but a custom object, so we keep this
- // level of indirection for future proofing )
- beans::PropertyValue aProp;
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp;
- rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) );
- const char* pAscii = sTmp.getStr();
- if ( bClear )
- pAppMgr->SetGlobalUNOConstant( pAscii, uno::makeAny( uno::Reference< uno::XInterface >() ) );
- else
- pAppMgr->SetGlobalUNOConstant( pAscii, aProp.Value );
+ OSL_ENSURE( rxComponent.is(), "lclGetVBAGlobalConstName - missing component" );
- }
- catch( const uno::Exception& )
- {
- }
- }
+ VBAConstantNameMap::iterator aIt = s_aRegisteredVBAConstants.find( rxComponent.get() );
+ if( aIt != s_aRegisteredVBAConstants.end() )
+ return aIt->second;
+
+ uno::Reference< beans::XPropertySet > xProps( rxComponent, uno::UNO_QUERY );
+ if( xProps.is() ) try
+ {
+ ::rtl::OUString aConstName;
+ xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobalConstantName" ) ) ) >>= aConstName;
+ return ::rtl::OUStringToOString( aConstName, RTL_TEXTENCODING_ASCII_US );
+ }
+ catch( uno::Exception& ) // not supported
+ {
}
+ return ::rtl::OString();
}
+} // namespace
+
//=========================================================================
class SfxModelListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XCloseListener >
@@ -195,6 +191,20 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even
SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
}
+ /* Remove VBA component from AppBasic. As every application registers its
+ own current component, the disposed component may not be the "current
+ component" of the SfxObjectShell. */
+ if ( _rEvent.Source.is() )
+ {
+ VBAConstantNameMap::iterator aIt = s_aRegisteredVBAConstants.find( _rEvent.Source.get() );
+ if ( aIt != s_aRegisteredVBAConstants.end() )
+ {
+ if ( BasicManager* pAppMgr = SFX_APP()->GetBasicManager() )
+ pAppMgr->SetGlobalUNOConstant( aIt->second.getStr(), Any( Reference< XInterface >() ) );
+ s_aRegisteredVBAConstants.erase( aIt );
+ }
+ }
+
if ( mpDoc->Get_Impl()->bHiddenLockedByAPI )
{
mpDoc->Get_Impl()->bHiddenLockedByAPI = sal_False;
@@ -922,8 +932,8 @@ sal_uInt16 SfxObjectShell::GetAutoStyleFilterIndex()
void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComponent )
{
- Reference< XInterface > xTest(s_xCurrentComponent);
- if ( _rxComponent == xTest )
+ Reference< XInterface > xOldCurrentComp(s_xCurrentComponent);
+ if ( _rxComponent == xOldCurrentComp )
// nothing to do
return;
// note that "_rxComponent.get() == s_xCurrentComponent.get().get()" is /sufficient/, but not
@@ -935,8 +945,29 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
s_xCurrentComponent = _rxComponent;
if ( pAppMgr )
{
- lcl_UpdateAppBasicDocVars( _rxComponent );
- pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) );
+ // set "ThisComponent" for Basic
+ pAppMgr->SetGlobalUNOConstant( "ThisComponent", Any( _rxComponent ) );
+
+ // set new current component for VBA compatibility
+ if ( _rxComponent.is() )
+ {
+ ::rtl::OString aVBAConstName = lclGetVBAGlobalConstName( _rxComponent );
+ if ( aVBAConstName.getLength() > 0 )
+ {
+ pAppMgr->SetGlobalUNOConstant( aVBAConstName.getStr(), Any( _rxComponent ) );
+ s_aRegisteredVBAConstants[ _rxComponent.get() ] = aVBAConstName;
+ }
+ }
+ // no new component passed -> remove last registered VBA component
+ else if ( xOldCurrentComp.is() )
+ {
+ ::rtl::OString aVBAConstName = lclGetVBAGlobalConstName( xOldCurrentComp );
+ if ( aVBAConstName.getLength() > 0 )
+ {
+ pAppMgr->SetGlobalUNOConstant( aVBAConstName.getStr(), Any( Reference< XInterface >() ) );
+ s_aRegisteredVBAConstants.erase( xOldCurrentComp.get() );
+ }
+ }
}
}
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index a08f8035b03f..87da2295a09e 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -110,7 +110,8 @@ public:
// application members
SfxFilterMatcher* pMatcher;
- ResMgr* pLabelResMgr;
+ ResMgr* pBasicResMgr;
+ ResMgr* pSvtResMgr;
SfxStatusDispatcher* pAppDispatch;
SfxDocumentTemplates* pTemplates;
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index df317d9c4f91..88cf28d7f093 100644
--- a/svx/inc/svx/svdograf.hxx
+++ b/svx/inc/svx/svdograf.hxx
@@ -149,6 +149,8 @@ public:
// Keep ATM for SD.
sal_Bool IsAnimated() const;
sal_Bool IsEPS() const;
+ sal_Bool IsRenderGraphic() const;
+ sal_Bool HasRenderGraphic() const;
sal_Bool IsSwappedOut() const;
const MapMode& GetGrafPrefMapMode() const;
diff --git a/svx/inc/svx/xoutbmp.hxx b/svx/inc/svx/xoutbmp.hxx
index 63e6411961c3..2dd14e8b6b7d 100644..100755
--- a/svx/inc/svx/xoutbmp.hxx
+++ b/svx/inc/svx/xoutbmp.hxx
@@ -44,6 +44,7 @@
#define XOUTBMP_CONTOUR_HORZ 0x00000001L
#define XOUTBMP_CONTOUR_VERT 0x00000002L
#define XOUTBMP_CONTOUR_EDGEDETECT 0x00000004L
+#define XOUTBMP_DONT_ADD_EXTENSION 0x00000008L
#define XOUTBMP_DONT_EXPAND_FILENAME 0x10000000L
#define XOUTBMP_USE_GIF_IF_POSSIBLE 0x20000000L
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 674b9d18491d..aede0a96f5ec 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -1022,6 +1022,9 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
default:
{
+ OSL_ENSURE( pAction->GetType() != META_RENDERGRAPHIC_ACTION,
+ "META_RENDERGRAPHIC_ACTION currently not supported at masking" );
+
pAction->Duplicate();
aMtf.AddAction( pAction );
}
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 580fa90f7b1c..3d94a7c25fa1 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2014,6 +2014,18 @@ void DbGridControl::AdjustRows()
RowRemoved(GetRowCount() - nDelta, nDelta, sal_False);
// es sind Zeilen weggefallen, dann ab der aktuellen Position neu zeichen
Invalidate();
+
+ sal_Int32 nNewPos = AlignSeekCursor();
+ if (m_bSynchDisplay)
+ DbGridControl_Base::GoToRow(nNewPos);
+
+ SetCurrent(nNewPos);
+ // there are rows so go to the selected current column
+ if (nRecordCount)
+ GoToRowColumnId(nNewPos, GetColumnId(GetCurColumnId()));
+ if (!IsResizing() && GetRowCount())
+ RecalcRows(GetTopRow(), GetVisibleRows(), sal_True);
+ m_aBar.InvalidateAll(m_nCurrentPos, sal_True);
}
else // zuwenig
RowInserted(GetRowCount(), -nDelta, sal_True);
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index c86e492251f1..bcd6582c69a0 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -648,7 +648,9 @@ void FmFormObj::SetUnoControlModel( const Reference< com::sun::star::awt::XContr
{
SdrUnoObj::SetUnoControlModel( _rxModel );
- // TODO: call something like formObjectInserted at the form page, to tell it the new model
+ FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetPage() );
+ if ( pFormPage )
+ pFormPage->GetImpl().formModelAssigned( *this );
impl_checkRefDevice_nothrow( true );
}
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index 86fece89935a..75b27ed6033a 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -80,9 +80,10 @@ FmFormPage::FmFormPage(FmFormModel& rModel, StarBASIC* _pBasic, bool bMasterPage
//------------------------------------------------------------------
FmFormPage::FmFormPage(const FmFormPage& rPage)
:SdrPage(rPage)
- ,m_pImpl(new FmFormPageImpl( *this, rPage.GetImpl() ) )
+ ,m_pImpl(new FmFormPageImpl( *this ) )
,m_pBasic(0)
{
+ m_pImpl->initFrom( rPage.GetImpl() );
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::FmFormPage" );
m_sPageName = rPage.m_sPageName;
}
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index 1134b3e5f2be..b46c074118ba 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -168,21 +168,18 @@ namespace
}
//------------------------------------------------------------------------------
-FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl )
- :m_rPage( _rPage )
- ,m_bFirstActivation( sal_True )
- ,m_bAttemptedFormCreation( false )
+void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
{
- DBG_CTOR(FmFormPageImpl,NULL);
-
// clone the Forms collection
- Reference< XCloneable > xCloneable( const_cast< FmFormPageImpl& >( rImpl ).getForms( false ), UNO_QUERY );
+ const Reference< XNameContainer > xForeignForms( const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ) );
+ const Reference< XCloneable > xCloneable( xForeignForms, UNO_QUERY );
if ( !xCloneable.is() )
{
// great, nothing to do
- OSL_ENSURE( !const_cast< FmFormPageImpl& >( rImpl ).getForms( false ).is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" );
+ OSL_ENSURE( !xForeignForms.is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" );
return;
}
+
try
{
m_xForms.set( xCloneable->createClone(), UNO_QUERY_THROW );
@@ -197,7 +194,7 @@ FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl
aVisitor.process( FormComponentPair( xCloneable, m_xForms ), aAssignmentProcessor );
// assign the cloned models to their SdrObjects
- SdrObjListIter aForeignIter( rImpl.m_rPage );
+ SdrObjListIter aForeignIter( i_foreignImpl.m_rPage );
SdrObjListIter aOwnIter( m_rPage );
OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" );
@@ -209,31 +206,23 @@ FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl
bool bForeignIsForm = pForeignObj && ( pForeignObj->GetObjInventor() == FmFormInventor );
bool bOwnIsForm = pOwnObj && ( pOwnObj->GetObjInventor() == FmFormInventor );
- if ( bForeignIsForm != bOwnIsForm )
- {
- OSL_FAIL( "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" );
- // don't attempt to do further assignments, something's completely messed up
- break;
- }
+ ENSURE_OR_BREAK( bForeignIsForm == bOwnIsForm, "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" );
+ // if this fires, don't attempt to do further assignments, something's completely messed up
+
if ( !bForeignIsForm )
// no form control -> next round
continue;
Reference< XControlModel > xForeignModel( pForeignObj->GetUnoControlModel() );
- OSL_ENSURE( xForeignModel.is(), "FmFormPageImpl::FmFormPageImpl: control shape without control!" );
- if ( !xForeignModel.is() )
- // the SdrObject does not have a UNO Control Model. This is pathological, but well ... So the cloned
- // SdrObject will also not have a UNO Control Model.
- continue;
-
- OSL_ENSURE( !pOwnObj->GetUnoControlModel().is(), "FmFormPageImpl::FmFormPageImpl: there already is a control model for the target object!" );
+ ENSURE_OR_CONTINUE( xForeignModel.is(), "FmFormPageImpl::FmFormPageImpl: control shape without control!" );
+ // if this fires, the SdrObject does not have a UNO Control Model. This is pathological, but well ...
+ // So the cloned SdrObject will also not have a UNO Control Model.
MapControlModels::const_iterator assignment = aModelAssignment.find( xForeignModel );
- OSL_ENSURE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" );
- if ( assignment == aModelAssignment.end() )
- // the source SdrObject has a model, but it is not part of the model hierarchy in rImpl.getForms().
+ ENSURE_OR_CONTINUE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" );
+ // if this fires, the source SdrObject has a model, but it is not part of the model hierarchy in
+ // i_foreignImpl.getForms().
// Pathological, too ...
- continue;
pOwnObj->SetUnoControlModel( assignment->second );
}
@@ -276,7 +265,7 @@ namespace
_map->put( makeAny( xControlModel ), makeAny( xControlShape ) );
}
- static void lcl_removeFormObject( const FmFormObj& _object, const Reference< XMap >& _map )
+ static void lcl_removeFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map, bool i_ignoreNonExistence = false )
{
// the control model
Reference< XControlModel > xControlModel( _object.GetUnoControlModel(), UNO_QUERY );
@@ -288,8 +277,13 @@ namespace
Any aOldAssignment =
#endif
_map->remove( makeAny( xControlModel ) );
- OSL_ENSURE( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ),
- "lcl_removeFormObject: map was inconsistent!" );
+ #if OSL_DEBUG_LEVEL > 0
+ (void)aOldAssignment;
+ #endif
+ OSL_ENSURE( !i_ignoreNonExistence ||
+ ( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ) ),
+ "lcl_removeFormObject: map was inconsistent!" );
+ (void)i_ignoreNonExistence;
}
}
@@ -704,7 +698,26 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource(
return sName;
}
-//------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+void FmFormPageImpl::formModelAssigned( const FmFormObj& _object )
+{
+ Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
+ if ( !xControlShapeMap.is() )
+ // our map does not exist -> not interested in this event
+ return;
+
+ try
+ {
+ lcl_removeFormObject_throw( _object, xControlShapeMap, false );
+ lcl_insertFormObject_throw( _object, xControlShapeMap );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
void FmFormPageImpl::formObjectInserted( const FmFormObj& _object )
{
Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
@@ -722,6 +735,7 @@ void FmFormPageImpl::formObjectInserted( const FmFormObj& _object )
}
}
+//----------------------------------------------------------------------------------------------------------------------
void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object )
{
Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
@@ -731,7 +745,7 @@ void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object )
try
{
- lcl_removeFormObject( _object, xControlShapeMap );
+ lcl_removeFormObject_throw( _object, xControlShapeMap );
}
catch( const Exception& )
{
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 42ef0bdcd361..df6aa255cc62 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -870,19 +870,19 @@ void FmFormShell::GetState(SfxItemSet &rSet)
case SID_FM_USE_WIZARDS:
if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
- else if (!m_bDesignMode || !GetFormModel())
+ else if (!GetFormModel())
rSet.DisableItem( nWhich );
else
rSet.Put( SfxBoolItem(nWhich, GetImpl()->GetWizardUsing() ) );
break;
case SID_FM_AUTOCONTROLFOCUS:
- if (!m_bDesignMode || !GetFormModel())
+ if (!GetFormModel())
rSet.DisableItem( nWhich );
else
rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetAutoControlFocus() ) );
break;
case SID_FM_OPEN_READONLY:
- if (!m_bDesignMode || !GetFormModel())
+ if (!GetFormModel())
rSet.DisableItem( nWhich );
else
rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetOpenInDesignMode() ) );
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 7e9578411473..e239fbd659e3 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -920,6 +920,7 @@ sal_Bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInse
case( GFX_LINK_TYPE_NATIVE_WMF ): nExportFormat = CVT_WMF; break;
case( GFX_LINK_TYPE_NATIVE_MET ): nExportFormat = CVT_MET; break;
case( GFX_LINK_TYPE_NATIVE_PCT ): nExportFormat = CVT_PCT; break;
+ case( GFX_LINK_TYPE_NATIVE_SVG ): nExportFormat = CVT_SVG; break;
default:
break;
}
diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx
index e806ce740bed..a62225d898cc 100644
--- a/svx/source/inc/fmpgeimp.hxx
+++ b/svx/source/inc/fmpgeimp.hxx
@@ -81,9 +81,10 @@ protected:
public:
FmFormPageImpl( FmFormPage& _rPage );
- FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl );
~FmFormPageImpl();
+ void initFrom( FmFormPageImpl& i_foreignImpl );
+
// nur wichtig fuer den DesignMode
void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm);
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm();
@@ -135,6 +136,7 @@ public:
void formObjectInserted( const FmFormObj& _object );
void formObjectRemoved( const FmFormObj& _object );
+ void formModelAssigned( const FmFormObj& _object );
/** returns an object mapping from control models to drawing shapes.
*/
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 5bbe1082cbc4..a0056f8e8313 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -58,8 +58,6 @@
#include <com/sun/star/container/XContainer.hpp>
/** === end UNO includes === **/
-#include <toolkit/helper/formpdfexport.hxx>
-#include <vcl/pdfextoutdevdata.hxx>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include <comphelper/processfactory.hxx>
@@ -70,7 +68,6 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
-#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
/*
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 304915de299f..f5ada616c0f8 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -652,8 +652,12 @@ void SdrEditView::CheckPossibilities()
sal_Bool bGraf=HAS_BASE(SdrGrafObj,pObj);
sal_Bool bOle2=HAS_BASE(SdrOle2Obj,pObj);
- if( bGraf && ((SdrGrafObj*)pObj)->HasGDIMetaFile() && !((SdrGrafObj*)pObj)->IsEPS() )
+ if( bGraf &&
+ ((SdrGrafObj*)pObj)->HasGDIMetaFile() &&
+ !( ((SdrGrafObj*)pObj)->IsEPS() || ((SdrGrafObj*)pObj)->IsRenderGraphic() ) )
+ {
bImportMtfPossible = sal_True;
+ }
if (bOle2)
bImportMtfPossible=((SdrOle2Obj*)pObj)->GetObjRef().is();
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index fe986ef215fa..3fbde293e4e9 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -197,7 +197,7 @@ sal_uIntPtr ImpSdrGDIMetaFileImport::DoImport(const GDIMetaFile& rMtf,
case META_POP_ACTION : DoAction((MetaPopAction &)*pAct); break;
case META_HATCH_ACTION : DoAction((MetaHatchAction &)*pAct); break;
case META_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, pMtf); break;
-
+ case META_RENDERGRAPHIC_ACTION : DoAction((MetaRenderGraphicAction &)*pAct); break;
}
if(pProgrInfo != NULL)
@@ -1026,6 +1026,27 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM
}
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaRenderGraphicAction& rAct)
+{
+ GDIMetaFile aMtf;
+ const ::vcl::RenderGraphic& rRenderGraphic = rAct.GetRenderGraphic();
+ Rectangle aRect( rAct.GetPoint(), rAct.GetSize() );
+ const Point aPos;
+ const Size aPrefSize( rRenderGraphic.GetPrefSize() );
+
+ aRect.Right()++; aRect.Bottom()++;
+
+ aMtf.SetPrefMapMode( rRenderGraphic.GetPrefMapMode() );
+ aMtf.SetPrefSize( aPrefSize );
+ aMtf.AddAction( new MetaRenderGraphicAction( aPos, aPrefSize, rRenderGraphic ) );
+ aMtf.WindStart();
+
+ SdrGrafObj* pGraf=new SdrGrafObj( aMtf, aRect );
+ InsertObj( pGraf );
+}
+
// eof
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx
index a38a482c9c12..c2f99a212d79 100644
--- a/svx/source/svdraw/svdfmtf.hxx
+++ b/svx/source/svdraw/svdfmtf.hxx
@@ -141,6 +141,7 @@ protected:
void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); }
void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); }
void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf);
+ void DoAction(MetaRenderGraphicAction& rAct);
void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct );
void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false);
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 5d22b4dd3a09..f39ef1719d06 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -504,6 +504,16 @@ sal_Bool SdrGrafObj::IsEPS() const
return pGraphic->IsEPS();
}
+sal_Bool SdrGrafObj::IsRenderGraphic() const
+{
+ return pGraphic->IsRenderGraphic();
+}
+
+sal_Bool SdrGrafObj::HasRenderGraphic() const
+{
+ return pGraphic->HasRenderGraphic();
+}
+
sal_Bool SdrGrafObj::IsSwappedOut() const
{
return mbIsPreview ? sal_True : pGraphic->IsSwappedOut();
@@ -658,6 +668,7 @@ void SdrGrafObj::ReleaseGraphicLink()
void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
bool bAnim = pGraphic->IsAnimated();
+ bool bRenderGraphic = pGraphic->HasRenderGraphic();
bool bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj;
rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 ||
@@ -665,11 +676,11 @@ void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
aGeo.nDrehWink % 27000 == 0;
rInfo.bResizePropAllowed = sal_True;
- rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim;
- rInfo.bRotate90Allowed = bNoPresGrf && !bAnim;
- rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim;
- rInfo.bMirror45Allowed = bNoPresGrf && !bAnim;
- rInfo.bMirror90Allowed = !bEmptyPresObj;
+ rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic;
+ rInfo.bRotate90Allowed = bNoPresGrf && !bAnim && !bRenderGraphic;
+ rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic;
+ rInfo.bMirror45Allowed = bNoPresGrf && !bAnim && !bRenderGraphic;
+ rInfo.bMirror90Allowed = !bEmptyPresObj && !bRenderGraphic;
rInfo.bTransparenceAllowed = sal_False;
rInfo.bGradientAllowed = sal_False;
rInfo.bShearAllowed = sal_False;
@@ -677,7 +688,7 @@ void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
rInfo.bCanConvToPath = sal_False;
rInfo.bCanConvToPathLineToArea = sal_False;
rInfo.bCanConvToPolyLineToArea = sal_False;
- rInfo.bCanConvToPoly = !IsEPS();
+ rInfo.bCanConvToPoly = !IsEPS() && !bRenderGraphic;
rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
}
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index d13d30e342ce..1c0763ad4a50 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -326,68 +326,23 @@ SdrUnoObj& SdrUnoObj::operator= (const SdrUnoObj& rObj)
SdrRectObj::operator= (rObj);
// release the reference to the current control model
- SetUnoControlModel(uno::Reference< awt::XControlModel >());
+ SetUnoControlModel( NULL );
aUnoControlModelTypeName = rObj.aUnoControlModelTypeName;
aUnoControlTypeName = rObj.aUnoControlTypeName;
// copy the uno control model
- uno::Reference< awt::XControlModel > xCtrl( rObj.GetUnoControlModel(), uno::UNO_QUERY );
- uno::Reference< util::XCloneable > xClone( xCtrl, uno::UNO_QUERY );
-
- if ( xClone.is() )
+ const uno::Reference< awt::XControlModel > xSourceControlModel( rObj.GetUnoControlModel(), uno::UNO_QUERY );
+ if ( xSourceControlModel.is() )
{
- // copy the model by cloning
- uno::Reference< awt::XControlModel > xNewModel( xClone->createClone(), uno::UNO_QUERY );
- DBG_ASSERT( xNewModel.is(), "SdrUnoObj::operator =, no control model!");
- xUnoControlModel = xNewModel;
- }
- else
- {
- // copy the model by streaming
- uno::Reference< io::XPersistObject > xObj( xCtrl, uno::UNO_QUERY );
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
-
- if ( xObj.is() && xFactory.is() )
+ try
{
- // creating a pipe
- uno::Reference< io::XOutputStream > xOutPipe(xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe"))), uno::UNO_QUERY);
- uno::Reference< io::XInputStream > xInPipe(xOutPipe, uno::UNO_QUERY);
-
- // creating the mark streams
- uno::Reference< io::XInputStream > xMarkIn(xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.MarkableInputStream"))), uno::UNO_QUERY);
- uno::Reference< io::XActiveDataSink > xMarkSink(xMarkIn, uno::UNO_QUERY);
-
- uno::Reference< io::XOutputStream > xMarkOut(xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.MarkableOutputStream"))), uno::UNO_QUERY);
- uno::Reference< io::XActiveDataSource > xMarkSource(xMarkOut, uno::UNO_QUERY);
-
- // connect mark and sink
- uno::Reference< io::XActiveDataSink > xSink(xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.ObjectInputStream"))), uno::UNO_QUERY);
-
- // connect mark and source
- uno::Reference< io::XActiveDataSource > xSource(xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.ObjectOutputStream"))), uno::UNO_QUERY);
-
- uno::Reference< io::XObjectOutputStream > xOutStrm(xSource, uno::UNO_QUERY);
- uno::Reference< io::XObjectInputStream > xInStrm(xSink, uno::UNO_QUERY);
-
- if (xMarkSink.is() && xMarkSource.is() && xSink.is() && xSource.is())
- {
- xMarkSink->setInputStream(xInPipe);
- xMarkSource->setOutputStream(xOutPipe);
- xSink->setInputStream(xMarkIn);
- xSource->setOutputStream(xMarkOut);
-
- // write the object to source
- xOutStrm->writeObject(xObj);
- xOutStrm->closeOutput();
- // read the object
- uno::Reference< awt::XControlModel > xModel(xInStrm->readObject(), uno::UNO_QUERY);
- xInStrm->closeInput();
-
- DBG_ASSERT(xModel.is(), "SdrUnoObj::operator =, keine Model erzeugt");
-
- xUnoControlModel = xModel;
- }
+ uno::Reference< util::XCloneable > xClone( xSourceControlModel, uno::UNO_QUERY_THROW );
+ xUnoControlModel.set( xClone->createClone(), uno::UNO_QUERY_THROW );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index f11dee45177c..29aea86ab33c 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -745,10 +745,8 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
{
SfxItemPool& rPool = rView.GetModel()->GetItemPool();
SfxItemSet aSet( rPool, SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST );
-
- const bool bUndo = rView.IsUndoEnabled();
-
- String aUndoStr;
+ String aUndoStr;
+ const bool bUndo = rView.IsUndoEnabled();
if( bUndo )
{
@@ -1028,7 +1026,29 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
SfxItemPool& rPool = rView.GetModel()->GetItemPool();
SfxItemSet aAttrSet( rPool );
SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
+ bool bEnableColors = true;
+ bool bEnableTransparency = true;
+ bool bEnableCrop = ( 1 == rMarkList.GetMarkCount() );
+
+ for( int i = 0, nCount = rMarkList.GetMarkCount(); i < nCount; ++i )
+ {
+ SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( i )->GetMarkedSdrObj() );
+
+ if( !pGrafObj ||
+ ( pGrafObj->GetGraphicType() == GRAPHIC_NONE ) ||
+ ( pGrafObj->GetGraphicType() == GRAPHIC_DEFAULT ) ||
+ pGrafObj->HasRenderGraphic() )
+ {
+ bEnableColors = bEnableTransparency = bEnableCrop = false;
+ break;
+ }
+ else if( bEnableTransparency && ( pGrafObj->HasGDIMetaFile() || pGrafObj->IsAnimated() ) )
+ {
+ bEnableTransparency = false;
+ }
+ }
rView.GetAttributes( aAttrSet );
@@ -1042,8 +1062,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFMODE ) )
{
- rSet.Put( SfxUInt16Item( nSlotId,
- sal::static_int_cast< sal_uInt16 >( ITEMVALUE( aAttrSet, SDRATTR_GRAFMODE, SdrGrafModeItem ) ) ) );
+ if( bEnableColors )
+ {
+ rSet.Put( SfxUInt16Item( nSlotId,
+ sal::static_int_cast< sal_uInt16 >( ITEMVALUE( aAttrSet, SDRATTR_GRAFMODE, SdrGrafModeItem ) ) ) );
+ }
+ else
+ {
+ rSet.DisableItem( SID_ATTR_GRAF_MODE );
+ }
}
}
break;
@@ -1052,8 +1079,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFRED ) )
{
- rSet.Put( SfxInt16Item( nSlotId,
- ITEMVALUE( aAttrSet, SDRATTR_GRAFRED, SdrGrafRedItem ) ) );
+ if( bEnableColors )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFRED, SdrGrafRedItem ) ) );
+ }
+ else
+ {
+ rSet.DisableItem( SID_ATTR_GRAF_RED );
+ }
}
}
break;
@@ -1062,8 +1096,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFGREEN ) )
{
- rSet.Put( SfxInt16Item( nSlotId,
- ITEMVALUE( aAttrSet, SDRATTR_GRAFGREEN, SdrGrafGreenItem ) ) );
+ if( bEnableColors )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFGREEN, SdrGrafGreenItem ) ) );
+ }
+ else
+ {
+ rSet.DisableItem( SID_ATTR_GRAF_GREEN );
+ }
}
}
break;
@@ -1072,8 +1113,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFBLUE ) )
{
- rSet.Put( SfxInt16Item( nSlotId,
- ITEMVALUE( aAttrSet, SDRATTR_GRAFBLUE, SdrGrafBlueItem ) ) );
+ if( bEnableColors )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFBLUE, SdrGrafBlueItem ) ) );
+ }
+ else
+ {
+ rSet.DisableItem( SID_ATTR_GRAF_BLUE );
+ }
}
}
break;
@@ -1082,8 +1130,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFLUMINANCE ) )
{
- rSet.Put( SfxInt16Item( nSlotId,
- ITEMVALUE( aAttrSet, SDRATTR_GRAFLUMINANCE, SdrGrafLuminanceItem ) ) );
+ if( bEnableColors )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFLUMINANCE, SdrGrafLuminanceItem ) ) );
+ }
+ else
+ {
+ rSet.DisableItem( SID_ATTR_GRAF_LUMINANCE );
+ }
}
}
break;
@@ -1092,8 +1147,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFCONTRAST ) )
{
- rSet.Put( SfxInt16Item( nSlotId,
- ITEMVALUE( aAttrSet, SDRATTR_GRAFCONTRAST, SdrGrafContrastItem ) ) );
+ if( bEnableColors )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFCONTRAST, SdrGrafContrastItem ) ) );
+ }
+ else
+ {
+ rSet.DisableItem( SID_ATTR_GRAF_CONTRAST );
+ }
}
}
break;
@@ -1102,8 +1164,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFGAMMA ) )
{
- rSet.Put( SfxUInt32Item( nSlotId,
- ITEMVALUE( aAttrSet, SDRATTR_GRAFGAMMA, SdrGrafGamma100Item ) ) );
+ if( bEnableColors )
+ {
+ rSet.Put( SfxUInt32Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFGAMMA, SdrGrafGamma100Item ) ) );
+ }
+ else
+ {
+ rSet.DisableItem( SID_ATTR_GRAF_GAMMA );
+ }
}
}
break;
@@ -1112,53 +1181,22 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
{
if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFTRANSPARENCE ) )
{
- const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
- sal_Bool bEnable = sal_True;
-
- for( sal_uInt16 i = 0, nCount = (sal_uInt16) rMarkList.GetMarkCount();
- ( i < nCount ) && bEnable; i++ )
+ if( bEnableTransparency )
{
- SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
-
- if( !pObj || !pObj->ISA( SdrGrafObj ) ||
- ( (SdrGrafObj*) pObj )->HasGDIMetaFile() ||
- ( (SdrGrafObj*) pObj )->IsAnimated() )
- {
- bEnable = sal_False;
- }
- }
-
- if( bEnable )
rSet.Put( SfxUInt16Item( nSlotId,
ITEMVALUE( aAttrSet, SDRATTR_GRAFTRANSPARENCE, SdrGrafTransparenceItem ) ) );
+ }
else
+ {
rSet.DisableItem( SID_ATTR_GRAF_TRANSPARENCE );
+ }
}
}
break;
case( SID_ATTR_GRAF_CROP ):
{
- const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
- sal_Bool bDisable = sal_True;
-
- if( 1 == rMarkList.GetMarkCount() )
- {
- SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
-
- if( pObj && pObj->ISA( SdrGrafObj ) )
- {
- SdrGrafObj* pGrafObj = (SdrGrafObj*) pObj;
-
- if( ( pGrafObj->GetGraphicType() != GRAPHIC_NONE ) &&
- ( pGrafObj->GetGraphicType() != GRAPHIC_DEFAULT ) )
- {
- bDisable = sal_False;
- }
- }
- }
-
- if( bDisable )
+ if( !bEnableCrop )
rSet.DisableItem( nSlotId );
}
break;
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 1e7337b360c7..5bb7da42eb0e 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -153,7 +153,7 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const ::rtl::OUString& rGraphi
{
pStm->SetVersion( SOFFICE_FILEFORMAT_8 );
pStm->SetCompressMode( COMPRESSMODE_ZBITMAP );
- ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm );
+ ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC );
bRet = ( pStm->GetError() == 0 );
}
}
@@ -542,7 +542,8 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con
{ "gif", "image/gif" },
{ "png", "image/png" },
{ "jpg", "image/jpeg" },
- { "tif", "image/tiff" }
+ { "tif", "image/tiff" },
+ { "svg", "image/svg+xml" }
};
String aMimeType;
@@ -647,7 +648,7 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const ::rtl::OUString& rPictureSt
pStream->Write( rLink.GetData(), rLink.GetDataSize() );
}
else
- rMtf.Write( *pStream );
+ rMtf.Write( *pStream, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC );
bRet = ( pStream->GetError() == 0 );
}
@@ -727,6 +728,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s
case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".wmf" ) ); break;
case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".met" ) ); break;
case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".pct" ) ); break;
+ case( GFX_LINK_TYPE_NATIVE_SVG ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".svg" ) ); break;
default:
aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".grf" ) );
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 547a5334d124..f5535e63957f 100644..100755
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -368,7 +368,8 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName,
if( aExt.Len() )
{
- aURL.setExtension( aExt );
+ if( 0 == (nFlags & XOUTBMP_DONT_ADD_EXTENSION))
+ aURL.setExtension( aExt );
rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_SHARE_DENYNONE | STREAM_TRUNC, sal_True );
@@ -473,7 +474,8 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName,
if( ( GRFILTER_FORMAT_NOTFOUND != nFilter ) && ( aGraphic.GetType() != GRAPHIC_NONE ) )
{
- aURL.setExtension( aExt );
+ if( 0 == (nFlags & XOUTBMP_DONT_ADD_EXTENSION))
+ aURL.setExtension( aExt );
rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
nErr = ExportGraphic( aGraphic, aURL, *pFilter, nFilter, NULL );
}
diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx
index e4b3624ac377..324638f40466 100644
--- a/ucb/source/ucp/gvfs/gvfs_content.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_content.cxx
@@ -1179,7 +1179,7 @@ uno::Any Content::mapVFSException( const GnomeVFSResult result, sal_Bool bWrite
switch (result) {
case GNOME_VFS_OK:
- g_error ("VFS_OK mapped to exception.");
+ g_warning("VFS_OK mapped to exception.");
break;
case GNOME_VFS_ERROR_EOF:
g_warning ("VFS_EOF not handled somewhere.");
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
index ecc0ea46536d..7183fe8faa84 100644
--- a/uui/source/iahndl-ssl.cxx
+++ b/uui/source/iahndl-ssl.cxx
@@ -26,13 +26,19 @@
*
************************************************************************/
+
#include "com/sun/star/security/CertificateValidity.hpp"
+#include "com/sun/star/security/XCertificateExtension.hpp"
+#include "com/sun/star/security/XSanExtension.hpp"
+#include <com/sun/star/security/ExtAltNameType.hpp>
#include "com/sun/star/task/XInteractionAbort.hpp"
#include "com/sun/star/task/XInteractionApprove.hpp"
#include "com/sun/star/task/XInteractionRequest.hpp"
#include "com/sun/star/ucb/CertificateValidationRequest.hpp"
+#include <com/sun/star/uno/Reference.hxx>
#include "osl/mutex.hxx"
+#include <com/sun/star/uno/Sequence.hxx>
#include "tools/datetime.hxx"
#include "svl/zforlist.hxx"
#include "vcl/svapp.hxx"
@@ -48,6 +54,9 @@
#define DESCRIPTION_2 2
#define TITLE 3
+#define OID_SUBJECT_ALTERNATIVE_NAME "2.5.29.17"
+
+
using namespace com::sun::star;
namespace {
@@ -77,19 +86,25 @@ getContentPart( const String& _rRawString )
bool
isDomainMatch(
- rtl::OUString hostName, rtl::OUString certHostName)
+ rtl::OUString hostName, uno::Sequence< ::rtl::OUString > certHostNames)
{
- if (hostName.equalsIgnoreAsciiCase( certHostName ))
- return true;
-
- if ( 0 == certHostName.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "*" )) ) &&
- hostName.getLength() >= certHostName.getLength() )
- {
- rtl::OUString cmpStr = certHostName.copy( 1 );
-
- if ( hostName.matchIgnoreAsciiCase(
- cmpStr, hostName.getLength() - cmpStr.getLength()) )
- return true;
+ for ( int i = 0; i < certHostNames.getLength(); i++){
+ ::rtl::OUString element = certHostNames[i];
+
+ if (element.getLength() == 0)
+ continue;
+
+ if (hostName.equalsIgnoreAsciiCase( element ))
+ return true;
+
+ if ( 0 == element.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "*" )) ) &&
+ hostName.getLength() >= element.getLength() )
+ {
+ rtl::OUString cmpStr = element.copy( 1 );
+ if ( hostName.matchIgnoreAsciiCase(
+ cmpStr, hostName.getLength() - cmpStr.getLength()) )
+ return true;
+ }
}
return false;
@@ -278,10 +293,34 @@ handleCertificateValidationRequest_(
rRequest.Certificate );
}
+ uno::Sequence< uno::Reference< security::XCertificateExtension > > extensions = rRequest.Certificate->getExtensions();
+ uno::Sequence< security::CertAltNameEntry > altNames;
+ for (sal_Int32 i = 0 ; i < extensions.getLength(); i++){
+ uno::Reference< security::XCertificateExtension >element = extensions[i];
+
+ rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength());
+ if (aId.equals(OID_SUBJECT_ALTERNATIVE_NAME))
+ {
+ uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY );
+ altNames = sanExtension->getAlternativeNames();
+ break;
+ }
+ }
+
+ ::rtl::OUString certHostName = getContentPart( rRequest.Certificate->getSubjectName() );
+ uno::Sequence< ::rtl::OUString > certHostNames(altNames.getLength() + 1);
+
+ certHostNames[0] = certHostName;
+
+ for(int n = 1; n < altNames.getLength(); n++){
+ if (altNames[n].Type == security::ExtAltNameType_DNS_NAME){
+ altNames[n].Value >>= certHostNames[n];
+ }
+ }
+
if ( (!isDomainMatch(
rRequest.HostName,
- getContentPart(
- rRequest.Certificate->getSubjectName()) )) &&
+ certHostNames )) &&
trustCert )
{
trustCert = executeSSLWarnDialog( pParent,
diff --git a/vbahelper/Library_msforms.mk b/vbahelper/Library_msforms.mk
index d0b79c8cfbeb..58a90a7ccd42 100755
--- a/vbahelper/Library_msforms.mk
+++ b/vbahelper/Library_msforms.mk
@@ -50,16 +50,17 @@ $(eval $(call gb_Library_add_linked_libs,msforms,\
comphelper \
cppu \
cppuhelper \
+ sal \
+ sb \
+ sfx \
svl \
svt \
+ svx \
+ stl \
+ tk \
tl \
- sal \
vbahelper \
- sfx \
- svx \
vcl \
- tk \
- sb \
$(gb_STDLIBS) \
))
@@ -78,6 +79,7 @@ $(eval $(call gb_Library_add_exception_objects,msforms,\
vbahelper/source/msforms/vbalistbox \
vbahelper/source/msforms/vbalistcontrolhelper \
vbahelper/source/msforms/vbamultipage \
+ vbahelper/source/msforms/vbanewfont \
vbahelper/source/msforms/vbapages \
vbahelper/source/msforms/vbaprogressbar \
vbahelper/source/msforms/vbaradiobutton \
diff --git a/vbahelper/Library_vbahelper.mk b/vbahelper/Library_vbahelper.mk
index bb2c78b81604..af6b4089ada8 100755
--- a/vbahelper/Library_vbahelper.mk
+++ b/vbahelper/Library_vbahelper.mk
@@ -50,24 +50,27 @@ $(eval $(call gb_Library_set_defs,vbahelper,\
# add libraries to be linked to vbahelper; again these names need to be given as
# specified in Repository.mk
$(eval $(call gb_Library_add_linked_libs,vbahelper,\
+ comphelper \
cppu \
cppuhelper \
- comphelper \
- sb \
- tl \
+ msfilter \
sal \
+ sb \
sfx \
- svt \
- vcl \
+ stl \
svl \
- msfilter \
+ svt \
tk \
+ tl \
+ utl \
+ vcl \
$(gb_STDLIBS) \
))
# add all source files that shall be compiled with exceptions enabled
# the name is relative to $(SRCROOT) and must not contain an extension
$(eval $(call gb_Library_add_exception_objects,vbahelper,\
+ vbahelper/source/vbahelper/collectionbase \
vbahelper/source/vbahelper/vbaapplicationbase \
vbahelper/source/vbahelper/vbacolorformat \
vbahelper/source/vbahelper/vbacommandbar \
diff --git a/vbahelper/Package_inc.mk b/vbahelper/Package_inc.mk
index 6d8033aa5b02..385fbf15a625 100755
--- a/vbahelper/Package_inc.mk
+++ b/vbahelper/Package_inc.mk
@@ -26,6 +26,7 @@
#*************************************************************************
$(eval $(call gb_Package_Package,vbahelper_inc,$(SRCDIR)/vbahelper/inc))
+$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/collectionbase.hxx,vbahelper/collectionbase.hxx))
$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/helperdecl.hxx,vbahelper/helperdecl.hxx))
$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaaccesshelper.hxx,vbahelper/vbaaccesshelper.hxx))
$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaapplicationbase.hxx,vbahelper/vbaapplicationbase.hxx))
@@ -47,5 +48,6 @@ $(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbashaperange.hxx,
$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbashapes.hxx,vbahelper/vbashapes.hxx))
$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbatextframe.hxx,vbahelper/vbatextframe.hxx))
$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbawindowbase.hxx,vbahelper/vbawindowbase.hxx))
+$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/weakreference.hxx,vbahelper/weakreference.hxx))
# vim: set noet sw=4 ts=4:
diff --git a/vbahelper/inc/vbahelper/collectionbase.hxx b/vbahelper/inc/vbahelper/collectionbase.hxx
new file mode 100755
index 000000000000..ebb5bf8f2b9a
--- /dev/null
+++ b/vbahelper/inc/vbahelper/collectionbase.hxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 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_COLLECTIONBASE_HXX
+#define VBAHELPER_COLLECTIONBASE_HXX
+
+#include <vector>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/container/XElementAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <ooo/vba/XCollectionBase.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <vbahelper/vbahelper.hxx>
+
+namespace vbahelper {
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper1< ov::XCollectionBase > CollectionBase_BASE;
+
+/** Base class of VBA objects implementing the VBA collection concept.
+
+ This base class intentionally does not include the interface
+ XHelperInterface supported by all application VBA object. There may be
+ other VBA objects that do not support the special methods provided by
+ XHelperInterface.
+ */
+class VBAHELPER_DLLPUBLIC CollectionBase : public CollectionBase_BASE
+{
+public:
+ /** Enumerates different container types a VBA collection can be based on. */
+ enum ContainerType
+ {
+ /** Container elements are VBA items.
+
+ The initial container contains the final VBA items provided by the
+ VBA collection. No conversion takes place on item access.
+ */
+ CONTAINER_NATIVE_VBA,
+
+ /** Container elements will be converted to VBA items on demand.
+
+ The initial container contains intermediate objects (e.g. UNO
+ objects) which will be converted to VBA items everytime the item is
+ accessed (e.g. item access method, enumeration). Changes in the
+ initial container are reflected by the collection.
+ */
+ CONTAINER_CONVERT_ON_DEMAND,
+ };
+
+ // ------------------------------------------------------------------------
+
+ CollectionBase( const css::uno::Type& rElementType );
+
+ // ------------------------------------------------------------------------
+
+ // attributes
+ virtual sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+ // XElementAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
+ // XDefaultMethod
+ virtual ::rtl::OUString SAL_CALL getDefaultMethodName() throw (css::uno::RuntimeException);
+
+ // ------------------------------------------------------------------------
+
+ /** Associates this collection with the passed UNO container.
+
+ @param rxElementAccess
+ The UNO container with the elements of this collection. Shall
+ support either XIndexAccess or XNameAccess, may support both.
+
+ If the container does not support XIndexAccess, index access is
+ simulated based on the order returned by the function
+ XNameAccess::getElementNames().
+
+ If the container does not support XNameAccess, name access is
+ simulated by iterating the elements via index access and asking the
+ elements for their name via the interface XNamed. If the elements
+ do not support XNamed, the elements cannot be accessed by name.
+
+ @param eContainerType
+ Specifies the type of the passed container.
+ */
+ void initContainer(
+ const css::uno::Reference< css::container::XElementAccess >& rxElementAccess,
+ ContainerType eContainerType ) throw (css::uno::RuntimeException);
+
+ /** Initializes this collection with copies of all elements in the passed
+ temporary STL vector.
+
+ @param rElements
+ The STL vector with the named elements of this collection.
+ @param eContainerType
+ Specifies the type of the passed vector.
+ */
+ void initElements(
+ const ::std::vector< css::uno::Reference< css::container::XNamed > >& rElements,
+ ContainerType eContainerType ) throw (css::uno::RuntimeException);
+
+ /** Initializes this collection with copies of all elements in the passed
+ temporary STL vector.
+
+ @param rElements
+ The STL vector with the named elements of this collection.
+ @param eContainerType
+ Specifies the type of the passed vector.
+ */
+ void initElements(
+ const ::std::vector< css::beans::NamedValue >& rElements,
+ ContainerType eContainerType ) throw (css::uno::RuntimeException);
+
+ /** Returns a VBA implementation object from the passed element.
+
+ If the container type is CONTAINER_NATIVE_VBA, returns the passed
+ object unmodified. If the container type is CONTAINER_CONVERT_ON_DEMAND,
+ calls the virtual function implCreateCollectionItem() that implements
+ creation of the VBA implmentation object.
+
+ @param rElement
+ The container element the VBA implementation object is based on.
+
+ @param rIndex
+ The index or name that has been used to access the item.
+ */
+ css::uno::Any createCollectionItem(
+ const css::uno::Any& rElement,
+ const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
+
+ /** Returns a collection item specified by its one-based item index.
+
+ @param nIndex
+ The one-based index of the collection item.
+ */
+ css::uno::Any getItemByIndex( sal_Int32 nIndex ) throw (css::uno::RuntimeException);
+
+ /** Returns a collection item specified by its name.
+
+ @param rName
+ The name of the collection item.
+ */
+ css::uno::Any getItemByName( const ::rtl::OUString& rName ) throw (css::uno::RuntimeException);
+
+ /** Returns a collection item specified by its index or name.
+
+ @param rIndex
+ The index or name of the collection item. May be empty, in that
+ case the entire collection is returned.
+ */
+ css::uno::Any getAnyItemOrThis( const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
+
+ /** Returns a collection item of a specific type specified by its index or
+ name.
+
+ @param rIndex
+ The index or name of the collection item.
+ */
+ template< typename XType >
+ inline css::uno::Reference< XType > getAnyItem( const css::uno::Any& rIndex ) throw (css::uno::RuntimeException)
+ { css::uno::Any aRet; if( rIndex.hasValue() ) aRet = getAnyItemOrThis( rIndex ); return css::uno::Reference< XType >( aRet, css::uno::UNO_QUERY_THROW ); }
+
+protected:
+ /** Derived classes implement creation of a VBA implementation object from
+ the passed intermediate container element.
+
+ May be kept unimplemented if container type is CONTAINER_NATIVE_VBA.
+
+ @param rElement
+ The container element the VBA implementation object is based on.
+
+ @param rIndex
+ The index or name used to access the item. Can be used by
+ implementations as a hint how to find or convert the VBA object.
+ */
+ virtual css::uno::Any implCreateCollectionItem( const css::uno::Any& rElement, const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
+
+private:
+ css::uno::Reference< css::container::XIndexAccess > mxIndexAccess;
+ css::uno::Reference< css::container::XNameAccess > mxNameAccess;
+ css::uno::Type maElementType;
+ bool mbConvertOnDemand;
+};
+
+// ============================================================================
+
+} // namespace vbahelper
+
+#endif
diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
index 0a402c244ee5..7d21d3ed453b 100644
--- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
@@ -61,7 +61,6 @@ public:
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 css::uno::Any 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 css::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
index 3867825ef586..a0447bde4ef0 100644
--- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
@@ -89,8 +89,8 @@ private:
/** A wrapper that holds a com.sun.star.container.XEnumeration or a
com.sun.star.container.XIndexAccess and provides an enumeration of VBA objects.
- The method nextElement() needs to be implemented by the derived class. This
- class can be used to convert an enumeration or an index container
+ The method createCollectionObject() needs to be implemented by the derived
+ class. This class can be used to convert an enumeration or an index container
containing UNO objects to an enumeration providing the related VBA objects.
*/
class VBAHELPER_DLLPUBLIC SimpleEnumerationBase : public EnumerationHelper_BASE
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
index f08790ab26d2..d2c1a1ad7e29 100644
--- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -38,6 +38,7 @@ class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE
{
protected:
css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::uno::XInterface > mxVBProject;
protected:
virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
index a2a036b86236..3b158feb22e9 100644
--- a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
@@ -29,20 +29,26 @@
#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 <hash_map>
+#include <map>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <cppuhelper/implbase3.hxx>
#include "vbahelper/vbahelper.hxx"
namespace com { namespace sun { namespace star {
+ namespace script { namespace vba { class XVBAModuleInfo; } }
namespace uno { class XComponentContext; }
} } }
// ============================================================================
-typedef ::cppu::WeakImplHelper2< css::script::vba::XVBAEventProcessor, css::lang::XEventListener > VbaEventsHelperBase_BASE;
+typedef ::cppu::WeakImplHelper3<
+ css::script::vba::XVBAEventProcessor,
+ css::document::XEventListener,
+ css::util::XChangesListener > VbaEventsHelperBase_BASE;
class VBAHELPER_DLLPUBLIC VbaEventsHelperBase : public VbaEventsHelperBase_BASE
{
@@ -52,15 +58,24 @@ public:
const css::uno::Reference< css::uno::XComponentContext >& xContext );
virtual ~VbaEventsHelperBase();
- // XVBAEventProcessor
+ // script::vba::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);
+ virtual sal_Bool SAL_CALL processVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::util::VetoException, css::uno::RuntimeException);
- // XEventListener
- virtual void SAL_CALL disposing( const css::lang::EventObject& aSource ) throw (css::uno::RuntimeException);
+ // document::XEventListener
+ virtual void SAL_CALL notifyEvent( const css::document::EventObject& rEvent ) throw (css::uno::RuntimeException);
+
+ // util::XChangesListener
+ virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& rEvent ) throw (css::uno::RuntimeException);
+
+ // lang::XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& rEvent ) throw (css::uno::RuntimeException);
// little helpers ---------------------------------------------------------
+ /** Helper to execute event handlers without throwing any exceptions. */
+ void processVbaEventNoThrow( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs );
+
/** 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( (nIndex < 0) || (nIndex >= rArgs.getLength()) ) throw css::lang::IllegalArgumentException(); }
@@ -73,12 +88,11 @@ public:
protected:
// ------------------------------------------------------------------------
- enum EventHandlerType { EVENTHANDLER_GLOBAL, EVENTHANDLER_DOCUMENT };
struct EventHandlerInfo
{
sal_Int32 mnEventId;
+ sal_Int32 mnModuleType;
::rtl::OUString maMacroName;
- EventHandlerType meType;
sal_Int32 mnCancelIndex;
css::uno::Any maUserData;
};
@@ -86,14 +100,14 @@ protected:
/** Registers a supported event handler.
@param nEventId Event identifier from com.sun.star.script.vba.VBAEventId.
+ @param nModuleType Type of the module containing the event handler.
@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,
+ sal_Int32 nModuleType,
const sal_Char* pcMacroName,
- EventHandlerType eType = EVENTHANDLER_DOCUMENT,
sal_Int32 nCancelIndex = -1,
const css::uno::Any& rUserData = css::uno::Any() );
@@ -125,7 +139,6 @@ protected:
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. */
@@ -134,25 +147,42 @@ protected:
const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException) = 0;
private:
+ typedef ::std::map< sal_Int32, ::rtl::OUString > ModulePathMap;
+
+ /** Starts listening at the document model. */
+ void startListening();
+ /** Stops listening at the document model. */
+ void stopListening();
+
/** 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);
+ const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
- /** Removes this instance from all broadcasters. */
- void stopListening();
+ /** On first call, accesses the Basic library containing the VBA source code. */
+ void ensureVBALibrary() throw (css::uno::RuntimeException);
+
+ /** Returns the type of the Basic module with the specified name. */
+ sal_Int32 getModuleType( const ::rtl::OUString& rModuleName ) throw (css::uno::RuntimeException);
+
+ /** Updates the map containing paths to event handlers for a Basic module. */
+ ModulePathMap& updateModulePathMap( const ::rtl::OUString& rModuleName ) throw (css::uno::RuntimeException);
protected:
css::uno::Reference< css::frame::XModel > mxModel;
SfxObjectShell* mpShell;
private:
- typedef ::std::map< sal_Int32, EventHandlerInfo > EventHandlerMap;
+ typedef ::std::map< sal_Int32, EventHandlerInfo > EventHandlerInfoMap;
+ typedef ::std::hash_map< ::rtl::OUString, ModulePathMap, ::rtl::OUStringHash > EventHandlerPathMap;
- EventHandlerMap maEvents;
+ EventHandlerInfoMap maEventInfos;
+ EventHandlerPathMap maEventPaths;
+ css::uno::Reference< css::script::vba::XVBAModuleInfo > mxModuleInfos;
+ ::rtl::OUString maLibraryName;
bool mbDisposed;
};
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index a55cd790197d..00dfe585c9d7 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -68,7 +68,12 @@ namespace ooo
throw css::lang::IllegalArgumentException();
return aSomething;
}
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell );
+
+ class XHelperInterface;
+
+ /** Returns the VBA document implementation object representing the passed UNO document model. */
+ VBAHELPER_DLLPUBLIC css::uno::Reference< XHelperInterface > getVBADocument( const css::uno::Reference< css::frame::XModel >& xModel );
+ VBAHELPER_DLLPUBLIC css::uno::Reference< XHelperInterface > 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);
@@ -95,18 +100,32 @@ namespace ooo
VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection );
VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* );
- /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value.
- Returns false, if the Any is empty or contains an incompatible type. */
- VBAHELPER_DLLPUBLIC bool extractBoolFromAny( bool& rbValue, const css::uno::Any& rAny );
- /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value.
+ /** Extracts a 32-bit integer value from the passed Any, which may contain an integer or floating-point value.
+ Throws, if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC sal_Int32 extractIntFromAny( const css::uno::Any& rAny ) throw (css::uno::RuntimeException);
+ /** Extracts a 32-bit integer value from the passed Any, which may contain an integer or floating-point value.
+ Returns nDefault, if rAny is empty. Throws, if the Any contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC sal_Int32 extractIntFromAny( const css::uno::Any& rAny, sal_Int32 nDefault ) throw (css::uno::RuntimeException);
+
+ /** Extracts a boolean value from the passed Any, which may contain a Boolean or an integer or floating-point value.
Throws, if the Any is empty or contains an incompatible type. */
VBAHELPER_DLLPUBLIC bool extractBoolFromAny( const css::uno::Any& rAny ) throw (css::uno::RuntimeException);
+ /** Extracts a boolean value from the passed Any, which may contain a Boolean or an integer or floating-point value.
+ Returns bDefault, if rAny is empty. Throws, if the Any contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC bool extractBoolFromAny( const css::uno::Any& rAny, bool bDefault ) throw (css::uno::RuntimeException);
+
+ /** Extracts a string from the passed Any, which may contain a Boolean, a value, or a string.
+ Throws, if the Any is empty or contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC ::rtl::OUString extractStringFromAny( const css::uno::Any& rAny, bool bUppercaseBool = false ) throw (css::uno::RuntimeException);
+ /** Extracts a string from the passed Any, which may contain a Boolean, a value, or a string.
+ Returns rDefault, if rAny is empty. Throws, if the Any contains an incompatible type. */
+ VBAHELPER_DLLPUBLIC ::rtl::OUString extractStringFromAny( const css::uno::Any& rAny, const ::rtl::OUString& rDefault, bool bUppercaseBool = false ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
- VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
- VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
- VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( const css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC double PointsToPixels( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC double PixelsToPoints( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical);
VBAHELPER_DLLPUBLIC sal_Int32 PointsToHmm( double fPoints );
VBAHELPER_DLLPUBLIC double HmmToPoints( sal_Int32 nHmm );
VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
@@ -142,14 +161,21 @@ class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace
{
public:
virtual ~AbstractGeometryAttributes() {}
- virtual double getLeft() = 0;
+ virtual double getLeft() const = 0;
virtual void setLeft( double ) = 0;
- virtual double getTop() = 0;
+ virtual double getTop() const = 0;
virtual void setTop( double ) = 0;
- virtual double getHeight() = 0;
+ virtual double getHeight() const = 0;
virtual void setHeight( double ) = 0;
- virtual double getWidth() = 0;
+ virtual double getWidth() const = 0;
virtual void setWidth( double ) = 0;
+
+ virtual double getInnerHeight() const { return 0.0; }
+ virtual void setInnerHeight( double ) {}
+ virtual double getInnerWidth() const { return 0.0; }
+ virtual void setInnerWidth( double ) {}
+ virtual double getOffsetX() const { return 0.0; }
+ virtual double getOffsetY() const { return 0.0; }
};
namespace msforms {
@@ -163,20 +189,13 @@ protected:
public:
ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
- double getHeight();
-
- void setHeight(double _fheight) throw ( css::script::BasicErrorException );
-
- double getWidth();
-
+ double getHeight() const;
+ void setHeight(double _fheight) throw ( css::script::BasicErrorException );
+ double getWidth() const;
void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
-
- double getLeft();
-
+ double getLeft() const;
void setLeft(double _fLeft);
-
- double getTop();
-
+ double getTop() const;
void setTop(double _fTop);
};
@@ -185,13 +204,13 @@ class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeom
std::auto_ptr< ShapeHelper > m_pShapeHelper;
public:
ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape );
- virtual double getLeft();
+ virtual double getLeft() const;
virtual void setLeft( double nLeft );
- virtual double getTop();
+ virtual double getTop() const;
virtual void setTop( double nTop );
- virtual double getHeight();
+ virtual double getHeight() const;
virtual void setHeight( double nHeight );
- virtual double getWidth();
+ virtual double getWidth() const;
virtual void setWidth( double nWidth);
virtual ~ConcreteXShapeGeometryAttributes();
};
@@ -202,19 +221,39 @@ public:
#define VBA_WIDTH "Width"
class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes
{
+public:
+ UserFormGeometryHelper(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::awt::XControl >& xControl,
+ double fOffsetX, double fOffsetY );
+ virtual double getLeft() const;
+ virtual void setLeft( double fLeft );
+ virtual double getTop() const;
+ virtual void setTop( double fTop );
+ virtual double getWidth() const;
+ virtual void setWidth( double fWidth );
+ virtual double getHeight() const;
+ virtual void setHeight( double fHeight );
+ virtual double getInnerWidth() const;
+ virtual void setInnerWidth( double fWidth );
+ virtual double getInnerHeight() const;
+ virtual void setInnerHeight( double fHeight );
+ virtual double getOffsetX() const;
+ virtual double getOffsetY() const;
+
+private:
+ double implGetPos( bool bPosY ) const;
+ void implSetPos( double fPos, bool bPosY );
+ double implGetSize( bool bHeight, bool bOuter ) const;
+ void implSetSize( double fSize, bool bHeight, bool bOuter );
+
+private:
css::uno::Reference< css::awt::XWindow > mxWindow;
+ css::uno::Reference< css::beans::XPropertySet > mxModelProps;
+ css::uno::Reference< css::awt::XUnitConversion > mxUnitConv;
+ double mfOffsetX;
+ double mfOffsetY;
sal_Bool mbDialog;
-
-public:
- UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
- virtual double getLeft();
- virtual void setLeft( double nLeft );
- virtual double getTop();
- virtual void setTop( double nTop );
- virtual double getHeight();
- virtual void setHeight( double nHeight );
- virtual double getWidth();
- virtual void setWidth( double nWidth);
};
class VBAHELPER_DLLPUBLIC ContainerUtilities
@@ -256,8 +295,8 @@ public:
virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw ( css::uno::RuntimeException );
};
- } // openoffice
-} // org
+ } // vba
+} // ooo
namespace ov = ooo::vba;
diff --git a/vbahelper/inc/vbahelper/vbawindowbase.hxx b/vbahelper/inc/vbahelper/vbawindowbase.hxx
index f7e68273343f..40119b4ea7a3 100644
--- a/vbahelper/inc/vbahelper/vbawindowbase.hxx
+++ b/vbahelper/inc/vbahelper/vbawindowbase.hxx
@@ -25,24 +25,30 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef VBA_WINDOWBASE_HXX
#define VBA_WINDOWBASE_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <ooo/vba/XWindowBase.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
+#include <ooo/vba/XWindowBase.hpp>
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/frame/XController.hpp>
#include <vbahelper/vbahelperinterface.hxx>
-typedef InheritedHelperInterfaceImpl1<ov::XWindowBase > WindowBaseImpl_BASE;
+typedef InheritedHelperInterfaceImpl1< ov::XWindowBase > WindowBaseImpl_BASE;
class VBAHELPER_DLLPUBLIC VbaWindowBase : public WindowBaseImpl_BASE
{
-protected:
- css::uno::Reference< css::frame::XModel > m_xModel;
public:
- VbaWindowBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
- VbaWindowBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
+ VbaWindowBase(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ const css::uno::Reference< css::frame::XController >& xController )
+ throw (css::uno::RuntimeException);
+ VbaWindowBase(
+ css::uno::Sequence< css::uno::Any > const& aArgs,
+ css::uno::Reference< css::uno::XComponentContext > const& xContext )
+ throw (css::uno::RuntimeException);
// XWindowBase
virtual sal_Int32 SAL_CALL getHeight() throw (css::uno::RuntimeException) ;
@@ -59,6 +65,19 @@ public:
// XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+protected:
+ css::uno::Reference< css::frame::XController > getController() throw (css::uno::RuntimeException);
+ css::uno::Reference< css::awt::XWindow > getWindow() throw (css::uno::RuntimeException);
+ css::uno::Reference< css::awt::XWindow2 > getWindow2() throw (css::uno::RuntimeException);
+
+ css::uno::Reference< css::frame::XModel > m_xModel;
+
+private:
+ void construct( const css::uno::Reference< css::frame::XController >& xController ) throw (css::uno::RuntimeException);
+
+ css::uno::WeakReference< css::frame::XController > m_xController;
+ css::uno::WeakReference< css::awt::XWindow > m_xWindow;
};
#endif //VBA_WINDOWBASE_HXX
diff --git a/vbahelper/inc/vbahelper/weakreference.hxx b/vbahelper/inc/vbahelper/weakreference.hxx
new file mode 100755
index 000000000000..661f3bc5d73e
--- /dev/null
+++ b/vbahelper/inc/vbahelper/weakreference.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 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_WEAKREFERENCE_HXX
+#define VBAHELPER_WEAKREFERENCE_HXX
+
+#include <cppuhelper/weakref.hxx>
+#include <rtl/ref.hxx>
+
+namespace vbahelper {
+
+// ============================================================================
+
+/** A weak reference holding any UNO implementation object.
+
+ The held object must implement the ::com::sun::star::uno::XWeak interface.
+
+ In difference to the ::com::sun::star::uno::WeakReference<> implementation
+ from cppuhelper/weakref.hxx, the class type of this weak reference is not
+ restricted to UNO interface types, but can be used for any C++ class type
+ implementing the XWeak interface somehow (e.g. ::cppu::WeakImplHelperN<>,
+ ::cppu::ImplInheritanceHelperN<>, etc.).
+ */
+template< typename ObjectType >
+class WeakReference
+{
+public:
+ /** Default constructor. Creates an empty weak reference.
+ */
+ inline explicit WeakReference() SAL_THROW( () ) : mpObject( 0 ) {}
+
+ /** Initializes this weak reference with the passed reference to an object.
+ */
+ inline explicit WeakReference( const ::rtl::Reference< ObjectType >& rxObject ) SAL_THROW( () ) :
+ mxWeakRef( rxObject.get() ), mpObject( rxObject.get() ) {}
+
+ /** Releases this weak reference and takes over the passed reference.
+ */
+ inline WeakReference& SAL_CALL operator=( const ::rtl::Reference< ObjectType >& rxObject ) SAL_THROW( () )
+ {
+ mxWeakRef = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak >( rxObject.get() );
+ mpObject = rxObject.get();
+ return *this;
+ }
+
+ /** Gets an RTL reference to the referenced object.
+
+ @return Reference or null, if the weakly referenced object is gone.
+ */
+ inline SAL_CALL operator ::rtl::Reference< ObjectType >() SAL_THROW( () )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak > xRef = mxWeakRef;
+ ::rtl::Reference< ObjectType > xObject;
+ if( xRef.is() )
+ xObject = mpObject;
+ else
+ mpObject = 0;
+ return xObject;
+ }
+
+private:
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XWeak > mxWeakRef;
+ ObjectType* mpObject;
+};
+
+// ============================================================================
+
+} // namespace vbahelper
+
+#endif
diff --git a/vbahelper/source/msforms/vbabutton.cxx b/vbahelper/source/msforms/vbabutton.cxx
index d7e5249b3b3b..f0763330c8e2 100644
--- a/vbahelper/source/msforms/vbabutton.cxx
+++ b/vbahelper/source/msforms/vbabutton.cxx
@@ -25,8 +25,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbabutton.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -52,6 +53,56 @@ ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
+sal_Bool SAL_CALL ScVbaButton::getAutoSize() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaButton::setAutoSize( sal_Bool /*bAutoSize*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaButton::getCancel() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaButton::getDefault() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaButton::getBackColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaButton::setBackColor( sal_Int32 /*nBackColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaButton::getForeColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaButton::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaButton::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbabutton.hxx b/vbahelper/source/msforms/vbabutton.hxx
index e30605edb897..e999acf26ed4 100644
--- a/vbahelper/source/msforms/vbabutton.hxx
+++ b/vbahelper/source/msforms/vbabutton.hxx
@@ -28,12 +28,12 @@
#ifndef SC_VBA_BUTTON_HXX
#define SC_VBA_BUTTON_HXX
#include <cppuhelper/implbase1.hxx>
-#include <ooo/vba/msforms/XButton.hpp>
+#include <ooo/vba/msforms/XCommandButton.hpp>
#include "vbacontrol.hxx"
#include <vbahelper/vbahelper.hxx>
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE;
+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XCommandButton > ButtonImpl_BASE;
class ScVbaButton : public ButtonImpl_BASE
{
@@ -42,6 +42,17 @@ public:
// Attributes
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoSize( sal_Bool bAutoSize ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getCancel() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCancel( sal_Bool bCancel ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getDefault() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefault( sal_Bool bDefault ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBackColor( sal_Int32 nBackColor ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setForeColor( sal_Int32 nForeColor ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx
index cc026bd70c48..290cdd1a7e33 100644
--- a/vbahelper/source/msforms/vbacheckbox.cxx
+++ b/vbahelper/source/msforms/vbacheckbox.cxx
@@ -25,9 +25,10 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbacheckbox.hxx"
+#include "vbanewfont.hxx"
#include <vbahelper/helperdecl.hxx>
-#include <vector>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -88,6 +89,12 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
if ( nValue != nOldValue )
fireClickEvent();
}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaCheckbox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaCheckbox::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx
index 10af39e64ea3..e6cc4fe47453 100644
--- a/vbahelper/source/msforms/vbacheckbox.hxx
+++ b/vbahelper/source/msforms/vbacheckbox.hxx
@@ -44,6 +44,7 @@ public:
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// XDefaultProperty
rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
//XHelperInterface
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index 10910f4ef01b..6f5049c548e7 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -25,11 +25,19 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbacombobox.hxx"
#include <vector>
#include <filter/msfilter/msvbahelper.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbmod.hxx>
+#include "vbanewfont.hxx"
+#include <ooo/vba/msforms/fmStyle.hpp>
+#include <ooo/vba/msforms/fmDropButtonStyle.hpp>
+#include <ooo/vba/msforms/fmDragBehavior.hpp>
+#include <ooo/vba/msforms/fmEnterFieldBehavior.hpp>
+#include <ooo/vba/msforms/fmListStyle.hpp>
+#include <ooo/vba/msforms/fmTextAlign.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -45,9 +53,17 @@ const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataF
ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType )
{
- mpListHelper.reset( new ListControlHelper( m_xProps ) );
- // grab the default value property name
- m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
+ mpListHelper.reset( new ListControlHelper( m_xProps ) );
+ try
+ {
+ // grab the default value property name
+ m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
+ }
+ catch( uno::Exception& )
+ {
+ }
+ if( sSourceName.getLength() == 0 )
+ sSourceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) );
}
// Attributes
@@ -114,22 +130,13 @@ void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
rtl::OUString sOldValue, sNewValue;
- getValue() >>= sOldValue;
-
- uno::Any aConverted = _value;
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- try
- {
- aConverted = xConverter.is() ? xConverter->convertTo( _value, getCppuType( static_cast< const rtl::OUString* >(0) ) ) : aConverted;
- }
- catch( const uno::Exception& /*ex*/ )
- {
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid value" ) ), uno::Reference< uno::XInterface >() );
- }
+ // booleans are converted to uppercase strings
+ sOldValue = extractStringFromAny( getValue(), ::rtl::OUString(), true );
+ // booleans are converted to uppercase strings
+ sNewValue = extractStringFromAny( _value, ::rtl::OUString(), true );
- m_xProps->setPropertyValue( sSourceName, aConverted );
+ m_xProps->setPropertyValue( sSourceName, uno::Any( sNewValue ) );
- aConverted >>= sNewValue;
if ( sNewValue != sOldValue )
{
// If the new value is in current list, we should fire click event, otherwise fire the change event.
@@ -172,22 +179,22 @@ ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex )
void SAL_CALL
ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
- {
+{
mpListHelper->removeItem( index );
}
void SAL_CALL
ScVbaComboBox::Clear( ) throw (uno::RuntimeException)
- {
+{
mpListHelper->Clear();
- }
+}
void SAL_CALL
ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException)
{
ScVbaControl::setRowSource( _rowsource );
mpListHelper->setRowSource( _rowsource );
- }
+}
sal_Int32 SAL_CALL
ScVbaComboBox::getListCount() throw (uno::RuntimeException)
@@ -199,7 +206,71 @@ uno::Any SAL_CALL
ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
{
return mpListHelper->List( pvargIndex, pvarColumn );
- }
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmStyle::fmStyleDropDownCombo;
+}
+
+void SAL_CALL ScVbaComboBox::setStyle( sal_Int32 /*nStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getDropButtonStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmDropButtonStyle::fmDropButtonStyleArrow;
+}
+
+void SAL_CALL ScVbaComboBox::setDropButtonStyle( sal_Int32 /*nDropButtonStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getDragBehavior() throw (uno::RuntimeException)
+{
+ return msforms::fmDragBehavior::fmDragBehaviorDisabled;
+}
+
+void SAL_CALL ScVbaComboBox::setDragBehavior( sal_Int32 /*nDragBehavior*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getEnterFieldBehavior() throw (uno::RuntimeException)
+{
+ return msforms::fmEnterFieldBehavior::fmEnterFieldBehaviorSelectAll;
+}
+
+void SAL_CALL ScVbaComboBox::setEnterFieldBehavior( sal_Int32 /*nEnterFieldBehavior*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getListStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmListStyle::fmListStylePlain;
+}
+
+void SAL_CALL ScVbaComboBox::setListStyle( sal_Int32 /*nListStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getTextAlign() throw (uno::RuntimeException)
+{
+ return msforms::fmTextAlign::fmTextAlignLeft;
+}
+
+void SAL_CALL ScVbaComboBox::setTextAlign( sal_Int32 /*nTextAlign*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getTextLength() throw (uno::RuntimeException)
+{
+ return getText().getLength();
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaComboBox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
rtl::OUString&
ScVbaComboBox::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx
index fa4ee10d89d4..e2b1716e4685 100644
--- a/vbahelper/source/msforms/vbacombobox.hxx
+++ b/vbahelper/source/msforms/vbacombobox.hxx
@@ -59,6 +59,20 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStyle( sal_Int32 nStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getDropButtonStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDropButtonStyle( sal_Int32 nDropButtonStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getDragBehavior() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDragBehavior( sal_Int32 nDragBehavior ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getEnterFieldBehavior() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEnterFieldBehavior( sal_Int32 nEnterFieldBehavior ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getListStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setListStyle( sal_Int32 nListStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTextAlign() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTextAlign( sal_Int32 nTextAlign ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTextLength() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// Methods
virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 2d100caa2e54..445fc88713e8 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -48,8 +48,8 @@
#ifdef VBA_OOBUILD_HACK
#include <svtools/bindablecontrolhelper.hxx>
#endif
-#include"vbacontrol.hxx"
-#include"vbacombobox.hxx"
+#include "vbacontrol.hxx"
+#include "vbacombobox.hxx"
#include "vbabutton.hxx"
#include "vbalabel.hxx"
#include "vbatextbox.hxx"
@@ -411,18 +411,6 @@ void SAL_CALL ScVbaControl::setTag( const ::rtl::OUString& aTag )
m_aControlTag = aTag;
}
-::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 nForeColor = -1;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor;
- return OORGBToXLRGB( nForeColor );
-}
-
-void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
-{
- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
-}
-
void ScVbaControl::fireEvent( script::ScriptEvent& evt )
{
uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
@@ -491,24 +479,21 @@ void ScVbaControl::fireClickEvent()
fireEvent( evt );
}
-//ScVbaControlFactory
-
-ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel )
+sal_Int32 SAL_CALL ScVbaControl::getTabIndex() throw (uno::RuntimeException)
{
+ return 1;
}
-ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
+void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::RuntimeException)
{
- uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
- if ( xControlShape.is() ) // form controls
- return createControl( xControlShape, xParent );
- uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY );
- if ( !xControl.is() )
- throw uno::RuntimeException(); // really we should be more informative
- return createControl( xControl, xParent );
}
-ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException)
+//ScVbaControlFactory
+
+/*static*/ uno::Reference< msforms::XControl > ScVbaControlFactory::createShapeControl(
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< drawing::XControlShape >& xControlShape,
+ const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW );
sal_Int32 nClassId = -1;
@@ -519,84 +504,87 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
switch( nClassId )
{
case form::FormComponentType::COMBOBOX:
- return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaComboBox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::COMMANDBUTTON:
-
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
- if ( bToggle )
- return new ScVbaToggleButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
- else
- return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-
+ return new ScVbaButton( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::FIXEDTEXT:
- return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaLabel( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::TEXTFIELD:
- return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaTextBox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::CHECKBOX:
- return new ScVbaCheckbox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaCheckbox( xVbaParent, m_xContext, xControlShape, m_xModel, xGeoHelper.release() );
case form::FormComponentType::RADIOBUTTON:
- return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaRadioButton( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::LISTBOX:
- return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaListBox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::SPINBUTTON:
- return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaSpinButton( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::IMAGECONTROL:
- return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
- default:
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "Donot support this Control Type." )), uno::Reference< uno::XInterface >() );
+ return new ScVbaImage( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
}
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() );
}
-ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
+/*static*/ uno::Reference< msforms::XControl > ScVbaControlFactory::createUserformControl(
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< awt::XControl >& xControl,
+ const uno::Reference< awt::XControl >& xDialog,
+ const uno::Reference< frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) throw (uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW );
- ScVbaControl* pControl = NULL;
+ uno::Reference< msforms::XControl > xVBAControl;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
+ ::std::auto_ptr< UserFormGeometryHelper > xGeoHelper( new UserFormGeometryHelper( xContext, xControl, fOffsetX, fOffsetY ) );
+
if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
- pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaCheckbox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
- pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaRadioButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
- pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
+ xVBAControl.set( new ScVbaTextBox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), true ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
{
sal_Bool bToggle = sal_False;
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
if ( bToggle )
- pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaToggleButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else
- pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
}
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
- pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
+ xVBAControl.set( new ScVbaComboBox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), true ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaListBox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaLabel( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
- pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaImage( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
- pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaProgressBar( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaFrame( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), xDialog ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
- pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaScrollBar( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
- pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
+ xVBAControl.set( new ScVbaMultiPage( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), xDialog ) );
+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
+ xVBAControl.set( new ScVbaSpinButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) )
+ xVBAControl.set( new VbaSystemAXControl( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
// #FIXME implement a page control
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) )
- pControl = new ScVbaControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaControl( xVbaParent, m_xContext, xControl, m_xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) )
- pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
- pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) )
- pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
- else
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported control ")), uno::Reference< uno::XInterface >() );
- return pControl;
+ xVBAControl.set( new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, xGeoHelper.release() ) );
+ if( xVBAControl.is() )
+ return xVBAControl;
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() );
}
rtl::OUString&
@@ -618,8 +606,6 @@ ScVbaControl::getServiceNames()
return aServiceNames;
}
-
-
typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE;
class ControlProviderImpl : public ControlProvider_BASE
{
@@ -627,7 +613,6 @@ class ControlProviderImpl : public ControlProvider_BASE
public:
ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {}
virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
- virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
};
uno::Reference< msforms::XControl > SAL_CALL
@@ -635,10 +620,7 @@ ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape
{
uno::Reference< msforms::XControl > xControlToReturn;
if ( xControlShape.is() )
- {
- ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner );
- xControlToReturn.set( controlFactory.createControl( xDocOwner ) );
- }
+ xControlToReturn = ScVbaControlFactory::createShapeControl( m_xCtx, xControlShape, xDocOwner );
return xControlToReturn;
}
@@ -647,13 +629,7 @@ ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl
{
uno::Reference< msforms::XControl > xControlToReturn;
if ( xControl.is() && xDialog.is() )
- {
-
- ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner );
- xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) );
- ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() );
- pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) );
- }
+ xControlToReturn = ScVbaControlFactory::createUserformControl( m_xCtx, xControl, xDialog, xDocOwner, 0.0, 0.0 );
return xControlToReturn;
}
diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
index 0f7d171a4eb8..9076a3e38071 100644
--- a/vbahelper/source/msforms/vbacontrol.hxx
+++ b/vbahelper/source/msforms/vbacontrol.hxx
@@ -105,6 +105,8 @@ public:
virtual void SAL_CALL setControlTipText( const rtl::OUString& ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTag() throw (css::uno::RuntimeException);
virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTabIndex() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTabIndex( sal_Int32 nTabIndex ) throw (css::uno::RuntimeException);
//remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
virtual void removeResouce() throw( css::uno::RuntimeException );
virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
@@ -118,15 +120,21 @@ public:
class ScVbaControlFactory
{
public:
- ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel );
- ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException );
+ static css::uno::Reference< ov::msforms::XControl > createShapeControl(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::drawing::XControlShape >& xControlShape,
+ const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
+
+ static css::uno::Reference< ov::msforms::XControl > createUserformControl(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::awt::XControl >& xControl,
+ const css::uno::Reference< css::awt::XControl >& xDialog,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) throw (css::uno::RuntimeException);
+
private:
- ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
- ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::uno::XInterface > m_xControl;
- css::uno::Reference< css::frame::XModel > m_xModel;
+ ScVbaControlFactory();
+ ~ScVbaControlFactory();
};
#endif//SC_VBA_CONTROL_HXX
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 52340642fb64..309ff71e929f 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -28,11 +28,16 @@
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/lang/WrappedTargetException.hpp>
#include "vbacontrols.hxx"
+#include "vbacontrol.hxx"
#include <cppuhelper/implbase2.hxx>
#include <ooo/vba//XControlProvider.hpp>
#include <boost/unordered_map.hpp>
@@ -166,11 +171,28 @@ class ControlsEnumWrapper : public EnumerationHelper_BASE
uno::Reference<uno::XComponentContext > m_xContext;
uno::Reference<container::XIndexAccess > m_xIndexAccess;
uno::Reference<awt::XControl > m_xDlg;
+ uno::Reference< frame::XModel > m_xModel;
+ double mfOffsetX;
+ double mfOffsetY;
sal_Int32 nIndex;
public:
- ControlsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< awt::XControl >& xDlg ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), m_xDlg( xDlg ), nIndex( 0 ) {}
+ ControlsEnumWrapper(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< container::XIndexAccess >& xIndexAccess,
+ const uno::Reference< awt::XControl >& xDlg,
+ const uno::Reference< frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) :
+ m_xParent( xParent ),
+ m_xContext( xContext),
+ m_xIndexAccess( xIndexAccess ),
+ m_xDlg( xDlg ),
+ m_xModel( xModel ),
+ mfOffsetX( fOffsetX ),
+ mfOffsetY( fOffsetY ),
+ nIndex( 0 ) {}
virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
{
@@ -181,14 +203,12 @@ public:
{
if ( nIndex < m_xIndexAccess->getCount() )
{
- uno::Reference< frame::XModel > xModel;
uno::Reference< awt::XControl > xControl;
m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl;
- uno::Reference<lang::XMultiComponentFactory > xServiceManager( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), m_xContext ), uno::UNO_QUERY_THROW );
-
- uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, m_xDlg, xModel ) );
+ uno::Reference< msforms::XControl > xVBAControl;
+ if ( xControl.is() && m_xDlg.is() )
+ xVBAControl = ScVbaControlFactory::createUserformControl( m_xContext, xControl, m_xDlg, m_xModel, mfOffsetX, mfOffsetY );
return uno::makeAny( xVBAControl );
}
throw container::NoSuchElementException();
@@ -203,17 +223,24 @@ lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg )
return new ControlArrayWrapper( xDlg );
}
-ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
- const css::uno::Reference< awt::XControl >& xDialog )
- : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) )
+ScVbaControls::ScVbaControls(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const css::uno::Reference< awt::XControl >& xDialog,
+ const uno::Reference< frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) :
+ ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) ),
+ mxDialog( xDialog ),
+ mxModel( xModel ),
+ mfOffsetX( fOffsetX ),
+ mfOffsetY( fOffsetY )
{
- mxDialog.set( xDialog, uno::UNO_QUERY );
}
uno::Reference< container::XEnumeration >
ScVbaControls::createEnumeration() throw (uno::RuntimeException)
{
- uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog ) );
+ uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog, mxModel, mfOffsetX, mfOffsetY ) );
if ( !xEnum.is() )
throw uno::RuntimeException();
return xEnum;
@@ -223,15 +250,9 @@ uno::Any
ScVbaControls::createCollectionObject( const css::uno::Any& aSource )
{
// Create control from awt::XControl
- uno::Reference< awt::XControl > xControl;
- aSource >>= xControl;
- uno::Reference< frame::XModel > xModel;
- uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW );
-
- uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, mxDialog, xModel ) );
-
- return uno::makeAny( xVBAControl );
+ uno::Reference< awt::XControl > xControl( aSource, uno::UNO_QUERY_THROW );
+ uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, mxDialog, mxModel, mfOffsetX, mfOffsetY );
+ return uno::Any( xVBAControl );
}
void SAL_CALL
@@ -274,23 +295,117 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
aNewName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Control" ) );
sal_Int32 nInd = 0;
- while( xDialogContainer->hasByName( aNewName ) && nInd < SAL_MAX_INT32 )
+ while( xDialogContainer->hasByName( aNewName ) && (nInd < SAL_MAX_INT32) )
{
aNewName = aComServiceName;
- aNewName += ::rtl::OUString::valueOf( nInd );
+ aNewName += ::rtl::OUString::valueOf( nInd++ );
}
}
+ double fDefWidth = 72.0, fDefHeight = 18.0;
if ( aComServiceName.getLength() )
{
- uno::Reference< awt::XControlModel > xNewModel( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.custom.awt.UnoControlSystemAXContainerModel" ) ) ), uno::UNO_QUERY_THROW );
+ // create a UNO control model based on the passed control type
+ uno::Reference< awt::XControlModel > xNewModel;
+ bool bFontSupport = false;
+ bool bNativeAX = false;
+ if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.CommandButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 24.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.Label.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedTextModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.Image.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlImageControlModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 72.0;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.CheckBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCheckBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 108.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.OptionButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlRadioButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 108.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.TextBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ListBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlListBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ComboBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlComboBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xProps( xNewModel, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dropdown" ) ), uno::Any( true ) );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ToggleButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xProps( xNewModel, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Toggle" ) ), uno::Any( true ) );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.Frame.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlGroupBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 216.0; fDefHeight = 144.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.SpinButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlSpinButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 12.75; fDefHeight = 25.5;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ScrollBar.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 12.75; fDefHeight = 63.8;
+ }
+ else
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.custom.awt.UnoControlSystemAXContainerModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bNativeAX = true;
+ }
+ // need to set a few font properties to get rid of the default DONT_KNOW values
+ if( bFontSupport )
+ {
+ uno::Reference< beans::XPropertySet > xModelProps( xNewModel, uno::UNO_QUERY_THROW );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontName" ) ), uno::Any( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Tahoma" ) ) ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight" ) ), uno::Any( float( 8.0 ) ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ), uno::Any( awt::FontWeight::NORMAL ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontSlant" ) ), uno::Any( awt::FontSlant_NONE ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline" ) ), uno::Any( awt::FontUnderline::NONE ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout" ) ), uno::Any( awt::FontStrikeout::NONE ) );
+ }
xDialogContainer->insertByName( aNewName, uno::makeAny( xNewModel ) );
uno::Reference< awt::XControlContainer > xControlContainer( mxDialog, uno::UNO_QUERY_THROW );
xNewControl = xControlContainer->getControl( aNewName );
- try
+ if( bNativeAX ) try
{
uno::Reference< script::XInvocation > xControlInvoke( xNewControl, uno::UNO_QUERY_THROW );
@@ -312,6 +427,11 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
UpdateCollectionIndex( lcl_controlsWrapper( mxDialog ) );
aResult <<= xNewControl;
aResult = createCollectionObject( aResult );
+ uno::Reference< msforms::XControl > xVBAControl( aResult, uno::UNO_QUERY_THROW );
+ if( fDefWidth > 0.0 )
+ xVBAControl->setWidth( fDefWidth );
+ if( fDefHeight > 0.0 )
+ xVBAControl->setHeight( fDefHeight );
}
else
throw uno::RuntimeException();
@@ -389,23 +509,6 @@ ScVbaControls::getElementType() throw (uno::RuntimeException)
{
return ooo::vba::msforms::XControl::static_type(0);
}
-rtl::OUString&
-ScVbaControls::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControls") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaControls::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Controls" ) );
- }
- return aServiceNames;
-}
+VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaControls, "ooo.vba.msforms.Controls" )
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacontrols.hxx b/vbahelper/source/msforms/vbacontrols.hxx
index c525cb49297c..50aaae92f8f5 100644
--- a/vbahelper/source/msforms/vbacontrols.hxx
+++ b/vbahelper/source/msforms/vbacontrols.hxx
@@ -39,19 +39,17 @@ typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE;
class ScVbaControls : public ControlsImpl_BASE
{
- css::uno::Reference< css::awt::XControl > mxDialog;
-
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
public:
- ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::awt::XControl >& xDialog );
+ ScVbaControls(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::awt::XControl >& xDialog,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY );
// XControls
virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL Add( const ::com::sun::star::uno::Any& Object, const ::com::sun::star::uno::Any& StringKey, const ::com::sun::star::uno::Any& Before, const ::com::sun::star::uno::Any& After ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL Remove( const ::com::sun::star::uno::Any& StringKeyOrIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Object, const css::uno::Any& StringKey, const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Remove( const css::uno::Any& StringKeyOrIndex ) throw (css::uno::RuntimeException);
// XEnumerationAccess
virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
@@ -60,7 +58,16 @@ public:
// ScVbaCollectionBaseImpl
virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ // XHelperInterface
+ VBAHELPER_DECL_XHELPERINTERFACE
+
+private:
+ css::uno::Reference< css::awt::XControl > mxDialog;
+ css::uno::Reference< css::frame::XModel > mxModel;
+ double mfOffsetX;
+ double mfOffsetY;
};
+
#endif //SC_VBA_OLEOBJECTS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx
index 09d3b3c7fbd5..f108807a1bfb 100644
--- a/vbahelper/source/msforms/vbaframe.cxx
+++ b/vbahelper/source/msforms/vbaframe.cxx
@@ -25,37 +25,48 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbaframe.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
+#include "vbacontrols.hxx"
+#include <ooo/vba/msforms/fmBorderStyle.hpp>
+#include <ooo/vba/msforms/fmSpecialEffect.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
+
+ScVbaFrame::ScVbaFrame(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< uno::XInterface >& xControl,
+ const uno::Reference< frame::XModel >& xModel,
+ ov::AbstractGeometryAttributes* pGeomHelper,
+ const css::uno::Reference< css::awt::XControl >& xDialog ) :
+ FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ),
+ mxDialog( xDialog )
{
}
-// Attributes
-rtl::OUString SAL_CALL
-ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
+// XFrame attributes
+
+rtl::OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
{
rtl::OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label;
return Label;
}
-void SAL_CALL
-ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
{
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
-uno::Any SAL_CALL
-ScVbaFrame::getValue() throw (css::uno::RuntimeException)
+sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException)
{
- return uno::makeAny( getCaption() );
+ return msforms::fmSpecialEffect::fmSpecialEffectEtched;
}
void SAL_CALL
@@ -77,36 +88,40 @@ void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::co
}
-rtl::OUString SAL_CALL
-ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
+void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException)
{
- //FIXME: seems not support?
- return rtl::OUString();
}
-void SAL_CALL
-ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
+sal_Int32 SAL_CALL ScVbaFrame::getBorderStyle() throw (uno::RuntimeException)
{
- //FIXME: seems not support?
+ return msforms::fmBorderStyle::fmBorderStyleNone;
}
-rtl::OUString&
-ScVbaFrame::getServiceImplName()
+void SAL_CALL ScVbaFrame::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException)
{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
- return sImplName;
}
-uno::Sequence< rtl::OUString >
-ScVbaFrame::getServiceNames()
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaFrame::getFont() throw (uno::RuntimeException)
{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
- }
- return aServiceNames;
+ return new VbaNewFont( this, mxContext, m_xProps );
}
+// XFrame methods
+
+uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex ) throw (uno::RuntimeException)
+{
+ // horizontal anchor of frame children is inside border line (add one unit to compensate border line width)
+ double fOffsetX = mpGeometryHelper->getOffsetX() + getLeft() + 1.0;
+ // vertical anchor of frame children is inside border line (add half of text height and one unit to compensate border line width)
+ double fOffsetY = mpGeometryHelper->getOffsetY() + getTop() + (getFont()->getSize() / 2.0) + 1.0;
+
+ uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, mxDialog, m_xModel, fOffsetX, fOffsetY ) );
+ if( rIndex.hasValue() )
+ return uno::Any( xControls->Item( rIndex, uno::Any() ) );
+ return uno::Any( xControls );
+}
+
+// XHelperInterface
+
+VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" )
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx
index 9b2c77252f67..bb5b198335e2 100644
--- a/vbahelper/source/msforms/vbaframe.hxx
+++ b/vbahelper/source/msforms/vbaframe.hxx
@@ -28,31 +28,43 @@
#ifndef SC_VBA_FRAME_HXX
#define SC_VBA_FRAME_HXX
#include <cppuhelper/implbase1.hxx>
-#include <ooo/vba/msforms/XLabel.hpp>
+#include <ooo/vba/msforms/XFrame.hpp>
#include "vbacontrol.hxx"
#include <vbahelper/vbahelper.hxx>
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE;
+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XFrame > FrameImpl_BASE;
class ScVbaFrame : public FrameImpl_BASE
{
public:
- ScVbaFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
+ ScVbaFrame(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::uno::XInterface >& xControl,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ ov::AbstractGeometryAttributes* pGeomHelper,
+ const css::uno::Reference< css::awt::XControl >& xDialog );
+
+ // XFrame attributes
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
-
- virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSpecialEffect() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSpecialEffect( sal_Int32 nSpecialEffect ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBorderStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBorderStyle( sal_Int32 nBorderStyle ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
+ // XFrame methods
+ css::uno::Any SAL_CALL Controls( const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+private:
+ css::uno::Reference< css::awt::XControl > mxDialog;
};
#endif //SC_VBA_LABEL_HXX
diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx
index 29c8dfa83466..a12aa65295cc 100644
--- a/vbahelper/source/msforms/vbalabel.cxx
+++ b/vbahelper/source/msforms/vbalabel.cxx
@@ -25,8 +25,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbalabel.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -78,7 +79,11 @@ ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com
//FIXME: seems not support?
}
-rtl::OUString&
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaLabel::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
ScVbaLabel::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx
index 6ee3998b52b0..1166f045e6ac 100644
--- a/vbahelper/source/msforms/vbalabel.hxx
+++ b/vbahelper/source/msforms/vbalabel.hxx
@@ -47,6 +47,7 @@ public:
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx
index a29c1312eecc..f008fef9d5e2 100644
--- a/vbahelper/source/msforms/vbalistbox.cxx
+++ b/vbahelper/source/msforms/vbalistbox.cxx
@@ -25,12 +25,12 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
#include "vbalistbox.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
#include <comphelper/anytostring.hxx>
#include <com/sun/star/script/ArrayWrapper.hpp>
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -276,6 +276,11 @@ ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) t
return mpListHelper->List( pvargIndex, pvarColumn );
}
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaListBox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaListBox::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx
index 972e5808a62d..28e9590fc06f 100644
--- a/vbahelper/source/msforms/vbalistbox.hxx
+++ b/vbahelper/source/msforms/vbalistbox.hxx
@@ -61,9 +61,10 @@ public:
virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// Methods
+ virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx
index ac613ccdfaca..26555f0bfa2c 100644
--- a/vbahelper/source/msforms/vbamultipage.cxx
+++ b/vbahelper/source/msforms/vbamultipage.cxx
@@ -67,7 +67,14 @@ ScVbaMultiPage::getPages( sal_Int32 nPages )
return new PagesImpl( nPages );
}
-ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
+ScVbaMultiPage::ScVbaMultiPage(
+ const uno::Reference< ov::XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< uno::XInterface >& xControl,
+ const uno::Reference< frame::XModel >& xModel,
+ AbstractGeometryAttributes* pGeomHelper,
+ const uno::Reference< awt::XControl >& xDialog ) :
+ MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{
mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW );
}
diff --git a/vbahelper/source/msforms/vbamultipage.hxx b/vbahelper/source/msforms/vbamultipage.hxx
index b3a16294d8f4..26070a8a90d5 100644
--- a/vbahelper/source/msforms/vbamultipage.hxx
+++ b/vbahelper/source/msforms/vbamultipage.hxx
@@ -42,7 +42,14 @@ class ScVbaMultiPage : public MultiPageImpl_BASE
css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages );
css::uno::Reference< css::beans::XPropertySet > mxDialogProps;
public:
- ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog );
+ ScVbaMultiPage(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::uno::XInterface >& xControl,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ ov::AbstractGeometryAttributes* pGeomHelper,
+ const css::uno::Reference< css::awt::XControl >& xDialog );
+
// Attributes
virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( sal_Int32 _value ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbanewfont.cxx b/vbahelper/source/msforms/vbanewfont.cxx
new file mode 100755
index 000000000000..f487b4e6919c
--- /dev/null
+++ b/vbahelper/source/msforms/vbanewfont.cxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <vbanewfont.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+// ============================================================================
+
+VbaNewFont::VbaNewFont(
+ const uno::Reference< XHelperInterface >& rxParent,
+ const uno::Reference< uno::XComponentContext >& rxContext,
+ const uno::Reference< beans::XPropertySet >& rxModelProps ) throw (uno::RuntimeException) :
+ VbaNewFont_BASE( rxParent, rxContext ),
+ mxProps( rxModelProps, uno::UNO_SET_THROW )
+{
+}
+
+// XNewFont attributes
+
+::rtl::OUString SAL_CALL VbaNewFont::getName() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontName" ) ) );
+ return aAny.get< ::rtl::OUString >();
+}
+
+void SAL_CALL VbaNewFont::setName( const ::rtl::OUString& rName ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontName" ) ),
+ uno::Any( rName ) );
+}
+
+double SAL_CALL VbaNewFont::getSize() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight" ) ) );
+ return aAny.get< float >();
+}
+
+void SAL_CALL VbaNewFont::setSize( double fSize ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight" ) ),
+ uno::Any( static_cast< float >( fSize ) ) );
+}
+
+sal_Int16 SAL_CALL VbaNewFont::getCharset() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontCharset" ) ) );
+ return rtl_getBestWindowsCharsetFromTextEncoding( static_cast< rtl_TextEncoding >( aAny.get< sal_Int16 >() ) );
+}
+
+void SAL_CALL VbaNewFont::setCharset( sal_Int16 nCharset ) throw (uno::RuntimeException)
+{
+ rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
+ if( (0 <= nCharset) && (nCharset <= SAL_MAX_UINT8) )
+ eFontEnc = rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( nCharset ) );
+ if( eFontEnc == RTL_TEXTENCODING_DONTKNOW )
+ throw uno::RuntimeException();
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontCharset" ) ),
+ uno::Any( static_cast< sal_Int16 >( eFontEnc ) ) );
+}
+
+sal_Int16 SAL_CALL VbaNewFont::getWeight() throw (uno::RuntimeException)
+{
+ return getBold() ? 700 : 400;
+}
+
+void SAL_CALL VbaNewFont::setWeight( sal_Int16 nWeight ) throw (uno::RuntimeException)
+{
+ setBold( nWeight >= 700 );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getBold() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ) );
+ return aAny.get< float >() > awt::FontWeight::NORMAL;
+}
+
+void SAL_CALL VbaNewFont::setBold( sal_Bool bBold ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ),
+ uno::Any( bBold ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL ) );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getItalic() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontSlant" ) ) );
+ return aAny.get< awt::FontSlant >() != awt::FontSlant_NONE;
+}
+
+void SAL_CALL VbaNewFont::setItalic( sal_Bool bItalic ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontSlant" ) ),
+ uno::Any( bItalic ? awt::FontSlant_ITALIC : awt::FontSlant_NONE ) );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getUnderline() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline" ) ) );
+ return aAny.get< sal_Int16 >() != awt::FontUnderline::NONE;
+}
+
+void SAL_CALL VbaNewFont::setUnderline( sal_Bool bUnderline ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline" ) ),
+ uno::Any( bUnderline ? awt::FontUnderline::SINGLE : awt::FontUnderline::NONE ) );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getStrikethrough() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout" ) ) );
+ return aAny.get< sal_Int16 >() != awt::FontStrikeout::NONE;
+}
+
+void SAL_CALL VbaNewFont::setStrikethrough( sal_Bool bStrikethrough ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout" ) ),
+ uno::Any( bStrikethrough ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE ) );
+}
+
+// XHelperInterface
+
+VBAHELPER_IMPL_XHELPERINTERFACE( VbaNewFont, "ooo.vba.msforms.NewFont" )
+
+// ============================================================================
diff --git a/vbahelper/source/msforms/vbanewfont.hxx b/vbahelper/source/msforms/vbanewfont.hxx
new file mode 100755
index 000000000000..d59d5caa139c
--- /dev/null
+++ b/vbahelper/source/msforms/vbanewfont.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * 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_MSFORMS_VBANEWFONT_HXX
+#define VBAHELPER_MSFORMS_VBANEWFONT_HXX
+
+#include <ooo/vba/msforms/XNewFont.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+// ============================================================================
+
+typedef InheritedHelperInterfaceImpl1< ov::msforms::XNewFont > VbaNewFont_BASE;
+
+class VbaNewFont : public VbaNewFont_BASE
+{
+public:
+ VbaNewFont(
+ const css::uno::Reference< ov::XHelperInterface >& rxParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::beans::XPropertySet >& rxModelProps ) throw (css::uno::RuntimeException);
+
+ // XNewFont attributes
+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& rName ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSize( double fSize ) throw (css::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getCharset() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCharset( sal_Int16 nCharset ) throw (css::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getWeight() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setWeight( sal_Int16 nWeight ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getBold() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBold( sal_Bool bBold ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getItalic() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setItalic( sal_Bool bItalic ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getUnderline() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setUnderline( sal_Bool bUnderline ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getStrikethrough() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStrikethrough( sal_Bool bStrikethrough ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ VBAHELPER_DECL_XHELPERINTERFACE
+
+private:
+ css::uno::Reference< css::beans::XPropertySet > mxProps;
+};
+
+// ============================================================================
+
+#endif
diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx
index 8c89b08ff1ef..8f349f499597 100644
--- a/vbahelper/source/msforms/vbaradiobutton.cxx
+++ b/vbahelper/source/msforms/vbaradiobutton.cxx
@@ -25,8 +25,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbaradiobutton.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -97,6 +98,11 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
}
}
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaRadioButton::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaRadioButton::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbaradiobutton.hxx b/vbahelper/source/msforms/vbaradiobutton.hxx
index 6bb0981553f4..b499cbfa8c77 100644
--- a/vbahelper/source/msforms/vbaradiobutton.hxx
+++ b/vbahelper/source/msforms/vbaradiobutton.hxx
@@ -43,6 +43,7 @@ public:
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx
index f73bdca68b54..39861b9a75b6 100644
--- a/vbahelper/source/msforms/vbatextbox.cxx
+++ b/vbahelper/source/msforms/vbatextbox.cxx
@@ -25,16 +25,16 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <com/sun/star/text/XTextRange.hpp>
#include "vbatextbox.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
+#include <com/sun/star/text/XTextRange.hpp>
+#include <ooo/vba/msforms/fmBorderStyle.hpp>
+#include <ooo/vba/msforms/fmSpecialEffect.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
-
-
ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog )
{
}
@@ -49,7 +49,8 @@ ScVbaTextBox::getValue() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
{
- rtl::OUString sVal = getAnyAsString( _value );
+ // booleans are converted to uppercase strings
+ rtl::OUString sVal = extractStringFromAny( _value, true );
setText( sVal );
}
@@ -123,6 +124,34 @@ ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeExcept
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
}
+sal_Int32 SAL_CALL ScVbaTextBox::getSpecialEffect() throw (uno::RuntimeException)
+{
+ return msforms::fmSpecialEffect::fmSpecialEffectSunken;
+}
+
+void SAL_CALL ScVbaTextBox::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaTextBox::getBorderStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmBorderStyle::fmBorderStyleNone;
+}
+
+void SAL_CALL ScVbaTextBox::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaTextBox::getTextLength() throw (uno::RuntimeException)
+{
+ return getText().getLength();
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaTextBox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaTextBox::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbatextbox.hxx b/vbahelper/source/msforms/vbatextbox.hxx
index 161926c98c92..bdbff16439ea 100644
--- a/vbahelper/source/msforms/vbatextbox.hxx
+++ b/vbahelper/source/msforms/vbatextbox.hxx
@@ -48,6 +48,12 @@ public:
virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException);
virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSpecialEffect() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSpecialEffect( sal_Int32 nSpecialEffect ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBorderStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBorderStyle( sal_Int32 nBorderStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTextLength() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// XDefaultProperty
rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
//XHelperInterface
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index a6f20a28f39f..b989616a8574 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -25,8 +25,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbatogglebutton.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -96,6 +97,55 @@ ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExcepti
m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
}
+sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaToggleButton::setAutoSize( sal_Bool /*bAutoSize*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaToggleButton::getCancel() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaToggleButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaToggleButton::getDefault() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaToggleButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaToggleButton::getBackColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaToggleButton::setBackColor( sal_Int32 /*nBackColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaToggleButton::getForeColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaToggleButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaToggleButton::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
rtl::OUString&
ScVbaToggleButton::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbatogglebutton.hxx b/vbahelper/source/msforms/vbatogglebutton.hxx
index 7ae6daab84d7..6e8a0cb28e18 100644
--- a/vbahelper/source/msforms/vbatogglebutton.hxx
+++ b/vbahelper/source/msforms/vbatogglebutton.hxx
@@ -44,9 +44,19 @@ public:
// Attributes
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoSize( sal_Bool bAutoSize ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getCancel() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCancel( sal_Bool bCancel ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getDefault() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefault( sal_Bool bDefault ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBackColor( sal_Int32 nBackColor ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setForeColor( sal_Int32 nForeColor ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 7152523e2696..dd303eb1ad1f 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -57,9 +57,7 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Refer
m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW );
uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
- setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
- if ( aArgs.getLength() >= 4 )
- aArgs[ 3 ] >>= m_sLibName;
+ setGeometryHelper( new UserFormGeometryHelper( xContext, xControl, 0.0, 0.0 ) );
}
ScVbaUserForm::~ScVbaUserForm()
@@ -110,18 +108,38 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
}
rtl::OUString SAL_CALL
-ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException)
+ScVbaUserForm::getCaption() throw (uno::RuntimeException)
{
rtl::OUString sCaption;
m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ) ) >>= sCaption;
return sCaption;
}
void
-ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
+ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
{
m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) );
}
+double SAL_CALL ScVbaUserForm::getInnerWidth() throw (uno::RuntimeException)
+{
+ return mpGeometryHelper->getInnerWidth();
+}
+
+void SAL_CALL ScVbaUserForm::setInnerWidth( double fInnerWidth ) throw (uno::RuntimeException)
+{
+ mpGeometryHelper->setInnerWidth( fInnerWidth );
+}
+
+double SAL_CALL ScVbaUserForm::getInnerHeight() throw (uno::RuntimeException)
+{
+ return mpGeometryHelper->getInnerHeight();
+}
+
+void SAL_CALL ScVbaUserForm::setInnerHeight( double fInnerHeight ) throw (uno::RuntimeException)
+{
+ mpGeometryHelper->setInnerHeight( fInnerHeight );
+}
+
void SAL_CALL
ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
{
@@ -251,10 +269,8 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
xContainer->getControl( aPropertyName );
if ( xControl.is() )
{
- ScVbaControlFactory aFac( mxContext, xControl, m_xModel );
- uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
- ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
- pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
+ uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() );
+ ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
if ( m_sLibName.getLength() )
pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) );
aResult = uno::makeAny( xVBAControl );
@@ -275,7 +291,7 @@ ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
// 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 ) );
+ uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() ) );
if ( index.hasValue() )
return uno::makeAny( xControls->Item( index, uno::Any() ) );
return uno::makeAny( xControls );
diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
index 700f1017bffd..f66c3f85bb0e 100644
--- a/vbahelper/source/msforms/vbauserform.hxx
+++ b/vbahelper/source/msforms/vbauserform.hxx
@@ -56,18 +56,22 @@ public:
// XUserForm
virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException);
- // XIntrospection
- virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getCaption() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getInnerWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInnerWidth( double fInnerWidth ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getInnerHeight() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInnerHeight( double fInnerHeight ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ // XIntrospection
+ virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/vbahelper/collectionbase.cxx b/vbahelper/source/vbahelper/collectionbase.cxx
new file mode 100755
index 000000000000..16fc673f54d5
--- /dev/null
+++ b/vbahelper/source/vbahelper/collectionbase.cxx
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 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/collectionbase.hxx>
+
+#include <map>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace vbahelper {
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+// ============================================================================
+
+namespace {
+
+// ----------------------------------------------------------------------------
+
+class CollectionEnumeration : public ::cppu::WeakImplHelper1< container::XEnumeration >
+{
+public:
+ explicit CollectionEnumeration( const ::rtl::Reference< CollectionBase >& rxCollection );
+ virtual sal_Bool SAL_CALL hasMoreElements() throw (uno::RuntimeException);
+ virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+private:
+ ::rtl::Reference< CollectionBase > mxCollection;
+ sal_Int32 mnCurrIndex;
+};
+
+CollectionEnumeration::CollectionEnumeration( const ::rtl::Reference< CollectionBase >& rxCollection ) :
+ mxCollection( rxCollection ),
+ mnCurrIndex( 1 ) // collection expects one-based indexes
+{
+}
+
+sal_Bool SAL_CALL CollectionEnumeration::hasMoreElements() throw (uno::RuntimeException)
+{
+ return mnCurrIndex <= mxCollection->getCount();
+}
+
+uno::Any SAL_CALL CollectionEnumeration::nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( hasMoreElements() )
+ return mxCollection->getItemByIndex( mnCurrIndex++ );
+ throw container::NoSuchElementException();
+}
+
+// ----------------------------------------------------------------------------
+
+struct IsLessIgnoreCase
+{
+ inline bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const
+ { return ::rtl_ustr_compareIgnoreAsciiCase_WithLength( rName1.getStr(), rName1.getLength(), rName2.getStr(), rName2.getLength() ) < 0; }
+};
+
+// ----------------------------------------------------------------------------
+
+class SequenceToContainer : public ::cppu::WeakImplHelper2< container::XIndexAccess, container::XNameAccess >
+{
+public:
+ explicit SequenceToContainer( const ::std::vector< uno::Reference< container::XNamed > >& rElements, const uno::Type& rElementType );
+ explicit SequenceToContainer( const ::std::vector< beans::NamedValue >& rElements, const uno::Type& rElementType );
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException);
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
+ // XNameAccess
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& rName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& rName ) throw (uno::RuntimeException);
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException);
+
+private:
+ typedef uno::Sequence< ::rtl::OUString > ElementNameSequence;
+ typedef ::std::vector< uno::Any > ElementVector;
+ typedef ::std::map< ::rtl::OUString, uno::Any, IsLessIgnoreCase > ElementMap;
+
+ ElementNameSequence maElementNames;
+ ElementVector maElements;
+ ElementMap maElementMap;
+ uno::Type maElementType;
+};
+
+SequenceToContainer::SequenceToContainer( const ::std::vector< uno::Reference< container::XNamed > >& rElements, const uno::Type& rElementType ) :
+ maElementType( rElementType )
+{
+ maElementNames.realloc( static_cast< sal_Int32 >( rElements.size() ) );
+ maElements.reserve( rElements.size() );
+ ::rtl::OUString* pElementName = maElementNames.getArray();
+ for( ::std::vector< uno::Reference< container::XNamed > >::const_iterator aIt = rElements.begin(), aEnd = rElements.end(); aIt != aEnd; ++aIt, ++pElementName )
+ {
+ uno::Reference< container::XNamed > xNamed = *aIt;
+ *pElementName = xNamed->getName();
+ maElements.push_back( uno::Any( xNamed ) );
+ // same name may occur multiple times, VBA returns first occurance
+ if( maElementMap.count( *pElementName ) == 0 )
+ maElementMap[ *pElementName ] <<= xNamed;
+ }
+}
+
+SequenceToContainer::SequenceToContainer( const ::std::vector< beans::NamedValue >& rElements, const uno::Type& rElementType ) :
+ maElementType( rElementType )
+{
+ maElementNames.realloc( static_cast< sal_Int32 >( rElements.size() ) );
+ maElements.reserve( rElements.size() );
+ ::rtl::OUString* pElementName = maElementNames.getArray();
+ for( ::std::vector< beans::NamedValue >::const_iterator aIt = rElements.begin(), aEnd = rElements.end(); aIt != aEnd; ++aIt, ++pElementName )
+ {
+ *pElementName = aIt->Name;
+ maElements.push_back( aIt->Value );
+ // same name may occur multiple times, VBA returns first occurance
+ if( maElementMap.count( *pElementName ) == 0 )
+ maElementMap[ *pElementName ] = aIt->Value;
+ }
+}
+
+sal_Int32 SAL_CALL SequenceToContainer::getCount() throw (uno::RuntimeException)
+{
+ return static_cast< sal_Int32 >( maElements.size() );
+}
+
+uno::Any SAL_CALL SequenceToContainer::getByIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( (0 <= nIndex) && (nIndex < getCount()) )
+ return maElements[ static_cast< size_t >( nIndex ) ];
+ throw lang::IndexOutOfBoundsException();
+}
+
+uno::Any SAL_CALL SequenceToContainer::getByName( const ::rtl::OUString& rName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ElementMap::iterator aIt = maElementMap.find( rName );
+ if( aIt != maElementMap.end() )
+ return aIt->second;
+ throw container::NoSuchElementException();
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SequenceToContainer::getElementNames() throw (uno::RuntimeException)
+{
+ return maElementNames;
+}
+
+sal_Bool SAL_CALL SequenceToContainer::hasByName( const ::rtl::OUString& rName ) throw (uno::RuntimeException)
+{
+ return maElementMap.count( rName ) > 0;
+}
+
+uno::Type SAL_CALL SequenceToContainer::getElementType() throw (uno::RuntimeException)
+{
+ return maElementType;
+}
+
+sal_Bool SAL_CALL SequenceToContainer::hasElements() throw (uno::RuntimeException)
+{
+ return !maElements.empty();
+}
+
+} // namespace
+
+// ============================================================================
+
+CollectionBase::CollectionBase( const uno::Type& rElementType ) :
+ maElementType( rElementType ),
+ mbConvertOnDemand( false )
+{
+}
+
+sal_Int32 SAL_CALL CollectionBase::getCount() throw (uno::RuntimeException)
+{
+ if( mxIndexAccess.is() )
+ return mxIndexAccess->getCount();
+ if( mxNameAccess.is() )
+ return mxNameAccess->getElementNames().getLength();
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
+}
+
+uno::Reference< container::XEnumeration > SAL_CALL CollectionBase::createEnumeration() throw (uno::RuntimeException)
+{
+ return new CollectionEnumeration( this );
+}
+
+uno::Type SAL_CALL CollectionBase::getElementType() throw (uno::RuntimeException)
+{
+ return maElementType;
+}
+
+sal_Bool SAL_CALL CollectionBase::hasElements() throw (uno::RuntimeException)
+{
+ if( mxIndexAccess.is() )
+ return mxIndexAccess->hasElements();
+ if( mxNameAccess.is() )
+ return mxNameAccess->hasElements();
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
+}
+
+::rtl::OUString SAL_CALL CollectionBase::getDefaultMethodName() throw (uno::RuntimeException)
+{
+ static ::rtl::OUString saDefMethodName( RTL_CONSTASCII_USTRINGPARAM( "Item" ) );
+ return saDefMethodName;
+}
+
+// ----------------------------------------------------------------------------
+
+void CollectionBase::initContainer(
+ const uno::Reference< container::XElementAccess >& rxElementAccess,
+ ContainerType eContainerType ) throw (uno::RuntimeException)
+{
+ mxIndexAccess.set( rxElementAccess, uno::UNO_QUERY );
+ mxNameAccess.set( rxElementAccess, uno::UNO_QUERY );
+ switch( eContainerType )
+ {
+ case CONTAINER_NATIVE_VBA:
+ mbConvertOnDemand = false;
+ break;
+ case CONTAINER_CONVERT_ON_DEMAND:
+ mbConvertOnDemand = true;
+ break;
+ }
+}
+
+void CollectionBase::initElements( const ::std::vector< uno::Reference< container::XNamed > >& rElements, ContainerType eContainerType ) throw (uno::RuntimeException)
+{
+ // SequenceToContainer derives twice from XElementAccess, need to resolve ambiguity
+ initContainer( static_cast< container::XIndexAccess* >( new SequenceToContainer( rElements, maElementType ) ), eContainerType );
+}
+
+void CollectionBase::initElements( const ::std::vector< beans::NamedValue >& rElements, ContainerType eContainerType ) throw (uno::RuntimeException)
+{
+ // SequenceToContainer derives twice from XElementAccess, need to resolve ambiguity
+ initContainer( static_cast< container::XIndexAccess* >( new SequenceToContainer( rElements, maElementType ) ), eContainerType );
+}
+
+uno::Any CollectionBase::createCollectionItem( const uno::Any& rElement, const uno::Any& rIndex ) throw (css::uno::RuntimeException)
+{
+ uno::Any aItem = mbConvertOnDemand ? implCreateCollectionItem( rElement, rIndex ) : rElement;
+ if( aItem.hasValue() )
+ return aItem;
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item." ) ), 0 );
+}
+
+uno::Any CollectionBase::getItemByIndex( sal_Int32 nIndex ) throw (uno::RuntimeException)
+{
+ if( mxIndexAccess.is() )
+ {
+ if( (1 <= nIndex) && (nIndex <= mxIndexAccess->getCount()) )
+ // createCollectionItem() will convert from container element to VBA item
+ return createCollectionItem( mxIndexAccess->getByIndex( nIndex - 1 ), uno::Any( nIndex ) );
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Index out of bounds." ) ), 0 );
+ }
+ if( mxNameAccess.is() )
+ {
+ uno::Sequence< ::rtl::OUString > aElementNames = mxNameAccess->getElementNames();
+ if( (1 <= nIndex) && (nIndex <= aElementNames.getLength()) )
+ // createCollectionItem() will convert from container element to VBA item
+ return createCollectionItem( mxNameAccess->getByName( aElementNames[ nIndex - 1 ] ), uno::Any( aElementNames[ nIndex - 1 ] ) );
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Index out of bounds." ) ), 0 );
+ }
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
+}
+
+uno::Any CollectionBase::getItemByName( const ::rtl::OUString& rName ) throw (uno::RuntimeException)
+{
+ if( mxNameAccess.is() )
+ {
+ if( rName.getLength() > 0 )
+ // createCollectionItem() will convert from container element to VBA item
+ return createCollectionItem( mxNameAccess->getByName( rName ), uno::Any( rName ) );
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item name." ) ), 0 );
+ }
+ if( mxIndexAccess.is() )
+ {
+ for( sal_Int32 nIndex = 0, nSize = mxIndexAccess->getCount(); nIndex < nSize; ++nIndex )
+ {
+ uno::Any aElement = mxIndexAccess->getByIndex( nIndex );
+ uno::Reference< container::XNamed > xNamed( aElement, uno::UNO_QUERY );
+ if( xNamed.is() && xNamed->getName().equalsIgnoreAsciiCase( rName ) )
+ // createCollectionItem() will convert from container element to VBA item
+ return createCollectionItem( aElement, uno::Any( nIndex ) );
+ }
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item name." ) ), 0 );
+ }
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
+}
+
+uno::Any CollectionBase::getAnyItemOrThis( const uno::Any& rIndex ) throw (uno::RuntimeException)
+{
+ if( !rIndex.hasValue() )
+ return uno::Any( uno::Reference< XCollectionBase >( this ) );
+ if( rIndex.has< ::rtl::OUString >() )
+ return getItemByName( rIndex.get< ::rtl::OUString >() );
+ // extractIntFromAny() throws if no index can be extracted
+ return getItemByIndex( extractIntFromAny( rIndex ) );
+}
+
+// protected ------------------------------------------------------------------
+
+uno::Any CollectionBase::implCreateCollectionItem( const uno::Any& /*rElement*/, const uno::Any& /*rIndex*/ ) throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Creation of VBA implementation object not implemented." ) ), 0 );
+}
+
+// ============================================================================
+
+} // namespace vbahelper
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 16cb309cae7c..21eec2670a09 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -388,12 +388,12 @@ uno::Any SAL_CALL VbaApplicationBase::getVBE() throw (uno::RuntimeException)
{
try // return empty object on error
{
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
- aArgs[ 1 ] <<= getCurrentDocument();
+ // "VBE" object does not have a parent, but pass document model to be able to determine application type
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] <<= 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 );
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.vbide.VBE" ) ), aArgs, mxContext );
return uno::Any( xVBE );
}
catch( uno::Exception& )
@@ -402,25 +402,6 @@ uno::Any SAL_CALL VbaApplicationBase::getVBE() throw (uno::RuntimeException)
return uno::Any();
}
-uno::Any SAL_CALL
-VbaApplicationBase::getVBProjects() throw (uno::RuntimeException)
-{
- 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&
VbaApplicationBase::getServiceImplName()
{
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
index 6df2a94bc3bf..54d8f032ce49 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
@@ -92,50 +92,37 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u
::sal_Bool SAL_CALL
ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException)
{
- /*sal_Bool bVisible = sal_True;
- uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")) );
+ sal_Bool bVisible = sal_True;
+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ) );
if( aValue.hasValue() )
aValue >>= bVisible;
- return bVisible;*/
- return getEnabled();
-
+ return bVisible;
}
void SAL_CALL
ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
{
- uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")) );
+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ) );
if( aValue.hasValue() )
{
- setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")), uno::makeAny( _visible ) );
+ setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE ), uno::makeAny( _visible ) );
ApplyChange();
}
- setEnabled( _visible);
}
::sal_Bool SAL_CALL
ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException)
{
sal_Bool bEnabled = sal_True;
- rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___");
- rtl::OUString aCommandURL ;
- if( m_xParentMenu.is() )
+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED ) );
+ if( aValue.hasValue() )
{
- // currently only the menu in the MenuBat support Enable/Disable
- // FIXME: how to support the menu item in Toolbar
- bEnabled = m_xParentMenu->isItemEnabled( m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) ) );
+ aValue >>= bEnabled;
}
else
{
// emulated with Visible
- //bEnabled = getVisible();
- uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") );
- if (aValue >>= aCommandURL){
- if (0 == aCommandURL.indexOf(aCommandURLappendix)){
- bEnabled = sal_False;
- }
- }
-
+ bEnabled = getVisible();
}
return bEnabled;
}
@@ -143,30 +130,16 @@ ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException)
void SAL_CALL
ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
{
- rtl::OUString aCommandURL ;
- rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___");
- rtl::OUStringBuffer aCommandURLSringBuffer;
- if( m_xParentMenu.is() )
+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED ) );
+ if( aValue.hasValue() )
{
- // currently only the menu in the MenuBat support Enable/Disable
- m_xParentMenu->enableItem( m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) ), _enabled );
+ setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED ), uno::makeAny( _enabled ) );
+ ApplyChange();
}
else
{
- uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") );
- if (aValue >>= aCommandURL){
- if (0 == aCommandURL.indexOf(aCommandURLappendix)){
- aCommandURL = aCommandURL.copy(3);
- }
- if (false == _enabled){
- aCommandURLSringBuffer = aCommandURLappendix;
- }
- aCommandURLSringBuffer.append(aCommandURL);
- setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURLSringBuffer.makeStringAndClear()) );
- ApplyChange();
- }
// emulated with Visible
- //setVisible( _enabled );
+ setVisible( _enabled );
}
}
@@ -207,14 +180,7 @@ ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicE
if( !xSubMenu.is() )
throw uno::RuntimeException();
- uno::Reference< awt::XMenu > xMenu;
- if( m_xParentMenu.is() )
- {
- sal_Int16 nItemId = m_xParentMenu->getItemId( sal::static_int_cast< sal_Int16 >( m_nPosition ) );
- xMenu.set( m_xParentMenu->getPopupMenu( nItemId ), uno::UNO_QUERY );
- }
-
- uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) );
+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
if( aIndex.hasValue() )
{
return xCommandBarControls->Item( aIndex, uno::Any() );
@@ -242,12 +208,11 @@ ScVbaCommandBarControl::getServiceNames()
}
//////////// ScVbaCommandBarPopup //////////////////////////////
-ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
{
m_nPosition = nPosition;
m_bTemporary = bTemporary;
m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
- m_xParentMenu = xMenu;
}
rtl::OUString&
@@ -269,12 +234,11 @@ ScVbaCommandBarPopup::getServiceNames()
}
//////////// ScVbaCommandBarButton //////////////////////////////
-ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
+ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
{
m_nPosition = nPosition;
m_bTemporary = bTemporary;
m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
- m_xParentMenu = xMenu;
}
rtl::OUString&
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
index 1b9a58e660e8..7033c4dd1179 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
@@ -44,10 +44,9 @@ class ScVbaCommandBarControl : public CommandBarControl_BASE
protected:
VbaCommandBarHelperRef pCBarHelper;
rtl::OUString m_sResourceUrl;
- css::uno::Reference< css::container::XIndexAccess > m_xCurrentSettings;
- css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
- css::uno::Sequence< css::beans::PropertyValue > m_aPropertyValues;
- css::uno::Reference< css::awt::XMenu > m_xParentMenu;
+ css::uno::Reference< css::container::XIndexAccess > m_xCurrentSettings;
+ css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
+ css::uno::Sequence< css::beans::PropertyValue > m_aPropertyValues;
sal_Int32 m_nPosition;
sal_Bool m_bTemporary;
@@ -88,7 +87,7 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPop
class ScVbaCommandBarPopup : public CommandBarPopup_BASE
{
public:
- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException);
+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
{
@@ -103,7 +102,7 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarBut
class ScVbaCommandBarButton : public CommandBarButton_BASE
{
public:
- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException);
+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
{
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
index cfeb31007067..55befbe6f086 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
@@ -56,14 +56,20 @@ public:
}
};
-ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl, const uno::Reference< awt::XMenu >& xMenu ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl ), m_xMenu( xMenu )
+ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl )
{
m_bIsMenu = sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) ? sal_True : sal_False;
}
-uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const uno::Any& aSubMenu )
+uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemData( const rtl::OUString& sCommandURL,
+ const rtl::OUString& sHelpURL,
+ const rtl::OUString& sLabel,
+ sal_uInt16 nType,
+ const uno::Any& aSubMenu,
+ sal_Bool isVisible,
+ sal_Bool isEnabled )
{
- uno::Sequence< beans::PropertyValue > aProps(5);
+ uno::Sequence< beans::PropertyValue > aProps(7);
aProps[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ));
aProps[0].Value <<= sCommandURL;
@@ -75,6 +81,10 @@ uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemDat
aProps[3].Value <<= nType;
aProps[4].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ));
aProps[4].Value = aSubMenu;
+ aProps[5].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE );
+ aProps[5].Value <<= isVisible;
+ aProps[6].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ENABLED );
+ aProps[6].Value <<= isEnabled;
return aProps;
}
@@ -125,9 +135,9 @@ ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource )
getPropertyValue( aProps, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )) ) >>= xSubMenu;
ScVbaCommandBarControl* pNewCommandBarControl = NULL;
if( xSubMenu.is() )
- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu );
+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
else
- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu );
+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
}
@@ -203,7 +213,7 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un
sal_uInt16 nItemType = 0;
if( IsMenu() )
{
- aProps = CreateMenuItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu );
+ aProps = CreateMenuItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu, true, true );
}
else
{
@@ -218,12 +228,11 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un
pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings );
- // sometimes it would crash if passing m_xMenu instead of uno::Reference< awt::XMenu >() in Linux.
ScVbaCommandBarControl* pNewCommandBarControl = NULL;
if( nType == office::MsoControlType::msoControlPopup )
- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() );
+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
else
- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() );
+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
}
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
index 674e7132895a..0fc6a89e28c7 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
@@ -39,18 +39,23 @@ typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE;
class ScVbaCommandBarControls : public CommandBarControls_BASE
{
private:
- VbaCommandBarHelperRef pCBarHelper;
- css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
- rtl::OUString m_sResourceUrl;
- css::uno::Reference< css::awt::XMenu > m_xMenu;
- sal_Bool m_bIsMenu;
+ VbaCommandBarHelperRef pCBarHelper;
+ css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
+ rtl::OUString m_sResourceUrl;
+ sal_Bool m_bIsMenu;
- css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu );
+ css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL,
+ const rtl::OUString& sHelpURL,
+ const rtl::OUString& sLabel,
+ sal_uInt16 nType,
+ const css::uno::Any& aSubMenu,
+ sal_Bool isVisible,
+ sal_Bool isEnabled );
css::uno::Sequence< css::beans::PropertyValue > CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle );
public:
ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw( css::uno::RuntimeException );
- sal_Bool IsMenu() const { return m_bIsMenu; }
+ sal_Bool IsMenu(){ return m_bIsMenu; }
// XEnumerationAccess
virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
index 36202ad53039..8c4be0c5a577 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
@@ -48,6 +48,7 @@ static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
static const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible";
static const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL";
static const char ITEM_DESCRIPTOR_UINAME[] = "UIName";
+static const char ITEM_DESCRIPTOR_ENABLED[] = "Enabled";
static const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar";
static const char ITEM_TOOLBAR_URL[] = "private:resource/toolbar/";
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 7c34a2c7609c..e8aa501a40df 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <ooo/vba/XApplicationBase.hpp>
#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/unwrapargs.hxx>
@@ -277,20 +278,21 @@ VbaDocumentBase::Activate() throw (uno::RuntimeException)
uno::Any SAL_CALL
VbaDocumentBase::getVBProject() throw (uno::RuntimeException)
{
- try // return empty object on error
+ if( !mxVBProject.is() ) try
{
+ uno::Reference< XApplicationBase > xApp( Application(), uno::UNO_QUERY_THROW );
+ uno::Reference< XInterface > xVBE( xApp->getVBE(), uno::UNO_QUERY_THROW );
uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
- aArgs[ 1 ] <<= getModel();
+ aArgs[ 0 ] <<= xVBE; // the VBE
+ aArgs[ 1 ] <<= getModel(); // document model for script container access
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 );
+ mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.vbide.VBProject" ) ), aArgs, mxContext );
}
catch( uno::Exception& )
{
}
- return uno::Any();
+ return uno::Any( mxVBProject );
}
rtl::OUString&
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
index 836e6325c01b..57e535a1dc1a 100644
--- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
@@ -27,34 +27,40 @@
************************************************************************/
#include "vbahelper/vbaeventshelperbase.hxx"
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
#include <filter/msfilter/msvbahelper.hxx>
+#include <unotools/eventcfg.hxx>
using namespace ::com::sun::star;
using namespace ::ooo::vba;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
// ============================================================================
VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) :
mpShell( 0 ),
- mbDisposed( false )
+ mbDisposed( true )
{
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& )
{
}
+ mbDisposed = mpShell == 0;
+ startListening();
}
VbaEventsHelperBase::~VbaEventsHelperBase()
{
- stopListening();
+ OSL_ENSURE( mbDisposed, "VbaEventsHelperBase::~VbaEventsHelperBase - missing disposing notification" );
}
sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
@@ -66,8 +72,8 @@ sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, c
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)
+sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
+ throw (lang::IllegalArgumentException, 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
@@ -80,9 +86,9 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
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;
+ /* bExecuted will change to true if at least one event handler has been
+ found and executed. */
+ bool bExecuted = false;
/* Loop as long as there are more events to be processed. Derived classes
may add new events to be processed in the virtual implPrepareEvent()
@@ -99,15 +105,15 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
const EventHandlerInfo& rInfo = getEventHandlerInfo( aEventQueue.front().mnEventId );
uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs;
aEventQueue.pop_front();
+ OSL_TRACE( "VbaEventsHelperBase::processVbaEvent( \"%s\" )", ::rtl::OUStringToOString( rInfo.maMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
/* Let derived classes prepare the event, they may add new events for
next iteration. If false is returned, the event handler must not be
called. */
- bool bEventSuccess = false;
if( implPrepareEvent( aEventQueue, rInfo, aEventArgs ) )
{
// search the event handler macro in the document
- ::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
+ OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
if( aMacroPath.getLength() > 0 )
{
// build the argument list
@@ -121,96 +127,225 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
}
// execute the event handler
uno::Any aRet, aCaller;
- bEventSuccess = executeMacro( mpShell, aMacroPath, aVbaArgs, aRet, aCaller );
- // extract new cancel value
+ executeMacro( mpShell, aMacroPath, aVbaArgs, aRet, aCaller );
+ // extract new cancel value (may be boolean or any integer type)
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;
+ checkArgument( aVbaArgs, rInfo.mnCancelIndex );
+ bCancel = extractBoolFromAny( aVbaArgs[ rInfo.mnCancelIndex ] );
}
+ // event handler has been found
+ bExecuted = true;
}
- // global success, if at least one event handler succeeded
- bSuccess |= bEventSuccess;
}
// post processing (also, if event handler does not exist, or disabled, or on error
- implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel );
+ implPostProcessEvent( aEventQueue, rInfo, bCancel );
}
// 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();
+ // return true, if at least one event handler has been found
+ return bExecuted;
}
-void SAL_CALL VbaEventsHelperBase::disposing( const lang::EventObject& /*aSource*/ ) throw (uno::RuntimeException)
+void SAL_CALL VbaEventsHelperBase::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException)
{
- OSL_TRACE( "VbaEventsHelperBase::disposing" );
- stopListening();
- mbDisposed = true;
+ OSL_TRACE( "VbaEventsHelperBase::notifyEvent( \"%s\" )", ::rtl::OUStringToOString( rEvent.EventName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) )
+ stopListening();
+}
+
+void SAL_CALL VbaEventsHelperBase::changesOccurred( const util::ChangesEvent& rEvent ) throw (uno::RuntimeException)
+{
+ // make sure the VBA library exists
+ try
+ {
+ ensureVBALibrary();
+ }
+ catch( uno::Exception& )
+ {
+ return;
+ }
+
+ // check that the sender of the event is the VBA library
+ uno::Reference< script::vba::XVBAModuleInfo > xSender( rEvent.Base, uno::UNO_QUERY );
+ if( mxModuleInfos.get() != xSender.get() )
+ return;
+
+ // process all changed modules
+ for( sal_Int32 nIndex = 0, nLength = rEvent.Changes.getLength(); nIndex < nLength; ++nIndex )
+ {
+ const util::ElementChange& rChange = rEvent.Changes[ nIndex ];
+ OUString aModuleName;
+ if( (rChange.Accessor >>= aModuleName) && (aModuleName.getLength() > 0) ) try
+ {
+ // invalidate event handler path map depending on module type
+ if( getModuleType( aModuleName ) == script::ModuleType::NORMAL )
+ // paths to global event handlers are stored with empty key (will be searched in all normal code modules)
+ maEventPaths.erase( OUString() );
+ else
+ // paths to class/form/document event handlers are keyed by module name
+ maEventPaths.erase( aModuleName );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+}
+
+void SAL_CALL VbaEventsHelperBase::disposing( const lang::EventObject& rEvent ) throw (uno::RuntimeException)
+{
+ uno::Reference< frame::XModel > xSender( rEvent.Source, uno::UNO_QUERY );
+ if( xSender.is() )
+ stopListening();
+}
+
+void VbaEventsHelperBase::processVbaEventNoThrow( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
+{
+ try
+ {
+ processVbaEvent( nEventId, rArgs );
+ }
+ catch( uno::Exception& )
+ {
+ }
}
// protected ------------------------------------------------------------------
-void VbaEventsHelperBase::registerEventHandler( sal_Int32 nEventId,
- const sal_Char* pcMacroName, EventHandlerType eType, sal_Int32 nCancelIndex, const uno::Any& rUserData )
+void VbaEventsHelperBase::registerEventHandler( sal_Int32 nEventId, sal_Int32 nModuleType,
+ const sal_Char* pcMacroName, sal_Int32 nCancelIndex, const uno::Any& rUserData )
{
- EventHandlerInfo& rInfo = maEvents[ nEventId ];
+ EventHandlerInfo& rInfo = maEventInfos[ nEventId ];
rInfo.mnEventId = nEventId;
- rInfo.maMacroName = ::rtl::OUString::createFromAscii( pcMacroName );
- rInfo.meType = eType;
+ rInfo.mnModuleType = nModuleType;
+ rInfo.maMacroName = OUString::createFromAscii( pcMacroName );
rInfo.mnCancelIndex = nCancelIndex;
rInfo.maUserData = rUserData;
}
// private --------------------------------------------------------------------
+void VbaEventsHelperBase::startListening()
+{
+ if( mbDisposed )
+ return;
+
+ uno::Reference< document::XEventBroadcaster > xEventBroadcaster( mxModel, uno::UNO_QUERY );
+ if( xEventBroadcaster.is() )
+ try { xEventBroadcaster->addEventListener( this ); } catch( uno::Exception& ) {}
+}
+
+void VbaEventsHelperBase::stopListening()
+{
+ if( mbDisposed )
+ return;
+
+ uno::Reference< document::XEventBroadcaster > xEventBroadcaster( mxModel, uno::UNO_QUERY );
+ if( xEventBroadcaster.is() )
+ try { xEventBroadcaster->removeEventListener( this ); } catch( uno::Exception& ) {}
+
+ mxModel.clear();
+ mpShell = 0;
+ maEventInfos.clear();
+ mbDisposed = true;
+}
+
const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandlerInfo(
sal_Int32 nEventId ) const throw (lang::IllegalArgumentException)
{
- EventHandlerMap::const_iterator aIt = maEvents.find( nEventId );
- if( aIt == maEvents.end() )
+ EventHandlerInfoMap::const_iterator aIt = maEventInfos.find( nEventId );
+ if( aIt == maEventInfos.end() )
throw lang::IllegalArgumentException();
return aIt->second;
}
-::rtl::OUString VbaEventsHelperBase::getEventHandlerPath( const EventHandlerInfo& rInfo,
- const uno::Sequence< uno::Any >& rArgs ) const throw (lang::IllegalArgumentException)
+OUString VbaEventsHelperBase::getEventHandlerPath( const EventHandlerInfo& rInfo,
+ const uno::Sequence< uno::Any >& rArgs ) throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- ::rtl::OUString aMacroName;
- switch( rInfo.meType )
+ OUString aModuleName;
+ switch( rInfo.mnModuleType )
{
- case EVENTHANDLER_GLOBAL:
- aMacroName = rInfo.maMacroName;
+ // global event handlers may exist in any standard code module
+ case script::ModuleType::NORMAL:
break;
- case EVENTHANDLER_DOCUMENT:
- aMacroName = ::rtl::OUStringBuffer( implGetDocumentModuleName( rInfo, rArgs ) ).
- append( sal_Unicode( '.' ) ).append( rInfo.maMacroName ).makeStringAndClear();
+
+ // document event: get name of the code module associated to the event sender
+ case script::ModuleType::DOCUMENT:
+ aModuleName = implGetDocumentModuleName( rInfo, rArgs );
+ if( aModuleName.getLength() == 0 )
+ throw lang::IllegalArgumentException();
break;
+
+ default:
+ throw uno::RuntimeException(); // unsupported module type
}
- MacroResolvedInfo aMacroInfo = resolveVBAMacro( mpShell, aMacroName, false );
- return aMacroInfo.mbFound ? ::rtl::OUString( aMacroInfo.msResolvedMacro ) : ::rtl::OUString();
+
+ /* Performance improvement: Check the list of existing event handlers
+ instead of searching in Basic source code every time. */
+ EventHandlerPathMap::iterator aIt = maEventPaths.find( aModuleName );
+ ModulePathMap& rPathMap = (aIt == maEventPaths.end()) ? updateModulePathMap( aModuleName ) : aIt->second;
+ return rPathMap[ rInfo.mnEventId ];
}
-void VbaEventsHelperBase::stopListening()
+void VbaEventsHelperBase::ensureVBALibrary() throw (uno::RuntimeException)
{
- if( !mbDisposed ) try
+ if( !mxModuleInfos.is() ) try
{
- uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY_THROW );
- xComponent->removeEventListener( this );
+ maLibraryName = getDefaultProjectName( mpShell );
+ if( maLibraryName.getLength() == 0 )
+ throw uno::RuntimeException();
+ uno::Reference< beans::XPropertySet > xModelProps( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xBasicLibs( xModelProps->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY_THROW );
+ mxModuleInfos.set( xBasicLibs->getByName( maLibraryName ), uno::UNO_QUERY_THROW );
+ // listen to changes in the VBA source code
+ uno::Reference< util::XChangesNotifier > xChangesNotifier( mxModuleInfos, uno::UNO_QUERY_THROW );
+ xChangesNotifier->addChangesListener( this );
}
catch( uno::Exception& )
{
+ // error accessing the Basic library, so this object is useless
+ stopListening();
+ throw uno::RuntimeException();
+ }
+}
+
+sal_Int32 VbaEventsHelperBase::getModuleType( const OUString& rModuleName ) throw (uno::RuntimeException)
+{
+ // make sure the VBA library exists
+ ensureVBALibrary();
+
+ // no module specified: global event handler in standard code modules
+ if( rModuleName.getLength() == 0 )
+ return script::ModuleType::NORMAL;
+
+ // get module type from module info
+ try
+ {
+ return mxModuleInfos->getModuleInfo( rModuleName ).ModuleType;
+ }
+ catch( uno::Exception& )
+ {
+ }
+ throw uno::RuntimeException();
+}
+
+VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( const ::rtl::OUString& rModuleName ) throw (uno::RuntimeException)
+{
+ // get type of the specified module (throws on error)
+ sal_Int32 nModuleType = getModuleType( rModuleName );
+ // search for all event handlers
+ ModulePathMap& rPathMap = maEventPaths[ rModuleName ];
+ for( EventHandlerInfoMap::iterator aIt = maEventInfos.begin(), aEnd = maEventInfos.end(); aIt != aEnd; ++aIt )
+ {
+ const EventHandlerInfo& rInfo = aIt->second;
+ if( rInfo.mnModuleType == nModuleType )
+ rPathMap[ rInfo.mnEventId ] = resolveVBAMacro( mpShell, maLibraryName, rModuleName, rInfo.maMacroName );
}
+ return rPathMap;
}
// ============================================================================
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 8211269bcd2a..c814632dc76c 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -485,82 +485,88 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
dispatchExecute( pViewShell, SID_VIEWSHELL1 );
}
-bool extractBoolFromAny( bool& rbValue, const uno::Any& rAny )
+sal_Int32 extractIntFromAny( const uno::Any& rAny ) throw (uno::RuntimeException)
{
- if( rAny >>= rbValue ) return true;
-
- sal_Int64 nSigned = 0;
- if( rAny >>= nSigned ) { rbValue = nSigned != 0; return true; }
-
- sal_uInt64 nUnsigned = 0;
- if( rAny >>= nUnsigned ) { rbValue = nUnsigned > 0; return true; }
-
- double fDouble = 0.0;
- if( rAny >>= fDouble ) { rbValue = fDouble != 0.0; return true; }
+ switch( rAny.getValueType().getTypeClass() )
+ {
+ case uno::TypeClass_FLOAT:
+ return static_cast< sal_Int32 >( rAny.get< float >() );
+ case uno::TypeClass_DOUBLE:
+ return static_cast< sal_Int32 >( rAny.get< double >() );
+ case uno::TypeClass_BYTE:
+ case uno::TypeClass_SHORT:
+ case uno::TypeClass_LONG:
+ return rAny.get< sal_Int32 >();
+ default:;
+ }
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid type, cannot convert to integer." ) ), 0 );
+}
- return false;
+sal_Int32 extractIntFromAny( const uno::Any& rAny, sal_Int32 nDefault ) throw (uno::RuntimeException)
+{
+ return rAny.hasValue() ? extractIntFromAny( rAny ) : nDefault;
+>>>>>>> ooo/DEV300_m106
}
bool extractBoolFromAny( const uno::Any& rAny ) throw (uno::RuntimeException)
{
- bool bValue = false;
- if( extractBoolFromAny( bValue, rAny ) )
- return bValue;
- throw uno::RuntimeException();
+ switch( rAny.getValueType().getTypeClass() )
+ {
+ case uno::TypeClass_BOOLEAN:
+ return rAny.get< bool >();
+ case uno::TypeClass_FLOAT:
+ return rAny.get< float >() != 0.0;
+ case uno::TypeClass_DOUBLE:
+ return rAny.get< double >() != 0.0;
+ case uno::TypeClass_BYTE:
+ case uno::TypeClass_SHORT:
+ case uno::TypeClass_LONG:
+ return rAny.get< sal_Int32 >() != 0;
+ case uno::TypeClass_HYPER:
+ return rAny.get< sal_Int64 >() != 0;
+ default:;
+ }
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid type, cannot convert to boolean." ) ), 0 );
}
-rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
+bool extractBoolFromAny( const uno::Any& rAny, bool bDefault ) throw (uno::RuntimeException)
+{
+ return rAny.hasValue() ? extractBoolFromAny( rAny ) : bDefault;
+}
+
+::rtl::OUString extractStringFromAny( const uno::Any& rAny, bool bUppercaseBool ) throw (uno::RuntimeException)
{
- uno::Type aType = pvargItem.getValueType();
- uno::TypeClass eTypeClass = aType.getTypeClass();
- rtl::OUString sString;
- switch ( eTypeClass )
+ switch( rAny.getValueType().getTypeClass() )
{
- case uno::TypeClass_BOOLEAN:
- {
- sal_Bool bBool = sal_False;
- pvargItem >>= bBool;
- sString = rtl::OUString::valueOf( bBool );
- break;
- }
case uno::TypeClass_STRING:
- pvargItem >>= sString;
- break;
+ return rAny.get< ::rtl::OUString >();
+ case uno::TypeClass_BOOLEAN:
+ return bUppercaseBool ?
+ (rAny.get< bool >() ? ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TRUE" ) ) : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FALSE" ) )) :
+ ::rtl::OUString::valueOf( (sal_Bool)rAny.get< bool >() );
case uno::TypeClass_FLOAT:
- {
- float aFloat = 0;
- pvargItem >>= aFloat;
- sString = rtl::OUString::valueOf( aFloat );
- break;
- }
+ return ::rtl::OUString::valueOf( rAny.get< float >() );
case uno::TypeClass_DOUBLE:
- {
- double aDouble = 0;
- pvargItem >>= aDouble;
- sString = rtl::OUString::valueOf( aDouble );
- break;
- }
+ return ::rtl::OUString::valueOf( rAny.get< double >() );
+ case uno::TypeClass_BYTE:
case uno::TypeClass_SHORT:
case uno::TypeClass_LONG:
- case uno::TypeClass_BYTE:
- {
- sal_Int32 aNum = 0;
- pvargItem >>= aNum;
- sString = rtl::OUString::valueOf( aNum );
- break;
- }
-
+ return ::rtl::OUString::valueOf( rAny.get< sal_Int32 >() );
case uno::TypeClass_HYPER:
- {
- sal_Int64 aHyper = 0;
- pvargItem >>= aHyper;
- sString = rtl::OUString::valueOf( aHyper );
- break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid type, can't convert")), uno::Reference< uno::XInterface >() );
+ return ::rtl::OUString::valueOf( rAny.get< sal_Int64 >() );
+ default:;
}
- return sString;
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid type, cannot convert to string." ) ), 0 );
+}
+
+::rtl::OUString extractStringFromAny( const uno::Any& rAny, const ::rtl::OUString& rDefault, bool bUppercaseBool ) throw (uno::RuntimeException)
+{
+ return rAny.hasValue() ? extractStringFromAny( rAny, bUppercaseBool ) : rDefault;
+}
+
+rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
+{
+ return extractStringFromAny( pvargItem );
}
@@ -697,7 +703,7 @@ rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
return sResult.makeStringAndClear( );
}
-double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
+double getPixelTo100thMillimeterConversionFactor( const css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
{
double fConvertFactor = 1.0;
if( bVertical )
@@ -711,12 +717,12 @@ double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt:
return fConvertFactor;
}
-double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
+double PointsToPixels( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
{
double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
return PointsToHmm( fPoints ) * fConvertFactor;
}
-double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
+double PixelsToPoints( const css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
{
double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
return HmmToPoints( fPixels/fConvertFactor );
@@ -880,128 +886,176 @@ void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, con
// ====UserFormGeomentryHelper====
//---------------------------------------------
-UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
-: mbDialog( uno::Reference< awt::XDialog >( xControl, uno::UNO_QUERY ).is() )
+UserFormGeometryHelper::UserFormGeometryHelper(
+ const uno::Reference< uno::XComponentContext >& /*xContext*/,
+ const uno::Reference< awt::XControl >& xControl,
+ double fOffsetX, double fOffsetY ) :
+ mfOffsetX( fOffsetX ),
+ mfOffsetY( fOffsetY ),
+ mbDialog( uno::Reference< awt::XDialog >( xControl, uno::UNO_QUERY ).is() )
{
if ( !xControl.is() )
throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No control is provided!" ) ),
uno::Reference< uno::XInterface >() );
mxWindow.set( xControl->getPeer(), uno::UNO_QUERY_THROW );
+ mxModelProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
+ mxUnitConv.set( mxWindow, uno::UNO_QUERY_THROW );
}
-//---------------------------------------------
-double UserFormGeometryHelper::getLeft()
+double UserFormGeometryHelper::getLeft() const
{
- return mxWindow->getPosSize().X;
+ return implGetPos( false );
}
-//---------------------------------------------
-void UserFormGeometryHelper::setLeft( double nLeft )
+void UserFormGeometryHelper::setLeft( double fLeft )
{
- mxWindow->setPosSize( nLeft, mxWindow->getPosSize().Y, 0, 0, awt::PosSize::POS );
+ implSetPos( fLeft, false );
}
-//---------------------------------------------
-double UserFormGeometryHelper::getTop()
+double UserFormGeometryHelper::getTop() const
{
- return mxWindow->getPosSize().Y;
+ return implGetPos( true );
}
-//---------------------------------------------
-void UserFormGeometryHelper::setTop( double nTop )
+void UserFormGeometryHelper::setTop( double fTop )
{
- mxWindow->setPosSize( mxWindow->getPosSize().X, nTop, 0, 0, awt::PosSize::POS );
+ implSetPos( fTop, true );
}
-//---------------------------------------------
-double UserFormGeometryHelper::getWidth()
+double UserFormGeometryHelper::getWidth() const
{
- if ( mbDialog )
- {
- const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow );
- if ( pWindow )
- {
- // get the size with decoration
- Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL );
- return aResult.getWidth();
- }
- }
+ return implGetSize( false, true );
+}
+
+void UserFormGeometryHelper::setWidth( double fWidth )
+{
+ implSetSize( fWidth, false, true );
+}
- return mxWindow->getPosSize().Width;
+double UserFormGeometryHelper::getHeight() const
+{
+ return implGetSize( true, true );
}
-//---------------------------------------------
-void UserFormGeometryHelper::setWidth( double nWidth )
+void UserFormGeometryHelper::setHeight( double fHeight )
{
- sal_Int64 nNewWidth = nWidth;
+ implSetSize( fHeight, true, true );
+}
- if ( mbDialog )
- {
- const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow );
- if ( pWindow )
- {
- // set the size with decoration
- Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL );
- if ( !aRDecor.IsEmpty() )
- {
- sal_Int64 nDecor = aRDecor.getWidth();
- sal_Int64 nUnDecor = mxWindow->getPosSize().Width;
- if ( nWidth < nDecor - nUnDecor )
- nUnDecor = nDecor - nWidth; // avoid negative size
- nNewWidth = nWidth + nUnDecor - nDecor;
- }
- }
- }
+double UserFormGeometryHelper::getInnerWidth() const
+{
+ return implGetSize( false, false );
+}
- mxWindow->setPosSize( 0, 0, nNewWidth, 0, awt::PosSize::WIDTH );
+void UserFormGeometryHelper::setInnerWidth( double fWidth )
+{
+ implSetSize( fWidth, false, false );
}
-//---------------------------------------------
-double UserFormGeometryHelper::getHeight()
+double UserFormGeometryHelper::getInnerHeight() const
+{
+ return implGetSize( true, false );
+}
+
+void UserFormGeometryHelper::setInnerHeight( double fHeight )
+{
+ implSetSize( fHeight, true, false );
+}
+
+double UserFormGeometryHelper::getOffsetX() const
+{
+ return mfOffsetX;
+}
+
+double UserFormGeometryHelper::getOffsetY() const
+{
+ return mfOffsetY;
+}
+
+// ----------------------------------------------------------------------------
+
+static const ::rtl::OUString saPosXName( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
+static const ::rtl::OUString saPosYName( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
+static const ::rtl::OUString saWidthName( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+static const ::rtl::OUString saHeightName( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+
+double UserFormGeometryHelper::implGetPos( bool bPosY ) const
+{
+ sal_Int32 nPosAppFont = mxModelProps->getPropertyValue( bPosY ? saPosYName : saPosXName ).get< sal_Int32 >();
+ // appfont to pixel
+ awt::Point aPosPixel = mxUnitConv->convertPointToPixel( awt::Point( nPosAppFont, nPosAppFont ), util::MeasureUnit::APPFONT );
+ // pixel to VBA points
+ awt::Point aPosPoint = mxUnitConv->convertPointToLogic( aPosPixel, util::MeasureUnit::POINT );
+ return bPosY ? (aPosPoint.Y - mfOffsetY) : (aPosPoint.X - mfOffsetX);
+}
+
+void UserFormGeometryHelper::implSetPos( double fPos, bool bPosY )
{
- if ( mbDialog )
+ // convert passed VBA points to pixels
+ sal_Int32 nPosPixel = static_cast< sal_Int32 >( fPos + (bPosY ? mfOffsetY : mfOffsetX) );
+ awt::Point aPosPixel = mxUnitConv->convertPointToPixel( awt::Point( nPosPixel, nPosPixel ), util::MeasureUnit::POINT );
+ // pixel to appfont
+ awt::Point aPosAppFont = mxUnitConv->convertPointToLogic( aPosPixel, util::MeasureUnit::APPFONT );
+ mxModelProps->setPropertyValue( bPosY ? saPosYName : saPosXName, uno::Any( bPosY ? aPosAppFont.Y : aPosAppFont.X ) );
+}
+
+double UserFormGeometryHelper::implGetSize( bool bHeight, bool bOuter ) const
+{
+ sal_Int32 nSizeAppFont = mxModelProps->getPropertyValue( bHeight ? saHeightName : saWidthName ).get< sal_Int32 >();
+ // appfont to pixel
+ awt::Size aSizePixel = mxUnitConv->convertSizeToPixel( awt::Size( nSizeAppFont, nSizeAppFont ), util::MeasureUnit::APPFONT );
+
+ /* The VBA symbols 'Width' and 'Height' return the outer size including
+ window decoration (in difference to the symbols 'InnerWidth' and
+ 'InnerHeight'), but the window API returns the inner size. */
+ if( mbDialog && bOuter )
{
- const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow );
- if ( pWindow )
+ if( const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) )
{
- // get the size with decoration
- Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL );
- return aResult.getHeight();
+ Rectangle aOuterRect = pWindow->GetWindowExtentsRelative( NULL );
+ aSizePixel = awt::Size( aOuterRect.getWidth(), aOuterRect.getHeight() );
}
}
- return mxWindow->getPosSize().Height;
+ // pixel to VBA points
+ awt::Size aSizePoint = mxUnitConv->convertSizeToLogic( aSizePixel, util::MeasureUnit::POINT );
+ return bHeight ? aSizePoint.Height : aSizePoint.Width;
}
-//---------------------------------------------
-void UserFormGeometryHelper::setHeight( double nHeight )
+void UserFormGeometryHelper::implSetSize( double fSize, bool bHeight, bool bOuter )
{
- sal_Int64 nNewHeight = nHeight;
- if ( mbDialog )
+ // convert passed VBA points to pixels
+ sal_Int32 nSize = static_cast< sal_Int32 >( fSize );
+ awt::Size aSizePixel = mxUnitConv->convertSizeToPixel( awt::Size( nSize, nSize ), util::MeasureUnit::POINT );
+
+ /* The VBA symbols 'Width' and 'Height' set the outer size (in difference
+ to the symbols 'InnerWidth' and 'InnerHeight'), but the dialog model
+ expects the inner size. We have to remove the window extents from the
+ pixel height to get the same result. */
+ if ( mbDialog && bOuter )
{
- const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow );
- if ( pWindow )
+ if( const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) )
{
- // set the size with decoration
- Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL );
- if ( !aRDecor.IsEmpty() )
+ Rectangle aOuterRect = pWindow->GetWindowExtentsRelative( NULL );
+ if( !aOuterRect.IsEmpty() )
{
- sal_Int64 nDecor = aRDecor.getHeight();
- sal_Int64 nUnDecor = mxWindow->getPosSize().Height;
- if ( nHeight < nDecor - nUnDecor )
- nUnDecor = nDecor - nHeight; // avoid negative size
- nNewHeight = nHeight + nUnDecor - nDecor;
+ awt::Rectangle aInnerRect = mxWindow->getPosSize();
+ sal_Int32 nDecorWidth = aOuterRect.getWidth() - aInnerRect.Width;
+ sal_Int32 nDecorHeight = aOuterRect.getHeight() - aInnerRect.Height;
+ aSizePixel.Width = ::std::max< sal_Int32 >( aSizePixel.Width - nDecorWidth, 1 );
+ aSizePixel.Height = ::std::max< sal_Int32 >( aSizePixel.Height - nDecorHeight, 1 );
}
}
}
- mxWindow->setPosSize( 0, 0, 0, nNewHeight, awt::PosSize::HEIGHT );
+ awt::Size aSizeAppFont = mxUnitConv->convertSizeToLogic( aSizePixel, util::MeasureUnit::APPFONT );
+ mxModelProps->setPropertyValue( bHeight ? saHeightName : saWidthName, uno::Any( bHeight ? aSizeAppFont.Height : aSizeAppFont.Width ) );
}
-// ============
+// ============================================================================
- double ConcreteXShapeGeometryAttributes::getLeft()
+ double ConcreteXShapeGeometryAttributes::getLeft() const
{
return m_pShapeHelper->getLeft();
}
@@ -1009,7 +1063,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
{
m_pShapeHelper->setLeft( nLeft );
}
- double ConcreteXShapeGeometryAttributes::getTop()
+ double ConcreteXShapeGeometryAttributes::getTop() const
{
return m_pShapeHelper->getTop();
}
@@ -1018,7 +1072,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
m_pShapeHelper->setTop( nTop );
}
- double ConcreteXShapeGeometryAttributes::getHeight()
+ double ConcreteXShapeGeometryAttributes::getHeight() const
{
return m_pShapeHelper->getHeight();
}
@@ -1026,7 +1080,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
{
m_pShapeHelper->setHeight( nHeight );
}
- double ConcreteXShapeGeometryAttributes::getWidth()
+ double ConcreteXShapeGeometryAttributes::getWidth() const
{
return m_pShapeHelper->getWidth();
}
@@ -1042,7 +1096,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No valid shape for helper")), css::uno::Reference< css::uno::XInterface >() );
}
- double ShapeHelper::getHeight()
+ double ShapeHelper::getHeight() const
{
return Millimeter::getInPoints(xShape->getSize().Height);
}
@@ -1061,9 +1115,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
}
}
-
-
- double ShapeHelper::getWidth()
+ double ShapeHelper::getWidth() const
{
return Millimeter::getInPoints(xShape->getSize().Width);
}
@@ -1083,7 +1135,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
}
- double ShapeHelper::getLeft()
+ double ShapeHelper::getLeft() const
{
return Millimeter::getInPoints(xShape->getPosition().X);
}
@@ -1097,7 +1149,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
}
- double ShapeHelper::getTop()
+ double ShapeHelper::getTop() const
{
return Millimeter::getInPoints(xShape->getPosition().Y);
}
@@ -1165,26 +1217,6 @@ void UserFormGeometryHelper::setHeight( double nHeight )
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;
- }
-
// Listener for XNotifyingDispatch
VBADispatchListener::VBADispatchListener() : m_State( sal_False )
{
@@ -1219,6 +1251,50 @@ void UserFormGeometryHelper::setHeight( double nHeight )
throw uno::RuntimeException();
return pFoundShell;
}
+uno::Reference< XHelperInterface > getVBADocument( const uno::Reference< frame::XModel >& xModel )
+{
+ uno::Reference< XHelperInterface > xIf;
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDocProps( xModel, uno::UNO_QUERY_THROW );
+ ::rtl::OUString aCodeName;
+ xDocProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CodeName" ) ) ) >>= aCodeName;
+ xIf = getUnoDocModule( aCodeName, getSfxObjShell( xModel ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return xIf;
+}
+
+uno::Reference< XHelperInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell )
+{
+ uno::Reference< XHelperInterface > xIf;
+ if ( pShell )
+ {
+ rtl::OUString sProj( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ BasicManager* pBasMgr = pShell->GetBasicManager();
+ if ( pBasMgr && pBasMgr->GetName().Len() )
+ sProj = pBasMgr->GetName();
+ if( StarBASIC* pBasic = pShell->GetBasicManager()->GetLib( sProj ) )
+ if( SbModule* pMod = pBasic->FindModule( aModName ) )
+ xIf.set( pMod->GetUnoModule(), uno::UNO_QUERY );
+ }
+ return xIf;
+}
+
+SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
+{
+ SfxObjectShell* pFoundShell = NULL;
+ if ( xModel.is() )
+ {
+ uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY_THROW );
+ pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()));
+ }
+ if ( !pFoundShell )
+ throw uno::RuntimeException();
+ return pFoundShell;
+}
} // openoffice
} //org
diff --git a/vbahelper/source/vbahelper/vbawindowbase.cxx b/vbahelper/source/vbahelper/vbawindowbase.cxx
index aa2d911caba7..f789595d20ed 100644
--- a/vbahelper/source/vbahelper/vbawindowbase.cxx
+++ b/vbahelper/source/vbahelper/vbawindowbase.cxx
@@ -25,137 +25,113 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <vbahelper/helperdecl.hxx>
-#include <vbahelper/vbawindowbase.hxx>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/XWindow2.hpp>
+
+#include "vbahelper/vbawindowbase.hxx"
+#include "vbahelper/helperdecl.hxx"
#include <com/sun/star/awt/PosSize.hpp>
using namespace ::com::sun::star;
using namespace ::ooo::vba;
-VbaWindowBase::VbaWindowBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowBaseImpl_BASE( xParent, xContext ), m_xModel( xModel )
+VbaWindowBase::VbaWindowBase(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ const uno::Reference< frame::XController >& xController ) throw (uno::RuntimeException) :
+ WindowBaseImpl_BASE( xParent, xContext ),
+ m_xModel( xModel, uno::UNO_SET_THROW )
{
+ construct( xController );
}
-VbaWindowBase::VbaWindowBase( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext )
- : WindowBaseImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ),
- m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
+VbaWindowBase::VbaWindowBase( uno::Sequence< uno::Any > const & args,
+ uno::Reference< uno::XComponentContext > const & xContext ) throw (uno::RuntimeException) :
+ WindowBaseImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0, false ), xContext ),
+ m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1, false ) )
{
+ construct( getXSomethingFromArgs< frame::XController >( args, 2 ) );
}
sal_Bool SAL_CALL
VbaWindowBase::getVisible() throw (uno::RuntimeException)
{
- sal_Bool bVisible = sal_True;
- uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow2 > xWindow2 (xWindow, uno::UNO_QUERY_THROW );
- if( xWindow2.is() )
- {
- bVisible = xWindow2->isVisible();
- }
- return bVisible;
+ return getWindow2()->isVisible();
}
void SAL_CALL
-VbaWindowBase::setVisible(sal_Bool _visible) throw (uno::RuntimeException)
-{
- uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- if( xWindow.is() )
- {
- xWindow->setVisible( _visible );
- }
-}
-
-css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel )
+VbaWindowBase::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
{
- css::awt::Rectangle aRect;
- uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- if( xWindow.is() )
- {
- aRect = xWindow->getPosSize();
- }
- return aRect;
+ getWindow2()->setVisible( _visible );
}
-void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, sal_uInt16 nFlag )
+void setPosSize( const uno::Reference< awt::XWindow >& xWindow, sal_Int32 nValue, sal_Int16 nFlag )
{
- uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- if( xWindow.is() )
+ css::awt::Rectangle aRect = xWindow->getPosSize();
+ switch( nFlag )
{
- css::awt::Rectangle aRect = xWindow->getPosSize();
- switch( nFlag )
- {
- case css::awt::PosSize::X:
- xWindow->setPosSize( nValue, aRect.Y, 0, 0, css::awt::PosSize::X );
- break;
- case css::awt::PosSize::Y:
- xWindow->setPosSize( aRect.X, nValue, 0, 0, css::awt::PosSize::Y );
- break;
- case css::awt::PosSize::WIDTH:
- xWindow->setPosSize( 0, 0, nValue, aRect.Height, css::awt::PosSize::WIDTH );
- break;
- case css::awt::PosSize::HEIGHT:
- xWindow->setPosSize( 0, 0, aRect.Width, nValue, css::awt::PosSize::HEIGHT );
- break;
- default:
- break;
- }
+ case css::awt::PosSize::X:
+ xWindow->setPosSize( nValue, aRect.Y, 0, 0, css::awt::PosSize::X );
+ break;
+ case css::awt::PosSize::Y:
+ xWindow->setPosSize( aRect.X, nValue, 0, 0, css::awt::PosSize::Y );
+ break;
+ case css::awt::PosSize::WIDTH:
+ xWindow->setPosSize( 0, 0, nValue, aRect.Height, css::awt::PosSize::WIDTH );
+ break;
+ case css::awt::PosSize::HEIGHT:
+ xWindow->setPosSize( 0, 0, aRect.Width, nValue, css::awt::PosSize::HEIGHT );
+ break;
+ default:
+ break;
}
}
sal_Int32 SAL_CALL
VbaWindowBase::getHeight() throw (uno::RuntimeException)
{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.Height;
+ return getWindow()->getPosSize().Height;
}
void SAL_CALL
VbaWindowBase::setHeight( sal_Int32 _height ) throw (uno::RuntimeException)
{
- setPosSize(m_xModel, _height, css::awt::PosSize::HEIGHT);
+ setPosSize( getWindow(), _height, css::awt::PosSize::HEIGHT );
}
sal_Int32 SAL_CALL
VbaWindowBase::getLeft() throw (uno::RuntimeException)
{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.X;
+ return getWindow()->getPosSize().X;
}
void SAL_CALL
VbaWindowBase::setLeft( sal_Int32 _left ) throw (uno::RuntimeException)
{
- setPosSize(m_xModel, _left, css::awt::PosSize::X);
+ setPosSize( getWindow(), _left, css::awt::PosSize::X );
}
+
sal_Int32 SAL_CALL
VbaWindowBase::getTop() throw (uno::RuntimeException)
{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.Y;
+ return getWindow()->getPosSize().Y;
}
void SAL_CALL
VbaWindowBase::setTop( sal_Int32 _top ) throw (uno::RuntimeException)
{
- setPosSize(m_xModel, _top, css::awt::PosSize::Y);
+ setPosSize( getWindow(), _top, css::awt::PosSize::Y );
}
+
sal_Int32 SAL_CALL
VbaWindowBase::getWidth() throw (uno::RuntimeException)
{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.Width;
+ return getWindow()->getPosSize().Width;
}
void SAL_CALL
VbaWindowBase::setWidth( sal_Int32 _width ) throw (uno::RuntimeException)
{
- setPosSize(m_xModel, _width, css::awt::PosSize::WIDTH);
+ setPosSize( getWindow(), _width, css::awt::PosSize::WIDTH );
}
rtl::OUString&
@@ -177,4 +153,28 @@ VbaWindowBase::getServiceNames()
return aServiceNames;
}
+uno::Reference< frame::XController > VbaWindowBase::getController() throw (css::uno::RuntimeException)
+{
+ return uno::Reference< frame::XController >( m_xController, uno::UNO_SET_THROW );
+}
+
+uno::Reference< awt::XWindow > VbaWindowBase::getWindow() throw (uno::RuntimeException)
+{
+ return uno::Reference< awt::XWindow >( m_xWindow, uno::UNO_SET_THROW );
+}
+
+uno::Reference< awt::XWindow2 > VbaWindowBase::getWindow2() throw (uno::RuntimeException)
+{
+ return uno::Reference< awt::XWindow2 >( getWindow(), uno::UNO_QUERY_THROW );
+}
+
+void VbaWindowBase::construct( const uno::Reference< frame::XController >& xController ) throw (uno::RuntimeException)
+{
+ if( !xController.is() ) throw uno::RuntimeException();
+ uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW );
+ uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
+ m_xController = xController;
+ m_xWindow = xWindow;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
index 84685a780fdb..573d8836bafb 100644
--- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx
+++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -84,6 +84,11 @@
#define CTF_PM_PRINT_HEADERS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0017))
#define CTF_PM_PRINT_OBJECTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0018))
#define CTF_PM_PRINT_ZEROVALUES (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0019))
+#define CTF_PM_MARGINALL (XML_PM_CTF_START + 0x001A)
+#define CTF_PM_MARGINTOP (XML_PM_CTF_START + 0x001B)
+#define CTF_PM_MARGINBOTTOM (XML_PM_CTF_START + 0x001C)
+#define CTF_PM_MARGINLEFT (XML_PM_CTF_START + 0x001D)
+#define CTF_PM_MARGINRIGHT (XML_PM_CTF_START + 0x001E)
#define CTF_PM_PAGEUSAGE (XML_PM_CTF_START + 0x0031)
#define CTF_PM_GRAPHICPOSITION (XML_PM_CTF_START + 0x0032)
@@ -119,6 +124,12 @@
#define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034))
#define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035))
#define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036))
+#define CTF_PM_HEADERMARGINALL (CTF_PM_HEADERFLAG|CTF_PM_MARGINALL)
+#define CTF_PM_HEADERMARGINTOP (CTF_PM_HEADERFLAG|CTF_PM_MARGINTOP)
+#define CTF_PM_HEADERMARGINBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_MARGINBOTTOM)
+#define CTF_PM_HEADERMARGINLEFT (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT)
+#define CTF_PM_HEADERMARGINRIGHT (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT)
+
// footer
#define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL)
#define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP)
@@ -141,6 +152,12 @@
#define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034))
#define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035))
#define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036))
+#define CTF_PM_FOOTERMARGINALL (CTF_PM_FOOTERFLAG|CTF_PM_MARGINALL)
+#define CTF_PM_FOOTERMARGINTOP (CTF_PM_FOOTERFLAG|CTF_PM_MARGINTOP)
+#define CTF_PM_FOOTERMARGINBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_MARGINBOTTOM)
+#define CTF_PM_FOOTERMARGINLEFT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT)
+#define CTF_PM_FOOTERMARGINRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT)
+
#define CTF_PM_FTN_HEIGTH (XML_PM_CTF_START + 0x0060)
#define CTF_PM_FTN_LINE_WEIGTH (XML_PM_CTF_START + 0x0061)
#define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062)
diff --git a/xmloff/inc/xmloff/txtprmap.hxx b/xmloff/inc/xmloff/txtprmap.hxx
index 88c7d0aa63df..c708391ec0ff 100644
--- a/xmloff/inc/xmloff/txtprmap.hxx
+++ b/xmloff/inc/xmloff/txtprmap.hxx
@@ -180,6 +180,14 @@
#define CTF_TEXT_DISPLAY (XML_TEXT_CTF_START + 143)
#define CTF_TEXT_CLIP (XML_TEXT_CTF_START + 144)
#define CTF_TEXT_CLIP11 (XML_TEXT_CTF_START + 145)
+#define CTF_PARAMARGINALL (XML_TEXT_CTF_START + 146)
+#define CTF_PARAMARGINALL_REL (XML_TEXT_CTF_START + 147)
+#define CTF_MARGINALL (XML_TEXT_CTF_START + 148)
+#define CTF_MARGINLEFT (XML_TEXT_CTF_START + 149)
+#define CTF_MARGINRIGHT (XML_TEXT_CTF_START + 150)
+#define CTF_MARGINTOP (XML_TEXT_CTF_START + 151)
+#define CTF_MARGINBOTTOM (XML_TEXT_CTF_START + 152)
+
#define TEXT_PROP_MAP_TEXT 0
#define TEXT_PROP_MAP_PARA 1
#define TEXT_PROP_MAP_FRAME 2
diff --git a/xmloff/inc/xmloff/xmlmetai.hxx b/xmloff/inc/xmloff/xmlmetai.hxx
index 5d5e470f3be3..7f285ddd1ad5 100644
--- a/xmloff/inc/xmloff/xmlmetai.hxx
+++ b/xmloff/inc/xmloff/xmlmetai.hxx
@@ -26,8 +26,8 @@
*
************************************************************************/
-#ifndef _XMLOFF_XMLMETAI_HXX
-#define _XMLOFF_XMLMETAI_HXX
+#ifndef XMLOFF_XMLMETAI_HXX
+#define XMLOFF_XMLMETAI_HXX
#include "sal/config.h"
#include "xmloff/dllapi.h"
@@ -70,12 +70,6 @@ public:
virtual void EndElement();
-protected:
- /// initialize DocumentProperties object with DOM and base URL
- void initDocumentProperties();
- // set the BuildId property at the importer
- void setBuildId(const ::rtl::OUString & i_rBuildId);
-
public:
static void setBuildId(const ::rtl::OUString & rGenerator,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xImportInfo );
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 64f5a44960e1..e9f00e519a34 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3136,6 +3136,8 @@ namespace xmloff { namespace token {
XML_MIN_VALUE,
XML_MAX_VALUE,
+ XML_MARGIN, // #i117001#
+
XML_TOKEN_END
};
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 9e2b9abf0139..e473551e5f68 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3134,6 +3134,8 @@ namespace xmloff { namespace token {
TOKEN( "min-value", XML_MIN_VALUE ),
TOKEN( "max-value", XML_MAX_VALUE ),
+ TOKEN( "margin", XML_MARGIN),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, NULL, NULL, XML_TOKEN_END }
#else
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index bba4b8f40e36..2d6f09187b6a 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -444,6 +444,17 @@ void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
if( xInfoSetInfo->hasPropertyByName( msPreview ) )
xInfoSet->getPropertyValue( msPreview ) >>= mbPreview;
+
+ ::rtl::OUString const sOrganizerMode(
+ RTL_CONSTASCII_USTRINGPARAM("OrganizerMode"));
+ if (xInfoSetInfo->hasPropertyByName(sOrganizerMode))
+ {
+ sal_Bool bStyleOnly(sal_False);
+ if (xInfoSet->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
+ {
+ mbLoadDoc = !bStyleOnly;
+ }
+ }
}
}
@@ -753,7 +764,7 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName,
{
SvXMLImportContext* pContext = 0L;
- if (!IsStylesOnlyMode() && (getImportFlags() & IMPORT_META))
+ if (getImportFlags() & IMPORT_META)
{
uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
@@ -761,9 +772,11 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName,
uno::UNO_QUERY_THROW);
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> const xDocProps(
+ (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties());
pContext = new SvXMLMetaDocumentContext(*this,
XML_NAMESPACE_OFFICE, rLocalName,
- xDPS->getDocumentProperties(), xDocBuilder);
+ xDocProps, xDocBuilder);
}
if(!pContext)
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 4c433c2bae50..3f26ebc05cd4 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -889,12 +889,12 @@ namespace xmloff
if (!bRetrievedValues)
{
getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty);
- ENSURE_OR_BREAK( pCurrentValueProperty && pValueProperty, "OControlImport::StartElement: illegal value property names!" );
+ ENSURE_OR_BREAK( pValueProperty, "OControlImport::StartElement: illegal value property names!" );
bRetrievedValues = sal_True;
}
- OSL_ENSURE((PROPID_VALUE != aValueProps->Handle) || pValueProperty,
+ ENSURE_OR_BREAK((PROPID_VALUE != aValueProps->Handle) || pValueProperty,
"OControlImport::StartElement: the control does not have a value property!");
- OSL_ENSURE((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty,
+ ENSURE_OR_BREAK((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty,
"OControlImport::StartElement: the control does not have a current-value property!");
// transfer the name
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index a6dbd1d0995e..4e2024c3cf5e 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/xml/dom/XSAXDocumentBuilder.hpp>
+#include <com/sun/star/xml/xpath/XXPathAPI.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
@@ -125,6 +126,71 @@ void XMLDocumentBuilderContext::EndElement()
//===========================================================================
+static void
+lcl_initDocumentProperties(SvXMLImport & rImport,
+ uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder,
+ uno::Reference<document::XDocumentProperties> const& xDocProps)
+{
+ uno::Sequence< uno::Any > aSeq(1);
+ uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder,
+ uno::UNO_QUERY_THROW);
+ aSeq[0] <<= xDB->getDocument();
+ uno::Reference< lang::XInitialization > const xInit(xDocProps,
+ uno::UNO_QUERY_THROW);
+ try {
+ xInit->initialize(aSeq);
+ rImport.SetStatistics(xDocProps->getDocumentStatistics());
+ // convert all URLs from relative to absolute
+ xDocProps->setTemplateURL(rImport.GetAbsoluteReference(
+ xDocProps->getTemplateURL()));
+ xDocProps->setAutoloadURL(rImport.GetAbsoluteReference(
+ xDocProps->getAutoloadURL()));
+ SvXMLMetaDocumentContext::setBuildId(
+ xDocProps->getGenerator(), rImport.getImportInfo());
+ } catch (uno::RuntimeException) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SvXMLMetaDocumentContext::initDocumentProperties: "
+ "properties init exception")),
+ rImport, makeAny(e));
+ }
+}
+
+static void
+lcl_initGenerator(SvXMLImport & rImport,
+ uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder)
+{
+ uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder,
+ uno::UNO_QUERY_THROW);
+ uno::Reference< xml::dom::XDocument > const xDoc(xDB->getDocument(),
+ uno::UNO_SET_THROW);
+ try {
+ uno::Reference< xml::xpath::XXPathAPI > const xPath(
+ rImport.getServiceFactory()->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.xpath.XPathAPI"))),
+ uno::UNO_QUERY_THROW );
+ xPath->registerNS(GetXMLToken(XML_NP_OFFICE),GetXMLToken(XML_N_OFFICE));
+ xPath->registerNS(GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META));
+
+ ::rtl::OUString const expr(RTL_CONSTASCII_USTRINGPARAM(
+ "string(/office:document-meta/office:meta/meta:generator)"));
+ uno::Reference< xml::xpath::XXPathObject > const xObj(
+ xPath->eval(xDoc.get(), expr), uno::UNO_SET_THROW);
+ OUString const value(xObj->getString());
+ SvXMLMetaDocumentContext::setBuildId(value, rImport.getImportInfo());
+ } catch (uno::RuntimeException) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SvXMLMetaDocumentContext::initGenerator: exception")),
+ rImport, makeAny(e));
+ }
+}
+
SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport,
sal_uInt16 nPrfx, const rtl::OUString& rLName,
const uno::Reference<document::XDocumentProperties>& xDocProps,
@@ -133,8 +199,9 @@ SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport,
mxDocProps(xDocProps),
mxDocBuilder(xDocBuilder)
{
- DBG_ASSERT(xDocProps.is(), "SvXMLMetaDocumentContext: no document props");
- DBG_ASSERT(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr");
+// #i103539#: must always read meta.xml for generator, xDocProps unwanted then
+// OSL_ENSURE(xDocProps.is(), "SvXMLMetaDocumentContext: no document props");
+ OSL_ENSURE(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr");
// here are no attributes
}
@@ -167,6 +234,7 @@ void SvXMLMetaDocumentContext::StartElement(
mxDocBuilder->startElement(
GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(),
GetXMLToken(XML_DOCUMENT_META)), xAttrList);
+
}
void SvXMLMetaDocumentContext::EndElement()
@@ -176,43 +244,16 @@ void SvXMLMetaDocumentContext::EndElement()
GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(),
GetXMLToken(XML_DOCUMENT_META)));
mxDocBuilder->endDocument();
- initDocumentProperties();
-}
-
-void SvXMLMetaDocumentContext::initDocumentProperties()
-{
- uno::Sequence< uno::Any > aSeq(1);
- uno::Reference< xml::dom::XSAXDocumentBuilder > xDB (mxDocBuilder,
- uno::UNO_QUERY_THROW);
- aSeq[0] <<= xDB->getDocument();
- uno::Reference< lang::XInitialization > xInit(mxDocProps,
- uno::UNO_QUERY_THROW);
- try {
- xInit->initialize(aSeq);
- GetImport().SetStatistics(mxDocProps->getDocumentStatistics());
- // convert all URLs from relative to absolute
- mxDocProps->setTemplateURL(GetImport().GetAbsoluteReference(
- mxDocProps->getTemplateURL()));
- mxDocProps->setAutoloadURL(GetImport().GetAbsoluteReference(
- mxDocProps->getAutoloadURL()));
- setBuildId(mxDocProps->getGenerator());
- } catch (uno::RuntimeException) {
- throw;
- } catch (uno::Exception & e) {
- throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "SvXMLMetaDocumentContext::initDocumentProperties: "
- "properties init exception")),
- GetImport(), makeAny(e));
+ if (mxDocProps.is())
+ {
+ lcl_initDocumentProperties(GetImport(), mxDocBuilder, mxDocProps);
+ }
+ else
+ {
+ lcl_initGenerator(GetImport(), mxDocBuilder);
}
}
-void SvXMLMetaDocumentContext::setBuildId(const ::rtl::OUString & i_rBuildId)
-{
- SvXMLMetaDocumentContext::setBuildId( i_rBuildId, GetImport().getImportInfo() );
-}
-
-//static
void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId, const uno::Reference<beans::XPropertySet>& xImportInfo )
{
OUString sBuildId;
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index 6a9b9d1d7a2f..ff6c46cc466f 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -85,6 +85,12 @@ void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nInde
struct XMLPropertyStateBuffer
{
+ XMLPropertyState* pPMMarginAll;
+ XMLPropertyState* pPMMarginTop;
+ XMLPropertyState* pPMMarginBottom;
+ XMLPropertyState* pPMMarginLeft;
+ XMLPropertyState* pPMMarginRight;
+
XMLPropertyState* pPMBorderAll;
XMLPropertyState* pPMBorderTop;
XMLPropertyState* pPMBorderBottom;
@@ -107,7 +113,13 @@ struct XMLPropertyStateBuffer
void ContextFilter( ::std::vector< XMLPropertyState >& rPropState );
};
-XMLPropertyStateBuffer::XMLPropertyStateBuffer() :
+XMLPropertyStateBuffer::XMLPropertyStateBuffer()
+ : pPMMarginAll( NULL )
+ , pPMMarginTop( NULL )
+ , pPMMarginBottom( NULL )
+ , pPMMarginLeft( NULL )
+ , pPMMarginRight( NULL )
+ ,
pPMBorderAll( NULL ),
pPMBorderTop( NULL ),
pPMBorderBottom( NULL ),
@@ -130,6 +142,31 @@ XMLPropertyStateBuffer::XMLPropertyStateBuffer() :
void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
{
+ if (pPMMarginAll)
+ {
+ if (pPMMarginTop && pPMMarginBottom && pPMMarginLeft && pPMMarginRight)
+ {
+ sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0;
+
+ pPMMarginTop->maValue >>= nTop;
+ pPMMarginBottom->maValue >>= nBottom;
+ pPMMarginLeft->maValue >>= nLeft;
+ pPMMarginRight->maValue >>= nRight;
+
+ if ((nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight))
+ {
+ lcl_RemoveState( pPMMarginTop );
+ lcl_RemoveState( pPMMarginBottom );
+ lcl_RemoveState( pPMMarginLeft );
+ lcl_RemoveState( pPMMarginRight );
+ }
+ else
+ lcl_RemoveState( pPMMarginAll );
+ }
+ else
+ lcl_RemoveState( pPMMarginAll );
+ }
+
if( pPMBorderAll )
{
if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight )
@@ -349,6 +386,11 @@ void XMLPageMasterExportPropMapper::ContextFilter(
switch( nSimpleId )
{
+ case CTF_PM_MARGINALL: pBuffer->pPMMarginAll = pProp; break;
+ case CTF_PM_MARGINTOP: pBuffer->pPMMarginTop = pProp; break;
+ case CTF_PM_MARGINBOTTOM: pBuffer->pPMMarginBottom = pProp; break;
+ case CTF_PM_MARGINLEFT: pBuffer->pPMMarginLeft = pProp; break;
+ case CTF_PM_MARGINRIGHT: pBuffer->pPMMarginRight = pProp; break;
case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break;
case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break;
case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break;
diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx
index e8c82edb7f5b..f920425e0d8e 100644
--- a/xmloff/source/style/PageMasterImportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterImportPropMapper.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-
#include "PageMasterImportPropMapper.hxx"
#include "PageMasterPropMapper.hxx"
#include <xmloff/PageMasterStyleMap.hxx>
@@ -126,7 +125,15 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
XMLPropertyState* pFooterHeight = NULL;
XMLPropertyState* pFooterMinHeight = NULL;
XMLPropertyState* pFooterDynamic = NULL;
- sal_uInt16 i; // for the "for" loop
+ XMLPropertyState* pAllMarginProperty = NULL;
+ XMLPropertyState* pMargins[4] = { NULL, NULL, NULL, NULL };
+ ::std::auto_ptr<XMLPropertyState> pNewMargins[4];
+ XMLPropertyState* pAllHeaderMarginProperty = NULL;
+ XMLPropertyState* pHeaderMargins[4] = { NULL, NULL, NULL, NULL };
+ ::std::auto_ptr<XMLPropertyState> pNewHeaderMargins[4];
+ XMLPropertyState* pAllFooterMarginProperty = NULL;
+ XMLPropertyState* pFooterMargins[4] = { NULL, NULL, NULL, NULL };
+ ::std::auto_ptr<XMLPropertyState> pNewFooterMargins[4];
::std::vector< XMLPropertyState >::iterator aEnd = rProperties.end();
for (::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != aEnd; ++aIter)
@@ -186,12 +193,60 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
case CTF_PM_HEADERMINHEIGHT : pHeaderMinHeight = property; break;
case CTF_PM_FOOTERHEIGHT : pFooterHeight = property; break;
case CTF_PM_FOOTERMINHEIGHT : pFooterMinHeight = property; break;
+ case CTF_PM_MARGINALL :
+ pAllMarginProperty = property; break;
+ case CTF_PM_MARGINTOP :
+ pMargins[XML_LINE_TOP] = property; break;
+ case CTF_PM_MARGINBOTTOM:
+ pMargins[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_MARGINLEFT :
+ pMargins[XML_LINE_LEFT] = property; break;
+ case CTF_PM_MARGINRIGHT :
+ pMargins[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_HEADERMARGINALL :
+ pAllHeaderMarginProperty = property; break;
+ case CTF_PM_HEADERMARGINTOP :
+ pHeaderMargins[XML_LINE_TOP] = property; break;
+ case CTF_PM_HEADERMARGINBOTTOM:
+ pHeaderMargins[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_HEADERMARGINLEFT :
+ pHeaderMargins[XML_LINE_LEFT] = property; break;
+ case CTF_PM_HEADERMARGINRIGHT :
+ pHeaderMargins[XML_LINE_RIGHT] = property; break;
+ case CTF_PM_FOOTERMARGINALL :
+ pAllFooterMarginProperty = property; break;
+ case CTF_PM_FOOTERMARGINTOP :
+ pFooterMargins[XML_LINE_TOP] = property; break;
+ case CTF_PM_FOOTERMARGINBOTTOM:
+ pFooterMargins[XML_LINE_BOTTOM] = property; break;
+ case CTF_PM_FOOTERMARGINLEFT :
+ pFooterMargins[XML_LINE_LEFT] = property; break;
+ case CTF_PM_FOOTERMARGINRIGHT :
+ pFooterMargins[XML_LINE_RIGHT] = property; break;
}
}
}
- for ( i = 0; i < 4; i++)
+ for (sal_uInt16 i = 0; i < 4; i++)
{
+ if (pAllMarginProperty && !pMargins[i])
+ {
+ pNewMargins[i].reset(new XMLPropertyState(
+ pAllMarginProperty->mnIndex + 1 + i,
+ pAllMarginProperty->maValue));
+ }
+ if (pAllHeaderMarginProperty && !pHeaderMargins[i])
+ {
+ pNewHeaderMargins[i].reset(new XMLPropertyState(
+ pAllHeaderMarginProperty->mnIndex + 1 + i,
+ pAllHeaderMarginProperty->maValue));
+ }
+ if (pAllFooterMarginProperty && !pFooterMargins[i])
+ {
+ pNewFooterMargins[i].reset(new XMLPropertyState(
+ pAllFooterMarginProperty->mnIndex + 1 + i,
+ pAllFooterMarginProperty->maValue));
+ }
if (pAllPaddingProperty && !pPadding[i])
pNewPadding[i] = new XMLPropertyState(pAllPaddingProperty->mnIndex + 1 + i, pAllPaddingProperty->maValue);
if (pAllBorderProperty && !pBorders[i])
@@ -294,8 +349,20 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
aAny.setValue( &bValue, ::getBooleanCppuType() );
pFooterDynamic = new XMLPropertyState(pFooterMinHeight->mnIndex + 1, aAny);
}
- for (i = 0; i < 4; i++)
+ for (sal_uInt16 i = 0; i < 4; i++)
{
+ if (pNewMargins[i].get())
+ {
+ rProperties.push_back(*pNewMargins[i]);
+ }
+ if (pNewHeaderMargins[i].get())
+ {
+ rProperties.push_back(*pNewHeaderMargins[i]);
+ }
+ if (pNewFooterMargins[i].get())
+ {
+ rProperties.push_back(*pNewFooterMargins[i]);
+ }
if (pNewPadding[i])
{
rProperties.push_back(*pNewPadding[i]);
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index 79624cfc6285..52f02ef4afd9 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -30,7 +30,7 @@
#include "precompiled_xmloff.hxx"
#include <xmloff/PageMasterStyleMap.hxx>
-#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
using namespace ::xmloff::token;
@@ -53,10 +53,11 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_PM_TYPE_NUMLETTERSYNC, 0 ),
PLMAP( "PrinterPaperTray", XML_NAMESPACE_STYLE, XML_PAPER_TRAY_NAME, XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT, 0 ),
PLMAP( "IsLandscape", XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PM_TYPE_PRINTORIENTATION, 0 ),
- PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, 0 ),
- PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ),
- PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, 0 ),
- PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ),
+ PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_MARGINALL ),
+ PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_MARGINTOP ),
+ PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_MARGINBOTTOM ),
+ PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_MARGINLEFT ),
+ PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_MARGINRIGHT ),
PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_BORDERALL ),
PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_BORDERTOP ),
PLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_BORDERBOTTOM ),
@@ -130,9 +131,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ),
HFMAP( "HeaderHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMINHEIGHT ),
HFMAP( "HeaderIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_HEADERDYNAMIC ),
- HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ),
- HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ),
- HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ),
+ HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINALL ),
+ HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINLEFT ),
+ HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINRIGHT ),
+ HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINBOTTOM ),
HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_HEADERBORDERALL ),
HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_HEADERBORDERTOP ),
HFMAP( "HeaderBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_HEADERBORDERBOTTOM ),
@@ -160,9 +162,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
HFMAP( "FooterHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERHEIGHT ),
HFMAP( "FooterHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMINHEIGHT ),
HFMAP( "FooterIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_FOOTERDYNAMIC ),
- HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ),
- HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ),
- HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ),
+ HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINALL ),
+ HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINLEFT ),
+ HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINRIGHT ),
+ HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINTOP ),
HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERALL ),
HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERTOP ),
HFMAP( "FooterBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERBOTTOM ),
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 169ec68b6698..22aba3a67289 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -31,6 +31,9 @@
#include <tools/debug.hxx>
#include <xmloff/txtprmap.hxx>
#include <com/sun/star/table/BorderLine2.hpp>
+
+#include "txtexppr.hxx"
+
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
@@ -38,7 +41,10 @@
#include <com/sun/star/awt/FontPitch.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
-#include "txtexppr.hxx"
+
+#include <tools/debug.hxx>
+
+#include <xmloff/txtprmap.hxx>
#include <xmloff/xmlexp.hxx>
#include "XMLSectionFootnoteConfigExport.hxx"
@@ -303,6 +309,26 @@ void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
// helper method; implementation below
bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&);
+static void
+lcl_checkMultiProperty(XMLPropertyState *const pState,
+ XMLPropertyState *const pRelState)
+{
+ if (pState && pRelState)
+ {
+ sal_Int32 nTemp = 0;
+ pRelState->maValue >>= nTemp;
+ if (100 == nTemp)
+ {
+ pRelState->mnIndex = -1;
+ pRelState->maValue.clear();
+ }
+ else
+ {
+ pState->mnIndex = -1;
+ pState->maValue.clear();
+ }
+ }
+}
void XMLTextExportPropertySetMapper::ContextFilter(
::std::vector< XMLPropertyState >& rProperties,
@@ -443,6 +469,9 @@ void XMLTextExportPropertySetMapper::ContextFilter(
XMLPropertyState* pClip11State = NULL;
XMLPropertyState* pClipState = NULL;
+ XMLPropertyState* pAllParaMargin = NULL;
+ XMLPropertyState* pAllMargin = NULL;
+
sal_Bool bNeedsAnchor = sal_False;
for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
@@ -557,6 +586,8 @@ void XMLTextExportPropertySetMapper::ContextFilter(
case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break;
case CTF_TEXT_CLIP11: pClip11State = propertie; break;
case CTF_TEXT_CLIP: pClipState = propertie; break;
+ case CTF_PARAMARGINALL: pAllParaMargin = propertie; break;
+ case CTF_MARGINALL: pAllMargin = propertie; break;
}
}
@@ -602,87 +633,21 @@ void XMLTextExportPropertySetMapper::ContextFilter(
}
}
- if( pParaLeftMarginState && pParaLeftMarginRelState )
- {
- sal_Int32 nTemp = 0;
- pParaLeftMarginRelState->maValue >>= nTemp;
- if( nTemp == 100 )
- {
- pParaLeftMarginRelState->mnIndex = -1;
- pParaLeftMarginRelState->maValue.clear();
- }
- else
- {
- pParaLeftMarginState->mnIndex = -1;
- pParaLeftMarginState->maValue.clear();
- }
-
- }
-
- if( pParaRightMarginState && pParaRightMarginRelState )
- {
- sal_Int32 nTemp = 0;
- pParaRightMarginRelState->maValue >>= nTemp;
- if( nTemp == 100 )
- {
- pParaRightMarginRelState->mnIndex = -1;
- pParaRightMarginRelState->maValue.clear();
- }
- else
- {
- pParaRightMarginState->mnIndex = -1;
- pParaRightMarginState->maValue.clear();
- }
- }
-
- if( pParaFirstLineState && pParaFirstLineRelState )
- {
- sal_Int32 nTemp = 0;
- pParaFirstLineRelState->maValue >>= nTemp;
- if( nTemp == 100 )
- {
- pParaFirstLineRelState->mnIndex = -1;
- pParaFirstLineRelState->maValue.clear();
- }
- else
- {
- pParaFirstLineState->mnIndex = -1;
- pParaFirstLineState->maValue.clear();
- }
- }
+ lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState);
+ lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState);
+ lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState);
+ lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState);
+ lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState);
- if( pParaTopMarginState && pParaTopMarginRelState )
+ if (pAllParaMargin)
{
- sal_Int32 nTemp = 0;
- pParaTopMarginRelState->maValue >>= nTemp;
- if( nTemp == 100 )
- {
- pParaTopMarginRelState->mnIndex = -1;
- pParaTopMarginRelState->maValue.clear();
- }
- else
- {
- pParaTopMarginState->mnIndex = -1;
- pParaTopMarginState->maValue.clear();
- }
-
+ pAllParaMargin->mnIndex = -1; // just export individual attributes...
+ pAllParaMargin->maValue.clear();
}
-
- if( pParaBottomMarginState && pParaBottomMarginRelState )
+ if (pAllMargin)
{
- sal_Int32 nTemp = 0;
- pParaBottomMarginRelState->maValue >>= nTemp;
- if( nTemp == 100 )
- {
- pParaBottomMarginRelState->mnIndex = -1;
- pParaBottomMarginRelState->maValue.clear();
- }
- else
- {
- pParaBottomMarginState->mnIndex = -1;
- pParaBottomMarginState->maValue.clear();
- }
-
+ pAllMargin->mnIndex = -1; // just export individual attributes...
+ pAllMargin->maValue.clear();
}
if( pAllBorderWidthState )
diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
index 6a16693078e2..342291d703f4 100644
--- a/xmloff/source/text/txtimppr.cxx
+++ b/xmloff/source/text/txtimppr.cxx
@@ -316,7 +316,12 @@ void XMLTextImportPropertyMapper::finished(
XMLPropertyState* pVertOrientRelAsChar = 0;
XMLPropertyState* pBackTransparency = NULL; // transparency in %
XMLPropertyState* pBackTransparent = NULL; // transparency as boolean
- sal_uInt16 i; // for the "for" loop
+ XMLPropertyState* pAllParaMargin = 0;
+ XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 };
+ ::std::auto_ptr<XMLPropertyState> pNewParaMargins[4];
+ XMLPropertyState* pAllMargin = 0;
+ XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 };
+ ::std::auto_ptr<XMLPropertyState> pNewMargins[4];
for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
aIter != rProperties.end();
@@ -384,7 +389,31 @@ void XMLTextImportPropertyMapper::finished(
bHasAnyWidth = sal_True; break;
case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break;
case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break;
-
+ case CTF_PARAMARGINALL:
+ case CTF_PARAMARGINALL_REL:
+ pAllParaMargin = property; break;
+ case CTF_PARALEFTMARGIN:
+ case CTF_PARALEFTMARGIN_REL:
+ pParaMargins[XML_LINE_LEFT] = property; break;
+ case CTF_PARARIGHTMARGIN:
+ case CTF_PARARIGHTMARGIN_REL:
+ pParaMargins[XML_LINE_RIGHT] = property; break;
+ case CTF_PARATOPMARGIN:
+ case CTF_PARATOPMARGIN_REL:
+ pParaMargins[XML_LINE_TOP] = property; break;
+ case CTF_PARABOTTOMMARGIN:
+ case CTF_PARABOTTOMMARGIN_REL:
+ pParaMargins[XML_LINE_BOTTOM] = property; break;
+ case CTF_MARGINALL:
+ pAllMargin = property; break;
+ case CTF_MARGINLEFT:
+ pMargins[XML_LINE_LEFT] = property; break;
+ case CTF_MARGINRIGHT:
+ pMargins[XML_LINE_RIGHT] = property; break;
+ case CTF_MARGINTOP:
+ pMargins[XML_LINE_TOP] = property; break;
+ case CTF_MARGINBOTTOM:
+ pMargins[XML_LINE_BOTTOM] = property; break;
}
}
@@ -401,8 +430,31 @@ void XMLTextImportPropertyMapper::finished(
FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL,
pFontPitchCTL, pFontCharSetCTL );
- for( i = 0; i < 4; i++ )
+ for (sal_uInt16 i = 0; i < 4; i++)
{
+ if (pAllParaMargin && !pParaMargins[i])
+ {
+#ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pAllParaMargin->mnIndex + (2*i) + 2 );
+ OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN &&
+ nTmp <= CTF_PARABOTTOMMARGIN_REL,
+ "wrong property context id" );
+#endif
+ pNewParaMargins[i].reset(new XMLPropertyState(
+ pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue));
+ }
+ if (pAllMargin && !pMargins[i])
+ {
+#ifdef DBG_UTIL
+ sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
+ pAllMargin->mnIndex + i + 1 );
+ OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM,
+ "wrong property context id" );
+#endif
+ pNewMargins[i].reset(new XMLPropertyState(
+ pAllMargin->mnIndex + i + 1, pAllMargin->maValue));
+ }
if( pAllBorderDistance && !pBorderDistances[i] )
{
#ifdef DBG_UTIL
@@ -450,6 +502,16 @@ void XMLTextImportPropertyMapper::finished(
pBorders[i]->maValue <<= aBorderLine;
}
}
+
+ if (pAllParaMargin)
+ {
+ pAllParaMargin->mnIndex = -1;
+ }
+ if (pAllMargin)
+ {
+ pAllMargin->mnIndex = -1;
+ }
+
if( pAllBorderDistance )
pAllBorderDistance->mnIndex = -1;
@@ -593,8 +655,16 @@ void XMLTextImportPropertyMapper::finished(
delete pNewFontCharSetCTL;
}
- for( i=0; i<4; i++ )
+ for (sal_uInt16 i=0; i<4; i++)
{
+ if (pNewParaMargins[i].get())
+ {
+ rProperties.push_back(*pNewParaMargins[i]);
+ }
+ if (pNewMargins[i].get())
+ {
+ rProperties.push_back(*pNewMargins[i]);
+ }
if( pNewBorderDistances[i] )
{
rProperties.push_back( *pNewBorderDistances[i] );
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index d3b5311cfc84..2409a6493d16 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -28,11 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
+
+#include <xmloff/txtprmap.hxx>
+
#include <tools/debug.hxx>
-#include "xmloff/xmlnmspe.hxx"
+
+#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
#include "txtprhdl.hxx"
-#include <xmloff/txtprmap.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -88,6 +91,9 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
// RES_UNKNOWNATR_CONTAINER
MP_E( "ParaUserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
// RES_LR_SPACE
+ // !!! DO NOT REORDER THE MARGINS !!!
+ MP_E( "ParaLeftMargin", FO, MARGIN, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ),
+ MP_E( "ParaLeftMarginRelative", FO, MARGIN, XML_TYPE_PERCENT16, CTF_PARAMARGINALL_REL ),
MP_E( "ParaLeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ),
MP_E( "ParaLeftMarginRelative", FO, MARGIN_LEFT, XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ),
MP_E( "ParaRightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ),
@@ -575,11 +581,12 @@ XMLPropertyMapEntry aXMLFramePropMap[] =
MG_ED( "VertOrientPosition", SVG, Y, XML_TYPE_MEASURE, 0 ),
// ***** The map for automatic styles starts here *****
// RES_LR_SPACE
- MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, 0),
- MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ),
+ MG_E( "LeftMargin", FO, MARGIN, XML_TYPE_MEASURE, CTF_MARGINALL ),
+ MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, CTF_MARGINLEFT ),
+ MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_MARGINRIGHT ),
// RES_UL_SPACE
- MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, 0 ),
- MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ),
+ MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, CTF_MARGINTOP ),
+ MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_MARGINBOTTOM ),
// RES_PAGEDESC
// not required
// RES_BREAK
@@ -844,7 +851,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType )
break;
case TEXT_PROP_MAP_SHAPE_PARA:
pMap = &(aXMLParaPropMap[1]);
- DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "shape para map changed" );
+ OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "shape para map changed" );
break;
case TEXT_PROP_MAP_PARA:
pMap = aXMLParaPropMap;
@@ -854,7 +861,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType )
break;
case TEXT_PROP_MAP_AUTO_FRAME:
pMap = &(aXMLFramePropMap[13]);
- DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "frame map changed" );
+ OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "frame map changed" );
break;
case TEXT_PROP_MAP_SHAPE:
pMap = aXMLShapePropMap;