summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-05-27 20:46:20 +0200
committerJan Holesovsky <kendy@suse.cz>2011-05-27 20:46:20 +0200
commit9aad9cf77f93f6a689731972d97f2acc04527422 (patch)
treecf79102596e03d339b8429fd5545410b16292870
parentfde37c1a38273e7a90bb6d26cd1c948e8fe63783 (diff)
parenta019d3e3c180b0ec41e2725e7cfe442afccf9cb0 (diff)
Merge remote-tracking branch 'origin/integration/dev300_m106'
Conflicts: basic/source/classes/sbunoobj.cxx basic/source/inc/runtime.hxx basic/source/runtime/step1.cxx desktop/source/deployment/dp_services.cxx drawinglayer/prj/d.lst drawinglayer/source/primitive2d/makefile.mk sfx2/source/appl/appinit.cxx sfx2/source/appl/appquit.cxx sfx2/source/inc/appdata.hxx sfx2/source/view/viewfrm.cxx svx/source/fmcomp/gridctrl.cxx vbahelper/source/vbahelper/vbahelper.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.mk12
-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.hxx194
-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.cxx54
-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.cxx7
-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.cxx38
-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/Library_drawinglayer.mk1
-rw-r--r--drawinglayer/Package_inc.mk1
-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.lst2
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx69
-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.cxx127
-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)22
-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)5
-rw-r--r--framework/source/xml/imagesdocumenthandler.cxx (renamed from framework/source/fwe/xml/imagesdocumenthandler.cxx)2
-rw-r--r--idl/source/objects/slot.cxx4
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu2
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu2
-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
-rw-r--r--oovbaapi/ooo/vba/excel/XWorkbook.idl7
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl3
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheets.idl1
-rwxr-xr-xoovbaapi/ooo/vba/makefile.mk2
-rw-r--r--oovbaapi/ooo/vba/msforms/XButton.idl6
-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-xoovbaapi/ooo/vba/msforms/XFrame.idl55
-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/inc/sfx2/dinfdlg.hxx3
-rw-r--r--sfx2/source/appl/appdata.cxx2
-rw-r--r--sfx2/source/appl/appinit.cxx8
-rw-r--r--sfx2/source/appl/appopen.cxx5
-rw-r--r--sfx2/source/appl/appquit.cxx3
-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/dinfdlg.cxx62
-rwxr-xr-xsfx2/source/dialog/dinfdlg.hrc1
-rw-r--r--sfx2/source/dialog/dinfdlg.src12
-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.cxx98
-rw-r--r--sfx2/source/inc/appdata.hxx3
-rw-r--r--svx/inc/svx/svdograf.hxx2
-rwxr-xr-xsvx/inc/svx/svxids.hrc1
-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.cxx14
-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.hxx5
-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.mk11
-rwxr-xr-xvbahelper/Library_vbahelper.mk14
-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.hxx70
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx123
-rw-r--r--vbahelper/inc/vbahelper/vbawindowbase.hxx37
-rwxr-xr-xvbahelper/inc/vbahelper/weakreference.hxx94
-rw-r--r--vbahelper/source/msforms/vbabutton.cxx55
-rw-r--r--vbahelper/source/msforms/vbabutton.hxx15
-rw-r--r--vbahelper/source/msforms/vbacheckbox.cxx11
-rw-r--r--vbahelper/source/msforms/vbacheckbox.hxx1
-rw-r--r--vbahelper/source/msforms/vbacombobox.cxx117
-rw-r--r--vbahelper/source/msforms/vbacombobox.hxx14
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx133
-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.cxx83
-rw-r--r--vbahelper/source/msforms/vbaframe.hxx30
-rw-r--r--vbahelper/source/msforms/vbalabel.cxx11
-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.cxx10
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.hxx1
-rw-r--r--vbahelper/source/msforms/vbatextbox.cxx41
-rw-r--r--vbahelper/source/msforms/vbatextbox.hxx6
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.cxx54
-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/vbacommandbar.cxx9
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.cxx74
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.hxx11
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.cxx27
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.hxx21
-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.cxx687
-rw-r--r--vbahelper/source/vbahelper/vbawindowbase.cxx142
-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/txtfldi.cxx2
-rw-r--r--xmloff/source/text/txtimppr.cxx78
-rw-r--r--xmloff/source/text/txtprmap.cxx23
248 files changed, 6754 insertions, 2060 deletions
diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk
index 0bea1330a0..c87d43afb2 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 e40ad07917..6fe310e28a 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 451d15cf40..deb801211a 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 1ab94fa248..5ac6f32572 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 e5987cf9cd..4162df662d 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 b07518abac..1170c31d40 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1761,8 +1761,7 @@ rtl::OUString Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Ref
return aName;
}
-bool checkUnoObjectType( SbUnoObject* pUnoObj,
- const ::rtl::OUString& 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 d503cefacd..1e6b59edbe 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 edbbcc44bc..4f3a1ad32b 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 7bb42a64d1..f9d1879a90 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 5fe64ceae0..146c832df9 100755
--- a/basic/source/comp/makefile.mk
+++ b/basic/source/comp/makefile.mk
@@ -41,16 +41,16 @@ SLOFILES= \
$(SLO)$/exprnode.obj \
$(SLO)$/io.obj \
$(SLO)$/loops.obj \
- $(SLO)$/sbcomp.obj \
$(SLO)$/symtbl.obj \
$(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 729ec8390c..a12fda353a 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 b069512f4e..2099ad830d 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 89b6eb26b5..e30aea8d25 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 16e5ee30a8..bc127c550b 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 3d4a1ffc7b..b9bfd9b74d 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,37 +93,17 @@ typedef ::cppu::WeakComponentImplHelper9<
typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
::com::sun::star::container::XContainer > NameContainerHelper;
-
-struct hashName_Impl
-{
- size_t operator()(const ::rtl::OUString Str) const
- {
- return (size_t)Str.hashCode();
- }
-};
-
-struct eqName_Impl
-{
- sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
- {
- return ( Str1 == Str2 );
- }
-};
-
-typedef boost::unordered_map
-<
- ::rtl::OUString,
- sal_Int32,
- hashName_Impl,
- eqName_Impl
->
-NameContainerNameMap;
-
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::util::XChangesNotifier > NameContainer_BASE;
//============================================================================
-class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
+class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE
{
+ typedef boost::unordered_map < ::rtl::OUString, sal_Int32, ::rtl::OUStringHash > NameContainerNameMap;
+
NameContainerNameMap mHashMap;
::com::sun::star::uno::Sequence< ::rtl::OUString > mNames;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
@@ -123,14 +112,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 +168,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 +209,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 +272,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 +545,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 +576,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 +717,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 +736,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 +760,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 +781,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;
-
+ < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
+ bool m_bBundledPackagesLoaded;
- int m_iUserPackage;
- int m_iSharedPackage;
- int m_iBundledPackage;
+ 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 073311c5f7..8f0a3940b5 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 bf2caf12cb..8cc889fd5b 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 33a6fa7589..63dd3813be 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 boost::unordered_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 5be485e8f7..dbb66169e2 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 b1200887c3..c87c9aa522 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>
@@ -109,8 +111,6 @@ SbxVariable* getDefaultProp( SbxVariable* pRef );
#include <basic/sbobjmod.hxx>
-#include <basic/sbobjmod.hxx>
-
#ifdef WNT
#define GradientStyle_RECT BLA_GradientStyle_RECT
#include <windows.h>
@@ -119,6 +119,9 @@ SbxVariable* getDefaultProp( SbxVariable* pRef );
#undef GradientSyle_RECT
#endif
+// from source/classes/sbxmod.cxx
+Reference< XModel > getDocumentModel( StarBASIC* );
+
static void FilterWhiteSpace( String& rStr )
{
rStr.EraseAllChars( ' ' );
@@ -383,22 +386,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
@@ -477,11 +506,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 );
}
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index fc30f5fb9b..760c3f3139 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1055,6 +1055,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;
@@ -1170,7 +1174,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 7258a7d2d4..d8ac23a289 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 7178492a92..308550a4e6 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 a15457c1c0..e48d1ce539 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 a9dddab134..0733e0d49d 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 b9db477b36..27548afc39 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 ::rtl::OUString& aClass );
+bool checkUnoObjectType( SbUnoObject* refVal, const ::rtl::OUString& aClass );
// Laden einer numerischen Konstanten (+ID)
@@ -441,11 +440,11 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass )
{
bool bRet = true;
- if( aClass.getLength() != 0 )
+ if( !aClass.isEmpty() )
{
bRet = pObj->IsClass( aClass );
if( !bRet )
- bRet = aClass.equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("object") ) );
+ bRet = aClass.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("object") );
if( !bRet )
{
String aObjClass = pObj->GetClassName();
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index cd7aa82b7d..845f1046cf 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 444a4edd24..5a52b819b6 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 635b293698..29564fddd1 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 7c04fd352f..33b6e39a1b 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 ba9e029133..a4e69d9244 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 aa5811e746..c6287bdca4 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 ee41cab635..c087ab98bd 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 8661c0fa91..1f49fc64d0 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 a4bd5ae352..1bba5dab6f 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 d2b7b1dfee..2a6ae71bed 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 c9e076d9f8..82d28617bd 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 e787831794..676c38e9b8 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 d7ea2c4d78..3ef8b4c506 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 b18e20b5d1..f1d027211c 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 5a1fe174d7..ce9cd1bf10 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 f928d6e708..203086e16e 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 d054360d0f..fd7ce73c93 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 14bf8ee5fe..886e639923 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 95d71edee8..bdad9dac75 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 b2f23d8d51..3b0bd52bba 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 9621b33410..3b3648ef8c 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 49ae3b4015..dd0da5df4d 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 5527aec92e..4e938585c1 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 bb6eb60661..3bf9cac179 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 f8efe2eed4..b664b38977 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 99a30de206..4a6062acc6 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, const
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, 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(tableNamePattern,m_nTextEncoding);
aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
@@ -1081,7 +1083,8 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( 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(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 c45482304f..59273acf1a 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 af21829918..a534a7e560 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 096f1db375..c80355c8a0 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 b75c92c464..e3e2296cca 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 ea19cf8bef..0c1c95fa7f 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 dbfbd7ad13..7abcacd6f7 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 c959230c0d..85296a8633 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 2a7b36c649..62554d6d77 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);
@@ -1923,7 +1923,7 @@ void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumn
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
- << (bAscending ? "sal_True" : "sal_False")
+ << (bAscending ? "true" : "false")
<< "\n";
#endif
}
@@ -1945,7 +1945,7 @@ void OSQLParseTreeIterator::setGroupByColumnName(const ::rtl::OUString & rColumn
cout << "OSQLParseTreeIterator::setOrderByColumnName: "
<< (const char *) rColumnName << ", "
<< (const char *) rTableRange << ", "
- << (bAscending ? "sal_True" : "sal_False")
+ << (bAscending ? "true" : "false")
<< "\n";
#endif
}
@@ -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 0c13673428..0f9170b0ed 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 e8bda451b8..d8483a2de8 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1733,6 +1733,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 a992ce28fb..07ee2e6716 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;
-
SAL_DLLPUBLIC_EXPORT 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 096d84f502..d865d7f570 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/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index fa9cef0811..7aab083fe9 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -112,6 +112,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/primitive2d/polygonprimitive2d \
drawinglayer/source/primitive2d/polypolygonprimitive2d \
drawinglayer/source/primitive2d/primitivetools2d \
+ drawinglayer/source/primitive2d/rendergraphicprimitive2d \
drawinglayer/source/primitive2d/sceneprimitive2d \
drawinglayer/source/primitive2d/sdrdecompositiontools2d \
drawinglayer/source/primitive2d/shadowprimitive2d \
diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk
index d4c81dcd30..df4a75b607 100644
--- a/drawinglayer/Package_inc.mk
+++ b/drawinglayer/Package_inc.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/polygonprimitive2d.hxx,drawinglayer/primitive2d/polygonprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx,drawinglayer/primitive2d/polypolygonprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/primitivetools2d.hxx,drawinglayer/primitive2d/primitivetools2d.hxx))
+$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/rendergraphicprimitive2d.hxx,drawinglayer/primitive2d/rendergraphicprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/sceneprimitive2d.hxx,drawinglayer/primitive2d/sceneprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx,drawinglayer/primitive2d/sdrdecompositiontools2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/shadowprimitive2d.hxx,drawinglayer/primitive2d/shadowprimitive2d.hxx))
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 9c985a66a0..22ee5b51fb 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 0000000000..1904394429
--- /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 344782b398..c54e3138f9 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx
@@ -59,6 +59,7 @@ namespace drawinglayer { namespace primitive2d {
class MetafilePrimitive2D;
class TextSimplePortionPrimitive2D;
class BitmapPrimitive2D;
+ class RenderGraphicPrimitive2D;
class TransparencePrimitive2D;
class PolygonStrokePrimitive2D;
class FillBitmapPrimitive2D;
@@ -111,6 +112,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 c83c04fca7..0f1197113a 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -44,6 +44,7 @@ namespace drawinglayer { namespace primitive2d {
class TextSimplePortionPrimitive2D;
class PolygonHairlinePrimitive2D;
class BitmapPrimitive2D;
+ class RenderGraphicPrimitive2D;
class FillBitmapPrimitive2D;
class PolyPolygonGradientPrimitive2D;
class PolyPolygonBitmapPrimitive2D;
@@ -100,6 +101,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 e69de29bb2..e8c0ccc6e5 100644
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -0,0 +1,2 @@
+
+..\inc\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\rendergraphicprimitive2d.hxx \ No newline at end of file
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index 6447d78bcf..55ed96d09c 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/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 0d97702f29..71fc248afe 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 0000000000..c58990a420
--- /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 8f3ad7acb1..4349ee6d19 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 2eb35597f2..37966678eb 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 111a6392c5..e23eb20f83 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 8009306275..7f3c22e269 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 402b4ef3f6..9db1485af3 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 7ca17fba8e..5b0897d7aa 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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
@@ -129,9 +131,9 @@ namespace drawinglayer
{
// Get the VCL font (use FontHeight as FontWidth)
Font aFont(primitive2d::getVclFontFromFontAttribute(
- rTextCandidate.getFontAttribute(),
- aFontScaling.getX(),
- aFontScaling.getY(),
+ rTextCandidate.getFontAttribute(),
+ aFontScaling.getX(),
+ aFontScaling.getY(),
fRotate,
rTextCandidate.getLocale()));
@@ -141,7 +143,7 @@ namespace drawinglayer
if( pTCPP != NULL )
{
-
+
// set the color of text decorations
const basegfx::BColor aTextlineColor = maBColorModifierStack.getModifiedColor(pTCPP->getTextlineColor());
mpOutputDevice->SetTextLineColor( Color(aTextlineColor) );
@@ -228,7 +230,7 @@ namespace drawinglayer
const basegfx::B2DVector aPixelVector(maCurrentTransformation * basegfx::B2DVector(1.0, 0.0));
const double fPixelVectorFactor(aPixelVector.getLength());
- for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin());
+ for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin());
aStart != rTextCandidate.getDXArray().end(); aStart++)
{
aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor));
@@ -330,7 +332,7 @@ namespace drawinglayer
const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
basegfx::B2DPolyPolygon aLocalPolyPolygon(basegfx::tools::clipPolygonOnRange(
aLocalPolygon, rDiscreteViewport, true, false));
-
+
if(aLocalPolyPolygon.count())
{
// subdivide
@@ -352,7 +354,7 @@ namespace drawinglayer
for(sal_uInt32 a(0); a < nCount; a++)
{
const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon());
-
+
if(bShowOutlinesThere)
{
mpOutputDevice->SetFillColor(Color(aHairlineColor));
@@ -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());
@@ -538,7 +609,7 @@ namespace drawinglayer
// nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it
// in vcl many times, create a size-optimized version
const Size aNeededBitmapSizePixel(nBWidth, nBHeight);
-
+
if(aNeededBitmapSizePixel != aBitmapEx.GetSizePixel())
{
aBitmapEx.Scale(aNeededBitmapSizePixel);
@@ -650,7 +721,7 @@ namespace drawinglayer
{
// with tiling, fill the whole PolyPolygon with the modifier color
basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon);
-
+
aLocalPolyPolygon.transform(maCurrentTransformation);
mpOutputDevice->SetLineColor();
mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
@@ -659,7 +730,7 @@ namespace drawinglayer
else
{
// without tiling, only the area common to the bitmap tile and the
- // PolyPolygon is filled. Create the bitmap tile area in object
+ // PolyPolygon is filled. Create the bitmap tile area in object
// coordinates. For this, the object transformation needs to be created
// from the already scaled PolyPolygon. The tile area in object
// coordinates wil always be non-rotated, so it's not necessary to
@@ -724,7 +795,7 @@ namespace drawinglayer
const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(
aLocalPolyPolygon, rDiscreteViewport, true, false);
-
+
if(aLocalPolyPolygon.count())
{
// subdivide
@@ -745,7 +816,7 @@ namespace drawinglayer
for(sal_uInt32 a(0); a < nCount; a++)
{
const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon());
-
+
if(bShowOutlinesThere)
{
mpOutputDevice->SetFillColor(Color(aPolygonColor));
@@ -768,7 +839,7 @@ namespace drawinglayer
{
mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
- if(mnPolygonStrokePrimitive2D
+ if(mnPolygonStrokePrimitive2D
&& getOptionsDrawinglayer().IsAntiAliasing()
&& (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW))
{
@@ -803,7 +874,7 @@ namespace drawinglayer
aScale = basegfx::absolute(aScale);
fRotate += F_PI;
}
-
+
// get BoundRect
basegfx::B2DRange aOutlineRange(rMetaCandidate.getB2DRange(getViewInformation2D()));
aOutlineRange.transform(maCurrentTransformation);
@@ -953,7 +1024,7 @@ namespace drawinglayer
// use decomposition
process(rTransCandidate.get2DDecomposition(getViewInformation2D()));
}
- else
+ else
{
if(0.0 == rTransCandidate.getTransparence())
{
@@ -975,7 +1046,7 @@ namespace drawinglayer
// paint content to it
process(rTransCandidate.getChildren());
-
+
// back to old OutDev
mpOutputDevice = pLastOutputDevice;
@@ -1101,17 +1172,17 @@ namespace drawinglayer
{
// get discrete half size
const basegfx::B2DVector aDiscreteHalfSize(
- (aBitmapSize.getWidth() - 1.0) * 0.5,
+ (aBitmapSize.getWidth() - 1.0) * 0.5,
(aBitmapSize.getHeight() - 1.0) * 0.5);
const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled());
- // do not forget evtl. moved origin in target device MapMode when
+ // do not forget evtl. moved origin in target device MapMode when
// switching it off; it would be missing and lead to wrong positions.
// All his could be done using logic sizes and coordinates, too, but
// we want a 1:1 bitmap rendering here, so it's more safe and faster
// to work with switching off MapMode usage completely.
const Point aOrigin(mpOutputDevice->GetMapMode().GetOrigin());
-
+
mpOutputDevice->EnableMapMode(false);
for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); ++aIter)
@@ -1232,22 +1303,22 @@ namespace drawinglayer
const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, -fDistance);
aMat.set(1, 2, 0.0);
aCandidate.transform(aMat);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, fDistance);
aMat.set(1, 2, -fDistance);
aCandidate.transform(aMat);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, fDistance);
aMat.set(1, 2, fDistance);
aCandidate.transform(aMat);
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+
aMat.set(0, 2, -fDistance);
aMat.set(1, 2, fDistance);
aCandidate.transform(aMat);
@@ -1311,16 +1382,16 @@ namespace drawinglayer
}
}
}
-
+
if(!bDone)
{
// remeber that we enter a PolygonStrokePrimitive2D decomposition,
// used for AA thick line drawing
mnPolygonStrokePrimitive2D++;
-
+
// line width is big enough for standard filled polygon visualisation or zero
process(rPolygonStrokeCandidate.get2DDecomposition(getViewInformation2D()));
-
+
// leave PolygonStrokePrimitive2D
mnPolygonStrokePrimitive2D--;
}
@@ -1332,7 +1403,7 @@ namespace drawinglayer
// primitive to handle embedded Eps data. On some devices, this can be
// painted directly (mac, printer).
// To be able to handle the replacement correctly, i need to handle it myself
- // since DrawEPS will not be able e.g. to rotate the replacement. To be able
+ // since DrawEPS will not be able e.g. to rotate the replacement. To be able
// to do that, i added a boolean return to OutputDevice::DrawEPS(..)
// to know when EPS was handled directly already.
basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0);
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 93decd93c5..ba3cd534f4 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 c1a8117ab0..e071b3abe8 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 03e86eb093..068e99d3b1 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 f82dc2ca6f..fe47cc69d4 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 3c870dedcf..97316d57dd 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 bff7d144dd..4f92f3e806 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1263,15 +1263,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();
@@ -1280,6 +1272,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 )
@@ -1293,17 +1304,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
@@ -1365,6 +1381,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 eaa326ab31..1724ea40dd 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 9eb8ee7794..d466104f01 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 ce38abf435..e61a9b0c79 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 14cefe36f7..7bb206d02c 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 b13069c0bf..8016b74eb5 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 823141d3b8..04669a2ddd 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 6f549cf708..e38493becd 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 84479c2c9e..5a3d26893f 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 776d564e79..55a0af968c 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 f0e234a937..6c87f86d15 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 948af2325d..fc6fb1fce5 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 6d1c03a597..d72dd52128 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 79b6fe17ea..c7ea2b60c3 100644
--- a/framework/inc/framework/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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
@@ -68,9 +68,9 @@ typedef ImageItemDescriptor* ImageItemDescriptorPtr;
SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10, 2)
typedef ExternalImageItemDescriptor* ExternalImageItemDescriptorPtr;
-SV_DECL_PTRARR_DEL( ExternalImageItemListDescriptor, ExternalImageItemDescriptorPtr, 10, 2)
+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,14 +99,14 @@ struct FWE_DLLPUBLIC ImageListsDescriptor
ExternalImageItemListDescriptor* pExternalImageList;
};
-class FWE_DLLPUBLIC ImagesConfiguration
+class ImagesConfiguration
{
public:
- static sal_Bool LoadImages(
+ static sal_Bool LoadImages(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
SvStream& rInStream, ImageListsDescriptor& aItems );
- static sal_Bool StoreImages(
+ static sal_Bool StoreImages(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
SvStream& rOutStream, const ImageListsDescriptor& aItems );
diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx
index bff0a5cce2..e957da01e0 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, // Stru
::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 7bae7866f3..1e09aadaa1 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 cbd396fddb..2c1a3ace13 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -421,6 +421,14 @@ bool ToolbarLayoutManager::requestToolbar( const ::rtl::OUString& rResourceURL )
bool bNotify( false );
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 4e35c95ab7..731df33683 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 3741c7d54b..103498c6be 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 1483a231f2..1e0ce642cf 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 f31f6baf3c..132c5550c8 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 ad50a2be4c..07365cb087 100644
--- a/framework/source/fwe/xml/imagesconfiguration.cxx
+++ b/framework/source/xml/imagesconfiguration.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 3190f8a2cf..354d0cadbd 100644
--- a/framework/source/fwe/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx
index ebbaffc455..75553a48b0 100644
--- a/idl/source/objects/slot.cxx
+++ b/idl/source/objects/slot.cxx
@@ -1592,9 +1592,9 @@ void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
void WriteBool( sal_Bool bSet, SvStream& rStream )
{
if ( bSet )
- rStream << "sal_True" << ',';
+ rStream << "TRUE" << ',';
else
- rStream << "sal_False" << ',';
+ rStream << "FALSE" << ',';
}
void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm )
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index dedcee555a..ce25934559 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -28,7 +28,7 @@
</node>
<node oor:name=".uno:ResetAttributes" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">~Clear Direct Formatting</value>
+ <value xml:lang="en-US">Clear ~Direct Formatting</value>
</prop>
</node>
<node oor:name=".uno:ClearArrowPrecedents" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index f5725b320b..07346a9e54 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -891,7 +891,7 @@
</node>
<node oor:name=".uno:ResetAttributes" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">~Clear Direct Formatting</value>
+ <value xml:lang="en-US">Clear ~Direct Formatting</value>
</prop>
</node>
<node oor:name=".uno:WrapOff" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu
index 149971a42e..37e489be70 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 ec73e01b6a..8fa0e7e9f2 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 c53e1fa357..21c7bbc5be 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 0000000000..245b252f78
--- /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 17474e2535..297161e77d 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 0000000000..8754c80713
--- /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 a88ab6b162..41a8004535 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 eab19df639..eeef790b80 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/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl
index 66dc0b58fd..26b26f504d 100644
--- a/oovbaapi/ooo/vba/excel/XWorkbook.idl
+++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl
@@ -27,7 +27,7 @@
#ifndef __ooo_vba_excel_XWorkbook_idl__
#define __ooo_vba_excel_XWorkbook_idl__
-#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/lang/XUnoTunnel.idl>
#include <ooo/vba/XHelperInterface.idl>
//=============================================================================
@@ -40,8 +40,11 @@ interface XWorksheet;
interface XWorksheets;
interface XStyles;
-interface XWorkbook : com::sun::star::uno::XInterface
+interface XWorkbook
{
+
+ interface ::com::sun::star::lang::XUnoTunnel;
+
[attribute, readonly] boolean ProtectStructure;
[attribute, readonly] XWorksheet ActiveSheet;
[attribute, readonly] string CodeName;
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index 2b041199c9..e3128181ee 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -27,7 +27,7 @@
#ifndef __ooo_vba_excel_XWorksheet_idl__
#define __ooo_vba_excel_XWorksheet_idl__
-#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/lang/XUnoTunnel.idl>
#include <ooo/vba/XHelperInterface.idl>
#include <com/sun/star/script/XInvocation.idl>
#include <com/sun/star/container/XNamed.idl>
@@ -49,6 +49,7 @@ interface XWorksheet
interface ::ooo::vba::XHelperInterface;
interface ::com::sun::star::script::XInvocation;
interface ::com::sun::star::container::XNamed;
+ interface ::com::sun::star::lang::XUnoTunnel;
[attribute] long Visible;
[attribute, readonly] long StandardHeight;
diff --git a/oovbaapi/ooo/vba/excel/XWorksheets.idl b/oovbaapi/ooo/vba/excel/XWorksheets.idl
index d0d99fe5d5..0d84bfd7dc 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheets.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheets.idl
@@ -44,6 +44,7 @@ interface XWorksheets
void Delete();
void PrintOut( [in] any From, [in] any To, [in] any Copies, [in] any Preview, [in] any ActivePrinter, [in] any PrintToFile, [in] any Collate, [in] any PrToFileName );
void Select( [in] any Replace );
+ void Copy( [in] any Before, [in] any After);
};
}; }; };
diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk
index bacb05fb6f..10281a6451 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/XButton.idl b/oovbaapi/ooo/vba/msforms/XButton.idl
index 06a4c7cb3f..c88018a0ad 100644
--- a/oovbaapi/ooo/vba/msforms/XButton.idl
+++ b/oovbaapi/ooo/vba/msforms/XButton.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,10 +30,10 @@
#include <com/sun/star/uno/XInterface.idl>
//=============================================================================
-module ooo { module vba { module msforms {
+module ooo { module vba { module msforms {
//=============================================================================
-interface XButton: com::sun::star::uno::XInterface
+interface XButton: com::sun::star::uno::XInterface
{
[attribute] string Caption;
};
diff --git a/oovbaapi/ooo/vba/msforms/XCheckBox.idl b/oovbaapi/ooo/vba/msforms/XCheckBox.idl
index 301d23a7b3..ec2c713638 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 7094629c5a..24778bd049 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 0000000000..0e7697cbd1
--- /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 41b8d9137a..684bdf65ff 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/XFrame.idl b/oovbaapi/ooo/vba/msforms/XFrame.idl
new file mode 100755
index 0000000000..6038b61dd3
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/XFrame.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * 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_XFrame_idl__
+#define __ooo_vba_msforms_XFrame_idl__
+
+#include <ooo/vba/msforms/XNewFont.idl>
+
+//=============================================================================
+
+module ooo { module vba { module msforms {
+
+//=============================================================================
+
+interface XFrame
+{
+ [attribute] string Caption;
+ [attribute] long SpecialEffect;
+ [attribute] long BorderStyle;
+ [attribute, readonly] XNewFont Font;
+
+ any Controls( [in] any Index );
+};
+
+//=============================================================================
+
+}; }; };
+
+//=============================================================================
+
+#endif
diff --git a/oovbaapi/ooo/vba/msforms/XGroupBox.idl b/oovbaapi/ooo/vba/msforms/XGroupBox.idl
index 1ca6190052..7c5d67c256 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 c8ba17cf17..7eb722e806 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 e5929a9af0..87b617e07d 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 0000000000..755dd510b6
--- /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 3b76552718..7f5b9ae45b 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 6a4f07848c..d96bcf9eab 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 9ce163a457..6fe3e8067a 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 76be892740..f06c688b0d 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 ebf4d2ee89..2717d0409d 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 4e77fa522c..e63e319cf5 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 e8830d4301..613e61d673 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 a760bffdf2..8bcf7ca698 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 717e096f16..94f1b090d8 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/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx
index cbeb4b37d0..95e8a5d0c2 100644
--- a/sfx2/inc/sfx2/dinfdlg.hxx
+++ b/sfx2/inc/sfx2/dinfdlg.hxx
@@ -174,6 +174,7 @@ class SfxDocumentPage : public SfxTabPage
private:
FixedImage aBmp1;
Edit aNameED;
+ PushButton aChangePassBtn;
FixedLine aLine1FL;
FixedText aTypeFT;
@@ -213,7 +214,9 @@ private:
DECL_LINK( DeleteHdl, PushButton * );
DECL_LINK( SignatureHdl, PushButton * );
+ DECL_LINK( ChangePassHdl, PushButton * );
void ImplUpdateSignatures();
+ void ImplCheckPasswordState();
protected:
SfxDocumentPage( Window* pParent, const SfxItemSet& );
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 327af69558..6404431ead 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 3e373c3de6..4d60e33753 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -259,10 +259,14 @@ bool SfxApplication::Initialize_Impl()
#endif
pAppData_Impl->m_pToolsErrorHdl = new SfxErrorHandler(
RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1);
+
+ pAppData_Impl->pBasicResMgr = CreateResManager("sb");
+ pAppData_Impl->pSvtResMgr = CreateResManager("svt");
+
pAppData_Impl->m_pSoErrorHdl = new SfxErrorHandler(
- RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END);
+ RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END, pAppData_Impl->pSvtResMgr );
pAppData_Impl->m_pSbxErrorHdl = new SfxErrorHandler(
- RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END );
+ RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END, pAppData_Impl->pBasicResMgr );
DBG_ASSERT( !pAppData_Impl->pAppDispat, "AppDispatcher already exists" );
pAppData_Impl->pAppDispat = new SfxDispatcher((SfxDispatcher*)0);
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 6ec464554f..84f0cef239 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 a81ccbee4f..9c39ac1a75 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -156,6 +156,9 @@ void SfxApplication::Deinitialize()
pAppData_Impl->pPool = NULL;
NoChaos::ReleaseItemPool();
+ DELETEZ(pAppData_Impl->pBasicResMgr);
+ DELETEZ(pAppData_Impl->pSvtResMgr);
+
delete pAppData_Impl->m_pSbxErrorHdl;
delete pAppData_Impl->m_pSoErrorHdl;
delete pAppData_Impl->m_pToolsErrorHdl;
diff --git a/sfx2/source/appl/sfx.src b/sfx2/source/appl/sfx.src
index 71c7c4cf98..514d990bad 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 f30f940e8b..481447fe7f 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 0a2e1e0103..5855c52f97 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -63,7 +63,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 ab8d43ce29..6d6beae11c 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/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index fd095cb7f2..7770deda3f 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -68,6 +68,7 @@
#include <sfx2/frame.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/passwd.hxx>
#include "helper.hxx"
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>
@@ -790,6 +791,7 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet )
aBmp1 ( this, SfxResId( BMP_FILE_1 ) ),
aNameED ( this, SfxResId( ED_FILE_NAME ) ),
+ aChangePassBtn ( this, SfxResId( BTN_CHANGE_PASS ) ),
aLine1FL ( this, SfxResId( FL_FILE_1 ) ),
aTypeFT ( this, SfxResId( FT_FILE_TYP ) ),
@@ -832,8 +834,10 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet )
FreeResource();
ImplUpdateSignatures();
+ ImplCheckPasswordState();
aDeleteBtn.SetClickHdl( LINK( this, SfxDocumentPage, DeleteHdl ) );
aSignatureBtn.SetClickHdl( LINK( this, SfxDocumentPage, SignatureHdl ) );
+ aChangePassBtn.SetClickHdl( LINK( this, SfxDocumentPage, ChangePassHdl ) );
// if the button text is too wide, then broaden it
const long nOffset = 12;
@@ -909,6 +913,32 @@ IMPL_LINK( SfxDocumentPage, SignatureHdl, PushButton*, EMPTYARG )
return 0;
}
+IMPL_LINK( SfxDocumentPage, ChangePassHdl, PushButton*, EMPTYARG )
+{
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+ do
+ {
+ if (!pShell)
+ break;
+
+ SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet();
+ if (!pMedSet)
+ break;
+
+ ::std::auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(this));
+ pDlg->SetMinLen(1);
+ pDlg->ShowExtras(SHOWEXTRAS_CONFIRM);
+ if (pDlg->Execute() != RET_OK)
+ break;
+
+ String aNewPass = pDlg->GetPassword();
+ pMedSet->Put( SfxStringItem(SID_PASSWORD, aNewPass) );
+ pShell->SetModified(true);
+ }
+ while (false);
+ return 0;
+}
+
void SfxDocumentPage::ImplUpdateSignatures()
{
SfxObjectShell* pDoc = SfxObjectShell::Current();
@@ -944,6 +974,34 @@ void SfxDocumentPage::ImplUpdateSignatures()
}
}
+void SfxDocumentPage::ImplCheckPasswordState()
+{
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+ do
+ {
+ if (!pShell)
+ break;
+
+ SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet();
+ if (!pMedSet)
+ break;
+
+ const SfxPoolItem* pItem;
+ if (!pMedSet->GetItemState(SID_PASSWORD, true, &pItem))
+ break;
+
+ const SfxStringItem* pStrItem = dynamic_cast<const SfxStringItem*>(pItem);
+ if (!pStrItem)
+ break;
+
+ String aPass = pStrItem->GetValue();
+ aChangePassBtn.Enable();
+ return;
+ }
+ while (false);
+ aChangePassBtn.Disable();
+}
+
//------------------------------------------------------------------------
SfxTabPage* SfxDocumentPage::Create( Window* pParent, const SfxItemSet& rItemSet )
@@ -2172,8 +2230,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
if ( pLine->m_bIsRemoved )
continue;
- Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDurationField,
- &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
+ Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField,
+ &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
Window** pCurrent = pWindows;
while ( *pCurrent )
{
diff --git a/sfx2/source/dialog/dinfdlg.hrc b/sfx2/source/dialog/dinfdlg.hrc
index f710e13534..d700bedee6 100755
--- a/sfx2/source/dialog/dinfdlg.hrc
+++ b/sfx2/source/dialog/dinfdlg.hrc
@@ -133,6 +133,7 @@
#define FT_SIGNED_VAL 77
#define STR_MULTSIGNED 78
#define BTN_SIGNATURE 79
+#define BTN_CHANGE_PASS 80
#define WIN_PROPERTIES 90
#define SB_VERTICAL 91
diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src
index ccaf6fcf21..64f28f792d 100644
--- a/sfx2/source/dialog/dinfdlg.src
+++ b/sfx2/source/dialog/dinfdlg.src
@@ -126,10 +126,18 @@ TabPage TP_DOCINFODOC
Edit ED_FILE_NAME
{
HelpID = "sfx2:Edit:TP_DOCINFODOC:ED_FILE_NAME";
- Pos = MAP_APPFONT ( 54 , 12 ) ;
- Size = MAP_APPFONT ( 200 , RSC_CD_TEXTBOX_HEIGHT ) ;
+ Pos = MAP_APPFONT ( 36 , 12 ) ;
+ Size = MAP_APPFONT ( 140 , RSC_CD_TEXTBOX_HEIGHT ) ;
Border = TRUE ;
};
+ PushButton BTN_CHANGE_PASS
+ {
+ HelpID = "sfx2:Edit:TP_DOCINFODOC:BTN_CHANGE_PASS";
+ Pos = MAP_APPFONT ( 189 , 11 ) ;
+ Size = MAP_APPFONT ( 65 , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Hide = FALSE;
+ Text [ en-US ] = "Change ~Password...";
+ };
FixedLine FL_FILE_1
{
Pos = MAP_APPFONT ( 6 , 31 ) ;
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 5db23434cb..996e1811e5 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 ec16c36605..64691834a9 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 fc58906571..ac4c671c88 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 0e2860ebf0..441c1f86dc 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>
@@ -350,24 +353,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 3dba18f324..05d2a412b7 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 >
@@ -190,11 +186,24 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even
SolarMutexGuard aSolarGuard;
if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source )
{
- lcl_UpdateAppBasicDocVars( SfxObjectShell::GetCurrentComponent(), true );
// remove ThisComponent reference from AppBasic
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 +931,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 +944,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 29f86318b3..aa180a642b 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -111,7 +111,8 @@ public:
// application members
SfxFilterMatcher* pMatcher;
- ResMgr* pLabelResMgr;
+ ResMgr* pBasicResMgr;
+ ResMgr* pSvtResMgr;
#ifdef DBG_UTIL
SimpleErrorHandler *m_pSimpleErrorHdl;
#endif
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index 4944bb3064..60b294b643 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/svxids.hrc b/svx/inc/svx/svxids.hrc
index 9bf3cb675f..0887235ea7 100755
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -237,7 +237,6 @@
#define SID_BASICIDE_MODULEDLG ( SID_BASICIDE_START + 5 )
#define SID_BASICIDE_OBJCAT ( SID_BASICIDE_START + 6 )
#define SID_BASICIDE_REMOVEWATCH ( SID_BASICIDE_START + 7 )
-#define SID_BASICIDE_GOTOCALL ( SID_BASICIDE_START + 8 )
#define SID_BASICIDE_SHOWSBX ( SID_BASICIDE_START + 9 )
#define SID_BASICIDE_HIDECURPAGE ( SID_BASICIDE_START + 10 )
#define SID_BASICIDE_NAMECHANGEDONTAB ( SID_BASICIDE_START + 11 )
diff --git a/svx/inc/svx/xoutbmp.hxx b/svx/inc/svx/xoutbmp.hxx
index 7a01ac7af6..bddf27bc2f 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 cb6b20bacb..2795e5dbeb 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 66fd40f22d..aaac150523 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1737,7 +1737,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId)
DbGridControl_Base::ColumnMoved(nId);
// remove the col from the model
- sal_Int16 nOldModelPos = GetModelColumnPos(nId);
+ sal_uInt16 nOldModelPos = GetModelColumnPos(nId);
#ifdef DBG_UTIL
DbGridColumn* pCol = m_aColumns[ (sal_uInt32)nOldModelPos ];
DBG_ASSERT(!pCol->IsHidden(), "DbGridControl::ColumnMoved : moved a hidden col ? how this ?");
@@ -2011,6 +2011,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 b985c20e43..b9e4ac44f4 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 838e0014c1..e953854175 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 aceeb5033b..9eee445597 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 5bfc8fcd2e..56a3df42e9 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 a56bd12c00..8f9c8c8b76 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 489aeff47e..2bbd8a63b6 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 c0a1468013..510b860a22 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 10716edbd5..97b4a2672e 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 884d7b0d79..dbda297e80 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 b92b6e0170..abbd1d1f15 100644
--- a/svx/source/svdraw/svdfmtf.hxx
+++ b/svx/source/svdraw/svdfmtf.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -81,7 +81,7 @@ protected:
SfxItemSet* pTextAttr;
SdrPage* pPage;
SdrModel* pModel;
- SdrLayerID nLayer;
+ SdrLayerID nLayer;
Color aOldLineColor;
sal_Int32 nLineWidth;
basegfx::B2DLineJoin maLineJoin;
@@ -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 7261fd7c9c..39cdb5c119 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 2e113d7272..af17676843 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 107b892dcb..f90e116148 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 ea0e3311f8..7892104114 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 f500b3f87a..9178ad9391 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, rFilter, nFilter, NULL );
}
diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx
index ce73cef471..e04d38aad6 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 e4bf947ba1..79af44793d 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 d0b79c8cfb..e1b00c7264 100755
--- a/vbahelper/Library_msforms.mk
+++ b/vbahelper/Library_msforms.mk
@@ -50,16 +50,16 @@ $(eval $(call gb_Library_add_linked_libs,msforms,\
comphelper \
cppu \
cppuhelper \
+ sal \
+ sb \
+ sfx \
svl \
svt \
+ svx \
+ tk \
tl \
- sal \
vbahelper \
- sfx \
- svx \
vcl \
- tk \
- sb \
$(gb_STDLIBS) \
))
@@ -78,6 +78,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 bb2c78b816..3b78599422 100755
--- a/vbahelper/Library_vbahelper.mk
+++ b/vbahelper/Library_vbahelper.mk
@@ -50,24 +50,26 @@ $(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 \
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 6d8033aa5b..385fbf15a6 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 0000000000..ebb5bf8f2b
--- /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 a7cd8af230..68b8110768 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 f3f7cb4c19..cf8a200dda 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 4a7dc837bf..7f1d3b5ad3 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 b07dc1358c..99c17e5c75 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 <map>
+#include <boost/unordered_map.hpp>
+#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 boost::unordered_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 bc6668f537..cfcc71c06b 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 963ae4d510..9534fe8f85 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 0000000000..661f3bc5d7
--- /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 69e4733c5d..9b3e870466 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,7 +53,57 @@ ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
-rtl::OUString&
+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()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") );
diff --git a/vbahelper/source/msforms/vbabutton.hxx b/vbahelper/source/msforms/vbabutton.hxx
index 1a01d69165..24c127b906 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 fea0853b68..93d54fd13a 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,7 +89,13 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
if ( nValue != nOldValue )
fireClickEvent();
}
-rtl::OUString&
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaCheckbox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
+rtl::OUString&
ScVbaCheckbox::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") );
diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx
index 0dbba7412e..3d76210afa 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 d0446bca77..67136d6706 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,9 +206,73 @@ 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&
+rtl::OUString&
ScVbaComboBox::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") );
diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx
index 77a546e678..cc66c40dae 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 2d100caa2e..7c19b117b1 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"
@@ -491,112 +491,113 @@ 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;
const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
xProps->getPropertyValue( sClassId ) >>= nClassId;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
- sal_Bool bToggle = sal_False;
+ uno::Reference< drawing::XShape > xShape( xControlShape, uno::UNO_QUERY_THROW );
+ ::std::auto_ptr< ConcreteXShapeGeometryAttributes > xGeoHelper( new ConcreteXShapeGeometryAttributes( xContext, xShape ) );
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, xContext, xControlShape, 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, xContext, xControl, 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, xContext, xControl, xModel, xGeoHelper.release(), xDialog ) );
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, xContext, xControl, 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, xContext, xControl, xModel, xGeoHelper.release() ) );
+ if( xVBAControl.is() )
+ return xVBAControl;
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() );
}
rtl::OUString&
@@ -618,8 +619,6 @@ ScVbaControl::getServiceNames()
return aServiceNames;
}
-
-
typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE;
class ControlProviderImpl : public ControlProvider_BASE
{
@@ -627,7 +626,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,27 +633,10 @@ 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;
}
-uno::Reference< msforms::XControl > SAL_CALL
-ControlProviderImpl::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 > 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 ) );
- }
- return xControlToReturn;
-}
namespace controlprovider
{
diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
index 2e00b26741..8eba8c5714 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 9dbe1e3588..be5d05e7f3 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 cbbb4fcafe..4745e7b901 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 09d3b3c7fb..7c5f102603 100644
--- a/vbahelper/source/msforms/vbaframe.cxx
+++ b/vbahelper/source/msforms/vbaframe.cxx
@@ -25,45 +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)
-{
- return uno::makeAny( getCaption() );
-}
-
-void SAL_CALL
-ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
+sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException)
{
- rtl::OUString sCaption;
- _value >>= sCaption;
- setCaption( sCaption );
+ return msforms::fmSpecialEffect::fmSpecialEffectEtched;
}
::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
@@ -77,36 +80,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 9b2c77252f..bb5b198335 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 29c8dfa834..4795a25be7 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,8 +79,12 @@ ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com
//FIXME: seems not support?
}
-rtl::OUString&
-ScVbaLabel::getServiceImplName()
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaLabel::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
+rtl::OUString& ScVbaLabel::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
return sImplName;
diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx
index 3619c06e15..47c5c949a1 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 a29c1312ee..f008fef9d5 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 a35f100f4b..3c1bb28d4a 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 1ca77dc436..6d3756ea0f 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 34fdb01a93..3c24b748f9 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 0000000000..f487b4e691
--- /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 0000000000..d59d5caa13
--- /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 aa08851902..99d1f613ec 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,7 +98,12 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
}
}
-rtl::OUString&
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaRadioButton::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
+rtl::OUString&
ScVbaRadioButton::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") );
diff --git a/vbahelper/source/msforms/vbaradiobutton.hxx b/vbahelper/source/msforms/vbaradiobutton.hxx
index 0bcbb33f15..48d1040b75 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 3fc94c7a17..6fa93fcbae 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,7 +124,35 @@ ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeExcept
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
}
-rtl::OUString&
+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()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") );
diff --git a/vbahelper/source/msforms/vbatextbox.hxx b/vbahelper/source/msforms/vbatextbox.hxx
index 548ae2ab47..dea33bb3af 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 297e30c103..28b4d511d9 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,8 +97,57 @@ 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&
+rtl::OUString&
ScVbaToggleButton::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") );
diff --git a/vbahelper/source/msforms/vbatogglebutton.hxx b/vbahelper/source/msforms/vbatogglebutton.hxx
index 540069de3d..40e480ee5b 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 2939e053e4..26912388ad 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 625d1fae02..c62fcf2fb8 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 0000000000..16fc673f54
--- /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 57baee722b..ae6b73e6f8 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/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx
index 68fada22d5..cf71425190 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.cxx
@@ -155,14 +155,7 @@ ScVbaCommandBar::Delete( ) throw (script::BasicErrorException, uno::RuntimeExce
uno::Any SAL_CALL
ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
{
- uno::Reference< awt::XMenu > xMenu;
- if( m_bIsMenu )
- {
- uno::Reference< frame::XLayoutManager > xLayoutManager = pCBarHelper->getLayoutManager();
- uno::Reference< beans::XPropertySet > xPropertySet( xLayoutManager->getElement( m_sResourceUrl ), uno::UNO_QUERY_THROW );
- xMenu.set( xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XMenuBar")) ), uno::UNO_QUERY );
- }
- uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) );
+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
if( aIndex.hasValue() )
{
return xCommandBarControls->Item( aIndex, uno::Any() );
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
index 1151fdccaa..728723296e 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
@@ -92,82 +92,55 @@ 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;
}
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 );
+ }
}
::sal_Bool SAL_CALL
@@ -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 c599472682..aaec78e0b6 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 3c8c531628..d646ce1202 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 834c99d8ca..7c6cff9494 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; }
+ 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 ) throw( css::uno::RuntimeException );
+ 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 139e5de906..8f1726af2d 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 656a4d44b3..4ccdb94ba3 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 e17d1e0005..a9e0376d0d 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 35a75470e5..9b19012af0 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -485,82 +485,87 @@ 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;
}
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 );
+}
+
+bool extractBoolFromAny( const uno::Any& rAny, bool bDefault ) throw (uno::RuntimeException)
+{
+ return rAny.hasValue() ? extractBoolFromAny( rAny ) : bDefault;
}
-rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
+::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 +702,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 +716,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(static_cast<sal_Int32>(fPixels/fConvertFactor));
@@ -880,345 +885,403 @@ 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(static_cast<sal_Int32>(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, static_cast<sal_Int32>(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 mxWindow->getPosSize().Width;
+ return implGetSize( false, true );
}
-//---------------------------------------------
-void UserFormGeometryHelper::setWidth( double nWidth )
+void UserFormGeometryHelper::setWidth( double fWidth )
{
- sal_Int64 nNewWidth = static_cast<sal_Int64>(nWidth);
+ implSetSize( fWidth, false, 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 = static_cast<sal_Int64>(nDecor - nWidth); // avoid negative size
- nNewWidth = static_cast<sal_Int64>(nWidth + nUnDecor - nDecor);
- }
- }
- }
+double UserFormGeometryHelper::getHeight() const
+{
+ return implGetSize( true, true );
+}
- mxWindow->setPosSize( 0, 0, nNewWidth, 0, awt::PosSize::WIDTH );
+void UserFormGeometryHelper::setHeight( double fHeight )
+{
+ implSetSize( fHeight, true, true );
}
-//---------------------------------------------
-double UserFormGeometryHelper::getHeight()
+double UserFormGeometryHelper::getInnerWidth() const
{
- if ( mbDialog )
- {
- const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow );
- if ( pWindow )
- {
- // get the size with decoration
- Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL );
- return aResult.getHeight();
- }
- }
+ return implGetSize( false, false );
+}
- return mxWindow->getPosSize().Height;
+void UserFormGeometryHelper::setInnerWidth( double fWidth )
+{
+ implSetSize( fWidth, false, false );
}
-//---------------------------------------------
-void UserFormGeometryHelper::setHeight( double nHeight )
+double UserFormGeometryHelper::getInnerHeight() const
{
- sal_Int64 nNewHeight = static_cast<sal_Int64>(nHeight);
- 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.getHeight();
- sal_Int64 nUnDecor = mxWindow->getPosSize().Height;
- if ( nHeight < nDecor - nUnDecor )
- nUnDecor = static_cast<sal_Int64>(nDecor - nHeight); // avoid negative size
- nNewHeight = static_cast<sal_Int64>(nHeight + nUnDecor - nDecor);
- }
- }
- }
+ return implGetSize( true, false );
+}
- mxWindow->setPosSize( 0, 0, 0, nNewHeight, awt::PosSize::HEIGHT );
+void UserFormGeometryHelper::setInnerHeight( double fHeight )
+{
+ implSetSize( fHeight, true, false );
}
-// ============
+double UserFormGeometryHelper::getOffsetX() const
+{
+ return mfOffsetX;
+}
- double ConcreteXShapeGeometryAttributes::getLeft()
- {
- return m_pShapeHelper->getLeft();
- }
- void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
- {
- m_pShapeHelper->setLeft( nLeft );
- }
- double ConcreteXShapeGeometryAttributes::getTop()
- {
- return m_pShapeHelper->getTop();
- }
- void ConcreteXShapeGeometryAttributes::setTop( double nTop )
- {
- m_pShapeHelper->setTop( nTop );
- }
+double UserFormGeometryHelper::getOffsetY() const
+{
+ return mfOffsetY;
+}
- double ConcreteXShapeGeometryAttributes::getHeight()
- {
- return m_pShapeHelper->getHeight();
- }
- void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
- {
- m_pShapeHelper->setHeight( nHeight );
- }
- double ConcreteXShapeGeometryAttributes::getWidth()
- {
- return m_pShapeHelper->getWidth();
- }
- void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
- {
- m_pShapeHelper->setWidth( nWidth );
- }
+// ----------------------------------------------------------------------------
+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" ) );
- ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
- {
- if( !xShape.is() )
- throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No valid shape for helper")), css::uno::Reference< css::uno::XInterface >() );
- }
+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);
+}
- double ShapeHelper::getHeight()
- {
- return Millimeter::getInPoints(xShape->getSize().Height);
- }
+void UserFormGeometryHelper::implSetPos( double fPos, bool bPosY )
+{
+ // 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 );
- void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException )
+ /* 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 )
{
- try
+ if( const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) )
{
- css::awt::Size aSize = xShape->getSize();
- aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight);
- xShape->setSize(aSize);
+ Rectangle aOuterRect = pWindow->GetWindowExtentsRelative( NULL );
+ aSizePixel = awt::Size( aOuterRect.getWidth(), aOuterRect.getHeight() );
}
- catch ( css::uno::Exception& /*e*/)
- {
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
}
+ // pixel to VBA points
+ awt::Size aSizePoint = mxUnitConv->convertSizeToLogic( aSizePixel, util::MeasureUnit::POINT );
+ return bHeight ? aSizePoint.Height : aSizePoint.Width;
+}
- double ShapeHelper::getWidth()
- {
- return Millimeter::getInPoints(xShape->getSize().Width);
- }
+void UserFormGeometryHelper::implSetSize( double fSize, bool bHeight, bool bOuter )
+{
+ // 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 );
- void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException )
+ /* 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 )
{
- try
- {
- css::awt::Size aSize = xShape->getSize();
- aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth);
- xShape->setSize(aSize);
- }
- catch (css::uno::Exception& /*e*/)
+ if( const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) )
{
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
+ Rectangle aOuterRect = pWindow->GetWindowExtentsRelative( NULL );
+ if( !aOuterRect.IsEmpty() )
+ {
+ 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 );
+ }
}
}
+ awt::Size aSizeAppFont = mxUnitConv->convertSizeToLogic( aSizePixel, util::MeasureUnit::APPFONT );
+ mxModelProps->setPropertyValue( bHeight ? saHeightName : saWidthName, uno::Any( bHeight ? aSizeAppFont.Height : aSizeAppFont.Width ) );
+}
+
+// ============================================================================
- double ShapeHelper::getLeft()
- {
- return Millimeter::getInPoints(xShape->getPosition().X);
- }
+double ConcreteXShapeGeometryAttributes::getLeft() const
+{
+ return m_pShapeHelper->getLeft();
+}
+void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
+{
+ m_pShapeHelper->setLeft( nLeft );
+}
+double ConcreteXShapeGeometryAttributes::getTop() const
+{
+ return m_pShapeHelper->getTop();
+}
+void ConcreteXShapeGeometryAttributes::setTop( double nTop )
+{
+ m_pShapeHelper->setTop( nTop );
+}
+double ConcreteXShapeGeometryAttributes::getHeight() const
+{
+ return m_pShapeHelper->getHeight();
+}
+void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
+{
+ m_pShapeHelper->setHeight( nHeight );
+}
+double ConcreteXShapeGeometryAttributes::getWidth() const
+{
+ return m_pShapeHelper->getWidth();
+}
+void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
+{
+ m_pShapeHelper->setWidth( nWidth );
+}
- void ShapeHelper::setLeft(double _fLeft)
- {
- css::awt::Point aPoint = xShape->getPosition();
- aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
- xShape->setPosition(aPoint);
- }
+ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
+{
+ if( !xShape.is() )
+ throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No valid shape for helper")), css::uno::Reference< css::uno::XInterface >() );
+}
- double ShapeHelper::getTop()
- {
- return Millimeter::getInPoints(xShape->getPosition().Y);
+double ShapeHelper::getHeight() const
+{
+ return Millimeter::getInPoints(xShape->getSize().Height);
}
- void ShapeHelper::setTop(double _fTop)
+ void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException )
+{
+ try
{
- css::awt::Point aPoint = xShape->getPosition();
- aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
- xShape->setPosition(aPoint);
+ css::awt::Size aSize = xShape->getSize();
+ aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight);
+ xShape->setSize(aSize);
}
-
- void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
+ catch ( css::uno::Exception& /*e*/)
{
- // #TODO #FIXME ( do we want to support additionalArg here )
- throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
+ throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
+ }
+}
+double ShapeHelper::getWidth() const
+{
+ return Millimeter::getInPoints(xShape->getSize().Width);
}
- void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
+void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException )
+{
+ try
{
- exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
+ css::awt::Size aSize = xShape->getSize();
+ aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth);
+ xShape->setSize(aSize);
}
- void DebugHelper::exception( const css::uno::Exception& ex ) throw( css::script::BasicErrorException )
+ catch (css::uno::Exception& /*e*/)
{
- exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
+ throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
}
+}
- Millimeter::Millimeter():m_nMillimeter(0) {}
- Millimeter::Millimeter(double mm):m_nMillimeter(mm) {}
+double ShapeHelper::getLeft() const
+{
+ return Millimeter::getInPoints(xShape->getPosition().X);
+}
- void Millimeter::set(double mm) { m_nMillimeter = mm; }
- void Millimeter::setInPoints(double points)
- {
- m_nMillimeter = points * factor / 100.0;
- }
- void Millimeter::setInHundredthsOfOneMillimeter(double hmm)
- {
- m_nMillimeter = hmm / 100;
- }
+void ShapeHelper::setLeft(double _fLeft)
+{
+ css::awt::Point aPoint = xShape->getPosition();
+ aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
+ xShape->setPosition(aPoint);
+}
- double Millimeter::get()
- {
- return m_nMillimeter;
- }
- double Millimeter::getInHundredthsOfOneMillimeter()
- {
- return m_nMillimeter * 100;
- }
- double Millimeter::getInPoints()
- {
- return m_nMillimeter / factor * 100.0;
- }
- sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points)
- {
- sal_Int32 mm = static_cast<sal_Int32>(points * factor);
- return mm;
- }
+double ShapeHelper::getTop() const
+{
+ return Millimeter::getInPoints(xShape->getPosition().Y);
+}
- double Millimeter::getInPoints(int _hmm)
- {
- double points = double( static_cast<double>(_hmm) / factor);
- return points;
- }
- uno::Reference< uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell )
- {
- uno::Reference< uno::XInterface > xIf;
- if ( pShell )
- {
- rtl::OUString sProj( RTL_CONSTASCII_USTRINGPARAM("Standard") );
- BasicManager* pBasMgr = pShell->GetBasicManager();
- if ( pBasMgr && pBasMgr->GetName().Len() )
- sProj = pShell->GetBasicManager()->GetName();
- StarBASIC* pBasic = pShell->GetBasicManager()->GetLib( sProj );
- if ( pBasic )
- {
- SbModule* pMod = pBasic->FindModule( aModName );
- if ( pMod )
- xIf = pMod->GetUnoModule();
- }
- }
- return xIf;
- }
+void ShapeHelper::setTop(double _fTop)
+{
+ css::awt::Point aPoint = xShape->getPosition();
+ aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
+ xShape->setPosition(aPoint);
+}
- // Listener for XNotifyingDispatch
- VBADispatchListener::VBADispatchListener() : m_State( sal_False )
- {
- }
+void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
+{
+ // #TODO #FIXME ( do we want to support additionalArg here )
+ throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
+}
+
+void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
+{
+ exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
+}
+void DebugHelper::exception( const css::uno::Exception& ex ) throw( css::script::BasicErrorException )
+{
+ exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
+}
+
+Millimeter::Millimeter():m_nMillimeter(0) {}
- // Listener for XNotifyingDispatch
- VBADispatchListener::~VBADispatchListener()
+Millimeter::Millimeter(double mm):m_nMillimeter(mm) {}
+
+void Millimeter::set(double mm) { m_nMillimeter = mm; }
+void Millimeter::setInPoints(double points)
+{
+ m_nMillimeter = points * factor / 100.0;
+}
+
+void Millimeter::setInHundredthsOfOneMillimeter(double hmm)
+{
+ m_nMillimeter = hmm / 100;
+}
+
+double Millimeter::get()
+{
+ return m_nMillimeter;
+}
+double Millimeter::getInHundredthsOfOneMillimeter()
+{
+ return m_nMillimeter * 100;
+}
+double Millimeter::getInPoints()
+{
+ return m_nMillimeter / factor * 100.0;
+}
+
+sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points)
+{
+ sal_Int32 mm = static_cast<sal_Int32>(points * factor);
+ return mm;
+}
+
+double Millimeter::getInPoints(int _hmm)
+{
+ double points = double( static_cast<double>(_hmm) / factor);
+ return points;
+}
+
+// Listener for XNotifyingDispatch
+VBADispatchListener::VBADispatchListener() : m_State( sal_False )
+{
+}
+
+// Listener for XNotifyingDispatch
+VBADispatchListener::~VBADispatchListener()
+{
+}
+
+// Listener for XNotifyingDispatch
+void SAL_CALL VBADispatchListener::dispatchFinished( const frame::DispatchResultEvent& aEvent ) throw ( uno::RuntimeException )
+{
+ m_Result = aEvent.Result;
+ m_State = ( aEvent.State == frame::DispatchResultState::SUCCESS ) ? sal_True : sal_False;
+}
+
+// Listener for XNotifyingDispatch
+void SAL_CALL VBADispatchListener::disposing( const lang::EventObject& /*aEvent*/ ) throw( uno::RuntimeException )
+{
+}
+
+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 ) );
}
-
- // Listener for XNotifyingDispatch
- void SAL_CALL VBADispatchListener::dispatchFinished( const frame::DispatchResultEvent& aEvent ) throw ( uno::RuntimeException )
+ catch( uno::Exception& )
{
- m_Result = aEvent.Result;
- m_State = ( aEvent.State == frame::DispatchResultState::SUCCESS ) ? sal_True : sal_False;
}
+ return xIf;
+}
- // Listener for XNotifyingDispatch
- void SAL_CALL VBADispatchListener::disposing( const lang::EventObject& /*aEvent*/ ) throw( uno::RuntimeException )
+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()));
}
-
- 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;
- }
+ if ( !pFoundShell )
+ throw uno::RuntimeException();
+ return pFoundShell;
+}
} // openoffice
} //org
diff --git a/vbahelper/source/vbahelper/vbawindowbase.cxx b/vbahelper/source/vbahelper/vbawindowbase.cxx
index 2f9556f79e..e605e39b89 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)
+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 );
- }
+ getWindow2()->setVisible( _visible );
}
-css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel )
+void setPosSize( const uno::Reference< awt::XWindow >& xWindow, sal_Int32 nValue, sal_Int16 nFlag )
{
- 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() )
+ css::awt::Rectangle aRect = xWindow->getPosSize();
+ switch( nFlag )
{
- aRect = xWindow->getPosSize();
+ 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;
}
- return aRect;
}
-void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, sal_uInt16 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 )
- {
- 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
+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 d81bd80daa..a555fce37f 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 cea259704e..44121534ef 100644
--- a/xmloff/inc/xmloff/txtprmap.hxx
+++ b/xmloff/inc/xmloff/txtprmap.hxx
@@ -179,6 +179,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 fff0fc3bad..900521ee0f 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 d361c38ac9..74fffcdee6 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 0a11903eb0..ada1cc766f 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 47fcac2a7f..cf68d47eba 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 6247264730..051b7c289f 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 0278307eda..aa1155f2da 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 c59d61ced2..fa4442a8f6 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 048c5dc5e1..3785ea7fd6 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 61449e776f..17f7e92001 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 0e8584b686..7d04488225 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/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 9812273ab5..536984bed0 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -210,7 +210,7 @@ const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage";
const sal_Char sAPI_is_visible[] = "IsVisible";
const sal_Char sAPI_TextRange[] = "TextRange";
-const sal_Char sAPI_true[] = "sal_True";
+const sal_Char sAPI_true[] = "TRUE";
TYPEINIT1( XMLTextFieldImportContext, SvXMLImportContext);
diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
index 7b5d99bec7..180ac0f3fe 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 8cf954a868..66c80b95b1 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;