summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]accessibility/inc/accessibility/extended/AccessibleGridControl.hxx9
-rwxr-xr-x[-rw-r--r--]accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx12
-rwxr-xr-x[-rw-r--r--]accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx2
-rwxr-xr-x[-rw-r--r--]accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx10
-rwxr-xr-x[-rw-r--r--]accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx6
-rwxr-xr-x[-rw-r--r--]accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx0
-rwxr-xr-x[-rw-r--r--]accessibility/source/extended/AccessibleGridControl.cxx35
-rwxr-xr-x[-rw-r--r--]accessibility/source/extended/AccessibleGridControlBase.cxx113
-rwxr-xr-x[-rw-r--r--]accessibility/source/extended/AccessibleGridControlHeader.cxx67
-rwxr-xr-x[-rw-r--r--]accessibility/source/extended/AccessibleGridControlHeaderCell.cxx0
-rwxr-xr-x[-rw-r--r--]accessibility/source/extended/AccessibleGridControlTable.cxx111
-rwxr-xr-x[-rw-r--r--]accessibility/source/extended/AccessibleGridControlTableBase.cxx4
-rwxr-xr-x[-rw-r--r--]accessibility/source/extended/AccessibleGridControlTableCell.cxx10
-rw-r--r--automation/source/inc/rcontrol.hxx8
-rw-r--r--automation/source/server/sta_list.cxx3
-rw-r--r--automation/source/server/statemnt.cxx183
-rw-r--r--basctl/inc/basidesh.hrc4
-rw-r--r--basctl/source/basicide/baside2.cxx127
-rw-r--r--basctl/source/basicide/baside2.hxx4
-rw-r--r--basctl/source/basicide/baside3.cxx3
-rw-r--r--basctl/source/basicide/basides1.cxx27
-rw-r--r--basctl/source/basicide/basides2.cxx29
-rw-r--r--basctl/source/basicide/basidesh.cxx103
-rw-r--r--basctl/source/basicide/basidesh.src16
-rw-r--r--basctl/source/basicide/basobj2.cxx2
-rw-r--r--basctl/source/basicide/bastype2.cxx270
-rw-r--r--basctl/source/basicide/bastype2.hxx13
-rw-r--r--basctl/source/basicide/bastype3.cxx46
-rw-r--r--basctl/source/basicide/bastypes.cxx25
-rw-r--r--basctl/source/basicide/macrodlg.cxx14
-rw-r--r--basctl/source/basicide/moduldlg.cxx70
-rw-r--r--basctl/source/basicide/scriptdocument.cxx36
-rw-r--r--basctl/source/inc/basidesh.hxx3
-rw-r--r--basctl/source/inc/bastypes.hxx10
-rw-r--r--basctl/source/inc/scriptdocument.hxx1
-rw-r--r--basic/inc/basic/sberrors.hxx3
-rw-r--r--basic/inc/basic/sbmod.hxx13
-rw-r--r--basic/inc/basic/sbobjmod.hxx97
-rw-r--r--basic/inc/basic/sbstar.hxx5
-rw-r--r--basic/inc/basic/sbuno.hxx2
-rwxr-xr-x[-rw-r--r--]basic/prj/build.lst2
-rw-r--r--basic/source/basmgr/basmgr.cxx39
-rw-r--r--basic/source/classes/errobject.cxx225
-rw-r--r--basic/source/classes/eventatt.cxx117
-rw-r--r--basic/source/classes/makefile.mk18
-rwxr-xr-xbasic/source/classes/sb.cxx62
-rw-r--r--basic/source/classes/sb.src4
-rw-r--r--basic/source/classes/sbunoobj.cxx2
-rw-r--r--basic/source/classes/sbxmod.cxx448
-rw-r--r--basic/source/comp/codegen.cxx11
-rw-r--r--basic/source/comp/parser.cxx13
-rw-r--r--basic/source/inc/codegen.hxx1
-rw-r--r--basic/source/inc/errobject.hxx52
-rw-r--r--basic/source/inc/image.hxx1
-rw-r--r--basic/source/inc/namecont.hxx9
-rw-r--r--basic/source/inc/runtime.hxx7
-rw-r--r--basic/source/inc/scriptcont.hxx17
-rw-r--r--basic/source/runtime/methods.cxx68
-rw-r--r--basic/source/runtime/methods1.cxx11
-rw-r--r--basic/source/runtime/props.cxx18
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/runtime.cxx101
-rw-r--r--basic/source/runtime/stdobj.cxx2
-rw-r--r--basic/source/runtime/step0.cxx11
-rw-r--r--basic/source/runtime/step1.cxx7
-rw-r--r--basic/source/uno/namecont.cxx24
-rw-r--r--basic/source/uno/scriptcont.cxx41
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/armhelper.S38
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s22
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx54
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/except.cxx6
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/share.hxx7
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx113
-rw-r--r--comphelper/inc/comphelper/mediadescriptor.hxx1
-rw-r--r--comphelper/source/misc/mediadescriptor.cxx6
-rw-r--r--dbaccess/uiconfig/dbapp/menubar/menubar.xml14
-rw-r--r--filter/inc/filter/msfilter/msvbahelper.hxx (renamed from vbahelper/inc/vbahelper/msvbahelper.hxx)10
-rw-r--r--filter/inc/filter/msfilter/svxmsbas.hxx4
-rw-r--r--filter/prj/build.lst2
-rwxr-xr-xfilter/source/config/tools/merge/pyAltFCFGMerge2
-rw-r--r--filter/source/msfilter/makefile.mk4
-rw-r--r--filter/source/msfilter/msvbahelper.cxx (renamed from vbahelper/source/vbahelper/msvbahelper.cxx)5
-rw-r--r--filter/source/msfilter/msvbasic.cxx18
-rw-r--r--filter/source/msfilter/msvbasic.hxx14
-rw-r--r--filter/source/msfilter/svxmsbas.cxx130
-rw-r--r--framework/source/uielement/langselectionmenucontroller.cxx10
-rw-r--r--framework/source/uielement/langselectionstatusbarcontroller.cxx21
-rw-r--r--framework/source/uielement/menubarmanager.cxx11
-rw-r--r--framework/source/xml/menudocumenthandler.cxx14
-rw-r--r--instsetoo_native/util/openoffice.lst2
-rw-r--r--l10ntools/source/help/HelpIndexerTool.java30
-rw-r--r--moz/makefile.mk4
-rw-r--r--moz/patches/linux_libc2.5.patch11
-rw-r--r--offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl1
-rw-r--r--offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl2
-rw-r--r--offapi/com/sun/star/awt/grid/GridColumn.idl2
-rw-r--r--offapi/com/sun/star/awt/grid/GridColumnEvent.idl17
-rw-r--r--offapi/com/sun/star/awt/grid/GridDataEvent.idl7
-rw-r--r--offapi/com/sun/star/awt/grid/GridInvalidDataException.idl58
-rw-r--r--offapi/com/sun/star/awt/grid/GridInvalidModelException.idl57
-rw-r--r--offapi/com/sun/star/awt/grid/GridSelectionEvent.idl13
-rw-r--r--offapi/com/sun/star/awt/grid/SelectionEventType.idl8
-rw-r--r--offapi/com/sun/star/awt/grid/UnoControlGrid.idl1
-rw-r--r--offapi/com/sun/star/awt/grid/UnoControlGridModel.idl65
-rw-r--r--offapi/com/sun/star/awt/grid/XGridCell.idl2
-rw-r--r--offapi/com/sun/star/awt/grid/XGridCellRenderer.idl5
-rw-r--r--offapi/com/sun/star/awt/grid/XGridColumn.idl50
-rw-r--r--offapi/com/sun/star/awt/grid/XGridColumnListener.idl22
-rw-r--r--offapi/com/sun/star/awt/grid/XGridColumnModel.idl38
-rw-r--r--offapi/com/sun/star/awt/grid/XGridControl.idl27
-rw-r--r--offapi/com/sun/star/awt/grid/XGridControlListener.idl2
-rw-r--r--offapi/com/sun/star/awt/grid/XGridDataListener.idl2
-rw-r--r--offapi/com/sun/star/awt/grid/XGridDataModel.idl31
-rw-r--r--offapi/com/sun/star/awt/grid/XGridSelection.idl38
-rw-r--r--offapi/com/sun/star/awt/grid/makefile.mk4
-rw-r--r--offapi/com/sun/star/document/MediaDescriptor.idl9
-rw-r--r--offapi/com/sun/star/script/ModuleInfo.idl55
-rw-r--r--offapi/com/sun/star/script/ModuleType.idl72
-rw-r--r--offapi/com/sun/star/script/XVBACompat.idl49
-rw-r--r--offapi/com/sun/star/script/XVBAModuleInfo.idl73
-rw-r--r--offapi/com/sun/star/script/makefile.mk4
-rw-r--r--officecfg/registry/data/org/openoffice/Office/SFX.xcu42
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl4
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl5
-rw-r--r--oox/inc/oox/core/filterbase.hxx27
-rw-r--r--oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx6
-rw-r--r--oox/inc/oox/drawingml/color.hxx4
-rw-r--r--oox/inc/oox/drawingml/customshapeproperties.hxx5
-rw-r--r--oox/inc/oox/drawingml/fillproperties.hxx9
-rw-r--r--oox/inc/oox/drawingml/lineproperties.hxx4
-rw-r--r--oox/inc/oox/dump/biffdumper.hxx8
-rw-r--r--oox/inc/oox/dump/dumperbase.hxx109
-rw-r--r--oox/inc/oox/dump/oledumper.hxx418
-rw-r--r--oox/inc/oox/dump/xlsbdumper.hxx2
-rw-r--r--oox/inc/oox/helper/binaryinputstream.hxx69
-rw-r--r--oox/inc/oox/helper/binaryoutputstream.hxx5
-rw-r--r--oox/inc/oox/helper/binarystreambase.hxx15
-rw-r--r--oox/inc/oox/helper/containerhelper.hxx131
-rw-r--r--oox/inc/oox/helper/graphichelper.hxx76
-rw-r--r--oox/inc/oox/helper/helper.hxx24
-rw-r--r--oox/inc/oox/helper/modelobjecthelper.hxx2
-rw-r--r--oox/inc/oox/helper/propertyset.hxx4
-rw-r--r--oox/inc/oox/helper/storagebase.hxx65
-rwxr-xr-xoox/inc/oox/helper/textinputstream.hxx58
-rw-r--r--oox/inc/oox/helper/zipstorage.hxx6
-rwxr-xr-x[-rw-r--r--]oox/inc/oox/ole/axbinaryreader.hxx109
-rw-r--r--oox/inc/oox/ole/axcontrol.hxx568
-rw-r--r--oox/inc/oox/ole/axcontrolfragment.hxx14
-rw-r--r--oox/inc/oox/ole/axcontrolhelper.hxx118
-rw-r--r--oox/inc/oox/ole/olehelper.hxx79
-rwxr-xr-x[-rw-r--r--]oox/inc/oox/ole/olestorage.hxx (renamed from oox/inc/oox/helper/olestorage.hxx)37
-rwxr-xr-xoox/inc/oox/ole/vbacontrol.hxx205
-rwxr-xr-xoox/inc/oox/ole/vbahelper.hxx233
-rwxr-xr-xoox/inc/oox/ole/vbamodule.hxx96
-rwxr-xr-xoox/inc/oox/ole/vbaproject.hxx289
-rw-r--r--oox/inc/oox/ppt/pptimport.hxx5
-rw-r--r--oox/inc/oox/vml/vmldrawing.hxx14
-rw-r--r--oox/inc/oox/vml/vmlformatting.hxx21
-rw-r--r--oox/inc/oox/xls/biffhelper.hxx2
-rw-r--r--oox/inc/oox/xls/excelfilter.hxx22
-rwxr-xr-xoox/inc/oox/xls/excelvbaproject.hxx73
-rw-r--r--oox/inc/oox/xls/stylesbuffer.hxx19
-rw-r--r--oox/inc/oox/xls/workbookhelper.hxx106
-rw-r--r--oox/inc/oox/xls/worksheetsettings.hxx2
-rw-r--r--oox/prj/build.lst2
-rw-r--r--oox/prj/d.lst5
-rw-r--r--oox/source/core/binaryfilterbase.cxx6
-rwxr-xr-xoox/source/core/filterbase.cxx111
-rw-r--r--oox/source/core/filterdetect.cxx4
-rw-r--r--oox/source/core/recordparser.cxx7
-rw-r--r--oox/source/docprop/docprophandler.cxx2
-rw-r--r--oox/source/drawingml/chart/chartdrawingfragment.cxx6
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx8
-rw-r--r--oox/source/drawingml/clrschemecontext.cxx2
-rw-r--r--oox/source/drawingml/color.cxx12
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx5
-rw-r--r--oox/source/drawingml/fillproperties.cxx54
-rw-r--r--oox/source/drawingml/fillpropertiesgroupcontext.cxx12
-rw-r--r--oox/source/drawingml/lineproperties.cxx15
-rw-r--r--oox/source/drawingml/linepropertiescontext.cxx2
-rw-r--r--oox/source/drawingml/shape.cxx17
-rw-r--r--oox/source/drawingml/table/tablecell.cxx4
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx4
-rw-r--r--oox/source/drawingml/textfont.cxx4
-rw-r--r--oox/source/drawingml/textparagraphproperties.cxx2
-rw-r--r--oox/source/dump/biffdumper.cxx333
-rw-r--r--oox/source/dump/biffdumper.ini4
-rw-r--r--oox/source/dump/dffdumper.cxx32
-rw-r--r--oox/source/dump/dumperbase.cxx371
-rw-r--r--oox/source/dump/oledumper.cxx1257
-rw-r--r--oox/source/dump/oledumper.ini439
-rw-r--r--oox/source/dump/pptxdumper.cxx9
-rw-r--r--oox/source/dump/xlsbdumper.cxx241
-rw-r--r--oox/source/helper/binaryinputstream.cxx98
-rw-r--r--oox/source/helper/binaryoutputstream.cxx20
-rw-r--r--oox/source/helper/binarystreambase.cxx21
-rw-r--r--oox/source/helper/graphichelper.cxx236
-rw-r--r--oox/source/helper/makefile.mk2
-rw-r--r--oox/source/helper/modelobjecthelper.cxx10
-rw-r--r--oox/source/helper/olestorage.cxx180
-rw-r--r--oox/source/helper/propertyset.cxx44
-rw-r--r--oox/source/helper/storagebase.cxx145
-rwxr-xr-xoox/source/helper/textinputstream.cxx128
-rw-r--r--oox/source/helper/zipstorage.cxx56
-rwxr-xr-x[-rw-r--r--]oox/source/ole/axbinaryreader.cxx100
-rw-r--r--oox/source/ole/axcontrol.cxx1122
-rw-r--r--oox/source/ole/axcontrolfragment.cxx35
-rw-r--r--oox/source/ole/axcontrolhelper.cxx175
-rw-r--r--oox/source/ole/makefile.mk8
-rw-r--r--oox/source/ole/olehelper.cxx112
-rwxr-xr-xoox/source/ole/olestorage.cxx423
-rwxr-xr-xoox/source/ole/vbacontrol.cxx811
-rwxr-xr-xoox/source/ole/vbahelper.cxx248
-rwxr-xr-xoox/source/ole/vbamodule.cxx241
-rwxr-xr-xoox/source/ole/vbaproject.cxx519
-rw-r--r--oox/source/ppt/animvariantcontext.cxx2
-rw-r--r--oox/source/ppt/pptimport.cxx30
-rw-r--r--oox/source/ppt/slidepersist.cxx2
-rw-r--r--oox/source/ppt/timenodelistcontext.cxx12
-rw-r--r--oox/source/token/properties.txt18
-rw-r--r--oox/source/vml/vmldrawing.cxx20
-rw-r--r--oox/source/vml/vmlformatting.cxx41
-rw-r--r--oox/source/vml/vmlshape.cxx22
-rw-r--r--oox/source/vml/vmlshapecontainer.cxx1
-rw-r--r--oox/source/xls/biffdetector.cxx6
-rw-r--r--oox/source/xls/biffhelper.cxx97
-rw-r--r--oox/source/xls/excelfilter.cxx56
-rwxr-xr-xoox/source/xls/excelvbaproject.cxx214
-rw-r--r--oox/source/xls/formulaparser.cxx3
-rw-r--r--oox/source/xls/makefile.mk1
-rw-r--r--oox/source/xls/sheetdatacontext.cxx4
-rw-r--r--oox/source/xls/stylesbuffer.cxx77
-rw-r--r--oox/source/xls/unitconverter.cxx2
-rw-r--r--oox/source/xls/viewsettings.cxx2
-rw-r--r--oox/source/xls/workbookfragment.cxx60
-rw-r--r--oox/source/xls/workbookhelper.cxx210
-rw-r--r--oox/source/xls/workbooksettings.cxx5
-rw-r--r--oox/source/xls/worksheetfragment.cxx3
-rw-r--r--oox/source/xls/worksheethelper.cxx63
-rw-r--r--oox/source/xls/worksheetsettings.cxx11
-rw-r--r--oox/util/makefile.mk3
-rw-r--r--postprocess/checkdeliver/checkdeliver.pl3
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/servuno.hxx10
-rw-r--r--sc/inc/unonames.hxx1
-rw-r--r--sc/inc/unowids.hxx3
-rwxr-xr-x[-rw-r--r--]sc/source/core/data/documen2.cxx40
-rw-r--r--sc/source/core/data/document.cxx12
-rw-r--r--sc/source/filter/excel/excimp8.cxx15
-rw-r--r--sc/source/filter/excel/read.cxx2
-rw-r--r--sc/source/filter/excel/xiescher.cxx6
-rw-r--r--sc/source/filter/excel/xlescher.cxx15
-rw-r--r--sc/source/filter/inc/xlescher.hxx4
-rw-r--r--sc/source/ui/docshell/docfunc.cxx139
-rw-r--r--sc/source/ui/docshell/docsh5.cxx39
-rw-r--r--sc/source/ui/drawfunc/drformsh.src2
-rw-r--r--sc/source/ui/drawfunc/objdraw.src2
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx17
-rw-r--r--sc/source/ui/unoobj/docuno.cxx13
-rw-r--r--sc/source/ui/unoobj/servuno.cxx130
-rw-r--r--sc/source/ui/vba/excelvbahelper.cxx7
-rw-r--r--sc/source/ui/vba/excelvbahelper.hxx4
-rwxr-xr-x[-rw-r--r--]sc/source/ui/vba/testvba/runTests.pl2
-rwxr-xr-xsc/source/ui/vba/testvba/testclientbin39390 -> 50595 bytes
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx78
-rw-r--r--sc/source/ui/vba/vbaformat.cxx60
-rw-r--r--sc/source/ui/vba/vbaformat.hxx5
-rw-r--r--sc/source/ui/vba/vbarange.cxx66
-rw-r--r--sc/source/ui/vba/vbarange.hxx11
-rw-r--r--sc/source/ui/view/viewfun2.cxx17
-rw-r--r--sc/uiconfig/scalc/menubar/menubar.xml24
-rw-r--r--scp2/source/ooo/file_library_ooo.scp4
-rw-r--r--sd/uiconfig/sdraw/menubar/menubar.xml10
-rw-r--r--sd/uiconfig/simpress/menubar/menubar.xml16
-rw-r--r--soldep/bootstrp/prj.cxx679
-rw-r--r--soldep/inc/soldep/prj.hxx9
-rwxr-xr-xsolenv/bin/build.pl2
-rw-r--r--solenv/bin/modules/installer/scriptitems.pm2
-rw-r--r--solenv/bin/modules/installer/simplepackage.pm7
-rw-r--r--solenv/config/sdev300.ini14
-rw-r--r--solenv/inc/minor.mk6
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx4
-rwxr-xr-x[-rw-r--r--]svtools/inc/svtools/accessibletable.hxx9
-rw-r--r--svtools/inc/svtools/table/abstracttablecontrol.hxx18
-rw-r--r--svtools/inc/svtools/table/defaultinputhandler.hxx1
-rw-r--r--svtools/inc/svtools/table/gridtablerenderer.hxx8
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx152
-rw-r--r--svtools/inc/svtools/table/tabledatawindow.hxx12
-rw-r--r--svtools/inc/svtools/table/tablemodel.hxx108
-rw-r--r--svtools/inc/svtools/table/tablerenderer.hxx44
-rw-r--r--svtools/inc/svtools/table/tabletypes.hxx10
-rw-r--r--svtools/prj/d.lst2
-rw-r--r--svtools/source/inc/accessibletableimp.hxx62
-rw-r--r--svtools/source/table/defaultinputhandler.cxx57
-rw-r--r--svtools/source/table/gridtablerenderer.cxx276
-rw-r--r--svtools/source/table/tablecontrol.cxx130
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx1415
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx161
-rw-r--r--svtools/source/table/tabledatawindow.cxx84
-rw-r--r--svtools/source/table/tablegeometry.cxx8
-rwxr-xr-x[-rw-r--r--]svtools/source/uno/svtxgridcontrol.cxx629
-rwxr-xr-x[-rw-r--r--]svtools/source/uno/svtxgridcontrol.hxx44
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx239
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx77
-rw-r--r--svx/source/dialog/srchdlg.cxx14
-rw-r--r--svx/source/unodraw/unoshape.cxx84
-rw-r--r--sw/inc/ndtxt.hxx2
-rw-r--r--sw/inc/shellio.hxx21
-rw-r--r--sw/inc/unoflatpara.hxx12
-rw-r--r--sw/source/core/bastyp/swrect.cxx2
-rw-r--r--sw/source/core/doc/docredln.cxx3
-rw-r--r--sw/source/core/docnode/ndcopy.cxx6
-rw-r--r--sw/source/core/frmedt/feshview.cxx5
-rw-r--r--sw/source/core/txtnode/atrfld.cxx13
-rw-r--r--sw/source/core/txtnode/fntcache.cxx178
-rw-r--r--sw/source/core/txtnode/ndhints.cxx16
-rw-r--r--sw/source/core/txtnode/thints.cxx304
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx30
-rw-r--r--sw/source/filter/ascii/ascatr.cxx9
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx4
-rw-r--r--sw/source/filter/writer/writer.cxx77
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx8
-rw-r--r--sw/source/ui/app/mn.src7
-rw-r--r--sw/source/ui/inc/swmn_tmpl.hrc1
-rw-r--r--sw/source/ui/lingu/olmenu.cxx14
-rw-r--r--sw/source/ui/uno/unotxvw.cxx27
-rw-r--r--sw/uiconfig/sglobal/menubar/menubar.xml22
-rw-r--r--sw/uiconfig/sweb/menubar/menubar.xml22
-rw-r--r--sw/uiconfig/swform/menubar/menubar.xml22
-rw-r--r--sw/uiconfig/swreport/menubar/menubar.xml22
-rw-r--r--sw/uiconfig/swriter/menubar/menubar.xml22
-rw-r--r--sw/uiconfig/swxform/menubar/menubar.xml22
-rwxr-xr-xtestautomation/framework/optional/f_basic_vba-compat.bas11
-rwxr-xr-x[-rw-r--r--]testautomation/framework/optional/includes/basic_gridcontrol.inc74
-rwxr-xr-xtestautomation/framework/optional/includes/basic_vba-compat_application-union.inc132
-rwxr-xr-xtestautomation/framework/optional/includes/basic_vba-compat_import_disabled.inc33
-rwxr-xr-xtestautomation/framework/optional/includes/basic_vba-compat_import_enabled.inc76
-rwxr-xr-xtestautomation/framework/optional/includes/basic_vba-compat_import_nothing.inc35
-rwxr-xr-xtestautomation/framework/optional/includes/basic_vba-compat_thisworkbook.inc143
-rwxr-xr-xtestautomation/framework/optional/includes/basic_vba-compat_xlsm-xlsb.inc187
-rwxr-xr-xtestautomation/framework/optional/input/gridcontrol.odtbin11602 -> 12000 bytes
-rwxr-xr-xtestautomation/framework/optional/input/vba-compat/vba-application-union.xlsbin0 -> 31744 bytes
-rwxr-xr-xtestautomation/framework/optional/input/vba-compat/vba-project.xlsbbin0 -> 19603 bytes
-rwxr-xr-xtestautomation/framework/optional/input/vba-compat/vba-project.xlsmbin0 -> 20276 bytes
-rw-r--r--testautomation/framework/optional/input/vba-compat/vba-thisworkbook.xlsbin0 -> 39424 bytes
-rwxr-xr-x[-rw-r--r--]testautomation/global/tools/includes/optional/t_treelist_tools.inc10
-rwxr-xr-xtestautomation/global/win/dial_d_h.win6
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx10
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx4
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx121
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx37
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx99
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx23
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx148
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx29
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx112
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx18
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx5
-rw-r--r--toolkit/source/helper/property.cxx8
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx21
-rw-r--r--unoxml/source/rdf/makefile.mk8
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx2
-rw-r--r--vbahelper/prj/build.lst2
-rw-r--r--vbahelper/source/vbahelper/makefile.mk1
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx2
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.cxx2
-rw-r--r--vbahelper/source/vbahelper/vbaglobalbase.cxx1
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx16
-rw-r--r--vbahelper/util/makefile.mk1
-rw-r--r--vcl/inc/vcl/vclevent.hxx1
-rw-r--r--xmloff/inc/xmloff/txtimp.hxx2
-rw-r--r--xmloff/inc/xmloff/xmlexp.hxx6
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx21
-rw-r--r--xmloff/source/chart/SchXMLParagraphContext.cxx18
-rw-r--r--xmloff/source/core/xmlexp.cxx16
-rw-r--r--xmloff/source/draw/animationexport.cxx22
-rw-r--r--xmloff/source/draw/animationimport.cxx34
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx4
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx4
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx3
-rw-r--r--xmloff/source/draw/shapeexport.cxx6
-rw-r--r--xmloff/source/draw/ximpbody.cxx23
-rw-r--r--xmloff/source/draw/ximpshap.cxx4
-rw-r--r--xmloff/source/forms/elementexport.cxx12
-rw-r--r--xmloff/source/forms/elementimport.cxx15
-rw-r--r--xmloff/source/forms/formattributes.cxx2
-rw-r--r--xmloff/source/meta/xmlmetae.cxx4
-rw-r--r--xmloff/source/style/XMLFontAutoStylePool.cxx5
-rw-r--r--xmloff/source/style/XMLFontStylesContext.cxx15
-rw-r--r--xmloff/source/style/fonthdl.cxx2
-rw-r--r--xmloff/source/style/fonthdl.hxx6
-rw-r--r--xmloff/source/style/prhdlfac.cxx5
-rw-r--r--xmloff/source/style/xmlnume.cxx26
-rw-r--r--xmloff/source/style/xmlnumi.cxx30
-rw-r--r--xmloff/source/text/XMLChangedRegionImportContext.cxx13
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx2
-rw-r--r--xmloff/source/text/txtimp.cxx2
-rw-r--r--xmloff/source/text/txtparae.cxx13
-rw-r--r--xmloff/source/text/txtparai.cxx15
-rw-r--r--xmloff/source/text/txtparai.hxx1
-rw-r--r--xmlscript/source/xmldlg_imexp/exp_share.hxx2
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx2
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx4
404 files changed, 17078 insertions, 6494 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
index 957b0a508bd8..cb2c4f6628c8 100644..100755
--- a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
@@ -56,7 +56,7 @@ protected:
AccessibleGridControl(
const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator,
- ::svt::table::IAccessibleTable& _rTable
+ ::svt::table::IAccessibleTable& _rTable
);
virtual ~AccessibleGridControl();
@@ -177,8 +177,7 @@ private:
<p>The instance holds it's XAccessibleContext with a hard reference, while
the contxt holds this instance weak.</p>
*/
-typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible
- > AccessibleGridControlAccess_Base;
+typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible > AccessibleGridControlAccess_Base;
class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base
,public ::svt::table::IAccessibleTableControl
@@ -191,7 +190,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
m_xContext;
- AccessibleGridControl* m_pContext;
+ AccessibleGridControl* m_pContext;
// note that this pointer is valid as long as m_xContext is valid!
public:
@@ -253,7 +252,7 @@ protected:
private:
AccessibleGridControlAccess(); // never implemented
- AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented
+ AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented
AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& ); // never implemented
};
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
index 3bdd5abe8912..c6a26d8c4548 100644..100755
--- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
@@ -96,8 +96,8 @@ public:
@param eDescrText The constant for the description text. */
AccessibleGridControlBase(
const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible >& rxParent,
- ::svt::table::IAccessibleTable& rTable,
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
::svt::table::AccessibleTableControlObjType eObjType );
protected:
@@ -135,14 +135,14 @@ public:
The relation set (the GridControl does not have one).
*/
virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
- getAccessibleRelationSet()
+ ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
+ getAccessibleRelationSet()
throw ( ::com::sun::star::uno::RuntimeException );
/** @return The set of current states. */
virtual ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
- getAccessibleStateSet()
+ getAccessibleStateSet()
throw ( ::com::sun::star::uno::RuntimeException );
/** @return The parent's locale. */
@@ -407,7 +407,7 @@ protected:
private:
GridControlAccessibleElement(); // never implemented
- GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented
+ GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented
GridControlAccessibleElement& operator=( const GridControlAccessibleElement& ); // never implemented
};
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx
index b45ad5bdae5a..90306435bd4b 100644..100755
--- a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx
@@ -51,7 +51,7 @@ public:
AccessibleGridControlHeader(
const ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible >& rxParent,
- ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::IAccessibleTable& rTable,
::svt::table::AccessibleTableControlObjType eObjType );
protected:
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx
index 648614a9e214..0672ca28a151 100644..100755
--- a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx
@@ -36,9 +36,9 @@ namespace accessibility
sal_Int32 m_nColumnRowId;
public:
AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId,
- const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
- ::svt::table::IAccessibleTable& _rTable,
- ::svt::table::AccessibleTableControlObjType _eObjType);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& _rTable,
+ ::svt::table::AccessibleTableControlObjType _eObjType);
/** @return The count of visible children. */
virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException );
@@ -56,8 +56,8 @@ namespace accessibility
/** Queries for a new interface. */
::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type& rType )
- throw ( ::com::sun::star::uno::RuntimeException );
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
/** Aquires the object (calls acquire() on base class). */
virtual void SAL_CALL acquire() throw ();
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx
index 35b7a69f5aa6..28d9cfb919f1 100644..100755
--- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx
@@ -57,9 +57,9 @@ public:
@param eDescrText The constant for the description text. */
AccessibleGridControlTableBase(
const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible >& rxParent,
- ::svt::table::IAccessibleTable& rTable,
- ::svt::table::AccessibleTableControlObjType eObjType );
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType eObjType );
protected:
virtual ~AccessibleGridControlTableBase();
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx
index dd44927d7fc1..dd44927d7fc1 100644..100755
--- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx
diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx
index e8111657d7d0..f0aa406b62bf 100644..100755
--- a/accessibility/source/extended/AccessibleGridControl.cxx
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -33,7 +33,6 @@
#include <svtools/accessibletable.hxx>
#include <comphelper/types.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-//#include "svtools/table/tablecontrol.hxx"
// ============================================================================
@@ -61,21 +60,19 @@ public:
/** The data table child. */
Reference<
::com::sun::star::accessibility::XAccessible > m_xTable;
- AccessibleGridControlTable* m_pTable;
+ AccessibleGridControlTable* m_pTable;
/** The header bar for rows. */
Reference<
::com::sun::star::accessibility::XAccessible > m_xRowHeaderBar;
- AccessibleGridControlHeader* m_pRowHeaderBar;
+ AccessibleGridControlHeader* m_pRowHeaderBar;
/** The header bar for columns (first row of the table). */
Reference<
::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar;
- AccessibleGridControlHeader* m_pColumnHeaderBar;
+ AccessibleGridControlHeader* m_pColumnHeaderBar;
};
-// Ctor/Dtor/disposing --------------------------------------------------------
-
DBG_NAME( AccessibleGridControl )
AccessibleGridControl::AccessibleGridControl(
@@ -83,7 +80,6 @@ AccessibleGridControl::AccessibleGridControl(
IAccessibleTable& _rTable )
: AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL )
{
-// DBG_CTOR( AccessibleTableControl, NULL );
m_pImpl.reset( new AccessibleGridControl_Impl() );
m_pImpl->m_aCreator = _rxCreator;
}
@@ -91,7 +87,6 @@ AccessibleGridControl::AccessibleGridControl(
// -----------------------------------------------------------------------------
AccessibleGridControl::~AccessibleGridControl()
{
- DBG_DTOR( AccessibleGridControl, NULL );
}
// -----------------------------------------------------------------------------
@@ -99,7 +94,7 @@ void SAL_CALL AccessibleGridControl::disposing()
{
::osl::MutexGuard aGuard( getOslMutex() );
- m_pImpl->m_pTable = NULL;
+ m_pImpl->m_pTable = NULL;
m_pImpl->m_pColumnHeaderBar = NULL;
m_pImpl->m_pRowHeaderBar = NULL;
m_pImpl->m_aCreator = Reference< XAccessible >();
@@ -143,7 +138,8 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex )
{
if(nChildIndex == 0 && m_aTable.HasColHeader())
{
- if(!m_pImpl->m_xColumnHeaderBar.is()){
+ if(!m_pImpl->m_xColumnHeaderBar.is())
+ {
AccessibleGridControlHeader* pColHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR);
m_pImpl->m_xColumnHeaderBar = pColHeaderBar;
}
@@ -151,7 +147,8 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex )
}
else if(m_aTable.HasRowHeader() && (nChildIndex == 1 || nChildIndex == 0))
{
- if(!m_pImpl->m_xRowHeaderBar.is()){
+ if(!m_pImpl->m_xRowHeaderBar.is())
+ {
AccessibleGridControlHeader* pRowHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR);
m_pImpl->m_xRowHeaderBar = pRowHeaderBar;
}
@@ -164,7 +161,6 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex )
xChild = m_pImpl->m_xTable;
}
}
-
return xChild;
}
// -----------------------------------------------------------------------------
@@ -200,11 +196,11 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint )
{
Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) );
Reference< XAccessibleComponent >
- xCurrChildComp( xCurrChild, uno::UNO_QUERY );
+ xCurrChildComp( xCurrChild, uno::UNO_QUERY );
if( xCurrChildComp.is() &&
- VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) )
- xChild = xCurrChild;
+ VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) )
+ xChild = xCurrChild;
}
}
return xChild;
@@ -217,7 +213,7 @@ void SAL_CALL AccessibleGridControl::grabFocus()
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
- m_aTable.GrabFocus();
+ m_aTable.GrabFocus();
}
// -----------------------------------------------------------------------------
@@ -260,7 +256,6 @@ Reference< XAccessible > AccessibleGridControl::implGetTable()
{
m_pImpl->m_pTable = createAccessibleTable();
m_pImpl->m_xTable = m_pImpl->m_pTable;
-
}
return m_pImpl->m_xTable;
}
@@ -302,7 +297,7 @@ AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex )
Reference< XAccessible > xRet;
switch( nChildIndex )
{
- case TCINDEX_COLUMNHEADERBAR:
+ case TCINDEX_COLUMNHEADERBAR:
xRet = implGetHeaderBar( TCTYPE_COLUMNHEADERBAR );
break;
case TCINDEX_ROWHEADERBAR:
@@ -318,7 +313,7 @@ AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex )
AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable()
{
Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator;
- DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" );
+ DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" );
return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE );
}
// ============================================================================
@@ -331,13 +326,11 @@ AccessibleGridControlAccess::AccessibleGridControlAccess( const Reference< XAcce
,m_rTable( _rTable )
,m_pContext( NULL )
{
- DBG_CTOR( AccessibleGridControlAccess, NULL );
}
// -----------------------------------------------------------------------------
AccessibleGridControlAccess::~AccessibleGridControlAccess()
{
- DBG_DTOR( AccessibleGridControlAccess, NULL );
}
// -----------------------------------------------------------------------------
diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx
index 12d4a7d141a4..ea81bd350426 100644..100755
--- a/accessibility/source/extended/AccessibleGridControlBase.cxx
+++ b/accessibility/source/extended/AccessibleGridControlBase.cxx
@@ -57,8 +57,6 @@ namespace accessibility {
using namespace com::sun::star::accessibility::AccessibleStateType;
// ============================================================================
-// Ctor/Dtor/disposing --------------------------------------------------------
-
DBG_NAME( AccessibleGridControlBase )
AccessibleGridControlBase::AccessibleGridControlBase(
@@ -73,13 +71,10 @@ AccessibleGridControlBase::AccessibleGridControlBase(
m_aDescription( rTable.GetAccessibleObjectDescription( eObjType ) ),
m_aClientId(0)
{
- DBG_CTOR( AccessibleGridControlBase, NULL );
}
AccessibleGridControlBase::~AccessibleGridControlBase()
{
-// DBG_DTOR( AccessibleGridControlBase, NULL );
-
if( isAlive() )
{
// increment ref count to prevent double call of Dtor
@@ -122,20 +117,19 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent()
xParentContext( m_xParent->getAccessibleContext() );
if( xParentContext.is() )
{
- Reference< uno::XInterface > xChild;
+ Reference< uno::XInterface > xChild;
sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild )
{
- xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
-
- if ( xMeMyselfAndI.get() == xChild.get() )
- {
- nRet = nChild;
- break;
- }
+ xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
+ if ( xMeMyselfAndI.get() == xChild.get() )
+ {
+ nRet = nChild;
+ break;
}
}
+ }
}
return nRet;
}
@@ -160,9 +154,9 @@ Reference< XAccessibleRelationSet > SAL_CALL
AccessibleGridControlBase::getAccessibleRelationSet()
throw ( uno::RuntimeException )
{
- ensureIsAlive();
- // GridControl does not have relations.
- return new utl::AccessibleRelationSetHelper;
+ ensureIsAlive();
+ // GridControl does not have relations.
+ return new utl::AccessibleRelationSetHelper;
}
Reference< XAccessibleStateSet > SAL_CALL
@@ -185,7 +179,7 @@ lang::Locale SAL_CALL AccessibleGridControlBase::getLocale()
Reference< XAccessibleContext >
xParentContext( m_xParent->getAccessibleContext() );
if( xParentContext.is() )
- return xParentContext->getLocale();
+ return xParentContext->getLocale();
}
throw IllegalAccessibleComponentStateException();
}
@@ -268,19 +262,18 @@ void SAL_CALL AccessibleGridControlBase::removeEventListener(
{
if( _rxListener.is() && getClientId( ) )
{
- ::osl::MutexGuard aGuard( getOslMutex() );
+ ::osl::MutexGuard aGuard( getOslMutex() );
sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener );
- if ( !nListenerCount )
- {
- // no listeners anymore
- // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
- // and at least to us not firing any events anymore, in case somebody calls
- // NotifyAccessibleEvent, again
-
- AccessibleEventNotifier::TClientId nId( getClientId( ) );
- setClientId( 0 );
- AccessibleEventNotifier::revokeClient( nId );
- }
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ AccessibleEventNotifier::TClientId nId( getClientId( ) );
+ setClientId( 0 );
+ AccessibleEventNotifier::revokeClient( nId );
+ }
}
}
@@ -310,7 +303,6 @@ sal_Bool SAL_CALL AccessibleGridControlBase::supportsService(
for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString )
;
-
return pString != pArrEnd;
}
@@ -351,7 +343,6 @@ sal_Bool AccessibleGridControlBase::implIsShowing()
}
else
pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
-
return pStateSetHelper;
}
@@ -382,7 +373,7 @@ Rectangle AccessibleGridControlBase::getBoundingBox()
}
return aRect;
}
-//
+
Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen()
throw ( lang::DisposedException )
{
@@ -436,22 +427,22 @@ sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole()
switch ( m_eObjType )
{
case TCTYPE_ROWHEADERCELL:
- nRole = AccessibleRole::ROW_HEADER;
- break;
- case TCTYPE_COLUMNHEADERCELL:
- nRole = AccessibleRole::COLUMN_HEADER;
- break;
- case TCTYPE_COLUMNHEADERBAR:
- case TCTYPE_ROWHEADERBAR:
- case TCTYPE_TABLE:
- nRole = AccessibleRole::TABLE;
- break;
- case TCTYPE_TABLECELL:
- nRole = AccessibleRole::TABLE_CELL;
- break;
- case TCTYPE_GRIDCONTROL:
- nRole = AccessibleRole::PANEL;
- break;
+ nRole = AccessibleRole::ROW_HEADER;
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ nRole = AccessibleRole::COLUMN_HEADER;
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ case TCTYPE_ROWHEADERBAR:
+ case TCTYPE_TABLE:
+ nRole = AccessibleRole::TABLE;
+ break;
+ case TCTYPE_TABLECELL:
+ nRole = AccessibleRole::TABLE_CELL;
+ break;
+ case TCTYPE_GRIDCONTROL:
+ nRole = AccessibleRole::PANEL;
+ break;
}
return nRole;
}
@@ -480,17 +471,16 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::su
{
if ( pInst->IsControlForeground() )
nColor = pInst->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( pInst->IsControlFont() )
+ aFont = pInst->GetControlFont();
else
- {
- Font aFont;
- if ( pInst->IsControlFont() )
- aFont = pInst->GetControlFont();
- else
- aFont = pInst->GetFont();
- nColor = aFont.GetColor().GetColor();
- }
+ aFont = pInst->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
}
-
return nColor;
}
// -----------------------------------------------------------------------------
@@ -505,20 +495,18 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) throw (::com::su
{
if ( pInst->IsControlBackground() )
nColor = pInst->GetControlBackground().GetColor();
- else
+ else
nColor = pInst->GetBackground().GetColor().GetColor();
}
-
return nColor;
}
//// ============================================================================
GridControlAccessibleElement::GridControlAccessibleElement( const Reference< XAccessible >& rxParent,
- IAccessibleTable& rTable,
- AccessibleTableControlObjType eObjType )
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType )
:AccessibleGridControlBase( rxParent, rTable, eObjType )
{
-// DBG_CTOR( GridControlAccessibleElement, NULL );
}
// XInterface -----------------------------------------------------------------
@@ -537,7 +525,6 @@ Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccess
// ----------------------------------------------------------------------------
GridControlAccessibleElement::~GridControlAccessibleElement( )
{
-// DBG_DTOR( GridControlAccessibleElement, NULL );
}
// ============================================================================
diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx
index c7622c18981e..1870eebc8e3e 100644..100755
--- a/accessibility/source/extended/AccessibleGridControlHeader.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -56,8 +56,6 @@ namespace accessibility {
// ============================================================================
-// Ctor/Dtor/disposing --------------------------------------------------------
-
DBG_NAME( AccessibleGridControlHeader )
AccessibleGridControlHeader::AccessibleGridControlHeader(
@@ -66,15 +64,12 @@ AccessibleGridControlHeader::AccessibleGridControlHeader(
::svt::table::AccessibleTableControlObjType eObjType):
AccessibleGridControlTableBase( rxParent, rTable, eObjType )
{
-// DBG_CTOR( AccessibleGridControlHeaderBar, NULL );
-
DBG_ASSERT( isRowBar() || isColumnBar(),
"accessibility/extended/AccessibleGridControlHeaderBar - invalid object type" );
}
AccessibleGridControlHeader::~AccessibleGridControlHeader()
{
-// DBG_DTOR( AccessibleGridControlHeader, NULL );
}
// XAccessibleContext ---------------------------------------------------------
@@ -83,11 +78,11 @@ Reference< XAccessible > SAL_CALL
AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- TCSolarGuard aSolarGuard;
+ TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
- throw IndexOutOfBoundsException();
+ throw IndexOutOfBoundsException();
ensureIsAlive();
Reference< XAccessible > xChild;
if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
@@ -106,11 +101,11 @@ AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex )
sal_Int32 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent()
throw ( uno::RuntimeException )
{
- ensureIsAlive();
- if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader())
- return 1;
- else
- return 0;
+ ensureIsAlive();
+ if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader())
+ return 1;
+ else
+ return 0;
}
// XAccessibleComponent -------------------------------------------------------
@@ -126,8 +121,8 @@ AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint )
sal_Int32 nRow = 0;
sal_Int32 nColumnPos = 0;
sal_Bool bConverted = isRowBar() ?
- m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) :
- m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) );
+ m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) :
+ m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) );
return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
}
@@ -181,35 +176,24 @@ Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibl
ensureIsAlive();
return NULL; // no headers in headers
}
-
+//not selectable
Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows()
throw ( uno::RuntimeException )
{
- TCSolarGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getOslMutex() );
- ensureIsAlive();
-
- Sequence< sal_Int32 > aSelSeq;
- // row of column header bar not selectable
- if( isRowBar() )
- implGetSelectedRows( aSelSeq );
+ Sequence< sal_Int32 > aSelSeq(0);
return aSelSeq;
}
//columns aren't selectable
Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns()
throw ( uno::RuntimeException )
{
- return NULL;
+ Sequence< sal_Int32 > aSelSeq(0);
+ return aSelSeq;
}
-//To Do - not yet implemented
-sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 nRow )
+//row headers not selectable
+sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 /*nRow*/ )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- TCSolarGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getOslMutex() );
- ensureIsAlive();
- ensureIsValidRow( nRow );
- //return isRowBar() ? implIsRowSelected( nRow ) : sal_False;
return sal_False;
}
//columns aren't selectable
@@ -219,28 +203,19 @@ sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_I
(void)nColumn;
return sal_False;
}
-
+//not implemented
Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt(
- sal_Int32 nRow, sal_Int32 nColumn )
+ sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- TCSolarGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getOslMutex() );
- ensureIsAlive();
- ensureIsValidAddress( nRow, nColumn );
- return implGetChild( nRow, implToVCLColumnPos( nColumn ) );
+ return NULL;
}
-// TO DO - not implemented yet
+// not selectable
sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected(
- sal_Int32 nRow, sal_Int32 nColumn )
+ sal_Int32 /*nRow*/, sal_Int32 /*nColumn */)
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- TCSolarGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getOslMutex() );
- ensureIsAlive();
- ensureIsValidAddress( nRow, nColumn );
- return FALSE;
- // return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn );
+ return sal_False;
}
// XServiceInfo ---------------------------------------------------------------
diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
index 485c57c40ae1..485c57c40ae1 100644..100755
--- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx
index efd78fc8634a..461e776f1392 100644..100755
--- a/accessibility/source/extended/AccessibleGridControlTable.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -51,8 +51,6 @@ namespace accessibility {
// ============================================================================
-// Ctor/Dtor/disposing --------------------------------------------------------
-
DBG_NAME( AccessibleGridControlTable )
AccessibleGridControlTable::AccessibleGridControlTable(
@@ -61,12 +59,10 @@ AccessibleGridControlTable::AccessibleGridControlTable(
AccessibleTableControlObjType _eType) :
AccessibleGridControlTableBase( rxParent, rTable, _eType )
{
- DBG_CTOR( AccessibleGridControlTable, NULL );
}
AccessibleGridControlTable::~AccessibleGridControlTable()
{
- DBG_DTOR( AccessibleGridControlTable, NULL );
}
// XAccessibleContext ---------------------------------------------------------
@@ -92,7 +88,6 @@ sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent()
return 1;
else
return 2;
-
}
// XAccessibleComponent -------------------------------------------------------
@@ -177,7 +172,6 @@ Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessible
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
-
Sequence< sal_Int32 > aSelSeq;
implGetSelectedRows( aSelSeq );
return aSelSeq;
@@ -187,38 +181,34 @@ Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessible
Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns()
throw ( uno::RuntimeException )
{
-// TCSolarGuard aSolarGuard;
-// ::osl::MutexGuard aGuard( getOslMutex() );
-// ensureIsAlive();
-//
-// Sequence< sal_Int32 > aSelSeq;
-// implGetSelectedColumns( aSelSeq );
-// return aSelSeq;
- return NULL;
+ Sequence< sal_Int32 > aSelSeq(0);
+ return aSelSeq;
}
-//To Do: not implemented yet
sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- //TCSolarGuard aSolarGuard;
- //::osl::MutexGuard aGuard( getOslMutex() );
- //ensureIsAlive();
- //ensureIsValidRow( nRow );
- //return implIsRowSelected( nRow );
- (void) nRow;
- return sal_False;
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ sal_Bool bSelected = sal_False;
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ for(int i=0; i<selectedRows.getLength(); i++)
+ {
+ if(nRow == selectedRows[i])
+ {
+ bSelected = sal_True;
+ continue;
+ }
+ }
+ return bSelected;
}
//columns aren't selectable
sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleColumnSelected( sal_Int32 nColumn )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- /*TCSolarGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getOslMutex() );
- ensureIsAlive();
- ensureIsValidColumn( nColumn );
- return implIsColumnSelected( nColumn );*/
(void) nColumn;
return sal_False;
}
@@ -238,16 +228,14 @@ sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected(
sal_Int32 nRow, sal_Int32 nColumn )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- /*TCSolarGuard aSolarGuard;
+ TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
ensureIsValidAddress( nRow, nColumn );
- return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );*/
- (void) nRow;
(void) nColumn;
- return sal_False;
+ //selection of single cells not possible, so if row is selected, the cell will be selected too
+ return isAccessibleRowSelected(nRow);
}
-//To Do: not implemented yet
void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
@@ -255,48 +243,51 @@ void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChil
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
ensureIsValidIndex( nChildIndex );
- //if( isRowBar() )
- // implSelectRow( nChildIndex, sal_True );
- //else
- // implSelectColumn( implToVCLColumnPos( nChildIndex ), sal_True );
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ sal_Int32 nRow = (nChildIndex / nColumns);
+ std::vector< sal_Int32 > selectedRows = m_aTable.GetSelectedRows();
+ selectedRows.push_back(nRow);
}
-//To Do - not implemented yet
sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- // using interface methods - no mutex
- /*return isRowBar() ?
- isAccessibleRowSelected( nChildIndex ) :
- isAccessibleColumnSelected( nChildIndex );*/
- (void)nChildIndex;
- return FALSE;
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ sal_Int32 nRow = (nChildIndex / nColumns);
+ return isAccessibleRowSelected(nRow);
}
-//To Do - not implemented yet
void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection()
throw ( uno::RuntimeException )
{
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
+ for(unsigned int i=0;i<m_aTable.GetSelectedRows().size();i++)
+ m_aTable.RemoveSelectedRow((sal_Int32)i);
}
-//To Do - not implemented yet
void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren()
throw ( uno::RuntimeException )
{
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ for(int i=0;i<m_aTable.GetRowCount();i++)
+ selectedRows[i]=i;
}
-//To Do - not implemented yet
sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount()
throw ( uno::RuntimeException )
{
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
- return 0;
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ return selectedRows.getLength()*nColumns;
}
-//To Do - not implemented yet
Reference< XAccessible > SAL_CALL
AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
@@ -304,10 +295,12 @@ AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChild
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
- (void)nSelectedChildIndex;
- return NULL;
+ if(isAccessibleChildSelected(nSelectedChildIndex))
+ return getAccessibleChild(nSelectedChildIndex);
+ else
+ return NULL;
}
-//To Do - not implemented yet
+//not implemented yet, because only row selection possible
void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild(
sal_Int32 nSelectedChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
@@ -316,14 +309,6 @@ void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild(
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
(void)nSelectedChildIndex;
- // method may throw lang::IndexOutOfBoundsException
- //if ( isAccessibleChildSelected(nSelectedChildIndex) )
- //{
- // if( isRowBar() )
- // implSelectRow( nSelectedChildIndex, sal_False );
- // else
- // implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), sal_False );
- //}
}
// XInterface -----------------------------------------------------------------
@@ -364,14 +349,6 @@ Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen()
return m_aTable.calcTableRect();
}
// internal helper methods ----------------------------------------------------
-//To Do - not implemented yet
-//sal_Int32 AccessibleGridControlTable::implGetChildIndexFromSelectedIndex(
-// sal_Int32 nSelectedChildIndex )
-// throw ( lang::IndexOutOfBoundsException )
-//{
-// (void)nSelectedChildIndex;
-// return 0;
-//}
Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
sal_Int32 nChildIndex )
throw ( uno::RuntimeException )
diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
index 8a7e3102bdf7..352e80e1a666 100644..100755
--- a/accessibility/source/extended/AccessibleGridControlTableBase.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
@@ -53,8 +53,6 @@ namespace accessibility {
// ============================================================================
-// Ctor/Dtor/disposing --------------------------------------------------------
-
DBG_NAME( AccessibleGridControlTableBase )
AccessibleGridControlTableBase::AccessibleGridControlTableBase(
@@ -63,12 +61,10 @@ AccessibleGridControlTableBase::AccessibleGridControlTableBase(
AccessibleTableControlObjType eObjType ) :
GridControlAccessibleElement( rxParent, rTable, eObjType )
{
- DBG_CTOR( AccessibleGridControlTableBase, NULL );
}
AccessibleGridControlTableBase::~AccessibleGridControlTableBase()
{
- DBG_DTOR( AccessibleGridControlTableBase, NULL );
}
// XAccessibleContext ---------------------------------------------------------
diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
index f511eb43cbf8..43b9400e9050 100644..100755
--- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -65,7 +65,6 @@ namespace accessibility
// =============================================================================
// = AccessibleGridControlCell
// =============================================================================
- //DBG_NAME( svt_AccessibleGridControlCell )
// -----------------------------------------------------------------------------
AccessibleGridControlCell::AccessibleGridControlCell(
const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable,
@@ -74,7 +73,6 @@ namespace accessibility
,m_nRowPos( _nRowPos )
,m_nColPos( _nColPos )
{
-// DBG_CTOR( svt_AccessibleGridControlCell, NULL );
// set accessible name here, because for that we need the position of the cell
// and so the base class isn't capable of doing this
::rtl::OUString aAccName;
@@ -104,8 +102,7 @@ namespace accessibility
::rtl::OUString AccessibleGridControlTableCell::implGetText()
{
ensureIsAlive();
- //return mpTable->GetAccessibleCellText( getRowPos(), static_cast< USHORT >( getColumnPos() ) );
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "test" ));
+ return m_aTable.GetAccessibleCellText( getRowPos(), getColumnPos() );
}
::com::sun::star::lang::Locale AccessibleGridControlTableCell::implGetLocale()
@@ -166,10 +163,7 @@ namespace accessibility
::com::sun::star::awt::Rectangle aRect;
if ( &m_aTable )
- {
aRect = AWTRectangle( m_aTable.GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) );
- }
-
return aRect;
}
@@ -363,12 +357,12 @@ namespace accessibility
//!!! don't know how to put a string into the clipboard
return sal_False;
}
+
Rectangle AccessibleGridControlTableCell::implGetBoundingBox()
{
return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
}
// -----------------------------------------------------------------------------
-
Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen()
{
return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
diff --git a/automation/source/inc/rcontrol.hxx b/automation/source/inc/rcontrol.hxx
index 829dd320beb6..7313603096b4 100644
--- a/automation/source/inc/rcontrol.hxx
+++ b/automation/source/inc/rcontrol.hxx
@@ -305,7 +305,7 @@
#define RC_Profile ( M_SOFFICE | M_MOZILLA | 9 )
// (Popup)Menu
#define RC_MenuSelect ( M_SOFFICE | M_MOZILLA | 10 )
-#define RC_SetControlType ( M_SOFFICE | 11 )
+#define RC_SetControlType ( M_SOFFICE | 11 ) // deprecated since RTTI
// RemoteFileAccess
#define RC_Kill ( M_SOFFICE | 12 )
#define RC_RmDir ( M_SOFFICE | 13 )
@@ -429,14 +429,14 @@
-// Konstanten die im Basic zur Verfügung stehen sollen
+// Constants which are available in VCLTestTool scripts
-// Verschiedene Typen von Controls für den Befehl SetControlType
-// !!!!!!!!!!! Müssen alle bei SetControlType eingetragen werden !!!!!!!!!!!!
+// Different types of controls recognized via RTTI
#define CONST_CTBrowseBox 100
#define CONST_CTValueSet 103
#define CONST_CTORoadmap 104
#define CONST_CTIExtensionListBox 105
+#define CONST_CTTableControl 106
#define CONST_CTUnknown 199
// Konstanten für das ALignment des gesuchten Splitters
diff --git a/automation/source/server/sta_list.cxx b/automation/source/server/sta_list.cxx
index 7f346c298563..c0abcb057f8b 100644
--- a/automation/source/server/sta_list.cxx
+++ b/automation/source/server/sta_list.cxx
@@ -53,6 +53,7 @@
#include <svtools/valueset.hxx>
#include <svtools/roadmap.hxx>
#include <svtools/extensionlistbox.hxx>
+#include <svtools/table/tablecontrol.hxx>
#define WINDOW_ANYTYPE WINDOW_BASE
@@ -999,6 +1000,8 @@ String StatementList::ClientTree(Window *pBase, int Indent)
WRITEc("/RoadMap")
else if ( dynamic_cast< svt::IExtensionListBox* >(pBase) )
WRITEc("/ExtensionListBox")
+ else if ( dynamic_cast< svt::table::TableControl* >(pBase) )
+ WRITEc("/TableControl")
else
WRITEc("/Unknown")
}
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx
index 68ff61bbaa0d..2d1cccd9fc51 100644
--- a/automation/source/server/statemnt.cxx
+++ b/automation/source/server/statemnt.cxx
@@ -82,6 +82,7 @@
#include <vcl/wintypes.hxx>
#include <svtools/valueset.hxx>
#include <svtools/roadmap.hxx>
+#include <svtools/table/tablecontrol.hxx>
#include <svl/poolitem.hxx>
#include <svtools/extensionlistbox.hxx>
// Hat keinen Includeschutz
@@ -96,6 +97,7 @@
#include <basic/ttstrhlp.hxx>
#endif
#include <basic/dispdefs.hxx>
+#include <basic/sbuno.hxx>
#include <vos/socket.hxx>
#include <svl/pickerhistory.hxx>
#include <com/sun/star/util/XCancellable.hpp>
@@ -128,9 +130,10 @@
using namespace com::sun::star::frame;
using namespace com::sun::star::uno;
-using namespace com::sun::star::util;
+//using namespace com::sun::star::util; geht wegen Color nicht
using namespace com::sun::star::beans;
using namespace svt;
+//using namespace svt::table;
#ifndef SBX_VALUE_DECL_DEFINED
@@ -618,7 +621,7 @@ BOOL StatementSlot::Execute()
AddReferer();
if ( !aUnoUrl.Len() )
aUnoUrl = CUniString("slot:").Append( String::CreateFromInt32( nFunctionId ) );
- URL aTargetURL;
+ ::com::sun::star::util::URL aTargetURL;
aTargetURL.Complete = aUnoUrl;
Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.frame.Desktop") ), UNO_QUERY );
Reference < XFrame > xFrame;
@@ -664,7 +667,7 @@ BOOL StatementSlot::Execute()
ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_FRAME, aTargetURL.Complete ) );
else
{
- Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY );
+ Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY );
xTrans->parseStrict( aTargetURL );
Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
@@ -865,6 +868,13 @@ void StatementCommand::WriteControlData( Window *pBase, ULONG nConf, BOOL bFirst
if ( bFirst )
pRet->GenReturn ( RET_WinInfo, SmartId(), (comm_ULONG)nConf | DH_MODE_DATA_VALID, UniString(), TRUE );
+ if ( bFirst )
+ {
+ if ( pBase->GetType() == WINDOW_WINDOW && pBase->GetParent() && pBase->GetParent()->GetType() == WINDOW_CONTROL &&
+ dynamic_cast< svt::table::TableControl* > ( pBase->GetParent() ) )
+ pBase = pBase->GetParent();
+ }
+
{ // Klammerung, so daß der String nicht während der Rekursion bestehen bleibt
String aName;
BOOL bSkip = FALSE;
@@ -958,6 +968,8 @@ void StatementCommand::WriteControlData( Window *pBase, ULONG nConf, BOOL bFirst
aTypeSuffix.AppendAscii( "/RoadMap", 8 );
else if ( dynamic_cast< IExtensionListBox* >(pBase) )
aTypeSuffix.AppendAscii( "/ExtensionListBox" );
+ else if ( dynamic_cast< svt::table::TableControl* >(pBase) )
+ aTypeSuffix.AppendAscii( "/TableControl" );
else
aTypeSuffix.AppendAscii( "/Unknown", 8 );
}
@@ -3388,17 +3400,17 @@ BOOL StatementCommand::Execute()
{
if( (nParams & PARAM_USHORT_1) )
{
- Reference < XCancellable > xPicker;
+ Reference < ::com::sun::star::util::XCancellable > xPicker;
switch( nNr1 )
{
case CONST_FilePicker:
{
- xPicker.set( Reference < XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) );
+ xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) );
}
break;
case CONST_FolderPicker:
{
- xPicker.set( Reference < XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) );
+ xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) );
}
break;
default:
@@ -5807,6 +5819,8 @@ BOOL StatementControl::Execute()
nRealControlType = CONST_CTORoadmap;
else if ( dynamic_cast< IExtensionListBox* >(pControl) )
nRealControlType = CONST_CTIExtensionListBox;
+ else if ( dynamic_cast< ::svt::table::TableControl* >(pControl) )
+ nRealControlType = CONST_CTTableControl;
else
nRealControlType = CONST_CTUnknown;
@@ -6148,6 +6162,163 @@ protected:
}
}
break;
+
+ case CONST_CTTableControl:
+ {
+ ::svt::table::TableControl *pTC = dynamic_cast< ::svt::table::TableControl* >(pControl);
+ switch ( nMethodId )
+ {
+ case M_GetItemType :
+ {
+ if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
+ ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
+ {
+ ::svt::table::PTableModel pModel = pTC->GetModel();
+ Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1];
+ pRet->GenReturn ( RET_Value, aUId, String( aCell.getValueTypeName() ));
+ }
+ }
+ break;
+ case M_GetItemText :
+ {
+ if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
+ ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
+ {
+ ::svt::table::PTableModel pModel = pTC->GetModel();
+ Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1];
+ /* doesn't work ATM since it gets casted to SbxDATE in VCLTestTool unfortunately
+ SbxVariableRef xRes = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( xRes, aCell );
+ pRet->GenReturn ( RET_Value, aUId, *xRes );*/
+
+ Type aType = aCell.getValueType();
+ TypeClass eTypeClass = aType.getTypeClass();
+ switch( eTypeClass )
+ {
+ /*case TypeClass_ENUM:
+ {
+ sal_Int32 nEnum = 0;
+ enum2int( nEnum, aValue );
+ pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)nEnum );
+ }
+ break;*/
+ case TypeClass_BOOLEAN:
+ pRet->GenReturn ( RET_Value, aUId, *(sal_Bool*)aCell.getValue() );
+ break;
+ case TypeClass_CHAR:
+ {
+ ::rtl::OUString aContent( *(sal_Unicode*)aCell.getValue() );
+ pRet->GenReturn ( RET_Value, aUId, aContent );
+ }
+ break;
+ case TypeClass_STRING:
+ {
+ ::rtl::OUString aContent;
+ aCell >>= aContent;
+ pRet->GenReturn ( RET_Value, aUId, aContent );
+ }
+ break;
+ //case TypeClass_FLOAT: break;
+ //case TypeClass_DOUBLE: break;
+ //case TypeClass_OCTET: break;
+ case TypeClass_BYTE:
+ case TypeClass_SHORT:
+ case TypeClass_LONG:
+ case TypeClass_HYPER:
+ case TypeClass_UNSIGNED_LONG:
+ case TypeClass_UNSIGNED_HYPER:
+ {
+ comm_ULONG val = 0;
+ aCell >>= val;
+ pRet->GenReturn ( RET_Value, aUId, val );
+ }
+ break;
+ //case TypeClass_UNSIGNED_OCTET:break;
+ case TypeClass_UNSIGNED_SHORT:
+ {
+ comm_USHORT val = 0;
+ aCell >>= val;
+ pRet->GenReturn ( RET_Value, aUId, val );
+ }
+ break;
+ default:
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT(0) );
+ break;
+ }
+ }
+ }
+ break;
+ case M_GetColumnCount :
+ {
+ pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetColumnCount() );
+ }
+ break;
+ case M_GetRowCount :
+ {
+ pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetRowCount() );
+ }
+ break;
+ case M_Select :
+ {
+ if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetRowCount() ))
+ {
+ if ( pTC->GoToRow( ::svt::table::RowPos( nNr1-1 ) ) )
+ {
+ Size aSize( pTC->GetSizePixel() );
+// DirectLog( S_QAError, UniString::CreateFromInt32( aSize.Width() ).Append( UniString::CreateFromInt32( aSize.Height() ) ) );
+ Point aPos( aSize.Width() / 2, aSize.Height() / 2 );
+ long nStep = aSize.Height() / 4;
+ ::svt::table::RowPos nLastPos;
+ while ( ( nLastPos = pTC->GetCurrentRow( aPos ) ) != nNr1-1 && nStep > 0 )
+ {
+ if ( nLastPos > nNr1-1 || nLastPos == ROW_INVALID )
+ aPos.Y() -= nStep;
+ else
+ aPos.Y() += nStep;
+ nStep /= 2;
+ }
+ if ( pTC->GetCurrentRow( aPos ) == nNr1-1 )
+ {
+ MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,MOUSE_LEFT,KEY_MOD1);
+ pTC->getSelEngine()->SelMouseButtonDown( aMEvnt );
+ pTC->getSelEngine()->SelMouseButtonUp( aMEvnt );
+ }
+ else
+ ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "find pos" ) );
+ }
+ else
+ ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "GoTo" ) );
+ }
+ }
+ break;
+ case M_GetSelCount :
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows().size() ));
+ break;
+ case M_GetSelIndex :
+ if ( ! (nParams & PARAM_USHORT_1) )
+ nNr1 = 1;
+ if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRows().size() ) )
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows()[nNr1-1] +1 ) );
+ break;
+/* case M_GetSelText :
+ if ( ! (nParams & PARAM_USHORT_1) )
+ nNr1 = 1;
+ if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
+ {
+ nNr1--;
+ COUNT_LBOX( FirstSelected, NextSelected, nNr1);
+ GetFirstValidTextItem( pThisEntry );
+ pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
+ }
+ break;
+ */
+ default:
+ ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TableControl" ) );
+ break;
+ }
+ }
+ break;
+
case CONST_CTUnknown:
ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) );
break;
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc
index 51d1ed2be6fc..8bf7d3316cd0 100644
--- a/basctl/inc/basidesh.hrc
+++ b/basctl/inc/basidesh.hrc
@@ -182,6 +182,10 @@
#define RID_STR_DLGIMP_MISMATCH_OMIT ( RID_BASICIDE_START + 115 )
#define RID_STR_DLGIMP_MISMATCH_TITLE ( RID_BASICIDE_START + 116 )
#define RID_STR_DLGIMP_MISMATCH_TEXT ( RID_BASICIDE_START + 117 )
+#define RID_STR_DOCUMENT_OBJECTS ( RID_BASICIDE_START + 118 )
+#define RID_STR_USERFORMS ( RID_BASICIDE_START + 119 )
+#define RID_STR_NORMAL_MODULES ( RID_BASICIDE_START + 120 )
+#define RID_STR_CLASS_MODULES ( RID_BASICIDE_START + 121 )
#endif // _SVX_NOIDERESIDS
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 9fc700948249..9f97e1766c3b 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
#include <com/sun/star/document/MacroExecMode.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <sfx2/docfile.hxx>
#include <basic/basrdll.hxx>
@@ -202,21 +203,35 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc
pLayout = pParent;
aXEditorWindow.Show();
- BasicManager* pBasMgr = rDocument.getBasicManager();
- if ( pBasMgr )
+ SetBackground();
+}
+
+SbModuleRef ModulWindow::XModule()
+{
+ // ModuleWindows can now be created as a result of the
+ // modules getting created via the api. This is a result of an
+ // elementInserted event from the BasicLibrary container.
+ // However the SbModule is also created from a different listener to
+ // the same event ( in basmgr ) Therefore it is possible when we look
+ // for xModule it may not yet be available, here we keep tring to access
+ // the module until such time as it exists
+
+ if ( !xModule.Is() )
{
- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
- if ( pBasic )
+ BasicManager* pBasMgr = GetDocument().getBasicManager();
+ if ( pBasMgr )
{
- xBasic = pBasic;
- xModule = (SbModule*)pBasic->FindModule( aName );
+ StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() );
+ if ( pBasic )
+ {
+ xBasic = pBasic;
+ xModule = (SbModule*)pBasic->FindModule( GetName() );
+ }
}
}
-
- SetBackground();
+ return xModule;
}
-
__EXPORT ModulWindow::~ModulWindow()
{
DBG_DTOR( ModulWindow, 0 );
@@ -266,7 +281,7 @@ void ModulWindow::CheckCompileBasic()
{
DBG_CHKTHIS( ModulWindow, 0 );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
// Zur Laufzeit wird niemals compiliert!
BOOL bRunning = StarBASIC::IsRunning();
@@ -322,7 +337,7 @@ BOOL ModulWindow::BasicExecute()
CheckCompileBasic();
- if ( xModule.Is() && xModule->IsCompiled() && !aStatus.bError )
+ if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError )
{
if ( GetBreakPoints().Count() )
aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK;
@@ -332,6 +347,9 @@ BOOL ModulWindow::BasicExecute()
DBG_ASSERT( xModule.Is(), "Kein Modul!" );
AddStatus( BASWIN_RUNNINGBASIC );
USHORT nStart, nEnd, nCurMethodStart = 0;
+ TextSelection aSel = GetEditView()->GetSelection();
+ if ( aDocument.isInVBAMode() )
+ nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
SbMethod* pMethod = 0;
// erstes Macro, sonst blind "Main" (ExtSearch?)
for ( USHORT nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ )
@@ -339,15 +357,27 @@ BOOL ModulWindow::BasicExecute()
SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
DBG_ASSERT( pM, "Method?" );
pM->GetLineRange( nStart, nEnd );
- if ( !pMethod || ( nStart < nCurMethodStart ) )
+ if ( aDocument.isInVBAMode() )
+ {
+ if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
+ {
+ pMethod = pM;
+ break;
+ }
+ }
+ else if ( !pMethod || ( nStart < nCurMethodStart ) )
{
pMethod = pM;
nCurMethodStart = nStart;
}
}
if ( !pMethod )
- pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD );
-
+ {
+ if ( aDocument.isInVBAMode() )
+ return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), FALSE, rtl::OUString() ).getLength() > 0 ) ? TRUE : FALSE;
+ else
+ pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD );
+ }
if ( pMethod )
{
pMethod->SetDebugFlags( aStatus.nBasicFlags );
@@ -374,7 +404,7 @@ BOOL ModulWindow::CompileBasic()
CheckCompileBasic();
BOOL bIsCompiled = FALSE;
- if ( xModule.Is() )
+ if ( XModule().Is() )
bIsCompiled = xModule->IsCompiled();
return bIsCompiled;
@@ -551,11 +581,11 @@ BOOL ModulWindow::ImportDialog()
BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
{
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
BOOL bNewBreakPoint = FALSE;
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
if ( aStatus.bError )
@@ -597,9 +627,9 @@ BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk )
{
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
@@ -823,9 +853,9 @@ void ModulWindow::BasicRemoveWatch()
void ModulWindow::EditMacro( const String& rMacroName )
{
DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
@@ -895,12 +925,12 @@ BOOL __EXPORT ModulWindow::AllowUndo()
void __EXPORT ModulWindow::UpdateData()
{
DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
// UpdateData wird gerufen, wenn sich der Source von aussen
// geaendert hat.
// => Keine Unterbrechungen erwuenscht!
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
SetModule( xModule->GetSource32() );
@@ -1193,19 +1223,6 @@ void __EXPORT ModulWindow::DoScroll( ScrollBar* pCurScrollBar )
}
-BOOL ModulWindow::RenameModule( const String& rNewName )
-{
- if ( !BasicIDE::RenameModule( this, GetDocument(), GetLibName(), GetName(), rNewName ) )
- return FALSE;
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
-
- return TRUE;
-}
-
-
BOOL __EXPORT ModulWindow::IsModified()
{
return GetEditEngine() ? GetEditEngine()->IsModified() : FALSE;
@@ -1221,7 +1238,7 @@ void __EXPORT ModulWindow::GoOnTop()
String ModulWindow::GetSbModuleName()
{
String aModuleName;
- if ( xModule.Is() )
+ if ( XModule().Is() )
aModuleName = xModule->GetName();
return aModuleName;
}
@@ -1343,7 +1360,7 @@ USHORT __EXPORT ModulWindow::GetSearchOptions()
void __EXPORT ModulWindow::BasicStarted()
{
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
aStatus.bIsRunning = TRUE;
BreakPointList& rList = GetBreakPoints();
@@ -1372,7 +1389,39 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor()
ScriptDocument aDocument( GetDocument() );
String aLibName( GetLibName() );
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_MODULE );
+ String aModName( GetName() );
+ String aLibSubName;
+ if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() )
+ {
+ switch( xModule->GetModuleType() )
+ {
+ case script::ModuleType::DOCUMENT:
+ {
+ aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) );
+ uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
+ if( xLib.is() )
+ {
+ String sObjName;
+ ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
+ if( sObjName.Len() )
+ {
+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
+ }
+ }
+ break;
+ }
+ case script::ModuleType::FORM:
+ aLibSubName = String( IDEResId( RID_STR_USERFORMS ) );
+ break;
+ case script::ModuleType::NORMAL:
+ aLibSubName = String( IDEResId( RID_STR_NORMAL_MODULES ) );
+ break;
+ case script::ModuleType::CLASS:
+ aLibSubName = String( IDEResId( RID_STR_CLASS_MODULES ) );
+ break;
+ }
+ }
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE );
}
void ModulWindow::SetReadOnly( BOOL b )
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 6d35f0a027a8..280bb6ee3ab6 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -357,6 +357,7 @@ private:
void AssertValidEditEngine();
sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 );
+ SbModuleRef XModule();
protected:
virtual void Resize();
virtual void GetFocus();
@@ -389,7 +390,7 @@ public:
virtual void SetReadOnly( BOOL bReadOnly );
virtual BOOL IsReadOnly();
- StarBASIC* GetBasic() { return xBasic; }
+ StarBASIC* GetBasic() { XModule(); return xBasic; }
SbModule* GetSbModule() { return xModule; }
void SetSbModule( SbModule* pModule ) { xModule = pModule; }
@@ -417,7 +418,6 @@ public:
// void InsertFromObjectCatalog( ObjectCatalog* pObjDlg );
BOOL ToggleBreakPoint( ULONG nLine );
- BOOL RenameModule( const String& rNewName );
BasicStatus& GetBasicStatus() { return aStatus; }
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index afbe3daf5be1..f4a3c1d48fc7 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1297,8 +1297,9 @@ BasicEntryDescriptor DialogWindow::CreateEntryDescriptor()
{
ScriptDocument aDocument( GetDocument() );
String aLibName( GetLibName() );
+ String aLibSubName;
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_DIALOG );
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG );
}
void DialogWindow::SetReadOnly( BOOL b )
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 4432de9aa282..351186325b09 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -109,7 +109,6 @@ void __EXPORT BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
{
if ( aDocument.removeModule( aLibName, aName ) )
{
- RemoveWindow( pCurWin, TRUE );
BasicIDE::MarkDocumentModified( aDocument );
}
}
@@ -430,11 +429,31 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
{
String aNewName( rModName.GetValue() );
String aOldName( pWin->GetName() );
-
if ( aNewName != aOldName )
{
- if ( ( pWin->IsA( TYPE( ModulWindow ) ) && ((ModulWindow*)pWin)->RenameModule( aNewName ) )
- || ( pWin->IsA( TYPE( DialogWindow ) ) && ((DialogWindow*)pWin)->RenameDialog( aNewName ) ) )
+ bool bRenameOk = false;
+ if ( pWin->IsA( TYPE( ModulWindow ) ) )
+ {
+ ModulWindow* pModWin = (ModulWindow*)pWin;
+ String aLibName = ( pModWin->GetLibName() );
+ ScriptDocument aDocument( pWin->GetDocument() );
+
+ if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) )
+ {
+ bRenameOk = true;
+ // Because we listen for container events for script
+ // modules, rename will delete the 'old' window
+ // pWin has been invalidated, restore now
+ pWin = FindBasWin( aDocument, aLibName, aNewName, TRUE );
+ }
+
+ }
+ else if ( pWin->IsA( TYPE( DialogWindow ) ) )
+ {
+ DialogWindow* pDlgWin = (DialogWindow*)pWin;
+ bRenameOk = pDlgWin->RenameDialog( aNewName );
+ }
+ if ( bRenameOk )
{
BasicIDE::MarkDocumentModified( pWin->GetDocument() );
}
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 20de8e9aafba..bef969db9266 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -51,6 +51,10 @@
#include <tools/diagnose_ex.h>
#include <sfx2/sfxdefs.hxx>
#include <sfx2/signaturestate.hxx>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -235,7 +239,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
if ( !aLibName.Len() )
aLibName = String::CreateFromAscii( "Standard" );
- rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
+ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
if ( !aModName.Len() )
aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
@@ -254,9 +258,15 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
if ( bSuccess )
{
- // new module window
- pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
- nKey = InsertWindowInTable( pWin );
+ pWin = FindBasWin( rDocument, aLibName, aModName, FALSE, TRUE );
+ if( !pWin )
+ {
+ // new module window
+ pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
+ nKey = InsertWindowInTable( pWin );
+ }
+ else // we've gotten called recursively ( via listener from createModule above ), get outta here
+ return pWin;
}
}
else
@@ -271,6 +281,17 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
}
DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
}
+ if( nKey && xLib.is() && rDocument.isInVBAMode() )
+ {
+ // display a nice friendly name in the ObjectModule tab,
+ // combining the objectname and module name, e.g. Sheet1 ( Financials )
+ String sObjName;
+ ModuleInfoHelper::getObjectName( xLib, rModName, sObjName );
+ if( sObjName.Len() )
+ {
+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
+ }
+ }
pTabBar->InsertPage( (USHORT)nKey, aModName );
pTabBar->Sort();
pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 23978f4df10b..2f9303756e09 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -77,6 +77,9 @@
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
#include <svx/xmlsecctrl.hxx>
@@ -84,6 +87,71 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
using ::rtl::OUString;
+static const rtl::OUString sStandardLibName( rtl::OUString::createFromAscii("Standard") );
+
+typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerBASE;
+
+class ContainerListenerImpl : public ContainerListenerBASE
+{
+ BasicIDEShell* mpShell;
+public:
+
+ ContainerListenerImpl( BasicIDEShell* pShell ) : mpShell( pShell ) {}
+
+ ~ContainerListenerImpl()
+ {
+ }
+
+ void addContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName )
+ {
+ try
+ {
+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, FALSE ), uno::UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ uno::Reference< container::XContainerListener > xContainerListener( this );
+ xContainer->addContainerListener( xContainerListener );
+ }
+ }
+ catch( uno::Exception& ) {}
+ }
+ void removeContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName )
+ {
+ try
+ {
+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, FALSE ), uno::UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ uno::Reference< container::XContainerListener > xContainerListener( this );
+ xContainer->removeContainerListener( xContainerListener );
+ }
+ }
+ catch( uno::Exception& ) {}
+ }
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& ) throw( uno::RuntimeException ) {}
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event ) throw( uno::RuntimeException )
+ {
+ rtl::OUString sModuleName;
+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
+ mpShell->FindBasWin( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, TRUE, FALSE );
+ }
+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& ) throw( com::sun::star::uno::RuntimeException ) { }
+ virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event ) throw( com::sun::star::uno::RuntimeException )
+ {
+ rtl::OUString sModuleName;
+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
+ {
+ IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
+ if( pWin )
+ mpShell->RemoveWindow( pWin, TRUE, TRUE );
+ }
+ }
+
+};
TYPEINIT1( BasicIDEShell, SfxViewShell );
@@ -121,6 +189,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell
m_bAppBasicModified( FALSE ),
m_aNotifier( *this )
{
+ m_xLibListener = new ContainerListenerImpl( this );
Init();
GnBasicIDEShellCount++;
}
@@ -212,6 +281,12 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
delete pTabBar;
delete pObjectCatalog;
DestroyModulWindowLayout();
+
+ ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
+ // Destroy all ContainerListeners for Basic Container.
+ if ( pListener )
+ pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
+
// MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die
// ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war.
// GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
@@ -828,9 +903,22 @@ void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, BOOL bDestroy, BOOL b
{
pWindow_->AddStatus( BASWIN_TOBEKILLED );
pWindow_->Hide();
- StarBASIC::Stop();
- // Es kommt kein Notify...
- pWindow_->BasicStopped();
+ // In normal mode stop basic in windows to be deleted
+ // In VBA stop basic only if the running script is trying to delete
+ // its parent module
+ bool bStop = true;
+ if ( pWindow_->GetDocument().isInVBAMode() )
+ {
+ SbModule* pMod = StarBASIC::GetActiveModule();
+ if ( !pMod || ( pMod && ( pMod->GetName() != pWindow_->GetName() ) ) )
+ bStop = false;
+ }
+ if ( bStop )
+ {
+ StarBASIC::Stop();
+ // Es kommt kein Notify...
+ pWindow_->BasicStopped();
+ }
aIDEWindowTable.Insert( nKey, pWindow_ ); // wieder einhaegen
}
}
@@ -918,8 +1006,17 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName,
{
if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
{
+ ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
+
+ if ( pListener )
+ pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
+
m_aCurDocument = rDocument;
+
+ pListener->addContainerListener( m_aCurDocument, aLibName );
+
m_aCurLibName = aLibName;
+
if ( bUpdateWindows )
UpdateWindows();
diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src
index f0c0727cd22f..556211f690af 100644
--- a/basctl/source/basicide/basidesh.src
+++ b/basctl/source/basicide/basidesh.src
@@ -636,6 +636,22 @@ String RID_STR_TRANSLATION_DEFAULT
{
Text [ en-US ] = "[Default Language]" ;
};
+String RID_STR_DOCUMENT_OBJECTS
+{
+ Text [ en-US ] = "Document Objects" ;
+};
+String RID_STR_USERFORMS
+{
+ Text [ en-US ] = "Forms" ;
+};
+String RID_STR_NORMAL_MODULES
+{
+ Text [ en-US ] = "Modules" ;
+};
+String RID_STR_CLASS_MODULES
+{
+ Text [ en-US ] = "Class Modules" ;
+};
String RID_STR_DLGIMP_CLASH_RENAME
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index d2672f39928f..3604866b4202 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -191,7 +191,7 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
if ( pIDEShell )
{
- IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rOldName, BASICIDE_TYPE_MODULE, FALSE );
+ IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rNewName, BASICIDE_TYPE_MODULE, TRUE );
if ( pWin )
{
// set new name in window
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index a37eb752e2ea..0709fe38cbe2 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -50,10 +50,51 @@
#include <com/sun/star/frame/XModuleManager.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
+#include <map>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNamed.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
+void ModuleInfoHelper::getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
+{
+ try
+ {
+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) )
+ {
+ script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName );
+ uno::Any aObject( aModuleInfo.ModuleObject );
+ uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
+ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
+ {
+ uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
+ if( xNamed.is() )
+ rObjName = xNamed->getName();
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+sal_Int32 ModuleInfoHelper::getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
+{
+ sal_Int32 nType = com::sun::star::script::ModuleType::NORMAL;
+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) )
+ {
+ script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName );
+ nType = aModuleInfo.ModuleType;
+ }
+ return nType;
+}
BasicEntry::~BasicEntry()
{
@@ -88,20 +129,22 @@ BasicEntryDescriptor::BasicEntryDescriptor()
{
}
-BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType )
+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType )
:m_aDocument( rDocument )
,m_eLocation( eLocation )
,m_aLibName( rLibName )
+ ,m_aLibSubName( rLibSubName )
,m_aName( rName )
,m_eType( eType )
{
OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" );
}
-BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType )
+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType )
:m_aDocument( rDocument )
,m_eLocation( eLocation )
,m_aLibName( rLibName )
+ ,m_aLibSubName( rLibSubName )
,m_aName( rName )
,m_aMethodName( rMethodName )
,m_eType( eType )
@@ -117,6 +160,7 @@ BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc )
:m_aDocument( rDesc.m_aDocument )
,m_eLocation( rDesc.m_eLocation )
,m_aLibName( rDesc.m_aLibName )
+ ,m_aLibSubName( rDesc.m_aLibSubName )
,m_aName( rDesc.m_aName )
,m_aMethodName( rDesc.m_aMethodName )
,m_eType( rDesc.m_eType )
@@ -128,6 +172,7 @@ BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescripto
m_aDocument = rDesc.m_aDocument;
m_eLocation = rDesc.m_eLocation;
m_aLibName = rDesc.m_aLibName;
+ m_aLibSubName = rDesc.m_aLibSubName;
m_aName = rDesc.m_aName;
m_aMethodName = rDesc.m_aMethodName;
m_eType = rDesc.m_eType;
@@ -140,6 +185,7 @@ bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const
return m_aDocument == rDesc.m_aDocument &&
m_eLocation == rDesc.m_eLocation &&
m_aLibName == rDesc.m_aLibName &&
+ m_aLibSubName == rDesc.m_aLibSubName &&
m_aName == rDesc.m_aName &&
m_aMethodName == rDesc.m_aMethodName &&
m_eType == rDesc.m_eType;
@@ -284,41 +330,46 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
{
try
{
- // get a sorted list of module names
- Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
- sal_Int32 nModCount = aModNames.getLength();
- const ::rtl::OUString* pModNames = aModNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ if( rDocument.isInVBAMode() )
+ ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName );
+ else
{
- String aModName = pModNames[ i ];
- SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
- if ( !pModuleEntry )
- pModuleEntry = AddEntry(
- aModName,
- Image( IDEResId( RID_IMG_MODULE ) ),
- Image( IDEResId( RID_IMG_MODULE_HC ) ),
- pLibRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
+ // get a sorted list of module names
+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
+ sal_Int32 nModCount = aModNames.getLength();
+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
- // methods
- if ( nMode & BROWSEMODE_SUBS )
+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
{
- Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
- sal_Int32 nCount = aNames.getLength();
- const ::rtl::OUString* pNames = aNames.getConstArray();
-
- for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ String aModName = pModNames[ i ];
+ SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
+ if ( !pModuleEntry )
+ pModuleEntry = AddEntry(
+ aModName,
+ Image( IDEResId( RID_IMG_MODULE ) ),
+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
+ pLibRootEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
+
+ // methods
+ if ( nMode & BROWSEMODE_SUBS )
{
- String aName = pNames[ j ];
- SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
- if ( !pEntry )
- pEntry = AddEntry(
- aName,
- Image( IDEResId( RID_IMG_MACRO ) ),
- Image( IDEResId( RID_IMG_MACRO_HC ) ),
- pModuleEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
+ sal_Int32 nCount = aNames.getLength();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+
+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ {
+ String aName = pNames[ j ];
+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
+ if ( !pEntry )
+ pEntry = AddEntry(
+ aName,
+ Image( IDEResId( RID_IMG_MACRO ) ),
+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
+ pModuleEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
+ }
}
}
}
@@ -365,6 +416,140 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
}
}
+void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
+{
+
+ ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries;
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
+ aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
+
+ ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter;
+ for( iter = aEntries.begin(); iter != aEntries.end(); ++iter )
+ {
+ BasicEntryType eType = iter->first;
+ ::rtl::OUString aEntryName = iter->second;
+ SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType );
+ if( pLibSubRootEntry )
+ {
+ SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ), Image( IDEResId( RID_IMG_MODLIB_HC ) ) );
+ if ( IsExpanded( pLibSubRootEntry ) )
+ ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName );
+ }
+ else
+ {
+ pLibSubRootEntry = AddEntry(
+ aEntryName,
+ Image( IDEResId( RID_IMG_MODLIB ) ),
+ Image( IDEResId( RID_IMG_MODLIB_HC ) ),
+ pLibRootEntry, true,
+ std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) );
+ }
+ }
+}
+
+void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName )
+{
+ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName );
+ if( !xLib.is() )
+ return;
+
+ try
+ {
+ // get a sorted list of module names
+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
+ sal_Int32 nModCount = aModNames.getLength();
+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
+
+ BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) );
+ BasicEntryType eCurrentType( aDesc.GetType() );
+
+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ {
+ String aModName = pModNames[ i ];
+ BasicEntryType eType = OBJ_TYPE_UNKNOWN;
+ switch( ModuleInfoHelper::getModuleType( xLib, aModName ) )
+ {
+ case script::ModuleType::DOCUMENT:
+ eType = OBJ_TYPE_DOCUMENT_OBJECTS;
+ break;
+ case script::ModuleType::FORM:
+ eType = OBJ_TYPE_USERFORMS;
+ break;
+ case script::ModuleType::NORMAL:
+ eType = OBJ_TYPE_NORMAL_MODULES;
+ break;
+ case script::ModuleType::CLASS:
+ eType = OBJ_TYPE_CLASS_MODULES;
+ break;
+ }
+ if( eType != eCurrentType )
+ continue;
+
+ // display a nice friendly name in the ObjectModule tab,
+ // combining the objectname and module name, e.g. Sheet1 ( Financials )
+ String aEntryName( aModName );
+ if( eType == OBJ_TYPE_DOCUMENT_OBJECTS )
+ {
+ String sObjName;
+ ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
+ if( sObjName.Len() )
+ {
+ aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
+ }
+ }
+ SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
+ if ( !pModuleEntry )
+ pModuleEntry = AddEntry(
+ aEntryName,
+ Image( IDEResId( RID_IMG_MODULE ) ),
+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
+ pLibSubRootEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
+
+ // methods
+ if ( nMode & BROWSEMODE_SUBS )
+ {
+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
+ sal_Int32 nCount = aNames.getLength();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+
+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
+ {
+ String aName = pNames[ j ];
+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
+ if ( !pEntry )
+ pEntry = AddEntry(
+ aName,
+ Image( IDEResId( RID_IMG_MACRO ) ),
+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
+ pModuleEntry, false,
+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
+ }
+ }
+ }
+ }
+ catch ( const container::NoSuchElementException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const String& rText )
+{
+ ULONG nRootPos = 0;
+ SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos );
+ while ( pEntry )
+ {
+ if ( GetEntryText( pEntry ) == rText )
+ return pEntry;
+
+ pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos );
+ }
+ return 0;
+}
+
void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
{
UpdateEntries();
@@ -477,10 +662,11 @@ long BasicTreeListBox::ExpandingHdl()
if ( aDocument.isAlive() )
{
String aLibName( aDesc.GetLibName() );
+ String aLibSubName( aDesc.GetLibSubName() );
String aName( aDesc.GetName() );
String aMethodName( aDesc.GetMethodName() );
- if ( aLibName.Len() && !aName.Len() && !aMethodName.Len() )
+ if ( aLibName.Len() && !aLibSubName.Len() && !aName.Len() && !aMethodName.Len() )
{
// check password, if library is password protected and not verified
::rtl::OUString aOULibName( aLibName );
@@ -633,7 +819,7 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
aDesc = BasicEntryDescriptor(
ScriptDocument::getApplicationScriptDocument(),
LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
- String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
+ String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
}
ScriptDocument aDocument( aDesc.GetDocument() );
OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
@@ -650,14 +836,24 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
if ( pLibEntry )
{
pCurEntry = pLibEntry;
+ String aLibSubName( aDesc.GetLibSubName() );
+ if( aLibSubName.Len() )
+ {
+ Expand( pLibEntry );
+ SvLBoxEntry* pLibSubEntry = ImpFindEntry( pLibEntry, aLibSubName );
+ if( pLibSubEntry )
+ {
+ pCurEntry = pLibSubEntry;
+ }
+ }
String aName( aDesc.GetName() );
if ( aName.Len() )
{
- Expand( pLibEntry );
+ Expand( pCurEntry );
BasicEntryType eType = OBJ_TYPE_MODULE;
if ( aDesc.GetType() == OBJ_TYPE_DIALOG )
eType = OBJ_TYPE_DIALOG;
- SvLBoxEntry* pEntry = FindEntry( pLibEntry, aName, eType );
+ SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType );
if ( pEntry )
{
pCurEntry = pEntry;
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
index 401282f7e1bf..4b4d42f477d0 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -39,7 +39,7 @@
#include <sbxitem.hxx>
#include "basobj.hxx"
-enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD };
+enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_USERFORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES };
#define BROWSEMODE_MODULES 0x01
#define BROWSEMODE_SUBS 0x02
@@ -98,14 +98,15 @@ class BasicEntryDescriptor
ScriptDocument m_aDocument;
LibraryLocation m_eLocation;
String m_aLibName;
+ String m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules
String m_aName;
String m_aMethodName;
BasicEntryType m_eType;
public:
BasicEntryDescriptor();
- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType );
- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType );
+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType );
+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType );
virtual ~BasicEntryDescriptor();
BasicEntryDescriptor( const BasicEntryDescriptor& rDesc );
@@ -122,6 +123,9 @@ public:
const String& GetLibName() const { return m_aLibName; }
void SetLibName( const String& aLibName ) { m_aLibName = aLibName; }
+ const String& GetLibSubName() const { return m_aLibSubName; }
+ void SetLibSubName( const String& aLibSubName ) { m_aLibSubName = aLibSubName; }
+
const String& GetName() const { return m_aName; }
void SetName( const String& aName ) { m_aName = aName; }
@@ -161,6 +165,9 @@ protected:
void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation );
void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
+ void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
+ void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName );
+ SvLBoxEntry* ImpFindEntry( SvLBoxEntry* pParent, const String& rText );
// DocumentEventListener
virtual void onDocumentCreated( const ScriptDocument& _rDocument );
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index a0320d89e88a..de9eff56ca24 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -131,6 +131,14 @@ void __EXPORT BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry )
}
}
}
+ else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS
+ || eType == OBJ_TYPE_USERFORMS
+ || eType == OBJ_TYPE_NORMAL_MODULES
+ || eType == OBJ_TYPE_CLASS_MODULES )
+ {
+ String aLibName( aDesc.GetLibName() );
+ ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
+ }
else {
DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
}
@@ -201,6 +209,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
}
SbxVariable* pVar = 0;
+ bool bDocumentObjects = false;
if ( aEntries.Count() )
{
for ( USHORT n = 0; n < aEntries.Count(); n++ )
@@ -223,6 +232,12 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
case OBJ_TYPE_MODULE:
{
DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" );
+ // extract the module name from the string like "Sheet1 (Example1)"
+ if( bDocumentObjects )
+ {
+ sal_uInt16 nIndex = 0;
+ aName = aName.GetToken( 0, ' ', nIndex );
+ }
pVar = ((StarBASIC*)pVar)->FindModule( aName );
}
break;
@@ -237,6 +252,15 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
// sbx dialogs removed
}
break;
+ case OBJ_TYPE_DOCUMENT_OBJECTS:
+ bDocumentObjects = true;
+ case OBJ_TYPE_USERFORMS:
+ case OBJ_TYPE_NORMAL_MODULES:
+ case OBJ_TYPE_CLASS_MODULES:
+ {
+ // skip, to find the child entry.
+ continue;
+ }
default:
{
DBG_ERROR( "FindVariable: Unbekannter Typ!" );
@@ -257,12 +281,13 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
String aLibName;
+ String aLibSubName;
String aName;
String aMethodName;
BasicEntryType eType = OBJ_TYPE_UNKNOWN;
if ( !pEntry )
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
EntryArray aEntries;
@@ -329,6 +354,15 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
eType = pBE->GetType();
}
break;
+ case OBJ_TYPE_DOCUMENT_OBJECTS:
+ case OBJ_TYPE_USERFORMS:
+ case OBJ_TYPE_NORMAL_MODULES:
+ case OBJ_TYPE_CLASS_MODULES:
+ {
+ aLibSubName = GetEntryText( pLE );
+ eType = pBE->GetType();
+ }
+ break;
default:
{
DBG_ERROR( "GetEntryDescriptor: Unbekannter Typ!" );
@@ -342,7 +376,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
}
}
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
}
USHORT BasicTreeListBox::ConvertType( BasicEntryType eType )
@@ -424,6 +458,14 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry )
bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName );
}
break;
+ case OBJ_TYPE_DOCUMENT_OBJECTS:
+ case OBJ_TYPE_USERFORMS:
+ case OBJ_TYPE_NORMAL_MODULES:
+ case OBJ_TYPE_CLASS_MODULES:
+ {
+ bIsValid = true;
+ }
+ break;
default: ;
}
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index af42503a5dae..150e10a5a76f 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -57,6 +57,7 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
@@ -584,8 +585,32 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt )
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
aPopup.RemoveDisabledEntries();
}
+ if ( aDocument.isInVBAMode() )
+ {
+ // disable to delete or remove object modules in IDE
+ BasicManager* pBasMgr = aDocument.getBasicManager();
+ if ( pBasMgr )
+ {
+ StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
+ if( pBasic )
+ {
+ IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
+ IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
+ if( pWin && pWin->ISA( ModulWindow ) )
+ {
+ SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
+ if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) )
+ {
+ aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE );
+ aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
+ }
+ }
+ }
+ }
+ }
}
+
SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
if ( pDispatcher )
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index f3e41e60d34b..41a5fa488950 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -382,7 +382,15 @@ SbMethod* MacroChooser::CreateMacro()
SbModule* pModule = 0;
String aModName( aDesc.GetName() );
if ( aModName.Len() )
+ {
+ // extract the module name from the string like "Sheet1 (Example1)"
+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
+ {
+ sal_uInt16 nIndex = 0;
+ aModName = aModName.GetToken( 0, ' ', nIndex );
+ }
pModule = pBasic->FindModule( aModName );
+ }
else if ( pBasic->GetModules()->Count() )
pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
@@ -710,6 +718,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
BasicManager* pBasMgr = aDocument.getBasicManager();
String aLib( aDesc.GetLibName() );
String aMod( aDesc.GetName() );
+ // extract the module name from the string like "Sheet1 (Example1)"
+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
+ {
+ sal_uInt16 nIndex = 0;
+ aMod = aMod.GetToken( 0, ' ', nIndex );
+ }
String aSub( aDesc.GetMethodName() );
SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() );
if ( pButton == &aEditButton )
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 478d56546f41..0f66a6ebe120 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -84,7 +84,7 @@ BOOL __EXPORT ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection&
if ( pEntry )
{
USHORT nDepth = GetModel()->GetDepth( pEntry );
- if ( nDepth == 2 )
+ if ( nDepth >= 2 )
{
BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
ScriptDocument aDocument( aDesc.GetDocument() );
@@ -162,7 +162,7 @@ DragDropMode __EXPORT ExtBasicTreeListBox::NotifyStartDrag( TransferDataContaine
if ( pEntry )
{
USHORT nDepth = GetModel()->GetDepth( pEntry );
- if ( nDepth == 2 )
+ if ( nDepth >= 2 )
{
nMode_ = SV_DRAGDROP_CTRL_COPY;
BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
@@ -210,7 +210,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry )
// don't drop on a library, which is not loaded, readonly or password protected
// or which already has a module/dialog with this name
- if ( bValid && ( nDepth == 1 || nDepth == 2 ) )
+ if ( bValid && ( nDepth > 0 ) )
{
// get source module/dialog name
BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) );
@@ -348,7 +348,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, Sv
rpNewParent = pTarget;
rNewChildPos = 0;
}
- else if ( nDepth == 2 )
+ else if ( nDepth >= 2 )
{
// Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen...
rpNewParent = GetParent( pTarget );
@@ -623,20 +623,29 @@ void ObjectPage::CheckButtons()
{
// enable/disable edit button
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
+ BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
+ ScriptDocument aDocument( aDesc.GetDocument() );
+ ::rtl::OUString aOULibName( aDesc.GetLibName() );
+ String aLibSubName( aDesc.GetLibSubName() );
+ sal_Bool bVBAEnabled = aDocument.isInVBAMode();
+ USHORT nMode = aBasicBox.GetMode();
+
USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
- if ( nDepth == 2 )
+ if ( nDepth >= 2 )
+ {
+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) )
+ aEditButton.Disable();
+ else
aEditButton.Enable();
+ }
else
aEditButton.Disable();
// enable/disable new module/dialog buttons
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
LibraryLocation eLocation( aDesc.GetLocation() );
BOOL bReadOnly = FALSE;
- if ( nDepth == 1 || nDepth == 2 )
+ if ( nDepth > 0 )
{
- ScriptDocument aDocument( aDesc.GetDocument() );
- ::rtl::OUString aOULibName( aDesc.GetLibName() );
Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
@@ -657,8 +666,13 @@ void ObjectPage::CheckButtons()
}
// enable/disable delete button
- if ( nDepth == 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
+ if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
+ {
+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
+ aDelButton.Disable();
+ else
aDelButton.Enable();
+ }
else
aDelButton.Disable();
}
@@ -685,13 +699,20 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton )
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
DBG_ASSERT( pCurEntry, "Entry?!" );
- if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) == 2 )
+ if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 )
{
BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
if ( pDispatcher )
{
+ String aModName( aDesc.GetName() );
+ // extract the module name from the string like "Sheet1 (Example1)"
+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
+ {
+ sal_uInt16 nIndex = 0;
+ aModName = aModName.GetToken( 0, ' ', nIndex );
+ }
SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(),
- aDesc.GetName(), aBasicBox.ConvertType( aDesc.GetType() ) );
+ aModName, aBasicBox.ConvertType( aDesc.GetType() ) );
pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
}
}
@@ -973,14 +994,14 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
try
{
::rtl::OUString sModuleCode;
+ // the module has existed
+ if( rDocument.hasModule( aLibName, aModName ) )
+ return NULL;
rDocument.createModule( aLibName, aModName, bMain, sModuleCode );
BasicManager* pBasMgr = rDocument.getBasicManager();
- if ( pBasMgr )
- {
- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
+ StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0;
if ( pBasic )
pModule = pBasic->FindModule( aModName );
- }
SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE );
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
@@ -1002,14 +1023,27 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
{
if ( !rBasicBox.IsExpanded( pLibEntry ) )
rBasicBox.Expand( pLibEntry );
- SvLBoxEntry* pEntry = rBasicBox.FindEntry( pLibEntry, aModName, OBJ_TYPE_MODULE );
+ SvLBoxEntry* pSubRootEntry = pLibEntry;
+ if( pBasic && rDocument.isInVBAMode() )
+ {
+ // add the new module in the "Modules" entry
+ SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_MODULES ) ) , OBJ_TYPE_NORMAL_MODULES );
+ if( pLibSubEntry )
+ {
+ if( !rBasicBox.IsExpanded( pLibSubEntry ) )
+ rBasicBox.Expand( pLibSubEntry );
+ pSubRootEntry = pLibSubEntry;
+ }
+ }
+
+ SvLBoxEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE );
if ( !pEntry )
{
pEntry = rBasicBox.AddEntry(
aModName,
Image( IDEResId( RID_IMG_MODULE ) ),
Image( IDEResId( RID_IMG_MODULE_HC ) ),
- pLibEntry, false,
+ pSubRootEntry, false,
std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
}
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index dd10a00e2bde..a8c6d24a3ff5 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -53,6 +53,8 @@
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
/** === end UNO includes === **/
#include <sfx2/objsh.hxx>
@@ -139,6 +141,9 @@ namespace basctl
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::document::XEventBroadcaster;
using ::com::sun::star::document::XEmbeddedScripts;
+ using ::com::sun::star::script::ModuleInfo;
+ using ::com::sun::star::script::XVBAModuleInfo;
+ using ::com::sun::star::script::XVBACompat;
/** === end UNO using === **/
namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
@@ -272,6 +277,7 @@ namespace basctl
// versions with the same signature/semantics as in ScriptDocument itself
bool isReadOnly() const;
+ bool isInVBAMode() const;
BasicManager*
getBasicManager() const;
Reference< XModel >
@@ -444,6 +450,20 @@ namespace basctl
return bIsReadOnly;
}
+ bool ScriptDocument_Impl::isInVBAMode() const
+ {
+ bool bResult = false;
+#ifdef FUTURE_VBA_CWS
+ if ( !isApplication() )
+ {
+ Reference< XVBACompat > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
+ if ( xVBACompat.is() )
+ bResult = xVBACompat->getVBACompatModeOn();
+ }
+#endif
+ return bResult;
+ }
+
//--------------------------------------------------------------------
BasicManager* ScriptDocument_Impl::getBasicManager() const
{
@@ -671,6 +691,16 @@ namespace basctl
}
// insert element by new name in container
+ else if ( _eType == E_SCRIPTS )
+ {
+ Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
+ if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) )
+ {
+ ModuleInfo sModuleInfo = xVBAModuleInfo->getModuleInfo( _rOldName );
+ xVBAModuleInfo->removeModuleInfo( _rOldName );
+ xVBAModuleInfo->insertModuleInfo( _rNewName, sModuleInfo );
+ }
+ }
xLib->insertByName( _rNewName, aElement );
return true;
}
@@ -735,7 +765,6 @@ namespace basctl
Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
if ( !xLib->hasByName( _rModName ) )
return false;
-
xLib->replaceByName( _rModName, makeAny( _rModuleCode ) );
return true;
}
@@ -1351,6 +1380,11 @@ namespace basctl
return m_pImpl->isApplication();
}
+ bool ScriptDocument::isInVBAMode() const
+ {
+ return m_pImpl->isInVBAMode();
+ }
+
//--------------------------------------------------------------------
BasicManager* ScriptDocument::getBasicManager() const
{
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index cf21d3488dd3..07bc2dfa3149 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -46,6 +46,7 @@
#include <com/sun/star/io/XInputStreamProvider.hpp>
#endif
+#include <com/sun/star/container/XContainerListener.hpp>
//----------------------------------------------------------------------------
@@ -105,6 +106,8 @@ friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const Strin
BOOL m_bAppBasicModified;
::basctl::DocumentEventNotifier
m_aNotifier;
+friend class ContainerListenerImpl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
#if _SOLAR__PRIVATE
void Init();
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index c9981001e456..bc588fccaf14 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -328,5 +328,13 @@ BOOL QueryDelModule( const String& rName, Window* pParent = 0 );
BOOL QueryDelLib( const String& rName, BOOL bRef = FALSE, Window* pParent = 0 );
BOOL QueryPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xLibContainer, const String& rLibName, String& rPassword, BOOL bRepeat = FALSE, BOOL bNewTitle = FALSE );
-
+class ModuleInfoHelper
+{
+ModuleInfoHelper();
+ModuleInfoHelper(const ModuleInfoHelper&);
+ModuleInfoHelper& operator = (const ModuleInfoHelper&);
+public:
+ static void getObjectName( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName, String& rObjName );
+ static sal_Int32 getModuleType( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName );
+};
#endif // _BASTYPES_HXX
diff --git a/basctl/source/inc/scriptdocument.hxx b/basctl/source/inc/scriptdocument.hxx
index 34d1a72963ce..9439c05f7249 100644
--- a/basctl/source/inc/scriptdocument.hxx
+++ b/basctl/source/inc/scriptdocument.hxx
@@ -212,6 +212,7 @@ namespace basctl
*/
bool isAlive() const;
+ bool isInVBAMode() const;
/// returns the BasicManager associated with this instance
BasicManager*
getBasicManager() const;
diff --git a/basic/inc/basic/sberrors.hxx b/basic/inc/basic/sberrors.hxx
index c21b3b0237b8..c34176e0bde7 100644
--- a/basic/inc/basic/sberrors.hxx
+++ b/basic/inc/basic/sberrors.hxx
@@ -287,6 +287,8 @@ typedef ULONG SbError;
#define ERRCODE_BASIC_LOOP_NOT_INIT ((LAST_SBX_ERROR_ID+109UL) | ERRCODE_AREA_SBX | \
ERRCODE_CLASS_COMPILER) // For loop not initialized
+#define ERRCODE_BASIC_COMPAT ((LAST_SBX_ERROR_ID+103UL)| ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME)
+
// Map old codes to new codes
#define SbERR_SYNTAX ERRCODE_BASIC_SYNTAX
#define SbERR_NO_GOSUB ERRCODE_BASIC_NO_GOSUB
@@ -410,6 +412,7 @@ typedef ULONG SbError;
#define SbERR_PROG_TOO_LARGE ERRCODE_BASIC_PROG_TOO_LARGE
#define SbERR_NO_STRINGS_ARRAYS ERRCODE_BASIC_NO_STRINGS_ARRAYS
#define SbERR_BASIC_EXCEPTION ERRCODE_BASIC_EXCEPTION
+#define SbERR_BASIC_COMPAT ERRCODE_BASIC_COMPAT
#define SbERR_BASIC_ARRAY_FIX ERRCODE_BASIC_ARRAY_FIX
#define SbERR_BASIC_STRING_OVERFLOW ERRCODE_BASIC_STRING_OVERFLOW
#define SbERR_BASIC_EXPR_TOO_COMPLEX ERRCODE_BASIC_EXPR_TOO_COMPLEX
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index d73c9780b1bb..63ffef6cdd61 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -31,9 +31,7 @@
#include <basic/sbdef.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sbxdef.hxx>
-#ifndef _RTL_USTRING_HXX
#include <rtl/ustring.hxx>
-#endif
class SbMethod;
class SbProperty;
@@ -63,6 +61,10 @@ protected:
SbiImage* pImage; // the Image
SbiBreakpoints* pBreaks; // Breakpoints
SbClassData* pClassData;
+ BOOL mbVBACompat;
+ INT32 mnType;
+ SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
+ bool bIsProxyModule;
void StartDefinitions();
SbMethod* GetMethod( const String&, SbxDataType );
@@ -87,7 +89,7 @@ protected:
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);
TYPEINFO();
- SbModule( const String& );
+ SbModule( const String&, BOOL bCompat = FALSE );
virtual void SetParent( SbxObject* );
virtual void Clear();
@@ -123,6 +125,11 @@ public:
BOOL LoadBinaryData( SvStream& );
BOOL ExceedsLegacyModuleSize();
void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
+ BOOL IsVBACompat();
+ void SetVBACompat( BOOL bCompat );
+ INT32 GetModuleType() { return mnType; }
+ void SetModuleType( INT32 nType ) { mnType = nType; }
+ bool GetIsProxyModule() { return bIsProxyModule; }
};
#ifndef __SB_SBMODULEREF_HXX
diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx
new file mode 100644
index 000000000000..ad804dcfab38
--- /dev/null
+++ b/basic/inc/basic/sbobjmod.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sbobjmod.hxx,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: $ $Date: 2007/08/27 16:31:39 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _SB_OBJMOD_HXX
+#define _SB_OBJMOD_HXX
+
+#include <basic/sbmod.hxx>
+#include <basic/sbstar.hxx>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace css = ::com::sun::star;
+
+// Basic-Module for excel object.
+
+class SbObjModule : public SbModule
+{
+ SbObjModule( const SbObjModule& );
+ SbObjModule();
+public:
+ TYPEINFO();
+ SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
+ using SbxValue::GetObject;
+ SbxVariable* GetObject();
+ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
+};
+
+class SbUserFormModule : public SbObjModule
+{
+ css::uno::Reference<css::lang::XEventListener> m_DialogListener;
+ css::uno::Reference<css::awt::XDialog> m_xDialog;
+ css::uno::Reference<css::frame::XModel> m_xModel;
+ String sFormName;
+ bool mbInit;
+ SbUserFormModule( const SbUserFormModule& );
+ SbUserFormModule();
+
+protected:
+ virtual void InitObject();
+public:
+ TYPEINFO();
+ SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
+ void ResetApiObj();
+ void Unload();
+ void load();
+ void triggerMethod( const String& );
+ void triggerMethod( const String&, css::uno::Sequence< css::uno::Any >& );
+ void triggerActivateEvent();
+ void triggerDeActivateEvent();
+ void triggerInitializeEvent();
+ void triggerTerminateEvent();
+};
+
+#ifndef __SB_SBOBJMODULEREF_HXX
+#define __SB_SBOBJMODULEREF_HXX
+
+SV_DECL_IMPL_REF(SbObjModule);
+
+#endif
+#endif
+
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx
index bdc4aa011cc9..a234dc206ec7 100644
--- a/basic/inc/basic/sbstar.hxx
+++ b/basic/inc/basic/sbstar.hxx
@@ -37,6 +37,7 @@
#include <basic/sbdef.hxx>
#include <basic/sberrors.hxx>
+#include <com/sun/star/script/ModuleInfo.hpp>
class SbModule; // completed module
class SbiInstance; // runtime instance
@@ -69,6 +70,7 @@ class StarBASIC : public SbxObject
BOOL bNoRtl; // if TRUE: do not search RTL
BOOL bBreak; // if TRUE: Break, otherwise Step
BOOL bDocBasic;
+ BOOL bVBAEnabled;
BasicLibInfo* pLibInfo; // Info block for basic manager
SbLanguageMode eLanguageMode; // LanguageMode of the basic object
BOOL bQuit;
@@ -117,6 +119,7 @@ public:
// Compiler-Interface
SbModule* MakeModule( const String& rName, const String& rSrc );
SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
+ SbModule* MakeModule32( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, const ::rtl::OUString& rSrc );
BOOL Compile( SbModule* );
BOOL Disassemble( SbModule*, String& rText );
static void Stop();
@@ -189,6 +192,8 @@ public:
( const String& rName, USHORT& rStatus );
static SbMethod* GetActiveMethod( USHORT nLevel = 0 );
static SbModule* GetActiveModule();
+ void SetVBAEnabled( BOOL bEnabled );
+ BOOL isVBAEnabled();
// #60175 TRUE: SFX-Resource is not displayed on basic errors
static void StaticSuppressSfxResource( BOOL bSuppress );
diff --git a/basic/inc/basic/sbuno.hxx b/basic/inc/basic/sbuno.hxx
index 68e2c6ab8778..d816d424313b 100644
--- a/basic/inc/basic/sbuno.hxx
+++ b/basic/inc/basic/sbuno.hxx
@@ -41,5 +41,7 @@ void createAllObjectProperties( SbxObject* pObj );
::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
+void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
+
#endif
diff --git a/basic/prj/build.lst b/basic/prj/build.lst
index 994901580c86..2cd1d3dc0466 100644..100755
--- a/basic/prj/build.lst
+++ b/basic/prj/build.lst
@@ -1,4 +1,4 @@
-sb basic : l10n offuh svtools xmlscript framework NULL
+sb basic : l10n offuh oovbaapi svtools xmlscript framework NULL
sb basic usr1 - all sb_mkout NULL
sb basic\inc nmake - all sb_inc NULL
sb basic\source\app nmake - all sb_app sb_class sb_inc NULL
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 7646667bc277..c242165df825 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -41,6 +41,7 @@
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <basic/sbmod.hxx>
+#include <basic/sbobjmod.hxx>
#include <basic/sbuno.hxx>
#include <basic/basmgr.hxx>
@@ -65,6 +66,9 @@
#include <com/sun/star/script/XStarBasicDialogInfo.hpp>
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -236,7 +240,15 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
Any aElement = xLibNameAccess->getByName( aModuleName );
::rtl::OUString aMod;
aElement >>= aMod;
- pLib->MakeModule32( aModuleName, aMod );
+ Reference< XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aModuleName ) )
+ {
+ ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aModuleName );
+ OSL_TRACE("#addLibraryModulesImpl - aMod");
+ pLib->MakeModule32( aModuleName, mInfo, aMod );
+ }
+ else
+ pLib->MakeModule32( aModuleName, aMod );
}
}
@@ -270,11 +282,16 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
{
Reference< XLibraryContainer > xScriptCont( Event.Source, UNO_QUERY );
insertLibraryImpl( xScriptCont, mpMgr, Event.Element, aName );
+ StarBASIC* pLib = mpMgr->GetLib( aName );
+ if ( pLib )
+ {
+ Reference<XVBACompat> xVBACompat( xScriptCont, UNO_QUERY );
+ if ( xVBACompat.is() )
+ pLib->SetVBAEnabled( xVBACompat->getVBACompatModeOn() );
+ }
}
else
{
- ::rtl::OUString aMod;
- Event.Element >>= aMod;
StarBASIC* pLib = mpMgr->GetLib( maLibName );
DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::elementInserted: Unknown lib!");
@@ -283,7 +300,16 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
SbModule* pMod = pLib->FindModule( aName );
if( !pMod )
{
- pLib->MakeModule32( aName, aMod );
+ ::rtl::OUString aMod;
+ Event.Element >>= aMod;
+ Reference< XVBAModuleInfo > xVBAModuleInfo( Event.Source, UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aName ) )
+ {
+ ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aName );
+ pLib->MakeModule32( aName, mInfo, aMod );
+ }
+ else
+ pLib->MakeModule32( aName, aMod );
pLib->SetModified( FALSE );
}
}
@@ -312,10 +338,11 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const ContainerEvent
SbModule* pMod = pLib->FindModule( aName );
::rtl::OUString aMod;
Event.Element >>= aMod;
+
if( pMod )
- pMod->SetSource32( aMod );
+ pMod->SetSource32( aMod );
else
- pLib->MakeModule32( aName, aMod );
+ pLib->MakeModule32( aName, aMod );
pLib->SetModified( FALSE );
}
diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx
new file mode 100644
index 000000000000..0ec0454e2bb5
--- /dev/null
+++ b/basic/source/classes/errobject.cxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+*
+* 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_basic.hxx"
+#include "errobject.hxx"
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/script/XDefaultProperty.hpp>
+#include "sbintern.hxx"
+#include "runtime.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::ooo;
+
+typedef ::cppu::WeakImplHelper2< vba::XErrObject, script::XDefaultProperty > ErrObjectImpl_BASE;
+
+class ErrObject : public ErrObjectImpl_BASE
+{
+ rtl::OUString m_sHelpFile;
+ rtl::OUString m_sSource;
+ rtl::OUString m_sDescription;
+ sal_Int32 m_nNumber;
+ sal_Int32 m_nHelpContext;
+
+public:
+ ErrObject();
+ ~ErrObject();
+ // Attributes
+ virtual ::sal_Int32 SAL_CALL getNumber() throw (uno::RuntimeException);
+ virtual void SAL_CALL setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getHelpContext() throw (uno::RuntimeException);
+ virtual void SAL_CALL setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getHelpFile() throw (uno::RuntimeException);
+ virtual void SAL_CALL setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDescription() throw (uno::RuntimeException);
+ virtual void SAL_CALL setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSource() throw (uno::RuntimeException);
+ virtual void SAL_CALL setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException);
+
+ // Methods
+ virtual void SAL_CALL Clear( ) throw (uno::RuntimeException);
+ virtual void SAL_CALL Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
+ // XDefaultProperty
+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException);
+
+ // Helper method
+ void setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description,
+ const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
+};
+
+
+ErrObject::~ErrObject()
+{
+}
+
+ErrObject::ErrObject() : m_nNumber(0), m_nHelpContext(0)
+{
+}
+
+sal_Int32 SAL_CALL
+ErrObject::getNumber() throw (uno::RuntimeException)
+{
+ return m_nNumber;
+}
+
+void SAL_CALL
+ErrObject::setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException)
+{
+ pINST->setErrorVB( _number, String() );
+ ::rtl::OUString _description = pINST->GetErrorMsg();
+ setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
+}
+
+::sal_Int32 SAL_CALL
+ErrObject::getHelpContext() throw (uno::RuntimeException)
+{
+ return m_nHelpContext;
+}
+void SAL_CALL
+ErrObject::setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException)
+{
+ m_nHelpContext = _helpcontext;
+}
+
+::rtl::OUString SAL_CALL
+ErrObject::getHelpFile() throw (uno::RuntimeException)
+{
+ return m_sHelpFile;
+}
+
+void SAL_CALL
+ErrObject::setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException)
+{
+ m_sHelpFile = _helpfile;
+}
+
+::rtl::OUString SAL_CALL
+ErrObject::getDescription() throw (uno::RuntimeException)
+{
+ return m_sDescription;
+}
+
+void SAL_CALL
+ErrObject::setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException)
+{
+ m_sDescription = _description;
+}
+
+::rtl::OUString SAL_CALL
+ErrObject::getSource() throw (uno::RuntimeException)
+{
+ return m_sSource;
+}
+
+void SAL_CALL
+ErrObject::setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException)
+{
+ m_sSource = _source;
+}
+
+// Methods
+void SAL_CALL
+ErrObject::Clear( ) throw (uno::RuntimeException)
+{
+ m_sHelpFile = rtl::OUString();
+ m_sSource = m_sHelpFile;
+ m_sDescription = m_sSource;
+ m_nNumber = 0;
+ m_nHelpContext = 0;
+}
+
+void SAL_CALL
+ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException)
+{
+ setData( Number, Source, Description, HelpFile, HelpContext );
+ if ( m_nNumber )
+ pINST->ErrorVB( m_nNumber, m_sDescription );
+}
+
+// XDefaultProperty
+::rtl::OUString SAL_CALL
+ErrObject::getDefaultPropertyName( ) throw (uno::RuntimeException)
+{
+ static rtl::OUString sDfltPropName( RTL_CONSTASCII_USTRINGPARAM("Number") );
+ return sDfltPropName;
+}
+
+void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext )
+ throw (uno::RuntimeException)
+{
+ if ( !Number.hasValue() )
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
+ Number >>= m_nNumber;
+ Description >>= m_sDescription;
+ Source >>= m_sSource;
+ HelpFile >>= m_sHelpFile;
+ HelpContext >>= m_nHelpContext;
+}
+
+// SbxErrObject
+SbxErrObject::SbxErrObject( const String& rName, const Any& rUnoObj )
+ : SbUnoObject( rName, rUnoObj )
+ , m_pErrObject( NULL )
+{
+ OSL_TRACE("SbxErrObject::SbxErrObject ctor");
+ rUnoObj >>= m_xErr;
+ if ( m_xErr.is() )
+ {
+ SetDfltProperty( uno::Reference< script::XDefaultProperty >( m_xErr, uno::UNO_QUERY_THROW )->getDefaultPropertyName() ) ;
+ m_pErrObject = static_cast< ErrObject* >( m_xErr.get() );
+ }
+}
+
+SbxErrObject::~SbxErrObject()
+{
+ OSL_TRACE("SbxErrObject::~SbxErrObject dtor");
+}
+
+uno::Reference< vba::XErrObject >
+SbxErrObject::getUnoErrObject()
+{
+ SbxVariable* pVar = getErrObject();
+ SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pVar );
+ return pGlobErr->m_xErr;
+}
+
+SbxVariableRef
+SbxErrObject::getErrObject()
+{
+ static SbxVariableRef pGlobErr = new SbxErrObject( String( RTL_CONSTASCII_USTRINGPARAM("Err")), uno::makeAny( uno::Reference< vba::XErrObject >( new ErrObject() ) ) );
+ return pGlobErr;
+}
+
+void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
+ throw (uno::RuntimeException)
+{
+ if( m_pErrObject != NULL )
+ m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
+}
+
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 5c57af5b6ce8..791e9fe5a8c1 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -55,13 +55,17 @@
#include <com/sun/star/awt/XDialogProvider.hpp>
#include <com/sun/star/frame/XModel.hpp>
-
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <basic/basicmanagerrepository.hxx>
+#include <basic/basmgr.hxx>
//==================================================================================================
#include <xmlscript/xmldlg_imexp.hxx>
#include <sbunoobj.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbmeth.hxx>
+#include <basic/sbuno.hxx>
#include <runtime.hxx>
#include <sbintern.hxx>
@@ -85,11 +89,6 @@ using namespace ::osl;
-//===================================================================
-void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
-Any sbxToUnoValue( SbxVariable* pVar );
-
-
Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic )
{
OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" );
@@ -450,6 +449,43 @@ Any implFindDialogLibForDialog( const Any& rDlgAny, SbxObject* pBasic )
return aRetDlgLibAny;
}
+Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, StarBASIC*& pFoundBasic )
+{
+ Any aDlgLibAny;
+ // Find dialog library for dialog, direct access is not possible here
+ StarBASIC* pStartedBasic = (StarBASIC*)pBasic;
+ SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
+ SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
+
+ SbxObject* pSearchBasic1 = NULL;
+ SbxObject* pSearchBasic2 = NULL;
+ if( pParentParentBasic )
+ {
+ pSearchBasic1 = pParentBasic;
+ pSearchBasic2 = pParentParentBasic;
+ }
+ else
+ {
+ pSearchBasic1 = pStartedBasic;
+ pSearchBasic2 = pParentBasic;
+ }
+ if( pSearchBasic1 )
+ {
+ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
+
+ if ( aDlgLibAny.hasValue() )
+ pFoundBasic = (StarBASIC*)pSearchBasic1;
+
+ else if( pSearchBasic2 )
+ {
+ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
+ if ( aDlgLibAny.hasValue() )
+ pFoundBasic = (StarBASIC*)pSearchBasic2;
+ }
+ }
+ return aDlgLibAny;
+}
+
static ::rtl::OUString aDecorationPropName =
::rtl::OUString::createFromAscii( "Decoration" );
static ::rtl::OUString aTitlePropName =
@@ -529,39 +565,54 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
{}
}
- // Find dialog library for dialog, direct access is not possible here
- StarBASIC* pStartedBasic = pINST->GetBasic();
- SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
- SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
-
- SbxObject* pSearchBasic1 = NULL;
- SbxObject* pSearchBasic2 = NULL;
- if( pParentParentBasic )
+ Any aDlgLibAny;
+ bool bDocDialog = false;
+ StarBASIC* pFoundBasic = NULL;
+ OSL_TRACE("About to try get a hold of ThisComponent");
+ Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
+ // If we found the dialog then it belongs to the Search basic
+ if ( !pFoundBasic )
{
- pSearchBasic1 = pParentBasic;
- pSearchBasic2 = pParentParentBasic;
- }
- else
+ Reference< frame::XDesktop > xDesktop( xMSF->createInstance
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
+ UNO_QUERY );
+ Reference< container::XEnumeration > xModels;
+ if ( xDesktop.is() )
{
- pSearchBasic1 = pStartedBasic;
- pSearchBasic2 = pParentBasic;
- }
-
- Any aDlgLibAny;
- if( pSearchBasic1 )
+ Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
+ if ( xComponents.is() )
+ xModels.set( xComponents->createEnumeration(), UNO_QUERY );
+ if ( xModels.is() )
+ {
+ while ( xModels->hasMoreElements() )
+ {
+ Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
+ if ( xNextModel.is() )
+ {
+ BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
+ if ( pMgr )
+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
+ if ( aDlgLibAny.hasValue() )
{
- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
- if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
+ bDocDialog = true;
+ xModel = xNextModel;
+ break;
}
-
-
- OSL_TRACE("About to try get a hold of ThisComponent");
- Reference< frame::XModel > xModel = getModelFromBasic( pStartedBasic ) ;
- Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pStartedBasic, xModel );
+ }
+ }
+ }
+ }
+ }
+ if ( pFoundBasic )
+ bDocDialog = pFoundBasic->IsDocBasic();
+ Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
Sequence< Any > aArgs( 4 );
- aArgs[ 0 ] <<= xModel;
+ if( bDocDialog )
+ aArgs[ 0 ] <<= xModel;
+ else
+ aArgs[ 0 ] <<= uno::Reference< uno::XInterface >();
aArgs[ 1 ] <<= xInput;
aArgs[ 2 ] = aDlgLibAny;
aArgs[ 3 ] <<= xScriptListener;
diff --git a/basic/source/classes/makefile.mk b/basic/source/classes/makefile.mk
index eb5486f02abf..e00ed4674cc1 100644
--- a/basic/source/classes/makefile.mk
+++ b/basic/source/classes/makefile.mk
@@ -37,18 +37,28 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
+ALLTAR .SEQUENTIAL : \
+ $(MISC)$/$(TARGET).don \
+ $(MISC)$/$(TARGET).slo
+
+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
+ +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
+ echo $@
+
+$(MISC)$/$(TARGET).slo : $(SLOTARGET)
+ echo $@
+
# --- Allgemein -----------------------------------------------------------
-COMMON_SLOFILES= \
+SLOFILES= \
$(SLO)$/sb.obj \
$(SLO)$/sbxmod.obj \
$(SLO)$/image.obj \
$(SLO)$/sbintern.obj \
$(SLO)$/sbunoobj.obj \
$(SLO)$/propacc.obj \
- $(SLO)$/disas.obj
-
-SLOFILES= $(COMMON_SLOFILES) \
+ $(SLO)$/disas.obj \
+ $(SLO)$/errobject.obj \
$(SLO)$/eventatt.obj
OBJFILES= \
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 3373442e5eb2..4f2f90d5da1f 100755
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -49,12 +49,18 @@
#include "disas.hxx"
#include "runtime.hxx"
#include <basic/sbuno.hxx>
+#include <basic/sbobjmod.hxx>
#include "stdobj.hxx"
#include "filefmt.hxx"
#include "sb.hrc"
#include <basrid.hxx>
#include <vos/mutex.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include "errobject.hxx"
+
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+using namespace ::com::sun::star::script;
// #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE )
@@ -238,6 +244,7 @@ const SFX_VB_ErrorItem __FAR_DATA SFX_VB_ErrorTab[] =
{ 1004, SbERR_METHOD_FAILED },
{ 1005, SbERR_SETPROP_FAILED },
{ 1006, SbERR_GETPROP_FAILED },
+ { 1007, SbERR_BASIC_COMPAT },
{ 0xFFFF, 0xFFFFFFFFL } // End mark
};
@@ -508,6 +515,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
}
}
}
+ SetModuleType( ModuleType::CLASS );
}
SbClassModuleObject::~SbClassModuleObject()
@@ -705,6 +713,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
SetParent( p );
pLibInfo = NULL;
bNoRtl = bBreak = FALSE;
+ bVBAEnabled = FALSE;
pModules = new SbxArray;
if( !GetSbData()->nInst++ )
@@ -805,7 +814,34 @@ SbModule* StarBASIC::MakeModule( const String& rName, const String& rSrc )
SbModule* StarBASIC::MakeModule32( const String& rName, const ::rtl::OUString& rSrc )
{
- SbModule* p = new SbModule( rName );
+ ModuleInfo mInfo;
+ mInfo.ModuleType = ModuleType::NORMAL;
+ return MakeModule32( rName, mInfo, rSrc );
+}
+SbModule* StarBASIC::MakeModule32( const String& rName, const ModuleInfo& mInfo, const rtl::OUString& rSrc )
+{
+
+ OSL_TRACE("create module %s type mInfo %d", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(), mInfo.ModuleType );
+ SbModule* p = NULL;
+ switch ( mInfo.ModuleType )
+ {
+ case ModuleType::DOCUMENT:
+ // In theory we should be able to create Object modules
+ // in ordinary basic ( in vba mode thought these are create
+ // by the application/basic and not by the user )
+ p = new SbObjModule( rName, mInfo, isVBAEnabled() );
+ break;
+ case ModuleType::CLASS:
+ p = new SbModule( rName, isVBAEnabled() );
+ p->SetModuleType( ModuleType::CLASS );
+ break;
+ case ModuleType::FORM:
+ p = new SbUserFormModule( rName, mInfo, isVBAEnabled() );
+ break;
+ default:
+ p = new SbModule( rName, isVBAEnabled() );
+
+ }
p->SetSource32( rSrc );
p->SetParent( this );
pModules->Insert( p, pModules->Count() );
@@ -981,6 +1017,12 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t )
}
pNamed = p;
}
+ // Only variables qualified by the Module Name e.g. Sheet1.foo
+ // should work for Documant && Class type Modules
+ INT32 nType = p->GetModuleType();
+ if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
+ continue;
+
// otherwise check if the element is available
// unset GBLSEARCH-Flag (due to Rekursion)
USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
@@ -1352,6 +1394,7 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
}
else
GetSbData()->aErrMsg = String::EmptyString();
+
}
BOOL StarBASIC::CError
@@ -1408,7 +1451,22 @@ BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1,
// Umsetzung des Codes fuer String-Transport in SFX-Error
if( rMsg.Len() )
- code = (ULONG)*new StringErrorInfo( code, String(rMsg) );
+ {
+ // very confusing, even though MakeErrorText sets up the error text
+ // seems that this is not used ( if rMsg already has content )
+ // In the case of VBA MakeErrorText also formats the error to be alittle more
+ // like vba ( adds an error number etc )
+ if ( SbiRuntime::isVBAEnabled() && ( code == SbERR_BASIC_COMPAT ) )
+ {
+ String aTmp = '\'';
+ aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() );
+ aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") );
+ aTmp += GetSbData()->aErrMsg.Len() ? GetSbData()->aErrMsg : rMsg;
+ code = (ULONG)*new StringErrorInfo( code, aTmp );
+ }
+ else
+ code = (ULONG)*new StringErrorInfo( code, String(rMsg) );
+ }
SetErrorData( code, l, c1, c2 );
if( GetSbData()->aErrHdl.IsSet() )
diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src
index 926da0359d7e..73cc1c3a0b2c 100644
--- a/basic/source/classes/sb.src
+++ b/basic/source/classes/sb.src
@@ -588,6 +588,10 @@ Resource RID_BASIC_START
{
Text [ en-US ] = "For loop not initialized." ;
};
+ String ERRCODE_BASIC_COMPAT & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "$(ARG1)" ;
+ };
};
// Hinweis: IDS_SBERR_TERMINATED = IDS_SBERR_START+2000.
String IDS_SBERR_TERMINATED
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 1c95b4f30de6..849fd839bfd1 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -567,7 +567,7 @@ SbxDataType unoToSbxType( const Reference< XIdlClass >& xIdlClass )
}
return eRetType;
}
-void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
+
static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int32 >& indices, Sequence< sal_Int32 >& sizes, const Any& aValue, sal_Int32& dimension, sal_Bool bIsZeroIndex, Type* pType = NULL )
{
Type aType = aValue.getValueType();
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 092ef458041e..83c0ae9e65f4 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -52,7 +52,13 @@
#include <basic/basrdll.hxx>
#include <vos/mutex.hxx>
+#include <basic/sbobjmod.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+using namespace com::sun::star;
// for the bsearch
#ifdef WNT
@@ -72,6 +78,13 @@
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/awt/XDialogProvider.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/anytostring.hxx>
TYPEINIT1(SbModule,SbxObject)
TYPEINIT1(SbMethod,SbxMethod)
@@ -79,6 +92,8 @@ TYPEINIT1(SbProperty,SbxProperty)
TYPEINIT1(SbProcedureProperty,SbxProperty)
TYPEINIT1(SbJScriptModule,SbModule)
TYPEINIT1(SbJScriptMethod,SbMethod)
+TYPEINIT1(SbObjModule,SbModule)
+TYPEINIT1(SbUserFormModule,SbObjModule)
SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
SV_IMPL_VARARR(SbiBreakpoints,USHORT)
@@ -86,6 +101,26 @@ SV_IMPL_VARARR(SbiBreakpoints,USHORT)
SV_IMPL_VARARR(HighlightPortions, HighlightPortion)
+bool getDefaultVBAMode( StarBASIC* pb )
+{
+ bool bResult = false;
+ 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::XVBACompat > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
+ if ( xVBAMode.is() )
+ bResult = ( xVBAMode->getVBACompatModeOn() == sal_True );
+ }
+ }
+ }
+ return bResult;
+}
+
class AsyncQuitHandler
{
AsyncQuitHandler() {}
@@ -148,12 +183,13 @@ bool UnlockControllerHack( StarBASIC* pBasic )
// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
// Elemente von anderen Modulen aus gefunden werden koennen.
-SbModule::SbModule( const String& rName )
+SbModule::SbModule( const String& rName, BOOL bVBACompat )
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
- pImage( NULL ), pBreaks( NULL ), pClassData( NULL )
+ pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( bVBACompat ), pDocObject( NULL ), bIsProxyModule( false )
{
SetName( rName );
SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
+ SetModuleType( script::ModuleType::NORMAL );
}
SbModule::~SbModule()
@@ -328,7 +364,10 @@ void SbModule::Clear()
SbxVariable* SbModule::Find( const XubString& rName, SbxClassType t )
{
+ // make sure a search in an uninstatiated class module will fail
SbxVariable* pRes = SbxObject::Find( rName, t );
+ if ( bIsProxyModule )
+ return NULL;
if( !pRes && pImage )
{
SbiInstance* pInst = pINST;
@@ -427,6 +466,8 @@ 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() ) ) );
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
@@ -457,9 +498,14 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
if( eCurTok == OPTION )
{
eCurTok = aTok.Next();
- if( eCurTok == COMPATIBLE
- || ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) && ( aTok.GetDbl()== 1 ) ) )
+ if( eCurTok == COMPATIBLE )
aTok.SetCompatible( true );
+ else if ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) )
+ {
+ BOOL bIsVBA = ( aTok.GetDbl()== 1 );
+ SetVBACompat( bIsVBA );
+ aTok.SetCompatible( bIsVBA );
+ }
}
}
eLastTok = eCurTok;
@@ -600,7 +646,15 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
if( ((StarBASIC*)p) != pBasic )
ClearUnoObjectsInRTL_Impl_Rek( (StarBASIC*)p );
}
+BOOL SbModule::IsVBACompat()
+{
+ return mbVBACompat;
+}
+void SbModule::SetVBACompat( BOOL bCompat )
+{
+ mbVBACompat = bCompat;
+}
// Ausfuehren eines BASIC-Unterprogramms
USHORT SbModule::Run( SbMethod* pMeth )
{
@@ -695,10 +749,9 @@ USHORT SbModule::Run( SbMethod* pMeth )
if( pRt->pNext )
pRt->pNext->block();
pINST->pRun = pRt;
- if ( SbiRuntime ::isVBAEnabled() )
+ if ( mbVBACompat )
{
pINST->EnableCompatibility( TRUE );
- pRt->SetVBAEnabled( true );
}
while( pRt->Step() ) {}
if( pRt->pNext )
@@ -1483,6 +1536,389 @@ SbJScriptMethod::~SbJScriptMethod()
/////////////////////////////////////////////////////////////////////////
+SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible )
+ : SbModule( rName, bIsVbaCompatible )
+{
+ SetModuleType( mInfo.ModuleType );
+ if ( mInfo.ModuleType == script::ModuleType::FORM )
+ {
+ SetClassName( rtl::OUString::createFromAscii( "Form" ) );
+ }
+ else if ( mInfo.ModuleObject.is() )
+ SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
+}
+void
+SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
+{
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxVariable*)pDocObject);
+ if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
+ return;
+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
+ if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
+ {
+ SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
+ }
+ else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Workbook" ) ) )
+ {
+ SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
+ }
+}
+
+SbxVariable*
+SbObjModule::GetObject()
+{
+ return pDocObject;
+}
+SbxVariable*
+SbObjModule::Find( const XubString& rName, SbxClassType t )
+{
+ //OSL_TRACE("SbObjectModule find for %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ SbxVariable* pVar = NULL;
+ if ( pDocObject)
+ pVar = pDocObject->Find( rName, t );
+ if ( !pVar )
+ pVar = SbModule::Find( rName, t );
+ return pVar;
+}
+
+typedef ::cppu::WeakImplHelper1< awt::XTopWindowListener > EventListener_BASE;
+
+class FormObjEventListenerImpl : public EventListener_BASE
+{
+ SbUserFormModule* mpUserForm;
+ uno::Reference< lang::XComponent > mxComponent;
+ bool mbDisposed;
+ sal_Bool mbOpened;
+ sal_Bool mbActivated;
+ sal_Bool mbShowing;
+ FormObjEventListenerImpl(); // not defined
+ FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined
+public:
+ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
+ {
+ if ( mxComponent.is() )
+ {
+ uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
+ OSL_TRACE("*********** Registering the listener");
+ xList->addTopWindowListener( this );
+ }
+ }
+
+ ~FormObjEventListenerImpl()
+ {
+ removeListener();
+ }
+ sal_Bool isShowing() { return mbShowing; }
+ void removeListener()
+ {
+ try
+ {
+ if ( mxComponent.is() && !mbDisposed )
+ {
+ uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
+ OSL_TRACE("*********** Removing the listener");
+ xList->removeTopWindowListener( this );
+ mxComponent = NULL;
+ }
+ }
+ catch( uno::Exception& ) {}
+ }
+ virtual void SAL_CALL windowOpened( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ if ( mpUserForm )
+ {
+ mbOpened = sal_True;
+ mbShowing = sal_True;
+ if ( mbActivated )
+ {
+ mbOpened = mbActivated = sal_False;
+ mpUserForm->triggerActivateEvent();
+ }
+ }
+ }
+
+ //liuchen 2009-7-21, support Excel VBA Form_QueryClose event
+ virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+#if IN_THE_FUTURE
+ uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
+ if ( xDialog.is() )
+ {
+ uno::Reference< awt::XControl > xControl( xDialog, uno::UNO_QUERY );
+ if ( xControl->getPeer().is() )
+ {
+ uno::Reference< document::XVbaMethodParameter > xVbaMethodParameter( xControl->getPeer(), uno::UNO_QUERY );
+ if ( xVbaMethodParameter.is() )
+ {
+ sal_Int8 nCancel = 0;
+ sal_Int8 nCloseMode = 0;
+
+ Sequence< Any > aParams;
+ aParams.realloc(2);
+ aParams[0] <<= nCancel;
+ aParams[1] <<= nCloseMode;
+
+ mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ),
+ aParams);
+ xVbaMethodParameter->setVbaMethodParameter( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cancel")), aParams[0]);
+ return;
+
+ }
+ }
+ }
+
+ mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
+#endif
+ }
+ //liuchen 2009-7-21
+
+ virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) { mbOpened = sal_False; mbShowing = sal_False; }
+ virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
+ virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException){}
+ virtual void SAL_CALL windowActivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ if ( mpUserForm )
+ {
+ mbActivated = sal_True;
+ if ( mbOpened )
+ {
+ mbOpened = mbActivated = sal_False;
+ mpUserForm->triggerActivateEvent();
+ }
+ }
+ }
+
+ virtual void SAL_CALL windowDeactivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ if ( mpUserForm )
+ mpUserForm->triggerDeActivateEvent();
+ }
+
+
+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
+ {
+ OSL_TRACE("** Userform/Dialog disposing");
+ mbDisposed = true;
+ uno::Any aSource;
+ aSource <<= Source;
+ mxComponent = NULL;
+ if ( mpUserForm )
+ mpUserForm->ResetApiObj();
+ }
+};
+
+SbUserFormModule::SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsCompat )
+ :SbObjModule( rName, mInfo, bIsCompat ), mbInit( false )
+{
+ m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW );
+}
+
+void SbUserFormModule::ResetApiObj()
+{
+ if ( m_xDialog.is() ) // probably someone close the dialog window
+ {
+ triggerTerminateEvent();
+ }
+ pDocObject = NULL;
+ m_xDialog = NULL;
+}
+
+void SbUserFormModule::triggerMethod( const String& aMethodToRun )
+{
+ Sequence< Any > aArguments;
+ triggerMethod( aMethodToRun, 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 IN_THE_FUTURE
+ //liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters
+ if ( aArguments.getLength() > 0 ) // Setup parameters
+ {
+ SbxArrayRef xArray = new SbxArray;
+ xArray->Put( pMeth, 0 ); // Method as parameter 0
+
+ for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
+ {
+ SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), aArguments[i] );
+ xArray->Put( xSbxVar, static_cast< USHORT >( i ) + 1 );
+
+ // Enable passing by ref
+ if ( xSbxVar->GetType() != SbxVARIANT )
+ xSbxVar->SetFlag( SBX_FIXED );
+ }
+ pMeth->SetParameters( xArray );
+
+ SbxValues aVals;
+ pMeth->Get( aVals );
+
+ for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
+ {
+ aArguments[i] = sbxToUnoValue( xArray->Get( static_cast< USHORT >(i) + 1) );
+ }
+ pMeth->SetParameters( NULL );
+ }
+ else
+//liuchen 2009-7-21
+#endif
+ {
+ SbxValues aVals;
+ pMeth->Get( aVals );
+ }
+ }
+}
+
+void SbUserFormModule::triggerActivateEvent( void )
+{
+ OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
+ triggerMethod( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm_activate") ) );
+ OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
+}
+
+void SbUserFormModule::triggerDeActivateEvent( void )
+{
+ OSL_TRACE("**** SbUserFormModule::triggerDeActivate");
+ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_DeActivate") ) );
+}
+
+void SbUserFormModule::triggerInitializeEvent( void )
+
+{
+ if ( mbInit )
+ return;
+ OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
+ static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Initialize") );
+ triggerMethod( aInitMethodName );
+ mbInit = true;
+}
+
+void SbUserFormModule::triggerTerminateEvent( void )
+{
+ OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
+ static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Terminate") );
+ triggerMethod( aTermMethodName );
+ mbInit=false;
+}
+
+void SbUserFormModule::load()
+{
+ OSL_TRACE("** load() ");
+ // forces a load
+ if ( !pDocObject )
+ InitObject();
+}
+
+//liuchen 2009-7-21 change to accmordate VBA's beheavior
+void SbUserFormModule::Unload()
+{
+ OSL_TRACE("** Unload() ");
+
+ sal_Int8 nCancel = 0;
+ sal_Int8 nCloseMode = 1;
+
+ Sequence< Any > aParams;
+ aParams.realloc(2);
+ aParams[0] <<= nCancel;
+ aParams[1] <<= nCloseMode;
+
+ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams);
+
+ aParams[0] >>= nCancel;
+ if (nCancel == 1)
+ {
+ return;
+ }
+
+ if ( m_xDialog.is() )
+ {
+ triggerTerminateEvent();
+ }
+ // Search method
+ SbxVariable* pMeth = SbObjModule::Find( String( RTL_CONSTASCII_USTRINGPARAM( "UnloadObject" ) ), SbxCLASS_METHOD );
+ if( pMeth )
+ {
+ OSL_TRACE("Attempting too run the UnloadObjectMethod");
+ m_xDialog = NULL; //release ref to the uno object
+ SbxValues aVals;
+ FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
+ bool bWaitForDispose = true; // assume dialog is showing
+ if ( pFormListener )
+ {
+ bWaitForDispose = pFormListener->isShowing();
+ OSL_TRACE("Showing %d", bWaitForDispose );
+ }
+ pMeth->Get( aVals);
+ if ( !bWaitForDispose )
+ {
+ // we've either already got a dispose or we'er never going to get one
+ ResetApiObj();
+ } // else wait for dispose
+ OSL_TRACE("UnloadObject completed ( we hope )");
+ }
+}
+//liuchen
+
+void SbUserFormModule::InitObject()
+{
+ try
+ {
+
+ String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
+ SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
+ if ( m_xModel.is() && pGlobs )
+ {
+
+ uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
+ uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[ 0 ] <<= m_xModel;
+ rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
+ rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ if ( this->GetParent()->GetName().Len() )
+ sProjectName = this->GetParent()->GetName();
+ sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
+
+ uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
+ m_xDialog = xProvider->createDialog( sDialogUrl );
+
+ // create vba api object
+ aArgs.realloc( 4 );
+ aArgs[ 0 ] = uno::Any();
+ aArgs[ 1 ] <<= m_xDialog;
+ aArgs[ 2 ] <<= m_xModel;
+ aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
+ uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
+ // remove old listener if it exists
+ FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
+ if ( pFormListener )
+ pFormListener->removeListener();
+ m_DialogListener = new FormObjEventListenerImpl( this, xComponent );
+
+ triggerInitializeEvent();
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ }
+
+}
+
+SbxVariable*
+SbUserFormModule::Find( const XubString& rName, SbxClassType t )
+{
+ if ( !pDocObject && !GetSbData()->bRunInit && pINST )
+ InitObject();
+ return SbObjModule::Find( rName, t );
+}
+/////////////////////////////////////////////////////////////////////////
SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p )
: SbxProperty( r, t ), pMod( p )
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index c7a63b6d7fbb..46f829b382e8 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -32,6 +32,7 @@
#include "sbcomp.hxx"
#include "image.hxx"
#include <limits>
+#include <com/sun/star/script/ModuleType.hpp>
// nInc ist die Inkrementgroesse der Puffer
@@ -127,12 +128,12 @@ void SbiCodeGen::Save()
// OPTION EXPLICIT-Flag uebernehmen
if( pParser->bExplicit )
p->SetFlag( SBIMG_EXPLICIT );
- if( pParser->IsVBASupportOn() )
- p->SetFlag( SBIMG_VBASUPPORT );
int nIfaceCount = 0;
- if( pParser->bClassModule )
+ if( rMod.mnType == com::sun::star::script::ModuleType::CLASS )
{
+ OSL_TRACE("COdeGen::save() classmodule processing");
+ rMod.bIsProxyModule = true;
p->SetFlag( SBIMG_CLASSMODULE );
pCLASSFAC->AddClassModule( &rMod );
@@ -155,6 +156,10 @@ void SbiCodeGen::Save()
else
{
pCLASSFAC->RemoveClassModule( &rMod );
+ // Only a ClassModule can revert to Normal
+ if ( rMod.mnType == com::sun::star::script::ModuleType::CLASS )
+ rMod.mnType = com::sun::star::script::ModuleType::NORMAL;
+ rMod.bIsProxyModule = false;
}
if( pParser->bText )
p->SetFlag( SBIMG_COMPARETEXT );
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 400e77a94b16..8770dc8539f0 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -29,6 +29,7 @@
#include "precompiled_basic.hxx"
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
+#include <com/sun/star/script/ModuleType.hpp>
struct SbiParseStack { // "Stack" fuer Statement-Blocks
SbiParseStack* pNext; // Chain
@@ -140,7 +141,8 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
bNewGblDefs =
bSingleLineIf =
bExplicit = FALSE;
- bClassModule = FALSE;
+ bClassModule = ( pm->GetModuleType() == com::sun::star::script::ModuleType::CLASS );
+ OSL_TRACE("Parser - %s, bClassModule %d", rtl::OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule );
pPool = &aPublics;
for( short i = 0; i < 26; i++ )
eDefTypes[ i ] = SbxVARIANT; // Kein expliziter Defaulttyp
@@ -153,6 +155,10 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
rTypeArray = new SbxArray; // Array fuer Benutzerdefinierte Typen
rEnumArray = new SbxArray; // Array for Enum types
+ bVBASupportOn = pm->IsVBACompat();
+ if ( bVBASupportOn )
+ EnableCompatibility();
+
}
@@ -751,6 +757,7 @@ void SbiParser::Option()
case CLASSMODULE:
bClassModule = TRUE;
+ aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::CLASS );
break;
case VBASUPPORT:
if( Next() == NUMBER )
@@ -760,6 +767,10 @@ void SbiParser::Option()
bVBASupportOn = ( nVal == 1 );
if ( bVBASupportOn )
EnableCompatibility();
+ // if the module setting is different
+ // reset it to what the Option tells us
+ if ( bVBASupportOn != aGen.GetModule().IsVBACompat() )
+ aGen.GetModule().SetVBACompat( bVBASupportOn );
break;
}
}
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
index d0a613eabebc..3d90d16bdcbe 100644
--- a/basic/source/inc/codegen.hxx
+++ b/basic/source/inc/codegen.hxx
@@ -53,6 +53,7 @@ public:
void GenStmnt(); // evtl. Statement-Opcode erzeugen
UINT32 GetPC();
UINT32 GetOffset() { return GetPC() + 1; }
+ SbModule& GetModule() { return rMod; }
void Save();
// #29955 for-Schleifen-Ebene pflegen
diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx
new file mode 100644
index 000000000000..39e6e319caae
--- /dev/null
+++ b/basic/source/inc/errobject.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef ERROBJECT_HXX
+#define ERROBJECT_HXX
+#include "sbunoobj.hxx"
+#include <ooo/vba/XErrObject.hpp>
+
+
+class SbxErrObject : public SbUnoObject
+{
+ class ErrObject* m_pErrObject;
+ com::sun::star::uno::Reference< ooo::vba::XErrObject > m_xErr;
+
+ SbxErrObject( const String& aName_, const com::sun::star::uno::Any& aUnoObj_ );
+ ~SbxErrObject();
+
+ class ErrObject* getImplErrObject( void )
+ { return m_pErrObject; }
+
+public:
+ static SbxVariableRef getErrObject();
+ static com::sun::star::uno::Reference< ooo::vba::XErrObject > getUnoErrObject();
+
+ void setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
+ throw (com::sun::star::uno::RuntimeException);
+};
+#endif
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 7347efe288f3..d674b91faf71 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -106,6 +106,5 @@ public:
#define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv
#define SBIMG_INITCODE 0x0004 // Init-Code vorhanden
#define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
-#define SBIMG_VBASUPPORT 0x0020 // OPTION VBASupport is 1
#endif
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 1f7e77170d44..1f4084db1d0d 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -58,19 +58,22 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/compbase6.hxx>
+#include <cppuhelper/compbase7.hxx>
#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/script/XVBACompat.hpp>
class BasicManager;
namespace basic
{
-typedef ::cppu::WeakComponentImplHelper6<
+typedef ::cppu::WeakComponentImplHelper7<
::com::sun::star::lang::XInitialization,
::com::sun::star::script::XStorageBasedLibraryContainer,
::com::sun::star::script::XLibraryContainerPassword,
::com::sun::star::script::XLibraryContainerExport,
::com::sun::star::container::XContainer,
+ ::com::sun::star::script::XVBACompat,
::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
@@ -216,6 +219,7 @@ public:
class SfxLibraryContainer :public LibraryContainerHelper
,public ::utl::OEventListenerAdapter
{
+ sal_Bool mbVBACompat;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
@@ -493,6 +497,9 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
throw (::com::sun::star::uno::RuntimeException) = 0;
+ // Methods XVBACompat
+ virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
};
class LibraryContainerMethodGuard
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 4a3f38c51027..c9a41110ad46 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -219,6 +219,8 @@ public:
void Error( SbError ); // trappable Error
void Error( SbError, const String& rMsg ); // trappable Error mit Message
+ void ErrorVB( sal_Int32 nVBNumber, const String& rMsg );
+ void setErrorVB( sal_Int32 nVBNumber, const String& rMsg );
void FatalError( SbError ); // non-trappable Error
void FatalError( SbError, const String& ); // non-trappable Error
void Abort(); // Abbruch mit aktuellem Fehlercode
@@ -433,7 +435,7 @@ class SbiRuntime
void StepFIND_CM( UINT32, UINT32 );
void StepFIND_STATIC( UINT32, UINT32 );
public:
- void SetVBAEnabled( bool bEnabled ) { bVBAEnabled = bEnabled; };
+ void SetVBAEnabled( bool bEnabled );
USHORT GetImageFlag( USHORT n ) const;
USHORT GetBase();
xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich
@@ -441,10 +443,11 @@ public:
SbiRuntime( SbModule*, SbMethod*, UINT32 );
~SbiRuntime();
- void Error( SbError ); // Fehler setzen, falls != 0
+ void Error( SbError, bool bVBATranslationAlreadyDone = false ); // Fehler setzen, falls != 0
void Error( SbError, const String& ); // Fehler setzen, falls != 0
void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen
+ static sal_Int32 translateErrorToVba( SbError nError, String& rMsg );
void DumpPCode();
BOOL Step(); // Einzelschritt (ein Opcode)
void Stop() { bRun = FALSE; }
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 19b0698d22a9..31025c48c4a4 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -30,6 +30,8 @@
#include "namecont.hxx"
#include <basic/basmgr.hxx>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <comphelper/uno3.hxx>
class BasicManager;
@@ -134,13 +136,19 @@ public:
};
//============================================================================
+typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::script::XVBAModuleInfo
+ > SfxScriptLibrary_BASE;
class SfxScriptLibrary : public SfxLibrary
+ , public SfxScriptLibrary_BASE
{
friend class SfxScriptLibraryContainer;
sal_Bool mbLoadedSource;
sal_Bool mbLoadedBinary;
+ ModuleInfoMap mModuleInfos;
// Provide modify state including resources
virtual sal_Bool isModified( void );
@@ -167,6 +175,15 @@ public:
const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
);
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // XVBAModuleInfo
+ virtual ::com::sun::star::script::ModuleInfo SAL_CALL getModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertModuleInfo( const ::rtl::OUString& ModuleName, const ::com::sun::star::script::ModuleInfo& ModuleInfo ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
protected:
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 9a21e488d4aa..e963de871c32 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -61,6 +61,7 @@
#else
#include <osl/file.hxx>
#endif
+#include "errobject.hxx"
#ifdef _USE_UNO
#include <comphelper/processfactory.hxx>
@@ -120,6 +121,10 @@ using namespace com::sun::star::io;
#include <io.h>
#endif
+using namespace rtl;
+
+#include <basic/sbobjmod.hxx>
+
static void FilterWhiteSpace( String& rStr )
{
rStr.EraseAllChars( ' ' );
@@ -256,6 +261,7 @@ RTLFUNC(Error)
{
String aErrorMsg;
SbError nErr = 0L;
+ INT32 nCode = 0;
if( rPar.Count() == 1 )
{
nErr = StarBASIC::GetErrBasic();
@@ -263,14 +269,34 @@ RTLFUNC(Error)
}
else
{
- INT32 nCode = rPar.Get( 1 )->GetLong();
+ nCode = rPar.Get( 1 )->GetLong();
if( nCode > 65535L )
StarBASIC::Error( SbERR_CONVERSION );
else
nErr = StarBASIC::GetSfxFromVBError( (USHORT)nCode );
}
- pBasic->MakeErrorText( nErr, aErrorMsg );
- rPar.Get( 0 )->PutString( pBasic->GetErrorText() );
+
+ bool bVBA = SbiRuntime::isVBAEnabled();
+ String tmpErrMsg;
+ if( bVBA && aErrorMsg.Len() > 0 )
+ {
+ tmpErrMsg = aErrorMsg;
+ }
+ else
+ {
+ pBasic->MakeErrorText( nErr, aErrorMsg );
+ tmpErrMsg = pBasic->GetErrorText();
+ }
+ // If this rtlfunc 'Error' passed a errcode the same as the active Err Objects's
+ // current err then return the description for the error message if it is set
+ // ( complicated isn't it ? )
+ if ( bVBA && rPar.Count() > 1 )
+ {
+ com::sun::star::uno::Reference< ooo::vba::XErrObject > xErrObj( SbxErrObject::getUnoErrObject() );
+ if ( xErrObj.is() && xErrObj->getNumber() == nCode && xErrObj->getDescription().getLength() )
+ tmpErrMsg = xErrObj->getDescription();
+ }
+ rPar.Get( 0 )->PutString( tmpErrMsg );
}
}
@@ -4106,12 +4132,20 @@ RTLFUNC(Load)
// Diesen Call einfach an das Object weiterreichen
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
- if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
+ if ( pObj )
{
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD );
- if( pVar )
- pVar->GetInteger();
+ if( pObj->IsA( TYPE( SbUserFormModule ) ) )
+ {
+ SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
+ pFormModule->load();
+ }
+ else if( pObj->IsA( TYPE( SbxObject ) ) )
+ {
+ SbxVariable* pVar = ((SbxObject*)pObj)->
+ Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD );
+ if( pVar )
+ pVar->GetInteger();
+ }
}
}
@@ -4129,12 +4163,20 @@ RTLFUNC(Unload)
// Diesen Call einfach an das Object weitereichen
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
- if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
+ if ( pObj )
{
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD );
- if( pVar )
- pVar->GetInteger();
+ if( pObj->IsA( TYPE( SbUserFormModule ) ) )
+ {
+ SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
+ pFormModule->Unload();
+ }
+ else if( pObj->IsA( TYPE( SbxObject ) ) )
+ {
+ SbxVariable* pVar = ((SbxObject*)pObj)->
+ Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD );
+ if( pVar )
+ pVar->GetInteger();
+ }
}
}
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index e0501e5c0d94..b25c213a493d 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -61,6 +61,7 @@
#endif
#include <vcl/jobset.hxx>
+#include <basic/sbobjmod.hxx>
#include "sbintern.hxx"
#include "runtime.hxx"
@@ -2594,14 +2595,16 @@ RTLFUNC(Me)
SbModule* pActiveModule = pINST->GetActiveModule();
SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule);
+ SbxVariableRef refVar = rPar.Get(0);
if( pClassModuleObject == NULL )
{
- StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT );
+ SbObjModule* pMod = PTR_CAST(SbObjModule,pActiveModule);
+ if ( pMod )
+ refVar->PutObject( pMod );
+ else
+ StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT );
}
else
- {
- SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( pClassModuleObject );
- }
}
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 9b4b35f551e2..cec74444e7a2 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -31,6 +31,7 @@
#include "runtime.hxx"
#include "stdobj.hxx"
#include "rtlproto.hxx"
+#include "errobject.hxx"
// Properties und Methoden legen beim Get (bWrite = FALSE) den Returnwert
@@ -50,14 +51,21 @@ RTLFUNC(Err)
(void)pBasic;
(void)bWrite;
- if( bWrite )
+ if( SbiRuntime::isVBAEnabled() )
{
- INT32 nVal = rPar.Get( 0 )->GetLong();
- if( nVal <= 65535L )
- StarBASIC::Error( StarBASIC::GetSfxFromVBError( (USHORT) nVal ) );
+ rPar.Get( 0 )->PutObject( SbxErrObject::getErrObject() );
}
else
- rPar.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErrBasic() ) );
+ {
+ if( bWrite )
+ {
+ INT32 nVal = rPar.Get( 0 )->GetLong();
+ if( nVal <= 65535L )
+ StarBASIC::Error( StarBASIC::GetSfxFromVBError( (USHORT) nVal ) );
+ }
+ else
+ rPar.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErrBasic() ) );
+ }
}
RTLFUNC(False)
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 52aa76e2f2df..29e49b0ffde8 100644..100755
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -43,13 +43,16 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include "sbunoobj.hxx"
+#include "errobject.hxx"
+
+using namespace ::com::sun::star;
bool SbiRuntime::isVBAEnabled()
{
bool result = false;
SbiInstance* pInst = pINST;
if ( pInst && pINST->pRun )
- result = pInst->pRun->GetImageFlag( SBIMG_VBASUPPORT );
+ result = pInst->pRun->bVBAEnabled;
return result;
}
@@ -60,6 +63,24 @@ void StarBASIC::StaticEnableReschedule( BOOL bReschedule )
{
bStaticGlobalEnableReschedule = bReschedule;
}
+void StarBASIC::SetVBAEnabled( BOOL bEnabled )
+{
+ if ( bDocBasic )
+ {
+ bVBAEnabled = bEnabled;
+ }
+}
+
+BOOL StarBASIC::isVBAEnabled()
+{
+ if ( bDocBasic )
+ {
+ if( SbiRuntime::isVBAEnabled() )
+ return TRUE;
+ return bVBAEnabled;
+ }
+ return FALSE;
+}
struct SbiArgvStack { // Argv stack:
@@ -422,6 +443,35 @@ void SbiInstance::Error( SbError n, const String& rMsg )
}
}
+void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg )
+{
+ if( !bWatchMode )
+ {
+ SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) );
+ if ( !n )
+ n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
+
+ aErrorMsg = rMsg;
+ SbiRuntime::translateErrorToVba( n, aErrorMsg );
+
+ bool bVBATranslationAlreadyDone = true;
+ pRun->Error( SbERR_BASIC_COMPAT, bVBATranslationAlreadyDone );
+ }
+}
+
+void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const String& rMsg )
+{
+ SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) );
+ if( !n )
+ n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
+
+ aErrorMsg = rMsg;
+ SbiRuntime::translateErrorToVba( n, aErrorMsg );
+
+ nErr = n;
+}
+
+
void SbiInstance::FatalError( SbError n )
{
pRun->FatalError( n );
@@ -520,6 +570,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
nForLvl = 0;
nOps = 0;
refExprStk = new SbxArray;
+ SetVBAEnabled( pMod->IsVBACompat() );
#if defined GCC
SetParameters( pe ? pe->GetParameters() : (class SbxArray *)NULL );
#else
@@ -527,7 +578,6 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
#endif
pRefSaveList = NULL;
pItemStoreList = NULL;
- bVBAEnabled = isVBAEnabled();
}
SbiRuntime::~SbiRuntime()
@@ -546,6 +596,11 @@ SbiRuntime::~SbiRuntime()
}
}
+void SbiRuntime::SetVBAEnabled(bool bEnabled )
+{
+ bVBAEnabled = bEnabled;
+}
+
// Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
// uebernommen; von ByVal-Parametern werden Kopien angelegt. Falls
// ein bestimmter Datentyp verlangt wird, wird konvertiert.
@@ -791,10 +846,24 @@ BOOL SbiRuntime::Step()
return bRun;
}
-void SbiRuntime::Error( SbError n )
+void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone )
{
if( n )
+ {
nError = n;
+ if( isVBAEnabled() && !bVBATranslationAlreadyDone )
+ {
+ String aMsg = pInst->GetErrorMsg();
+ sal_Int32 nVBAErrorNumber = translateErrorToVba( nError, aMsg );
+ SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject();
+ SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pSbxErrObjVar );
+ if( pGlobErr != NULL )
+ pGlobErr->setNumberAndDescription( nVBAErrorNumber, aMsg );
+
+ pInst->aErrorMsg = aMsg;
+ nError = SbERR_BASIC_COMPAT;
+ }
+ }
}
void SbiRuntime::Error( SbError _errCode, const String& _details )
@@ -826,6 +895,32 @@ void SbiRuntime::FatalError( SbError _errCode, const String& _details )
Error( _errCode, _details );
}
+sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
+{
+ // If a message is defined use that ( in preference to
+ // the defined one for the error ) NB #TODO
+ // if there is an error defined it more than likely
+ // is not the one you want ( some are the same though )
+ // we really need a new vba compatible error list
+ if ( !rMsg.Len() )
+ {
+ // TEST, has to be vb here always
+#ifdef DBG_UTIL
+ SbError nTmp = StarBASIC::GetSfxFromVBError( nError );
+ DBG_ASSERT( nTmp, "No VB error!" );
+#endif
+
+ StarBASIC::MakeErrorText( nError, rMsg );
+ rMsg = StarBASIC::GetErrorText();
+ if ( !rMsg.Len() ) // no message for err no, need localized resource here
+ rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
+ }
+ // no num? most likely then it *is* really a vba err
+ USHORT nVBErrorCode = StarBASIC::GetVBErrorCode( nError );
+ sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? nError : nVBErrorCode;
+ return nVBAErrorNumber;
+}
+
//////////////////////////////////////////////////////////////////////////
//
// Parameter, Locals, Caller
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index c0b4ffa3cd59..13bc8810144a 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -230,7 +230,7 @@ static Methods aMethods[] = {
{ "EOF", SbxBOOL, 1 | _FUNCTION, RTLNAME(EOF),0 },
{ "Channel", SbxINTEGER, 0,NULL,0 },
{ "Erl", SbxLONG, _ROPROP, RTLNAME( Erl ),0 },
-{ "Err", SbxLONG, _RWPROP, RTLNAME( Err ),0 },
+{ "Err", SbxVARIANT, _RWPROP, RTLNAME( Err ),0 },
{ "Error", SbxSTRING, 1 | _FUNCTION, RTLNAME( Error ),0 },
{ "code", SbxLONG, 0,NULL,0 },
{ "Exp", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Exp),0 },
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 33df854a4499..39af5ea4adc3 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -30,6 +30,7 @@
#include <vcl/msgbox.hxx>
#include <tools/fsys.hxx>
+#include "errobject.hxx"
#include "runtime.hxx"
#include "sbintern.hxx"
#include "iosys.hxx"
@@ -1116,6 +1117,7 @@ void SbiRuntime::StepSTDERROR()
pInst->nErr = 0L;
pInst->nErl = 0;
nError = 0L;
+ SbxErrObject::getUnoErrObject()->Clear();
}
void SbiRuntime::StepNOERROR()
@@ -1124,6 +1126,7 @@ void SbiRuntime::StepNOERROR()
pInst->nErr = 0L;
pInst->nErl = 0;
nError = 0L;
+ SbxErrObject::getUnoErrObject()->Clear();
bError = FALSE;
}
@@ -1132,6 +1135,9 @@ void SbiRuntime::StepNOERROR()
void SbiRuntime::StepLEAVE()
{
bRun = FALSE;
+ // If VBA and we are leaving an ErrorHandler then clear the error ( it's been processed )
+ if ( bInError && pError )
+ SbxErrObject::getUnoErrObject()->Clear();
}
void SbiRuntime::StepCHANNEL() // TOS = Kanalnummer
@@ -1265,6 +1271,9 @@ void SbiRuntime::StepERROR()
SbxVariableRef refCode = PopVar();
USHORT n = refCode->GetUShort();
SbError error = StarBASIC::GetSfxFromVBError( n );
- Error( error );
+ if ( bVBAEnabled )
+ pInst->Error( error );
+ else
+ Error( error );
}
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index 399257cf6ad3..c6f090048bf2 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -30,11 +30,13 @@
#include <stdlib.h>
#include <rtl/math.hxx>
+#include <basic/sbuno.hxx>
#include "runtime.hxx"
#include "sbintern.hxx"
#include "iosys.hxx"
#include "image.hxx"
#include "sbunoobj.hxx"
+#include "errobject.hxx"
bool checkUnoObjectType( SbUnoObject* refVal,
const String& aClass );
@@ -230,8 +232,6 @@ void SbiRuntime::StepRETURN( UINT32 nOp1 )
// FOR-Variable testen (+Endlabel)
-void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
-
void SbiRuntime::StepTESTFOR( UINT32 nOp1 )
{
if( !pForStk )
@@ -360,6 +360,7 @@ void SbiRuntime::StepERRHDL( UINT32 nOp1 )
pInst->nErr = 0;
pInst->nErl = 0;
nError = 0;
+ SbxErrObject::getUnoErrObject()->Clear();
}
// Resume nach Fehlern (+0=statement, 1=next or Label)
@@ -380,6 +381,8 @@ void SbiRuntime::StepRESUME( UINT32 nOp1 )
}
else
pCode = pErrStmnt;
+ if ( pError ) // current in error handler ( and got a Resume Next statment )
+ SbxErrObject::getUnoErrObject()->Clear();
if( nOp1 > 1 )
StepJUMP( nOp1 );
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 14c84420dad6..90e7cb4cb4d5 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -73,7 +73,6 @@
#include <cppuhelper/exc_hlp.hxx>
#include <basic/sbmod.hxx>
-
namespace basic
{
@@ -327,6 +326,7 @@ DBG_NAME( SfxLibraryContainer )
// Ctor
SfxLibraryContainer::SfxLibraryContainer( void )
: LibraryContainerHelper( maMutex )
+ , mbVBACompat( sal_False )
, maModifiable( *this, maMutex )
, maNameContainer( getCppuType( (Reference< XNameAccess >*) NULL ) )
, mbOldInfoFormat( sal_False )
@@ -2785,6 +2785,28 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
}
}
+::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
+{
+ return mbVBACompat;
+}
+
+void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
+{
+ BasicManager* pBasMgr = getBasicManager();
+ if( pBasMgr )
+ {
+ // get the standard library
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ if ( pBasMgr->GetName().Len() )
+ aLibName = pBasMgr->GetName();
+
+ StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
+ if( pBasic )
+ pBasic->SetVBAEnabled( _vbacompatmodeon );
+ }
+ mbVBACompat = _vbacompatmodeon;
+}
+
// Methods XServiceInfo
::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
throw (RuntimeException)
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 096d497a4c50..4185b6f9579c 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -942,7 +942,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
try {
xElementRootStorage = ::comphelper::OStorageHelper::GetStorageFromURL(
aElementPath,
- embed::ElementModes::READWRITE );
+ embed::ElementModes::READ );
} catch( uno::Exception& )
{
// TODO: error handling
@@ -1166,6 +1166,45 @@ bool SAL_CALL SfxScriptLibrary::isLibraryElementValid( ::com::sun::star::uno::An
return SfxScriptLibrary::containsValidModule( aElement );
}
+IMPLEMENT_FORWARD_XINTERFACE2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
+
+script::ModuleInfo SAL_CALL
+SfxScriptLibrary::getModuleInfo( const ::rtl::OUString& ModuleName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ if ( !hasModuleInfo( ModuleName ) )
+ throw NoSuchElementException();
+ return mModuleInfos[ ModuleName ];
+}
+
+sal_Bool SAL_CALL
+SfxScriptLibrary::hasModuleInfo( const ::rtl::OUString& ModuleName ) throw (RuntimeException)
+{
+ sal_Bool bRes = sal_False;
+ ModuleInfoMap::iterator it = mModuleInfos.find( ModuleName );
+
+ if ( it != mModuleInfos.end() )
+ bRes = sal_True;
+
+ return bRes;
+}
+
+void SAL_CALL SfxScriptLibrary::insertModuleInfo( const ::rtl::OUString& ModuleName, const script::ModuleInfo& ModuleInfo ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ if ( hasModuleInfo( ModuleName ) )
+ throw ElementExistException();
+ mModuleInfos[ ModuleName ] = ModuleInfo;
+}
+
+void SAL_CALL SfxScriptLibrary::removeModuleInfo( const ::rtl::OUString& ModuleName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ // #FIXME add NoSuchElementException to the spec
+ if ( !hasModuleInfo( ModuleName ) )
+ throw NoSuchElementException();
+ mModuleInfos.erase( mModuleInfos.find( ModuleName ) );
+}
+
+
//============================================================================
} // namespace basic
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.S b/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.S
new file mode 100644
index 000000000000..d5faf15eed6f
--- /dev/null
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.S
@@ -0,0 +1,38 @@
+@ ARM support code for OpenOffice C++/UNO bridging
+@
+@ Written by Peter Naulls <peter@chocky.org>
+@ Modified by Caolan McNamara <caolanm@redhat.com>
+@ Fixed by Michael Casadevall <mcasadevall@kubuntu.org>
+
+#ifdef __ARM_EABI__
+# define UNWIND
+#else
+# define UNWIND @
+#endif
+
+ .file "armhelper.s"
+ .text
+ .align 4
+ .global privateSnippetExecutor
+ .type privateSnippetExecutor, %function
+privateSnippetExecutor:
+ UNWIND .fnstart @ start of unwinder entry
+
+ stmfd sp!, {r0-r3} @ follow other parameters on stack
+ UNWIND .pad #16 @ throw this data away on exception
+ mov r0, ip @ r0 points to functionoffset/vtable
+ mov r1, sp @ r1 points to this and params
+ @ (see cppuno.cxx:codeSnippet())
+ stmfd sp!, {r4,lr} @ save return address
+ @ (r4 pushed to preserve stack alignment)
+ UNWIND .save {r4,lr} @ restore these regs on exception
+
+ bl cpp_vtable_call(PLT)
+
+ add sp, sp, #4 @ no need to restore r4 (we didn't touch it)
+ ldr pc, [sp], #20 @ return, discarding function arguments
+
+ UNWIND .fnend @ end of unwinder entry
+
+ .size privateSnippetExecutor, . - privateSnippetExecutor
+ .section .note.GNU-stack,"",%progbits
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s b/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s
deleted file mode 100644
index 8fd1a38e4f51..000000000000
--- a/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s
+++ /dev/null
@@ -1,22 +0,0 @@
-@ ARM support code for OpenOffice C++/UNO bridging
-@
-@ Written by Peter Naulls <peter@chocky.org>
-@ Modified by Caolan McNamara <caolanm@redhat.com>
- .file "armhelper.s"
- .text
- .align 4
- .global privateSnippetExecutor
- .type privateSnippetExecutor, %function
-privateSnippetExecutor:
- stmfd sp!, {r0-r3} @ follow other parameters on stack
- mov r0, ip @ r0 points to functionoffset/vtable
- mov ip, sp @ fix up the ip
- stmfd sp!, {fp,ip,lr,pc} @ 8 x 4 => stack remains 8 aligned
- sub fp, ip, #4 @ set frame pointer
-
- add r1, sp, #16 @ r1 points to this and params
- bl cpp_vtable_call(PLT)
-
- add sp, sp, #32 @ restore stack
- ldr fp, [sp, #-32] @ restore frame pointer
- ldr pc, [sp, #-24] @ return
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
index 98c213a53a83..0e801ab4433e 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
@@ -76,10 +76,8 @@ namespace
if (pReturnTypeDescr)
{
- if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
- {
+ if (!arm::return_in_hidden_param(pReturnTypeRef))
pUnoReturn = pRegisterReturn; // direct way for simple types
- }
else // complex return via ptr (pCppReturn)
{
pCppReturn = *(void **)pCppStack;
@@ -410,8 +408,30 @@ extern "C" sal_Int64 cpp_vtable_call( long *pFunctionAndOffset,
void **pCallStack )
{
sal_Int64 nRegReturn;
- cpp_mediate( pFunctionAndOffset[0], pFunctionAndOffset[1], pCallStack,
+ typelib_TypeClass aType = cpp_mediate( pFunctionAndOffset[0], pFunctionAndOffset[1], pCallStack,
&nRegReturn );
+
+ switch( aType )
+ {
+ case typelib_TypeClass_BOOLEAN:
+ case typelib_TypeClass_BYTE:
+ nRegReturn = (unsigned long)(*(unsigned char *)&nRegReturn);
+ break;
+ case typelib_TypeClass_CHAR:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ case typelib_TypeClass_SHORT:
+ nRegReturn = (unsigned long)(*(unsigned short *)&nRegReturn);
+ break;
+ case typelib_TypeClass_ENUM:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ case typelib_TypeClass_LONG:
+ nRegReturn = (unsigned long)(*(unsigned int *)&nRegReturn);
+ break;
+ case typelib_TypeClass_VOID:
+ default:
+ break;
+ }
+
return nRegReturn;
}
@@ -422,9 +442,9 @@ namespace
const int codeSnippetSize = 20;
unsigned char *codeSnippet(unsigned char* code, sal_Int32 functionIndex,
- sal_Int32 vtableOffset, bool simple_ret_type )
+ sal_Int32 vtableOffset, bool bHasHiddenParam)
{
- if (!simple_ret_type)
+ if (bHasHiddenParam)
functionIndex |= 0x80000000;
unsigned long * p = (unsigned long *)code;
@@ -478,24 +498,25 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
switch (member->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ {
+ typelib_InterfaceAttributeTypeDescription *pAttrTD =
+ reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( member );
+
// Getter:
(s++)->fn = code + writetoexecdiff;
code = codeSnippet(
code, functionOffset++, vtableOffset,
- bridges::cpp_uno::shared::isSimpleType(
- reinterpret_cast<
- typelib_InterfaceAttributeTypeDescription * >(
- member)->pAttributeTypeRef));
+ arm::return_in_hidden_param( pAttrTD->pAttributeTypeRef ));
+
// Setter:
- if (!reinterpret_cast<
- typelib_InterfaceAttributeTypeDescription * >(
- member)->bReadOnly)
+ if (!pAttrTD->bReadOnly)
{
(s++)->fn = code + writetoexecdiff;
code = codeSnippet(
- code, functionOffset++, vtableOffset, true);
+ code, functionOffset++, vtableOffset, false);
}
break;
+ }
case typelib_TypeClass_INTERFACE_METHOD:
{
(s++)->fn = code + writetoexecdiff;
@@ -504,11 +525,8 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
reinterpret_cast<
typelib_InterfaceMethodTypeDescription * >(member);
- bool issimple = bridges::cpp_uno::shared::isSimpleType(
- pMethodTD->pReturnTypeRef);
-
code = codeSnippet(code, functionOffset++, vtableOffset,
- issimple);
+ arm::return_in_hidden_param(pMethodTD->pReturnTypeRef));
break;
}
default:
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
index df717fe1f279..ec1e671a72ba 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
@@ -162,8 +162,8 @@ namespace CPPU_CURRENT_NAMESPACE
else
{
// try to lookup the symbol in the generated rtti map
- t_rtti_map::const_iterator iFind( m_generatedRttis.find( unoName ) );
- if (iFind == m_generatedRttis.end())
+ t_rtti_map::const_iterator iFind2( m_generatedRttis.find( unoName ) );
+ if (iFind2 == m_generatedRttis.end())
{
// we must generate it !
// symbol and rtti-name is nearly identical,
@@ -192,7 +192,7 @@ namespace CPPU_CURRENT_NAMESPACE
}
else // taking already generated rtti
{
- rtti = iFind->second;
+ rtti = iFind2->second;
}
}
}
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk b/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk
index 44c557795510..0900ec11f41f 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk
@@ -80,5 +80,5 @@ SHL1STDLIBS= \
.INCLUDE : target.mk
-$(SLO)$/%.obj: %.s
+$(SLO)$/%.obj: %.S
$(CXX) -c -o $(SLO)$/$(@:b).o $< -fPIC ; touch $@
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
index cfe220abaf17..fb72c360fd45 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
@@ -89,5 +89,12 @@ namespace CPPU_CURRENT_NAMESPACE
void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
+
+namespace arm
+{
+ enum armlimits { MAX_GPR_REGS = 4 };
+ bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
+}
+
#endif
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
index 154ae52027bb..be67ed8fd830 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
@@ -105,50 +105,94 @@ using namespace ::com::sun::star::uno;
namespace arm
{
- enum armlimits { MAX_GPR_REGS = 4 };
+ bool is_complex_struct(const typelib_TypeDescription * type)
+ {
+ const typelib_CompoundTypeDescription * p
+ = reinterpret_cast< const typelib_CompoundTypeDescription * >(type);
+ for (sal_Int32 i = 0; i < p->nMembers; ++i)
+ {
+ if (p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_STRUCT ||
+ p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_EXCEPTION)
+ {
+ typelib_TypeDescription * t = 0;
+ TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]);
+ bool b = is_complex_struct(t);
+ TYPELIB_DANGER_RELEASE(t);
+ if (b) {
+ return true;
+ }
+ }
+ else if (!bridges::cpp_uno::shared::isSimpleType(p->ppTypeRefs[i]->eTypeClass))
+ return true;
+ }
+ if (p->pBaseTypeDescription != 0)
+ return is_complex_struct(&p->pBaseTypeDescription->aBase);
+ return false;
+ }
+
+ bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef )
+ {
+ if (bridges::cpp_uno::shared::isSimpleType(pTypeRef))
+ return false;
+ else if (pTypeRef->eTypeClass == typelib_TypeClass_STRUCT || pTypeRef->eTypeClass == typelib_TypeClass_EXCEPTION)
+ {
+ typelib_TypeDescription * pTypeDescr = 0;
+ TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
+
+ //A Composite Type not larger than 4 bytes is returned in r0
+ bool bRet = pTypeDescr->nSize > 4 || is_complex_struct(pTypeDescr);
+
+ TYPELIB_DANGER_RELEASE( pTypeDescr );
+ return bRet;
+ }
+ return true;
+ }
}
-void MapReturn(long r0, long r1, typelib_TypeClass eReturnType, void *pRegisterReturn)
+void MapReturn(sal_uInt32 r0, sal_uInt32 r1, typelib_TypeDescriptionReference * pReturnType, sal_uInt32* pRegisterReturn)
{
#if !defined(__ARM_EABI__) && !defined(__SOFTFP__)
register float fret asm("f0");
register double dret asm("f0");
#endif
- switch( eReturnType )
+ switch( pReturnType->eTypeClass )
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
- ((long*)pRegisterReturn)[1] = r1;
+ pRegisterReturn[1] = r1;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
- ((long*)pRegisterReturn)[0] = r0;
- break;
case typelib_TypeClass_CHAR:
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
- *(unsigned short*)pRegisterReturn = (unsigned short)r0;
- break;
case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE:
- *(unsigned char*)pRegisterReturn = (unsigned char)r0;
+ pRegisterReturn[0] = r0;
break;
case typelib_TypeClass_FLOAT:
#if defined(__ARM_EABI__) || defined(__SOFTFP__)
- ((long*)pRegisterReturn)[0] = r0;
+ pRegisterReturn[0] = r0;
#else
*(float*)pRegisterReturn = fret;
#endif
break;
case typelib_TypeClass_DOUBLE:
#if defined(__ARM_EABI__) || defined(__SOFTFP__)
- ((long*)pRegisterReturn)[1] = r1;
- ((long*)pRegisterReturn)[0] = r0;
+ pRegisterReturn[1] = r1;
+ pRegisterReturn[0] = r0;
#else
*(double*)pRegisterReturn = dret;
#endif
break;
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_EXCEPTION:
+ {
+ if (!arm::return_in_hidden_param(pReturnType))
+ pRegisterReturn[0] = r0;
+ break;
+ }
default:
break;
}
@@ -162,7 +206,7 @@ void callVirtualMethod(
void * pThis,
sal_Int32 nVtableIndex,
void * pRegisterReturn,
- typelib_TypeClass eReturnType,
+ typelib_TypeDescriptionReference * pReturnType,
sal_uInt32 *pStack,
sal_uInt32 nStack,
sal_uInt32 *pGPR,
@@ -172,7 +216,7 @@ void callVirtualMethod(
void * pThis,
sal_Int32 nVtableIndex,
void * pRegisterReturn,
- typelib_TypeClass eReturnType,
+ typelib_TypeDescriptionReference * pReturnType,
sal_uInt32 *pStack,
sal_uInt32 nStack,
sal_uInt32 *pGPR,
@@ -201,23 +245,10 @@ void callVirtualMethod(
typedef void (*FunctionCall )( sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32);
FunctionCall pFunc = (FunctionCall)pMethod;
- // fill registers
- __asm__ __volatile__ (
- "ldr r0, [%0, #0]\n\t"
- "ldr r1, [%0, #4]\n\t"
- "ldr r2, [%0, #8]\n\t"
- "ldr r3, [%0, #12]\n\t"
- : : "r" (pGPR)
- : "r0", "r1", "r2", "r3"
- );
-
- // tell gcc that r0 to r3 are not available to it
- register sal_uInt32 r0 asm("r0");
- register sal_uInt32 r1 asm("r1");
- register sal_uInt32 r2 asm("r2");
- register sal_uInt32 r3 asm("r3");
-
- (*pFunc)(r0, r1, r2, r3);
+ (*pFunc)(pGPR[0], pGPR[1], pGPR[2], pGPR[3]);
+
+ sal_uInt32 r0;
+ sal_uInt32 r1;
// get return value
__asm__ __volatile__ (
@@ -225,7 +256,7 @@ void callVirtualMethod(
"mov %1, r1\n\t"
: "=r" (r0), "=r" (r1) : );
- MapReturn(r0, r1, eReturnType, pRegisterReturn);
+ MapReturn(r0, r1, pReturnType, (sal_uInt32*)pRegisterReturn);
}
}
@@ -312,14 +343,14 @@ static void cpp_call(
void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
bool bOverFlow = false;
-
+ bool bSimpleReturn = true;
if (pReturnTypeDescr)
{
+ if (arm::return_in_hidden_param( pReturnTypeRef ) )
+ bSimpleReturn = false;
- if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
- {
+ if (bSimpleReturn)
pCppReturn = pUnoReturn; // direct way for simple types
- }
else
{
// complex return via ptr
@@ -390,6 +421,8 @@ static void cpp_call(
case typelib_TypeClass_DOUBLE:
INSERT_DOUBLE( pCppArgs[nPos], nGPR, pGPR, pStack, pStackStart, bOverFlow );
break;
+ default:
+ break;
}
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
@@ -431,7 +464,7 @@ static void cpp_call(
{
callVirtualMethod(
pAdjustedThisPtr, aVtableSlot.index,
- pCppReturn, pReturnTypeDescr->eTypeClass,
+ pCppReturn, pReturnTypeRef,
pStackStart,
(pStack - pStackStart),
pGPR, nGPR);
@@ -504,15 +537,19 @@ void unoInterfaceProxyDispatch(
// is my surrogate
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
+#if OSL_DEBUG_LEVEL > 0
typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
+#endif
switch (pMemberDescr->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
+#if OSL_DEBUG_LEVEL > 0
// determine vtable call index
sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
+#endif
VtableSlot aVtableSlot(
getVtableSlot(
@@ -557,9 +594,11 @@ void unoInterfaceProxyDispatch(
}
case typelib_TypeClass_INTERFACE_METHOD:
{
+#if OSL_DEBUG_LEVEL > 0
// determine vtable call index
sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
+#endif
VtableSlot aVtableSlot(
getVtableSlot(
diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx
index ac9661c76ebc..e20440a3d30d 100644
--- a/comphelper/inc/comphelper/mediadescriptor.hxx
+++ b/comphelper/inc/comphelper/mediadescriptor.hxx
@@ -83,6 +83,7 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
static const ::rtl::OUString& PROP_FILTERNAME();
static const ::rtl::OUString& PROP_FILTEROPTIONS();
static const ::rtl::OUString& PROP_FORMAT();
+ static const ::rtl::OUString& PROP_FRAME();
static const ::rtl::OUString& PROP_FRAMENAME();
static const ::rtl::OUString& PROP_HIDDEN();
static const ::rtl::OUString& PROP_INPUTSTREAM();
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 7e3be338992b..1710a43027cf 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -183,6 +183,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_FORMAT()
return sProp;
}
+const ::rtl::OUString& MediaDescriptor::PROP_FRAME()
+{
+ static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Frame"));
+ return sProp;
+}
+
const ::rtl::OUString& MediaDescriptor::PROP_FRAMENAME()
{
static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FrameName"));
diff --git a/dbaccess/uiconfig/dbapp/menubar/menubar.xml b/dbaccess/uiconfig/dbapp/menubar/menubar.xml
index 629aa199f353..baafddcae8ad 100644
--- a/dbaccess/uiconfig/dbapp/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbapp/menubar/menubar.xml
@@ -59,10 +59,10 @@
<menu:menupopup>
<menu:menu menu:id=".uno:DBDatabaseObjectsMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:DBViewTables"/>
- <menu:menuitem menu:id=".uno:DBViewQueries"/>
- <menu:menuitem menu:id=".uno:DBViewForms"/>
- <menu:menuitem menu:id=".uno:DBViewReports"/>
+ <menu:menuitem menu:id=".uno:DBViewTables" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:DBViewQueries" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:DBViewForms" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:DBViewReports" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuseparator/>
@@ -70,9 +70,9 @@
<menu:menuitem menu:id=".uno:StatusBarVisible"/>
<menu:menu menu:id=".uno:DBPreview">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:DBDisablePreview"/>
- <menu:menuitem menu:id=".uno:DBShowDocInfoPreview"/>
- <menu:menuitem menu:id=".uno:DBShowDocPreview"/>
+ <menu:menuitem menu:id=".uno:DBDisablePreview" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:DBShowDocInfoPreview" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:DBShowDocPreview" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuseparator/>
diff --git a/vbahelper/inc/vbahelper/msvbahelper.hxx b/filter/inc/filter/msfilter/msvbahelper.hxx
index 898c44c349bc..540097c054dc 100644
--- a/vbahelper/inc/vbahelper/msvbahelper.hxx
+++ b/filter/inc/filter/msfilter/msvbahelper.hxx
@@ -28,11 +28,11 @@
#define _MSVBAHELPER_HXX
#include <sfx2/objsh.hxx>
-#include <vbahelper/vbadllapi.h>
+#include "filter/msfilter/msfilterdllapi.h"
namespace ooo { namespace vba
{
- class VBAHELPER_DLLPUBLIC VBAMacroResolvedInfo
+ class MSFILTER_DLLPUBLIC VBAMacroResolvedInfo
{
SfxObjectShell* mpDocContext;
bool mbFound;
@@ -47,9 +47,9 @@ namespace ooo { namespace vba
void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; }
};
- VBAHELPER_DLLPUBLIC String makeMacroURL( const String& sMacroName );
- VBAHELPER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false );
- VBAHELPER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
+ MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName );
+ MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false );
+ MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
} }
#endif
diff --git a/filter/inc/filter/msfilter/svxmsbas.hxx b/filter/inc/filter/msfilter/svxmsbas.hxx
index f488017e4804..716c6788989c 100644
--- a/filter/inc/filter/msfilter/svxmsbas.hxx
+++ b/filter/inc/filter/msfilter/svxmsbas.hxx
@@ -64,6 +64,9 @@ public:
// bit 1 = 1 -> the VBA - storage is copy to the ObjectShell storage
int Import( const String& rStorageName, const String &rSubStorageName,
BOOL bAsComment=TRUE, BOOL bStripped=TRUE );
+ int Import( const String& rStorageName, const String &rSubStorageName,
+ const std::vector< String >& codeNames,
+ BOOL bAsComment=TRUE, BOOL bStripped=TRUE );
// only for the export - copy or delete the saved VBA-macro-storage
// form the ObjectShell
@@ -84,6 +87,7 @@ private:
MSFILTER_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
const String &rSubStorageName,
+ const std::vector< String >& codeNames,
BOOL bAsComment, BOOL bStripped);
MSFILTER_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
const String &rSubStorageName);
diff --git a/filter/prj/build.lst b/filter/prj/build.lst
index b4be1c83e63e..bed99e401b7f 100644
--- a/filter/prj/build.lst
+++ b/filter/prj/build.lst
@@ -1,4 +1,4 @@
-fl filter : vbahelper l10n svtools unotools xmloff cppu tools cppuhelper sal svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt NULL
+fl filter : l10n svtools unotools xmloff cppu tools cppuhelper sal svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt NULL
fl filter usr1 - all fl_mkout NULL
fl filter\prj get - all fl_prj NULL
fl filter\inc nmake - all fl_inc NULL
diff --git a/filter/source/config/tools/merge/pyAltFCFGMerge b/filter/source/config/tools/merge/pyAltFCFGMerge
index faf9b9c34cb7..d9a974eb9fec 100755
--- a/filter/source/config/tools/merge/pyAltFCFGMerge
+++ b/filter/source/config/tools/merge/pyAltFCFGMerge
@@ -11,7 +11,7 @@
import sys, string, os.path
-CFGFILE = "../../../../transex3/source/filter/merge/FCFGMerge.cfg"
+CFGFILE = "../../../../l10ntools/source/filter/merge/FCFGMerge.cfg"
PROP_XMLVERSION = "xmlversion" # // <= global cfg file
PROP_XMLENCODING = "xmlencoding" # // <= global cfg file
diff --git a/filter/source/msfilter/makefile.mk b/filter/source/msfilter/makefile.mk
index 6056213ddecf..7780529b5580 100644
--- a/filter/source/msfilter/makefile.mk
+++ b/filter/source/msfilter/makefile.mk
@@ -51,7 +51,8 @@ SLOFILES= \
$(SLO)$/mscodec.obj \
$(SLO)$/msfiltertracer.obj \
$(SLO)$/svdfppt.obj \
- $(SLO)$/svxmsbas2.obj
+ $(SLO)$/svxmsbas2.obj \
+ $(SLO)$/msvbahelper.obj \
SHL1TARGET= msfilter$(DLLPOSTFIX)
SHL1IMPLIB= i$(TARGET)
@@ -59,7 +60,6 @@ SHL1OBJS= $(SLOFILES)
SHL1USE_EXPORTS=name
SHL1STDLIBS= \
$(EDITENGLIB) \
- $(VBAHELPERLIB) \
$(SVXCORELIB) \
$(SFX2LIB) \
$(XMLOFFLIB) \
diff --git a/vbahelper/source/vbahelper/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index f0d721529b2c..97529c22eae6 100644
--- a/vbahelper/source/vbahelper/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -24,9 +24,10 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
-#define VBAHELPER_DLLIMPLEMENTATION
-#include <vbahelper/msvbahelper.hxx>
+#include <filter/msfilter/msvbahelper.hxx>
#include <basic/sbx.hxx>
#include <basic/sbstar.hxx>
#include <basic/basmgr.hxx>
diff --git a/filter/source/msfilter/msvbasic.cxx b/filter/source/msfilter/msvbasic.cxx
index 91348043b75f..be8ee6bd30e5 100644
--- a/filter/source/msfilter/msvbasic.cxx
+++ b/filter/source/msfilter/msvbasic.cxx
@@ -38,6 +38,10 @@
#include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
#include "msvbasic.hxx"
+#include <com/sun/star/script/ModuleType.hpp>
+
+using namespace ::com::sun::star::script;
+
/*
A few urls which may in the future be of some use
http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
@@ -429,7 +433,7 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
*
*/
-ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
+ModType VBA_Impl::GetModuleType( const UniString& rModuleName )
{
ModuleTypeHash::iterator iter = mhModHash.find( rModuleName );
ModuleTypeHash::iterator iterEnd = mhModHash.end();
@@ -437,7 +441,7 @@ ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
{
return iter->second;
}
- return Unknown;
+ return ModuleType::UNKNOWN;
}
bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
@@ -480,7 +484,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
- mhModHash[ sThisDoc ] = Class;
+ mhModHash[ sThisDoc ] = ModuleType::CLASS;
while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
{
xub_StrLen index = tmp.Search( '=' );
@@ -490,14 +494,14 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
String value = tmp.Copy( index + 1 );
if ( key == sClass )
{
- mhModHash[ value ] = Class;
+ mhModHash[ value ] = ModuleType::CLASS;
OSL_TRACE("Module %s is of type Class",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
}
else if ( key == sBaseClass )
{
- mhModHash[ value ] = Form;
+ mhModHash[ value ] = ModuleType::FORM;
OSL_TRACE("Module %s is of type Form",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
@@ -510,14 +514,14 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
// value is of form <name>/&H<identifier>, strip the identifier
value.Erase( value.Search( '/' ) );
- mhModHash[ value ] = Document;
+ mhModHash[ value ] = ModuleType::DOCUMENT;
OSL_TRACE("Module %s is of type Document VBA",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
}
else if ( key == sModule )
{
- mhModHash[ value ] = Normal;
+ mhModHash[ value ] = ModuleType::NORMAL;
OSL_TRACE("Module %s is of type Normal VBA",
::rtl::OUStringToOString( value ,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
diff --git a/filter/source/msfilter/msvbasic.hxx b/filter/source/msfilter/msvbasic.hxx
index 5b361518c0f5..171671e8cd5c 100644
--- a/filter/source/msfilter/msvbasic.hxx
+++ b/filter/source/msfilter/msvbasic.hxx
@@ -30,16 +30,12 @@
#ifndef _MSVBASIC_HXX
#define _MSVBASIC_HXX
-#ifdef _SOLAR_H
#include <tools/solar.h>
-#endif
#include <tools/debug.hxx>
#include <sot/storage.hxx>
#include <tools/dynary.hxx>
-#ifndef __SGI_STL_VECTOR
#include <vector>
-#endif
-#include<map>
+#include <map>
/* class VBA:
* The VBA class provides a set of methods to handle Visual Basic For
@@ -63,13 +59,12 @@ DECLARE_DYNARRAY(StringArray,String *)
// #117718# define internal types to distinguish between
// module types, form, class & normal
// #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet
-enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
// #117718# define map to hold types of module
//
-
+typedef sal_Int32 ModType;
typedef ::std::map< UniString,
- ModuleType > ModuleTypeHash;
+ ModType > ModuleTypeHash;
class VBA_Impl
{
@@ -90,8 +85,7 @@ public:
void Output(int len, const sal_uInt8 *data);
//
// #117718# member map of module names to types of module
- ModuleType GetModuleType( const UniString& rModuleName );
-
+ ModType GetModuleType( const UniString& rModuleName );
std::vector<String> maReferences;
private:
struct VBAOffset_Impl
diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx
index e4305c2e4e65..55465850d8c8 100644
--- a/filter/source/msfilter/svxmsbas.cxx
+++ b/filter/source/msfilter/svxmsbas.cxx
@@ -50,6 +50,11 @@ using namespace com::sun::star::awt;
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
+
using namespace com::sun::star::container;
using namespace com::sun::star::script;
using namespace com::sun::star::uno;
@@ -58,12 +63,23 @@ using namespace com::sun::star;
using rtl::OUString;
+static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
+
+int SvxImportMSVBasic::Import( const String& rStorageName,
+ const String &rSubStorageName,
+ BOOL bAsComment, BOOL bStripped )
+{
+ std::vector< String > codeNames;
+ return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
+}
+
int SvxImportMSVBasic::Import( const String& rStorageName,
const String &rSubStorageName,
+ const std::vector< String >& codeNames,
BOOL bAsComment, BOOL bStripped )
{
int nRet = 0;
- if( bImport && ImportCode_Impl( rStorageName, rSubStorageName,
+ if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
bAsComment, bStripped ))
nRet |= 1;
@@ -225,6 +241,7 @@ BOOL SvxImportMSVBasic::CopyStorage_Impl( const String& rStorageName,
BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
const String &rSubStorageName,
+ const std::vector< String >& codeNames,
BOOL bAsComment, BOOL bStripped )
{
BOOL bRet = FALSE;
@@ -233,13 +250,18 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
{
SFX_APP()->EnterBasicCall();
Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
+ Reference<XVBACompat> xVBACompat( xLibContainer, UNO_QUERY );
+
+ if ( xVBACompat.is() && !bAsComment )
+ xVBACompat->setVBACompatModeOn( sal_True );
+
DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
UINT16 nStreamCount = aVBA.GetNoStreams();
Reference<XNameContainer> xLib;
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
if( xLibContainer.is() && nStreamCount )
{
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
if( !xLibContainer->hasByName( aLibName ) )
xLibContainer->createLibrary( aLibName );
@@ -248,6 +270,28 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
}
if( xLib.is() )
{
+ Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
+ Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
+ if ( !bAsComment )
+ {
+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
+ if ( xSF.is() )
+ {
+ try
+ {
+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
+ }
+ catch( Exception& ) { }
+ }
+ }
+ typedef std::hash_map< rtl::OUString, uno::Any, ::rtl::OUStringHash,
+::std::equal_to< ::rtl::OUString > > NameModuleDataHash;
+ typedef std::hash_map< rtl::OUString, script::ModuleInfo, ::rtl::OUStringHash,
+::std::equal_to< ::rtl::OUString > > NameModuleInfoHash;
+
+ NameModuleDataHash moduleData;
+ NameModuleInfoHash moduleInfos;
+
for( UINT16 i=0; i<nStreamCount;i++)
{
StringArray aDecompressed = aVBA.Decompress(i);
@@ -281,7 +325,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
// is the same as the encoding for the names
// that are keys in the map used by GetModuleType method
const String &sOrigVBAModName = aVBA.GetStreamName( i );
- ModuleType mType = aVBA.GetModuleType( sOrigVBAModName );
+ ModType mType = aVBA.GetModuleType( sOrigVBAModName );
rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
@@ -289,23 +333,23 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
switch( mType )
{
- case Class:
+ case ModuleType::CLASS:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
break;
- case Form:
+ case ModuleType::FORM:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
break;
- case Document:
+ case ModuleType::DOCUMENT:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
break;
- case Normal:
+ case ModuleType::NORMAL:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
break;
- case Unknown:
+ case ModuleType::UNKNOWN:
modeTypeComment = sClassRem +
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
break;
@@ -313,12 +357,11 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
break;
}
- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
if ( !bAsComment )
{
modeTypeComment = modeTypeComment + sVBAOption;
- if ( mType == Class )
+ if ( mType == ModuleType::CLASS )
modeTypeComment = modeTypeComment + sClassOption;
}
@@ -380,20 +423,69 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
aSource += rtl::OUString::createFromAscii("\nEnd Sub");
}
::rtl::OUString aModName( sModule );
- if ( aSource.getLength() )
- {
- aSource = modeTypeComment + aSource;
+ aSource = modeTypeComment + aSource;
- Any aSourceAny;
+ Any aSourceAny;
+ OSL_TRACE("erm %d", mType );
aSourceAny <<= aSource;
- if( xLib->hasByName( aModName ) )
- xLib->replaceByName( aModName, aSourceAny );
- else
- xLib->insertByName( aModName, aSourceAny );
+ if ( !bAsComment )
+ {
+ OSL_TRACE("vba processing %d", mType );
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = mType;
+ moduleInfos[ aModName ] = sModuleInfo;
+ }
+ moduleData[ aModName ] = aSourceAny;
+ }
+ // Hack for missing codenames ( only know to happen in excel but... )
+ // only makes sense to do this if we are importing non-commented basic
+ if ( !bAsComment )
+ {
+ for ( std::vector< String >::const_iterator it = codeNames.begin(); it != codeNames.end(); ++it )
+ {
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = ModuleType::DOCUMENT;
+ moduleInfos[ *it ] = sModuleInfo;
+ moduleData[ *it ] = uno::makeAny( sVBAOption );
+ }
+ }
+ NameModuleDataHash::iterator it_end = moduleData.end();
+ for ( NameModuleDataHash::iterator it = moduleData.begin(); it != it_end; ++it )
+ {
+ NameModuleInfoHash::iterator it_info = moduleInfos.find( it->first );
+ if ( it_info != moduleInfos.end() )
+ {
+ ModuleInfo& sModuleInfo = it_info->second;
+ if ( sModuleInfo.ModuleType == ModuleType::FORM )
+ // hack, the module ( imo document basic should...
+ // know the XModel... ) but it doesn't
+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
+ // document modules, we should be able to access
+ // the api objects at this time
+ else if ( sModuleInfo.ModuleType == ModuleType::DOCUMENT )
+ {
+ if ( xVBACodeNamedObjectAccess.is() )
+ {
+ try
+ {
+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( it->first ), uno::UNO_QUERY );
+ OSL_TRACE("** Straight up creation of Module");
+ }
+ catch(uno::Exception& e)
+ {
+ OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( it->first, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+ }
+ xVBAModuleInfo->insertModuleInfo( it->first, sModuleInfo );
}
- bRet = true;
+ if( xLib->hasByName( it->first ) )
+ xLib->replaceByName( it->first, it->second );
+ else
+ xLib->insertByName( it->first, it->second );
}
+ bRet = true;
}
SFX_APP()->LeaveBasicCall();
}
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index 9c8e68e24734..f2c905f237e8 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -344,6 +344,9 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
std::map< sal_Int16, ::rtl::OUString > LangTable;
const ::rtl::OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*"));
+ bool bMultipleLanguages = (eMode != MODE_SetLanguageSelectionMenu) || m_aCurLang.compareToAscii( "*" ) == 0;
+ bool bNothingSelected = true;
+ MenuItemBits nItemBits = !bMultipleLanguages ? MIB_RADIOCHECK : 0;
for(std::map< ::rtl::OUString, ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it)
{
if(it->first != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&&
@@ -351,12 +354,13 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
it->first.getLength())
{
++nItemId;
- pPopupMenu->InsertItem( nItemId,it->first);
+ pPopupMenu->InsertItem( nItemId,it->first,nItemBits );
LangTable[nItemId] = it->first;
if(it->first == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu )
{
//make a sign for the current language
pPopupMenu->CheckItem(nItemId,TRUE);
+ bNothingSelected = false;
}
aCmd=aCmd_Language;
aCmd+=(String)it->first;
@@ -366,7 +370,9 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup
//7--none
nItemId++;
- pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) );
+ pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )), nItemBits );
+ if (bNothingSelected && !bMultipleLanguages)
+ pPopupMenu->CheckItem(nItemId,TRUE);
aCmd=aCmd_Language;
aCmd+=String::CreateFromAscii("LANGUAGE_NONE");
pPopupMenu->SetItemCommand(nItemId,aCmd);
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 953470314785..544597261852 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -272,6 +272,9 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R
}
}
std::map< sal_Int16, ::rtl::OUString > LangTable;
+ bool bMultipleLanguages = m_aCurLang.compareToAscii( "*" ) == 0;
+ bool bNothingSelected = true;
+ sal_Int16 nMenuItemStyle = !bMultipleLanguages ? css::awt::MenuItemStyle::RADIOCHECK : 0;
for( std::set< ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it )
{
@@ -281,22 +284,26 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R
{
//nItemId = xPopupMenu->getItemCount()+1;
nItemId++;
- xPopupMenu->insertItem( nItemId, *it, css::awt::MenuItemStyle::RADIOCHECK, nItemId );
+ xPopupMenu->insertItem( nItemId, *it, nMenuItemStyle, nItemId );
LangTable[nItemId]=*it;
if( *it == m_aCurLang )
{
//make a sign for the current language
xPopupMenu->checkItem( nItemId, TRUE );
+ bNothingSelected = false;
}
}
}
//7--none
nItemId++;
- xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId );
+ xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), nMenuItemStyle, nItemId );
+ if (bNothingSelected && !bMultipleLanguages)
+ xPopupMenu->checkItem( nItemId, TRUE );
+
//More...
nItemId++;
- xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId );
+ xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), 0, nItemId );
for( ::std::set< ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it )
{
@@ -305,22 +312,22 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R
*it != ::rtl::OUString::createFromAscii( "" ))
{
nItemId++;
- subPopupMenu->insertItem( nItemId, *it, css::awt::MenuItemStyle::RADIOCHECK, nItemId );
+ subPopupMenu->insertItem( nItemId, *it, 0, nItemId );
LangTable[nItemId]=*it;
}
}
//7--none
nItemId++;
- subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId );
+ subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), 0, nItemId );
//More
nItemId++;
- subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId );
+ subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), 0, nItemId );
nItemId++;
xPopupMenu->insertSeparator(nItemId);
nItemId++;
- xPopupMenu->insertItem( nItemId, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), css::awt::MenuItemStyle::RADIOCHECK, nItemId );
+ xPopupMenu->insertItem( nItemId, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), 0, nItemId );
xPopupMenu->setPopupMenu( nItemId, subPopupMenu );
//display the popup menu and execute every command
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 9fbdf87336cc..9d8aa9205c90 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -548,11 +548,14 @@ throw ( RuntimeException )
if ( Event.State >>= bCheckmark )
{
- // Checkmark
+ // Checkmark or RadioButton
m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, TRUE );
m_pVCLMenu->CheckItem( pMenuItemHandler->nItemId, bCheckmark );
- m_pVCLMenu->SetItemBits( pMenuItemHandler->nItemId,
- m_pVCLMenu->GetItemBits( pMenuItemHandler->nItemId ) | MIB_CHECKABLE );
+
+ MenuItemBits nBits = m_pVCLMenu->GetItemBits( pMenuItemHandler->nItemId );
+ //If not already designated RadioButton set as CheckMark
+ if (!(nBits & MIB_RADIOCHECK))
+ m_pVCLMenu->SetItemBits( pMenuItemHandler->nItemId, nBits | MIB_CHECKABLE );
}
else if ( Event.State >>= aItemText )
{
@@ -1805,6 +1808,8 @@ void MenuBarManager::FillMenu(
nBits |= MIB_ICON;
if ( nStyle & ::com::sun::star::ui::ItemStyle::TEXT )
nBits |= MIB_TEXT;
+ if ( nStyle & ::com::sun::star::ui::ItemStyle::RADIO_CHECK )
+ nBits |= MIB_RADIOCHECK;
pMenu->SetItemBits( nId, nBits );
}
if ( xIndexContainer.is() )
diff --git a/framework/source/xml/menudocumenthandler.cxx b/framework/source/xml/menudocumenthandler.cxx
index 90f5fb25dec3..3fc5d1775be4 100644
--- a/framework/source/xml/menudocumenthandler.cxx
+++ b/framework/source/xml/menudocumenthandler.cxx
@@ -94,6 +94,7 @@
#define ATTRIBUTE_ITEMSTYLE_TEXT "text"
#define ATTRIBUTE_ITEMSTYLE_IMAGE "image"
+#define ATTRIBUTE_ITEMSTYLE_RADIO "radio"
// Property names of a menu/menu item ItemDescriptor
static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
@@ -134,6 +135,7 @@ struct MenuStyleItem
MenuStyleItem MenuItemStyles[ ] = {
{ ::com::sun::star::ui::ItemStyle::ICON, ATTRIBUTE_ITEMSTYLE_IMAGE },
{ ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT },
+ { ::com::sun::star::ui::ItemStyle::RADIO_CHECK, ATTRIBUTE_ITEMSTYLE_RADIO }
};
@@ -437,8 +439,10 @@ throw( SAXException, RuntimeException )
{
if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
- if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+ else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+ else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_RADIO ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::RADIO_CHECK;
}
}
while ( nIndex >= 0 );
@@ -670,8 +674,10 @@ throw( SAXException, RuntimeException )
{
if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
- if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+ else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+ else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_RADIO ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::RADIO_CHECK;
}
}
while ( nIndex >= 0 );
@@ -725,8 +731,10 @@ throw( SAXException, RuntimeException )
{
if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
- if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+ else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+ else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_RADIO ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::RADIO_CHECK;
}
}
while ( nIndex >= 0 );
diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst
index 5ce50111d519..30da95e51c97 100644
--- a/instsetoo_native/util/openoffice.lst
+++ b/instsetoo_native/util/openoffice.lst
@@ -213,7 +213,6 @@ OpenOffice_Dev
PACKAGEREVISION {milestone}
LICENSENAME LGPL
SERVICESPROJEKT 1
- WITHJREPRODUCT 1
GLOBALFILEGID gid_File_Lib_Vcl
GLOBALPATCHFILEGID gid_File_Txt_Patchfiles
SPELLCHECKERFILE spellchecker_selection.txt
@@ -565,7 +564,6 @@ BrOffice_Dev
PACKAGEREVISION {milestone}
LICENSENAME LGPL
SERVICESPROJEKT 1
- WITHJREPRODUCT 1
SETSTATICPATH 1
GLOBALFILEGID gid_File_Lib_Vcl
GLOBALPATCHFILEGID gid_File_Txt_Patchfiles
diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java
index 1245247c3c9a..2a49f964d48f 100644
--- a/l10ntools/source/help/HelpIndexerTool.java
+++ b/l10ntools/source/help/HelpIndexerTool.java
@@ -69,6 +69,7 @@ public class HelpIndexerTool
String aModule = "";
String aTargetZipFileStr = "";
String aCfsName = "";
+ String aSegmentName = "";
// Scan arguments
boolean bLang = false;
@@ -77,6 +78,7 @@ public class HelpIndexerTool
boolean bSrcDir = false;
boolean bOutput = false;
boolean bCfsName = false;
+ boolean bSegmentName = false;
int nArgCount = args.length;
for( int i = 0 ; i < nArgCount ; i++ )
@@ -126,7 +128,7 @@ public class HelpIndexerTool
}
i++;
}
- else if( "-checkcfsname".equals(args[i]) )
+ else if( "-checkcfsandsegname".equals(args[i]) )
{
if( i + 1 < nArgCount )
{
@@ -134,6 +136,17 @@ public class HelpIndexerTool
bCfsName = true;
}
i++;
+ if( i + 1 < nArgCount )
+ {
+ aSegmentName = "segments" + args[i + 1];
+ bSegmentName = true;
+ }
+ i++;
+ if (!(bCfsName && bSegmentName))
+ {
+ System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)");
+ System.exit( -1 );
+ }
}
}
@@ -173,12 +186,17 @@ public class HelpIndexerTool
writer.close();
boolean bCfsFileOk = true;
- if( bCfsName && !bExtensionMode && nRet != -1 )
+ boolean bSegmentFileOk = true;
+ if( bCfsName && bSegmentName && !bExtensionMode && nRet != -1 )
{
String aCompleteCfsFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aCfsName;
+ String aCompleteSegmentFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aSegmentName;
File aCfsFile = new File( aCompleteCfsFileName );
+ File aSegmentFile = new File( aCompleteSegmentFileName );
bCfsFileOk = aCfsFile.exists();
+ bSegmentFileOk = aSegmentFile.exists();
System.out.println( "Checking cfs file " + aCfsName+ ": " + (bCfsFileOk ? "Found" : "Not found") );
+ System.out.println( "Checking segment file " + aSegmentName+ ": " + (bSegmentFileOk ? "Found" : "Not found") );
}
if( bExtensionMode )
@@ -194,7 +212,7 @@ public class HelpIndexerTool
if( nRet == -1 )
deleteRecursively( aIndexDir );
- if( bCfsFileOk )
+ if( bCfsFileOk && bSegmentFileOk )
System.out.println( "Zipping ..." );
File aDirToZipFile = new File( aDirToZipStr );
createZipFile( aDirToZipFile, aTargetZipFileStr );
@@ -207,6 +225,12 @@ public class HelpIndexerTool
System.exit( -1 );
}
+ if( !bSegmentFileOk )
+ {
+ System.out.println( "segment file check failed, terminating..." );
+ System.exit( -1 );
+ }
+
Date end = new Date();
if( !bExtensionMode )
System.out.println(end.getTime() - start.getTime() + " total milliseconds");
diff --git a/moz/makefile.mk b/moz/makefile.mk
index 9629f7138b74..967e29688a7e 100644
--- a/moz/makefile.mk
+++ b/moz/makefile.mk
@@ -88,6 +88,10 @@ PATCH_FILES = \
patches/arm_build_fix.patch \
patches/link_fontconfig.patch
+.IF "$(OUTPATH)"=="unxlngi6"
+PATCH_FILES += patches/linux_libc2.5.patch
+.ENDIF
+
# This file is needed for the W32 build when BUILD_MOZAB is set
# (currently only vc8/vs2005 is supported when BUILD_MOZAB is set)
.IF "$(COM)"=="GCC"
diff --git a/moz/patches/linux_libc2.5.patch b/moz/patches/linux_libc2.5.patch
new file mode 100644
index 000000000000..b7f18141f457
--- /dev/null
+++ b/moz/patches/linux_libc2.5.patch
@@ -0,0 +1,11 @@
+--- misc/mozilla/configure 2010-04-14 18:08:55.402759185 +0200
++++ misc/build/mozilla/configure 2010-04-14 18:07:13.036410334 +0200
+@@ -11886,7 +11886,7 @@
+ $(DIST)/lib/$(LIB_PREFIX)nss'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\
+ $(DIST)/lib/$(LIB_PREFIX)softokn'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX)'
+ else
+- NSS_LIBS='-L$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lsoftokn$NSS_VERSION"
++ NSS_LIBS='-L$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
+ fi
+ fi
+
diff --git a/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl b/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl
index 56f5305d10f2..db69a6b5d842 100644
--- a/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl
+++ b/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl
@@ -38,6 +38,7 @@
//=============================================================================
/** If you do not want to implement the <type>XGridColumnModel</type> yourself, use this service.
+ @since OOo 3.3.0
*/
service DefaultGridColumnModel
{
diff --git a/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl b/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl
index e823e451249c..c487afc79b49 100644
--- a/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl
+++ b/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl
@@ -38,6 +38,8 @@
//=============================================================================
/** If you do not want to implement the <type>XGridDataModel</type> yourself, use this service.
+
+ @since OOo 3.3.0
*/
service DefaultGridDataModel
{
diff --git a/offapi/com/sun/star/awt/grid/GridColumn.idl b/offapi/com/sun/star/awt/grid/GridColumn.idl
index a38d6cafd903..a87aef84f7d3 100644
--- a/offapi/com/sun/star/awt/grid/GridColumn.idl
+++ b/offapi/com/sun/star/awt/grid/GridColumn.idl
@@ -38,6 +38,8 @@
//=============================================================================
/** Represents a column as used by the <type>DefaultGridColumnModel</type>
+
+ @since OOo 3.3.0
*/
service GridColumn
{
diff --git a/offapi/com/sun/star/awt/grid/GridColumnEvent.idl b/offapi/com/sun/star/awt/grid/GridColumnEvent.idl
index dfc6905d1148..caab721185a5 100644
--- a/offapi/com/sun/star/awt/grid/GridColumnEvent.idl
+++ b/offapi/com/sun/star/awt/grid/GridColumnEvent.idl
@@ -31,24 +31,14 @@
#include <com/sun/star/lang/EventObject.idl>
#endif
-#ifndef __com_sun_star_awt_grid_XGridColumn_idl__
-#include <com/sun/star/awt/grid/XGridColumn.idl>
-#endif
-
//=============================================================================
module com { module sun { module star { module awt { module grid {
//=============================================================================
+/** An event used by a <type>XGridColumn</type> to notify changes in the column.
-/** An event used by a <type>XGridColumnModel</type> to notify changes in the column
- model to the <type>XGridControl</type>.
- You usually need to fill this event only if you implement the <type>XGridColumnModel</type>
- yourself.
-
- @see XGridColumnModel
- @see XGridControl
- @see XGridColumnListener
+ @since OOo 3.3.0
*/
struct GridColumnEvent: com::sun::star::lang::EventObject
{
@@ -63,9 +53,6 @@ struct GridColumnEvent: com::sun::star::lang::EventObject
/** Contains the index of the changed column**/
long index;
-
- /** Contains the changed column**/
- XGridColumn column;
//-------------------------------------------------------------------------
};
diff --git a/offapi/com/sun/star/awt/grid/GridDataEvent.idl b/offapi/com/sun/star/awt/grid/GridDataEvent.idl
index 30d87a3f1c46..1e0afb610f16 100644
--- a/offapi/com/sun/star/awt/grid/GridDataEvent.idl
+++ b/offapi/com/sun/star/awt/grid/GridDataEvent.idl
@@ -27,10 +27,7 @@
#ifndef __com_sun_star_awt_grid_GridDataEvent_idl__
#define __com_sun_star_awt_grid_GridDataEvent_idl__
-#ifndef __com_sun_star_lang_EventObject_idl__
#include <com/sun/star/lang/EventObject.idl>
-#endif
-
//=============================================================================
@@ -46,6 +43,8 @@ module com { module sun { module star { module awt { module grid {
@see XGridDataModel
@see XGridControl
@see XGridDataListener
+
+ @sonce OOo 3.3.0
*/
struct GridDataEvent: com::sun::star::lang::EventObject
{
@@ -67,7 +66,7 @@ struct GridDataEvent: com::sun::star::lang::EventObject
string headerName;
/** Contains the changed row**/
- sequence<string> rowData;
+ sequence<any> rowData;
};
diff --git a/offapi/com/sun/star/awt/grid/GridInvalidDataException.idl b/offapi/com/sun/star/awt/grid/GridInvalidDataException.idl
new file mode 100644
index 000000000000..af1f90dfdc8b
--- /dev/null
+++ b/offapi/com/sun/star/awt/grid/GridInvalidDataException.idl
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: GridInvalidDataException.idl,v $
+ * $Revision: 1.0 $
+ *
+ * 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 __com_sun_star_awt_grid_GridInvalidDataException_idl__
+#define __com_sun_star_awt_grid_GridInvalidDataException_idl__
+
+#ifndef __com_sun_star_uno_RuntimeException_idl__
+#include <com/sun/star/uno/RuntimeException.idl>
+#endif
+
+
+//=============================================================================
+
+module com { module sun { module star { module awt { module grid {
+
+//=============================================================================
+
+/** Exception is thrown to indicate that set data is invalid, e.g. type of data is unknown
+ or data count doesn't match with column count.
+
+ @since OOo 3.3.0
+ */
+exception GridInvalidDataException : com::sun::star::uno::RuntimeException
+{
+
+};
+
+//=============================================================================
+
+}; }; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/awt/grid/GridInvalidModelException.idl b/offapi/com/sun/star/awt/grid/GridInvalidModelException.idl
new file mode 100644
index 000000000000..9d96daf624bb
--- /dev/null
+++ b/offapi/com/sun/star/awt/grid/GridInvalidModelException.idl
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: GridInvalidModelException.idl,v $
+ * $Revision: 1.0 $
+ *
+ * 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 __com_sun_star_awt_grid_GridInvalidModelException_idl__
+#define __com_sun_star_awt_grid_GridInvalidModelException_idl__
+
+#ifndef __com_sun_star_uno_RuntimeException_idl__
+#include <com/sun/star/uno/RuntimeException.idl>
+#endif
+
+
+//=============================================================================
+
+module com { module sun { module star { module awt { module grid {
+
+//=============================================================================
+
+/** Exception is thrown when data or column model isn't set.
+
+ @since OOo 3.3.0
+ */
+exception GridInvalidModelException : com::sun::star::uno::RuntimeException
+{
+
+};
+
+//=============================================================================
+
+}; }; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl b/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl
index 2475e59b5b26..e9b87c2fe7ed 100644
--- a/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl
+++ b/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl
@@ -50,14 +50,17 @@ struct GridSelectionEvent: com::sun::star::lang::EventObject
{
//-------------------------------------------------------------------------
- /** Contains the x coordinate of the selected cell**/
- long x;
+ /** the selected row*/
+ long Row;
- /** Contains the y coordinate of the selected cell**/
- long y;
+ /** the selected column*/
+ long Column;
+
+ /**number of selected rows, if multiple rows selected*/
+ long Range;
/** Contains the action <type>SelectionEventType</types> that was performed **/
- SelectionEventType action;
+ SelectionEventType Action;
};
diff --git a/offapi/com/sun/star/awt/grid/SelectionEventType.idl b/offapi/com/sun/star/awt/grid/SelectionEventType.idl
index 8096ceceeb13..c7ee61498cc3 100644
--- a/offapi/com/sun/star/awt/grid/SelectionEventType.idl
+++ b/offapi/com/sun/star/awt/grid/SelectionEventType.idl
@@ -49,7 +49,13 @@ enum SelectionEventType
/** This value indicates that a selection was removed from the grid control
*/
- REMOVE
+ REMOVE,
+
+ //-------------------------------------------------------------------------
+
+ /** This value indicates that a selection was changed
+ */
+ CHANGE
};
diff --git a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl
index 7de3eda02231..542c27085dcb 100644
--- a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl
+++ b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl
@@ -66,6 +66,7 @@
The <type>XGridSelection</type> interface provides a bunch of methods to set and get selection for the grid control.
</p>
+ @since OOo 3.3.0
*/
service UnoControlGrid
{
diff --git a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl
index bcb28af294b8..7eea49624045 100644
--- a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl
+++ b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl
@@ -37,6 +37,12 @@
#include <com/sun/star/view/SelectionType.idl>
+#include <com/sun/star/awt/FontDescriptor.idl>
+
+#include <com/sun/star/style/VerticalAlignment.idl>
+
+#include <com/sun/star/util/Color.idl>
+
//=============================================================================
module com { module sun { module star { module awt { module grid {
@@ -44,6 +50,8 @@ module com { module sun { module star { module awt { module grid {
//=============================================================================
/** specifies the standard model of a <type>UnoControlGridModel</type>.
+
+ @since OOo 3.3.0
*/
service UnoControlGridModel
{
@@ -84,11 +92,68 @@ service UnoControlGridModel
*/
[property] boolean VScroll;
+ /** Specifies that the control can be reached with the TAB key.
+ */
+ [property] boolean Tabstop;
+
/** Specifies the selection mode that is enabled for this grid control.
<p>The default value is <member scope="com::sun::star::view">SelectionType::SINGLE</member></p>
*/
[property] ::com::sun::star::view::SelectionType SelectionModel;
+ /** Specifies the background color of rows. If color for even rows is set, then specifies
+ the color of odd rows. Default value is white.
+ */
+ [property] ::com::sun::star::util::Color RowBackgroundColor;
+
+ /** Specifies the background color of even rows. Default value is white.
+ */
+ [property] ::com::sun::star::util::Color EvenRowBackgroundColor;
+
+ /** Specifies the background color of header. Default value is white.
+ */
+ [property] ::com::sun::star::util::Color HeaderBackgroundColor;
+
+ /** Specifies the text color. Default value is black.
+ */
+ [property] ::com::sun::star::util::Color TextColor;
+
+ /** Specifies the line color. Default value is white.
+ */
+ [property] ::com::sun::star::util::Color LineColor;
+
+ /** specifies the vertical alignment of the content in the control.
+
+ <pre>
+ TOP
+ MIDDLE
+ BOTTOM
+ </pre>
+ */
+ [property] com::sun::star::style::VerticalAlignment VerticalAlign;
+
+ /** specifies the font attributes of the text in the control.
+ */
+ [property] com::sun::star::awt::FontDescriptor FontDescriptor;
+
+ /** specifies the <type scope="com::sun::star::text">FontEmphasis</type>
+ value of the text in the control.
+ */
+ [property] short FontEmphasisMark;
+
+ /** specifies the <type scope="com::sun::star::text">FontRelief</type>
+ value of the text in the control.
+ */
+ [property] short FontRelief;
+
+ /** specifies the help text of the control.
+ */
+ [property] string HelpText;
+
+ /** specifies the help URL of the control.
+ */
+ [property] string HelpURL;
+
};
//=============================================================================
diff --git a/offapi/com/sun/star/awt/grid/XGridCell.idl b/offapi/com/sun/star/awt/grid/XGridCell.idl
index b64c40a3dce4..08f3cfd1b2d5 100644
--- a/offapi/com/sun/star/awt/grid/XGridCell.idl
+++ b/offapi/com/sun/star/awt/grid/XGridCell.idl
@@ -39,7 +39,7 @@ module com { module sun { module star { module awt { module grid {
//=============================================================================
-interface XGridCell: com::sun::star::uno::XInterface
+interface XGridCell
{
[attribute] string Value;
diff --git a/offapi/com/sun/star/awt/grid/XGridCellRenderer.idl b/offapi/com/sun/star/awt/grid/XGridCellRenderer.idl
index 825acd4af43a..7f9fa28c3307 100644
--- a/offapi/com/sun/star/awt/grid/XGridCellRenderer.idl
+++ b/offapi/com/sun/star/awt/grid/XGridCellRenderer.idl
@@ -37,10 +37,9 @@ module com { module sun { module star { module awt { module grid {
//=============================================================================
-/** gives access to the items of a list box and makes it possible to
- register item and action event listeners.
+/** renderer for cells
*/
-interface XGridCellRenderer: com::sun::star::uno::XInterface
+interface XGridCellRenderer
{
//-------------------------------------------------------------------------
diff --git a/offapi/com/sun/star/awt/grid/XGridColumn.idl b/offapi/com/sun/star/awt/grid/XGridColumn.idl
index 9c9981959ed3..d217ff5d4ac6 100644
--- a/offapi/com/sun/star/awt/grid/XGridColumn.idl
+++ b/offapi/com/sun/star/awt/grid/XGridColumn.idl
@@ -30,6 +30,9 @@
#ifndef __com_sun_star_uno_XInterface_idl__
#include <com/sun/star/uno/XInterface.idl>
#endif
+#include <com/sun/star/style/HorizontalAlignment.idl>
+#include <com/sun/star/awt/grid/XGridColumnListener.idl>
+
//=============================================================================
@@ -38,28 +41,67 @@ module com { module sun { module star { module awt { module grid {
//=============================================================================
/** The <type>XGridColumn</types> defines the properties and behavior of a column in a grid control
+ @since OOo 3.3.0
*/
-interface XGridColumn: com::sun::star::uno::XInterface
+interface XGridColumn
{
/** Specifies the an idendifier of the colomn.**/
[attribute] any Identifier;
/** Specifies the default column witdth. **/
[attribute] long ColumnWidth;
- /*
+
+ /** Specifies the preferred column witdth. **/
[attribute] long PreferredWidth;
+ /** Specifies the min column witdth. **/
[attribute] long MinWidth;
+ /** Specifies the max column witdth. **/
[attribute] long MaxWidth;
- [attribute] boolean Resizable;
- */
+ /** Specifies whether column has fixed size or not. **/
+ [attribute] boolean Resizeable;
+
+ /** Specifies the horizontal alignment of the content in the control.
+
+ <pre>
+ LEFT
+ CENTER
+ RIGHT
+ </pre>
+ */
+ [attribute] ::com::sun::star::style::HorizontalAlignment HorizontalAlign;
/** A title is displayed in the colum header row if <method>UnoControlGridModel::ShowRowHeader</method> is set to <true/>**/
[attribute] string Title;
+ /** Adds a listener for the <type>GridColumnEvent</type> posted after the grid changes.
+ @param Listener
+ the listener to add.
+ */
+ [oneway] void addColumnListener( [in] XGridColumnListener listener);
+ //-------------------------------------------------------------------------
+
+ /** Removes a listener previously added with <method>addColumnListener()</method>.
+ @param Listener
+ the listener to remove.
+ */
+ [oneway] void removeColumnListener( [in] XGridColumnListener listener);
+
+ /**Updates changed column widths, when column widths are being resized.
+ @param name
+ can be PrefWidth or ColWidth, depending on which was changed
+ @param width
+ the new column width
+ */
+ void updateColumn( [in] string name, [in] long width);
+ /**Sets column index
+ @param index
+ index, which is the index of the column in the column array of the column model
+ */
+ void setIndex( [in] long index );
};
//=============================================================================
diff --git a/offapi/com/sun/star/awt/grid/XGridColumnListener.idl b/offapi/com/sun/star/awt/grid/XGridColumnListener.idl
index a9a0e50a34ed..8a2d044f33d5 100644
--- a/offapi/com/sun/star/awt/grid/XGridColumnListener.idl
+++ b/offapi/com/sun/star/awt/grid/XGridColumnListener.idl
@@ -46,18 +46,20 @@ module com { module sun { module star { module awt { module grid {
<p>Usually you must not implement this interface yourself, but you must notify it correctly if
you implement the <type>XGridColumnModel</type> yourself</p>.
+
+ @since OOo 3.3.0
*/
-interface XGridColumnListener: com::sun::star::uno::XInterface
+interface XGridColumnListener
{
- /**
- Invoked after a column was added to the column model.
- */
- void columnAdded( [in] GridColumnEvent event );
-
- /**
- Invoked after a column was removed from the column model.
- */
- void columnRemoved( [in] GridColumnEvent event );
+ // /**
+ // Invoked after a column was added to the column model.
+ //*/
+ //void columnAdded( [in] GridColumnEvent event );
+ //
+ // /**
+ // Invoked after a column was removed from the column model.
+ //*/
+ //void columnRemoved( [in] GridColumnEvent event );
/**
Invoked after a column was modified.
diff --git a/offapi/com/sun/star/awt/grid/XGridColumnModel.idl b/offapi/com/sun/star/awt/grid/XGridColumnModel.idl
index 51f290fcef0e..86e77680cd95 100644
--- a/offapi/com/sun/star/awt/grid/XGridColumnModel.idl
+++ b/offapi/com/sun/star/awt/grid/XGridColumnModel.idl
@@ -30,6 +30,7 @@
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/awt/grid/XGridColumn.idl>
+
#include <com/sun/star/awt/grid/XGridColumnListener.idl>
//=============================================================================
@@ -42,12 +43,18 @@ module com { module sun { module star { module awt { module grid {
retrieve the column structure that is displayed in the actual control.
If you do not need your own model implementation, you can also use the <type>DefaultGridColumnModel</type>.
+
+ @since OOo 3.3.0
*/
-interface XGridColumnModel: com::sun::star::uno::XInterface
+interface XGridColumnModel
{
- /** Specifies whether column selection is allowed
+ ///** Specifies whether column selection is allowed
+ //*/
+ //[attribute] boolean ColumnSelectionAllowed;
+
+ /**Specifies the height of column header.
*/
- [attribute] boolean ColumnSelectionAllowed;
+ [attribute] long ColumnHeaderHeight;
/** Returns the number of columns.
@returns
@@ -81,29 +88,28 @@ interface XGridColumnModel: com::sun::star::uno::XInterface
/** Returns a specific column.
@param index
- the position of the reuquested column.
+ the position of the requested column.
@returns
the requested column.
*/
XGridColumn getColumn( [in] long index);
- /*
- long getTotalColumnWidth();
+ /** Sets default columns to the column model.
+ @param elements
+ the number of default columns that should be set.
*/
+ void setDefaultColumns([in] long elements);
- /** Adds a listener for the <type>GridColumnEvent</type> posted after the grid changes.
- @param Listener
- the listener to add.
+ /**Creates new XGridColumn with the settings of other column. To be used if the columns which are added to
+ the column model have the same settings.
+ @param column
+ the column, which is already created
*/
- [oneway] void addColumnListener( [in] XGridColumnListener listener);
-
- //-------------------------------------------------------------------------
+ XGridColumn copyColumn( [in] XGridColumn column );
- /** Removes a listener previously added with <method>addColumnListener()</method>.
- @param Listener
- the listener to remove.
+ /*
+ long getTotalColumnWidth();
*/
- [oneway] void removeColumnListener( [in] XGridColumnListener listener);
};
//=============================================================================
diff --git a/offapi/com/sun/star/awt/grid/XGridControl.idl b/offapi/com/sun/star/awt/grid/XGridControl.idl
index 05c49aa1669d..5019a571663b 100644
--- a/offapi/com/sun/star/awt/grid/XGridControl.idl
+++ b/offapi/com/sun/star/awt/grid/XGridControl.idl
@@ -41,30 +41,25 @@ module com { module sun { module star { module awt { module grid {
/** An interface to a control that displays a tabular data.
@see UnoControlGrid
+
+ @since OOo 3.3.0
*/
interface XGridControl: XGridSelection
{
- /** Specifies the <type>XGridColumnModel</type> of the control.
- */
- [attribute] XGridColumnModel ColumnModel;
-
- /** Specifies the <type>XGridDataModel</type> of the control.
- */
- [attribute] XGridDataModel DataModel;
-
-
/** Converting
*/
long getItemIndexAtPoint( [in] long x, [in] long y);
- /** registers a listener for mouse events.
- */
- //[oneway] void addMouseListener( [in] com::sun::star::awt::XMouseListener listener );
-
- /** unregisters a listener for mouse events.
- */
- //[oneway] void removeMouseListener( [in] com::sun::star::awt::XMouseListener listener );
+ /** Sets tooltip for row
+ @param textForTooltip
+ text, which will be shown as tooltip.
+ If only cell content should be displayed, leave sequence empty.
+ @param columnsForTooltip
+ column numbers, which define the cell content that should be shown in the tooltip.
+ If only text should be shown, leave this sequence empty.
+ */
+ void setToolTip( [in] sequence< string > textForTooltip, [in] sequence< long > columnsForTooltip);
};
diff --git a/offapi/com/sun/star/awt/grid/XGridControlListener.idl b/offapi/com/sun/star/awt/grid/XGridControlListener.idl
index ac703e8516ee..6f4fdf68ccd4 100644
--- a/offapi/com/sun/star/awt/grid/XGridControlListener.idl
+++ b/offapi/com/sun/star/awt/grid/XGridControlListener.idl
@@ -37,7 +37,7 @@ module com { module sun { module star { module awt { module grid {
//=============================================================================
-interface XGridControlListener: com::sun::star::uno::XInterface
+interface XGridControlListener
{
};
diff --git a/offapi/com/sun/star/awt/grid/XGridDataListener.idl b/offapi/com/sun/star/awt/grid/XGridDataListener.idl
index cee808a178f2..d6d0d930b331 100644
--- a/offapi/com/sun/star/awt/grid/XGridDataListener.idl
+++ b/offapi/com/sun/star/awt/grid/XGridDataListener.idl
@@ -46,6 +46,8 @@ module com { module sun { module star { module awt { module grid {
<p>Usually you must not implement this interface yourself, but you must notify it correctly if
you implement the <type>XGridDataModel</type> yourself</p>.
+
+ @since OOo 3.3.0
*/
interface XGridDataListener: com::sun::star::lang::XEventListener
{
diff --git a/offapi/com/sun/star/awt/grid/XGridDataModel.idl b/offapi/com/sun/star/awt/grid/XGridDataModel.idl
index f41841cf8039..5cc4085807e1 100644
--- a/offapi/com/sun/star/awt/grid/XGridDataModel.idl
+++ b/offapi/com/sun/star/awt/grid/XGridDataModel.idl
@@ -1,5 +1,6 @@
/*************************************************************************
*
+ * $Revision: 1.8 $
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -41,6 +42,8 @@ module com { module sun { module star { module awt { module grid {
retrieve the content data that is displayed in the actual control.
If you do not need your own model implementation, you can also use the <type>DefaultGridDataModel</type>.
+
+ @since OOo 3.3.0
*/
interface XGridDataModel: ::com::sun::star::lang::XComponent
{
@@ -54,7 +57,11 @@ interface XGridDataModel: ::com::sun::star::lang::XComponent
/** Returns the content of each row.
*/
- [attribute,readonly] sequence< sequence< string > > Data;
+ [attribute,readonly] sequence< sequence< any > > Data;
+
+ /**Specifies the width of row header.
+ */
+ [attribute] long RowHeaderWidth;
/** Returns the number of rows in in the model.
@returns
@@ -69,7 +76,7 @@ interface XGridDataModel: ::com::sun::star::lang::XComponent
@param data
the content of the row.
*/
- void addRow( [in] string headername, [in] sequence< string > data );
+ void addRow( [in] string headername, [in] sequence< any > data );
/** Removes a row from the model.
@@ -82,6 +89,26 @@ interface XGridDataModel: ::com::sun::star::lang::XComponent
*/
void removeAll();
+ /**Updates the content of a given cell.
+ @param row
+ the row index
+ @param column
+ the column index
+ @param value
+ the new value of the cell.
+ */
+ void updateCell([in] long row, [in] long column, [in] any value );
+
+ /**Updates the content of a given row.
+ @param row
+ the row index
+ @param columns
+ column indexes of the cells, which should be updated
+ @param value
+ the new values of the cells.
+ */
+ void updateRow([in] long row, [in] sequence< long > columns, [in] sequence< any > values);
+
//-------------------------------------------------------------------------
/** Adds a listener for the <type>GridDataEvent</type> posted after the grid changes.
diff --git a/offapi/com/sun/star/awt/grid/XGridSelection.idl b/offapi/com/sun/star/awt/grid/XGridSelection.idl
index ecb760cb3277..5049426018b0 100644
--- a/offapi/com/sun/star/awt/grid/XGridSelection.idl
+++ b/offapi/com/sun/star/awt/grid/XGridSelection.idl
@@ -39,7 +39,7 @@ module com { module sun { module star { module awt { module grid {
/** This interfaces provides access to the selection of row for <type>UnoControlGrid</type>.
*/
-interface XGridSelection: com::sun::star::uno::XInterface
+interface XGridSelection
{
/** Returns the lowest index of the selection.
@returns
@@ -53,21 +53,25 @@ interface XGridSelection: com::sun::star::uno::XInterface
*/
long getMaxSelectionIndex();
- /** Adds a selection intervall.
- @param start
- the start row index.
- @param length
- the number of rows to be selected.
+ /** Selects all rows.
*/
- [oneway] void insertIndexIntervall( [in] long start, [in] long length);
+ [oneway] void selectAllRows();
- /** Removes a selection intervall.
- @param start
- the start row index.
- @param length
- the number of rows to be selected.
+ /** Selects multiple rows. Previous selections will be removed.
+ @param rangeOfRows
+ array of rows indexes, which will be selected.
*/
- [oneway] void removeIndexIntervall( [in] long start, [in] long length);
+ [oneway] void selectRows( [in] sequence< long > rangeOfRows);
+
+ /** Deselects all selected rows.
+ */
+ [oneway] void deselectAllRows();
+
+ /** Deselects selected rows. Selected rows, which aren't in the range remain selected.
+ @param rangeOfRows
+ array of rows indexes, which will be deselected.
+ */
+ [oneway] void deselectRows( [in] sequence< long > rangeOfRows);
/** Returns the indicies of all selected rows.
@returns
@@ -90,17 +94,17 @@ interface XGridSelection: com::sun::star::uno::XInterface
boolean isSelectedIndex( [in] long index);
/** Marks a row as selected.
- @param
+ @param index
the index of a row.
*/
- [oneway] void selectRow( [in] long y);
+ [oneway] void selectRow( [in] long index);
/*
[oneway] void selectColumn( [in] long x);
*/
/** Adds a listener for the <type>GridSelectionEvent</type> posted after the grid changes.
- @param Listener
+ @param listener
the listener to add.
*/
[oneway] void addSelectionListener( [in] XGridSelectionListener listener);
@@ -108,7 +112,7 @@ interface XGridSelection: com::sun::star::uno::XInterface
//-------------------------------------------------------------------------
/** Removes a listener previously added with <method>addSelectionListener()</method>.
- @param Listener
+ @param listener
the listener to remove.
*/
[oneway] void removeSelectionListener( [in] XGridSelectionListener listener);
diff --git a/offapi/com/sun/star/awt/grid/makefile.mk b/offapi/com/sun/star/awt/grid/makefile.mk
index 3cfe6d83b3ba..02c159f8ffec 100644
--- a/offapi/com/sun/star/awt/grid/makefile.mk
+++ b/offapi/com/sun/star/awt/grid/makefile.mk
@@ -57,7 +57,9 @@ IDLFILES=\
ScrollBarMode.idl\
XGridControl.idl\
UnoControlGrid.idl\
- UnoControlGridModel.idl
+ UnoControlGridModel.idl\
+ GridInvalidDataException.idl\
+ GridInvalidModelException.idl
# ------------------------------------------------------------------
.INCLUDE : target.mk
diff --git a/offapi/com/sun/star/document/MediaDescriptor.idl b/offapi/com/sun/star/document/MediaDescriptor.idl
index 72690a45eccd..89a3141a443d 100644
--- a/offapi/com/sun/star/document/MediaDescriptor.idl
+++ b/offapi/com/sun/star/document/MediaDescriptor.idl
@@ -51,6 +51,10 @@
#include <com/sun/star/task/XStatusIndicator.idl>
#endif
+#ifndef __com_sun_star_frame_XFrame_idl__
+#include <com/sun/star/frame/XFrame.idl>
+#endif
+
//=============================================================================
module com { module sun { module star { module document {
@@ -594,6 +598,11 @@ published service MediaDescriptor
@since OOo 3.0
*/
[optional,property] string ViewControllerName;
+ //-------------------------------------------------------------------------
+
+ /** specifies the frame containing the document. May be empty.
+ */
+ [optional,property] com::sun::star::frame::XFrame Frame;
};
//=============================================================================
diff --git a/offapi/com/sun/star/script/ModuleInfo.idl b/offapi/com/sun/star/script/ModuleInfo.idl
new file mode 100644
index 000000000000..158ba387be6b
--- /dev/null
+++ b/offapi/com/sun/star/script/ModuleInfo.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ModuleInfo.idl,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_script_ModuleInfo_idl__
+#define __com_sun_star_script_ModuleInfo_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+//=============================================================================
+module com { module sun { module star { module script {
+struct ModuleInfo
+{
+ com::sun::star::uno::XInterface ModuleObject;
+ long ModuleType;
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/script/ModuleType.idl b/offapi/com/sun/star/script/ModuleType.idl
new file mode 100644
index 000000000000..a9bde042fa5a
--- /dev/null
+++ b/offapi/com/sun/star/script/ModuleType.idl
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ModuleType.idl,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_script_ModuleType_idl__
+#define __com_sun_star_script_ModuleType_idl__
+
+//=============================================================================
+
+module com { module sun { module star { module script {
+
+published constants ModuleType
+{
+ // ------------------------------------------------------------------------
+
+ const long UNKNOWN = 0;
+
+ // ------------------------------------------------------------------------
+
+ const long NORMAL = 1;
+
+ // ------------------------------------------------------------------------
+
+ const long CLASS = 2;
+
+ // ------------------------------------------------------------------------
+
+ const long FORM = 3;
+
+ // ------------------------------------------------------------------------
+
+ const long DOCUMENT = 4;
+
+ // ------------------------------------------------------------------------
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/script/XVBACompat.idl b/offapi/com/sun/star/script/XVBACompat.idl
new file mode 100644
index 000000000000..09da54eb27cd
--- /dev/null
+++ b/offapi/com/sun/star/script/XVBACompat.idl
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XLibraryContainer.idl,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_script_XVBACompat_idl__
+#define __com_sun_star_script_XVBACompat_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+//=============================================================================
+
+module com { module sun { module star { module script {
+
+interface XVBACompat: com::sun::star::uno::XInterface
+{
+
+//=============================================================================
+ [attribute ] boolean VBACompatModeOn;
+
+}; }; }; };
+};
+#endif
diff --git a/offapi/com/sun/star/script/XVBAModuleInfo.idl b/offapi/com/sun/star/script/XVBAModuleInfo.idl
new file mode 100644
index 000000000000..f9c4e64223c3
--- /dev/null
+++ b/offapi/com/sun/star/script/XVBAModuleInfo.idl
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XLibraryContainer.idl,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_script_XVBACompat_idl__
+#define __com_sun_star_script_XVBACompat_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+#ifndef __com_sun_star_script_ModuleInfo_idl__
+#include <com/sun/star/script/ModuleInfo.idl>
+#endif
+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+#endif
+#ifndef __com_sun_star_container_ElementExistException_idl__
+#include <com/sun/star/container/ElementExistException.idl>
+#endif
+#ifndef __com_sun_star_lang_WrappedTargetException_idl__
+#include <com/sun/star/lang/WrappedTargetException.idl>
+#endif
+#ifndef __com_sun_star_container_NoSuchElementException_idl__
+#include <com/sun/star/container/NoSuchElementException.idl>
+#endif
+
+//=============================================================================
+
+module com { module sun { module star { module script {
+
+interface XVBAModuleInfo: com::sun::star::uno::XInterface
+{
+
+ com::sun::star::script::ModuleInfo getModuleInfo( [in] string ModuleName )
+ raises( com::sun::star::container::NoSuchElementException,
+ com::sun::star::lang::WrappedTargetException );
+ boolean hasModuleInfo( [in] string ModuleName );
+ void insertModuleInfo( [in] string ModuleName,
+ [in] com::sun::star::script::ModuleInfo ModuleInfo )
+ raises( com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::container::ElementExistException,
+ com::sun::star::lang::WrappedTargetException );
+ void removeModuleInfo( [in] string ModuleName )
+ raises( com::sun::star::container::NoSuchElementException,
+ com::sun::star::lang::WrappedTargetException );
+}; }; }; };
+};
+#endif
diff --git a/offapi/com/sun/star/script/makefile.mk b/offapi/com/sun/star/script/makefile.mk
index 579174390ec4..b694a753f7d7 100644
--- a/offapi/com/sun/star/script/makefile.mk
+++ b/offapi/com/sun/star/script/makefile.mk
@@ -48,6 +48,10 @@ IDLFILES=\
XPersistentLibraryContainer.idl\
XStorageBasedLibraryContainer.idl\
ModuleSizeExceededRequest.idl\
+ XVBACompat.idl\
+ XVBAModuleInfo.idl\
+ ModuleInfo.idl\
+ ModuleType.idl\
# ------------------------------------------------------------------
diff --git a/officecfg/registry/data/org/openoffice/Office/SFX.xcu b/officecfg/registry/data/org/openoffice/Office/SFX.xcu
index 5a576588c974..1fbf093170cf 100644
--- a/officecfg/registry/data/org/openoffice/Office/SFX.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/SFX.xcu
@@ -30,27 +30,27 @@
<node oor:name="Help">
<prop oor:name="HelpAgentStarterList">
<value xml:lang="x-no-translate"></value>
- <value xml:lang="de">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="en-US">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="zh-CN">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="ja">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="zh-TW">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="el">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="es">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="pl">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="pt">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="ko">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="fr">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="ar">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="ru">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="nl">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="da">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="it">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="tr">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="sv">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="fi">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="pt-BR">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
- <value xml:lang="ca">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34119,34120,33368,10296,54946</value>
+ <value xml:lang="de">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="en-US">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="zh-CN">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="ja">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="zh-TW">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="el">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="es">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="pl">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="pt">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="ko">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="fr">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="ar">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="ru">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="nl">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="da">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="it">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="tr">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="sv">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="fi">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="pt-BR">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
+ <value xml:lang="ca">956368385,956368385,26220,26235,2567291937,2567291938,26272,26273,26063,957028378,26153,26312,958170133,958186547,958202951,26320,26321,956419588,956433419,26323,26324,20309,20308,20226,10371,27015,10087,10156,10350,27002,700810288,700810324,700730881,703778354,700777567,701124116,701124158,541248011,541249030,541249032,700763681,34023,957235721,3388501505,3388501506,3388501507,3388501508,3388501509,3388501510,10416,10297,5573,5573,5573,34099,34100,34101,34102,34104,34106,34107,34108,34109,34110,34112,34114,34115,34116,34117,34118,34120,33368,10296,54946</value>
</prop>
</node>
</oor:component-data>
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index 1a29a0d0c459..e4c063d161cf 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -61,10 +61,6 @@ interface XApplication : com::sun::star::uno::XInterface
[attribute, readonly] XWorksheet ActiveSheet;
[attribute, readonly] ooo::vba::XAssistant Assistant;
[attribute] long Calculation;
- //#TODO #FIXME this is more of a placeholder, will return
- // the value of activeworkbook, in xl 'ThisWorkbook' should return the
- // workbook in which the 'calling' macro is running. Should be possible
- // to determine this
[attribute, readonly] XWorkbook ThisWorkbook;
[attribute, readonly] string Name;
[attribute] boolean DisplayAlerts;
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index 2f66b7d0826f..3620c899de83 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -39,6 +39,9 @@
#include <com/sun/star/script/XInvocation.idl>
#endif
+#ifndef __com_sun_star_container_XNamed_idl__
+#include <com/sun/star/container/XNamed.idl>
+#endif
//=============================================================================
module ooo { module vba { module excel {
@@ -55,8 +58,8 @@ interface XWorksheet
{
interface ::ooo::vba::XHelperInterface;
interface ::com::sun::star::script::XInvocation;
+ interface ::com::sun::star::container::XNamed;
- [attribute] string Name;
[attribute] boolean Visible;
[attribute, readonly] long StandardHeight;
[attribute, readonly] long StandardWidth;
diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx
index b086538db73e..31e26d38f590 100644
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@ -49,6 +49,7 @@ namespace com { namespace sun { namespace star {
namespace frame { class XModel; }
namespace task { class XStatusIndicator; }
namespace task { class XInteractionHandler; }
+ namespace frame { class XFrame; }
namespace io { class XInputStream; }
namespace io { class XOutputStream; }
namespace io { class XStream; }
@@ -123,6 +124,10 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
getModelFactory() const;
+ /** Returns the frame that will contain the document model. */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
+ getTargetFrame() const;
+
/** Returns the status indicator (may be null). */
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >&
getStatusIndicator() const;
@@ -145,12 +150,12 @@ public:
@param rStorageName
The name of the embedded storage. The name may contain slashes to
open storages from embedded substorages.
- @param bCreate
+ @param bCreateMissing
True = create missing sub storages (for export filters).
*/
StorageRef openSubStorage(
const ::rtl::OUString& rStorageName,
- bool bCreate ) const;
+ bool bCreateMissing ) const;
/** Opens and returns the specified input stream from the base storage.
@@ -189,20 +194,6 @@ public:
/** Returns a helper for the handling of OLE obejcts. */
::oox::ole::OleObjectHelper& getOleObjectHelper() const;
- /** Returns information about the output device. */
- const ::com::sun::star::awt::DeviceInfo& getDeviceInfo() const;
- /** Converts the passed value from horizontal screen pixels to 1/100 mm. */
- sal_Int32 convertScreenPixelX( double fPixelX ) const;
- /** Converts the passed value from vertical screen pixels to 1/100 mm. */
- sal_Int32 convertScreenPixelY( double fPixelY ) const;
-
- /** Returns a system color specified by the passed XML token identifier. */
- sal_Int32 getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb = API_RGB_TRANSPARENT ) const;
- /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
- virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
- /** Derived classes may implement to resolve a palette index to an RGB color. */
- virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
-
/** Requests a password from the media descriptor or from the user. On
success, the password will be inserted into the media descriptor. */
::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const;
@@ -282,6 +273,10 @@ private:
void setMediaDescriptor(
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq );
+ /** Derived classes may create a specialized graphic helper, e.g. for
+ resolving palette colors. */
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+
virtual ::rtl::OUString implGetImplementationName() const = 0;
virtual StorageRef implCreateStorage(
diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
index e38311394046..0b5a7f6374a4 100644
--- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
+++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
@@ -2,14 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: chartdrawingfragment.hxx,v $
- *
- * $Revision: 1.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/oox/inc/oox/drawingml/color.hxx b/oox/inc/oox/drawingml/color.hxx
index 830959b77db9..51e9501205cf 100644
--- a/oox/inc/oox/drawingml/color.hxx
+++ b/oox/inc/oox/drawingml/color.hxx
@@ -35,7 +35,7 @@
#include <rtl/ustring.hxx>
#include "oox/helper/helper.hxx"
-namespace oox { namespace core { class FilterBase; } }
+namespace oox { class GraphicHelper; }
namespace oox {
namespace drawingml {
@@ -90,7 +90,7 @@ public:
bool isPlaceHolder() const { return meMode == COLOR_PH; }
/** Returns the final RGB color value.
@param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
- sal_Int32 getColor( const ::oox::core::FilterBase& rFilter, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+ sal_Int32 getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
/** Returns true, if the color has a transparence set. */
bool hasTransparence() const;
diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx
index 4e4b82cd5acd..44e91d6e797b 100644
--- a/oox/inc/oox/drawingml/customshapeproperties.hxx
+++ b/oox/inc/oox/drawingml/customshapeproperties.hxx
@@ -43,9 +43,7 @@
#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
-#ifndef __com_sun_star_beans_PropertyValues_hpp__
#include <com/sun/star/beans/PropertyValues.hpp>
-#endif
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/drawing/XShape.hpp>
@@ -69,8 +67,7 @@ public:
virtual ~CustomShapeProperties();
void apply( const CustomShapePropertiesPtr& );
- void pushToPropSet( const ::oox::core::FilterBase& rFilterBase,
- const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
+ void pushToPropSet( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape) const;
void setShapePresetType( const rtl::OUString& rShapePresetType ){ maShapePresetType = rShapePresetType; };
diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx
index be6561c970d3..42457e6f4dde 100644
--- a/oox/inc/oox/drawingml/fillproperties.hxx
+++ b/oox/inc/oox/drawingml/fillproperties.hxx
@@ -35,6 +35,7 @@
#include "oox/helper/helper.hxx"
namespace oox {
+ class GraphicHelper;
class ModelObjectHelper;
class PropertyMap;
class PropertySet;
@@ -156,8 +157,8 @@ struct FillProperties
/** Writes the properties to the passed property map. */
void pushToPropMap(
PropertyMap& rPropMap,
- const ::oox::core::FilterBase& rFilter,
ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper,
const FillPropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nShapeRotation = 0,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
@@ -165,8 +166,8 @@ struct FillProperties
/** Writes the properties to the passed property set. */
void pushToPropSet(
PropertySet& rPropSet,
- const ::oox::core::FilterBase& rFilter,
ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper,
const FillPropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nShapeRotation = 0,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
@@ -184,13 +185,13 @@ struct GraphicProperties
/** Writes the properties to the passed property map. */
void pushToPropMap(
PropertyMap& rPropMap,
- const ::oox::core::FilterBase& rFilter,
+ const GraphicHelper& rGraphicHelper,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
/** Writes the properties to the passed property set. */
void pushToPropSet(
PropertySet& rPropSet,
- const ::oox::core::FilterBase& rFilter,
+ const GraphicHelper& rGraphicHelper,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
diff --git a/oox/inc/oox/drawingml/lineproperties.hxx b/oox/inc/oox/drawingml/lineproperties.hxx
index 9a538db30156..0f034a89f65b 100644
--- a/oox/inc/oox/drawingml/lineproperties.hxx
+++ b/oox/inc/oox/drawingml/lineproperties.hxx
@@ -104,16 +104,16 @@ struct LineProperties
/** Writes the properties to the passed property map. */
void pushToPropMap(
PropertyMap& rPropMap,
- const ::oox::core::FilterBase& rFilter,
ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper,
const LinePropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
/** Writes the properties to the passed property map. */
void pushToPropSet(
PropertySet& rPropSet,
- const ::oox::core::FilterBase& rFilter,
ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper,
const LinePropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx
index 5a7e390d19a4..e9016fdf0b2b 100644
--- a/oox/inc/oox/dump/biffdumper.hxx
+++ b/oox/inc/oox/dump/biffdumper.hxx
@@ -217,7 +217,7 @@ protected:
void dumpDffClientRect();
void dumpEmbeddedDff();
- void dumpOcxControl();
+ void dumpControl();
private:
typedef ::boost::shared_ptr< BiffSharedData > BiffSharedDataRef;
@@ -242,7 +242,7 @@ void BiffObjectBase::writeRectItem( const String& rName,
Type nLeft, Type nTop, Type nWidth, Type nHeight,
const NameListWrapper& rListWrp, FormatType eFmtType )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( rName );
writeValueItem( "x-pos", nLeft, eFmtType, rListWrp );
writeValueItem( "y-pos", nTop, eFmtType, rListWrp );
@@ -508,6 +508,10 @@ protected:
const StorageRef& rxStrg,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rSysPath );
+
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const ::rtl::OUString& rSysFileName );
};
// ============================================================================
diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx
index ecca5751c16c..f65eeceebf27 100644
--- a/oox/inc/oox/dump/dumperbase.hxx
+++ b/oox/inc/oox/dump/dumperbase.hxx
@@ -61,6 +61,7 @@ namespace comphelper {
namespace oox {
class BinaryOutputStream;
+ class TextInputStream;
}
namespace oox { namespace core {
@@ -576,43 +577,41 @@ protected:
// ============================================================================
// ============================================================================
-typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream > ConfigInputStreamRef;
-
class ConfigItemBase
{
public:
virtual ~ConfigItemBase();
- void readConfigBlock( const ConfigInputStreamRef& rxStrm );
+ void readConfigBlock( TextInputStream& rStrm );
protected:
inline explicit ConfigItemBase() {}
virtual void implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rData );
virtual void implProcessConfigItemInt(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
sal_Int64 nKey,
const ::rtl::OUString& rData );
void readConfigBlockContents(
- const ConfigInputStreamRef& rxStrm );
+ TextInputStream& rStrm );
private:
enum LineType { LINETYPE_DATA, LINETYPE_END };
LineType readConfigLine(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
::rtl::OUString& orKey,
::rtl::OUString& orData ) const;
LineType readConfigLine(
- const ConfigInputStreamRef& rxStrm ) const;
+ TextInputStream& rStrm ) const;
void processConfigItem(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rData );
};
@@ -673,12 +672,12 @@ protected:
virtual bool implIsValid() const;
virtual void implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rData );
virtual void implProcessConfigItemInt(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
sal_Int64 nKey,
const ::rtl::OUString& rData );
@@ -721,7 +720,7 @@ public:
protected:
virtual void implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rData );
@@ -750,7 +749,7 @@ public:
protected:
virtual void implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rData );
@@ -777,7 +776,7 @@ public:
protected:
virtual void implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rData );
@@ -917,14 +916,14 @@ public:
protected:
virtual bool implIsValid() const;
virtual void implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm,
+ TextInputStream& rStrm,
const ::rtl::OUString& rKey,
const ::rtl::OUString& rData );
private:
bool readConfigFile( const ::rtl::OUString& rFileUrl );
template< typename ListType >
- void readNameList( const ConfigInputStreamRef& rxStrm, const ::rtl::OUString& rListName );
+ void readNameList( TextInputStream& rStrm, const ::rtl::OUString& rListName );
void createShortList( const ::rtl::OUString& rData );
void createUnitConverter( const ::rtl::OUString& rData );
@@ -960,11 +959,11 @@ template< typename ListType >
}
template< typename ListType >
-void SharedConfigData::readNameList( const ConfigInputStreamRef& rxStrm, const ::rtl::OUString& rListName )
+void SharedConfigData::readNameList( TextInputStream& rStrm, const ::rtl::OUString& rListName )
{
NameListRef xList = createNameList< ListType >( rListName );
if( xList.get() )
- xList->readConfigBlock( rxStrm );
+ xList->readConfigBlock( rStrm );
}
// ============================================================================
@@ -1182,7 +1181,7 @@ typedef ::boost::shared_ptr< Output > OutputRef;
class IndentGuard
{
public:
- inline explicit IndentGuard( Output& rOut ) : mrOut( rOut ) { mrOut.incIndent(); }
+ inline explicit IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
inline ~IndentGuard() { mrOut.decIndent(); }
private:
IndentGuard( const IndentGuard& );
@@ -1196,17 +1195,17 @@ private:
class TableGuard
{
public:
- inline explicit TableGuard( Output& rOut, sal_Int32 nW1 ) :
- mrOut( rOut ) { mrOut.startTable( nW1 ); }
- inline explicit TableGuard( Output& rOut, sal_Int32 nW1, sal_Int32 nW2 ) :
- mrOut( rOut ) { mrOut.startTable( nW1, nW2 ); }
- inline explicit TableGuard( Output& rOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3 ) :
- mrOut( rOut ) { mrOut.startTable( nW1, nW2, nW3 ); }
- inline explicit TableGuard( Output& rOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
- mrOut( rOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
- inline explicit TableGuard( Output& rOut, size_t nColCount,
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, size_t nColCount,
const sal_Int32* pnColWidths ) :
- mrOut( rOut ) { mrOut.startTable( nColCount, pnColWidths ); }
+ mrOut( *rxOut ) { mrOut.startTable( nColCount, pnColWidths ); }
inline ~TableGuard() { mrOut.endTable(); }
inline void tab() { mrOut.tab(); }
inline void tab( size_t nCol ) { mrOut.tab( nCol ); }
@@ -1222,8 +1221,8 @@ private:
class ItemGuard
{
public:
- inline explicit ItemGuard( Output& rOut, const String& rName = EMPTY_STRING ) :
- mrOut( rOut ) { mrOut.startItem( rName ); }
+ inline explicit ItemGuard( const OutputRef& rxOut, const String& rName = EMPTY_STRING ) :
+ mrOut( *rxOut ) { mrOut.startItem( rName ); }
inline ~ItemGuard() { mrOut.endItem(); }
inline void cont() { mrOut.contItem(); }
private:
@@ -1238,7 +1237,7 @@ private:
class MultiItemsGuard
{
public:
- inline explicit MultiItemsGuard( Output& rOut ) : mrOut( rOut ) { mrOut.startMultiItems(); }
+ inline explicit MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
inline ~MultiItemsGuard() { mrOut.endMultiItems(); }
private:
MultiItemsGuard( const MultiItemsGuard& );
@@ -1280,7 +1279,8 @@ class ObjectBase : public Base
public:
virtual ~ObjectBase();
- inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxConfig->getFactory(); }
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getFactory() const { return mxConfig->getFactory(); }
void dump();
@@ -1333,6 +1333,10 @@ protected:
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rSysPath );
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const ::rtl::OUString& rSysFileName );
+
void addPreferredStream( const String& rStrmName );
void addPreferredStorage( const String& rStrgPath );
@@ -1355,7 +1359,7 @@ private:
const StorageRef& rxStrg,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rItemName,
- const ::rtl::OUString& rSysOutPath,
+ const ::rtl::OUString& rSysPath,
bool bIsStrg, bool bIsStrm );
private:
@@ -1397,10 +1401,6 @@ protected:
// ------------------------------------------------------------------------
- inline Output& out() const { return *mxOut; }
-
- // ------------------------------------------------------------------------
-
void writeEmptyItem( const String& rName );
void writeInfoItem( const String& rName, const String& rData );
void writeCharItem( const String& rName, sal_Unicode cData );
@@ -1451,7 +1451,7 @@ protected:
template< typename Type >
void writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
-private:
+protected:
OutputRef mxOut;
};
@@ -1472,14 +1472,14 @@ void OutputObjectBase::addNameToItem( Type nData, const NameListWrapper& rListWr
template< typename Type >
void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeName( cfg(), nData, rListWrp );
}
template< typename Type >
void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeDec( nData );
addNameToItem( nData, rListWrp );
}
@@ -1487,7 +1487,7 @@ void OutputObjectBase::writeDecItem( const String& rName, Type nData, const Name
template< typename Type >
void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeHex( nData );
addNameToItem( nData, rListWrp );
}
@@ -1495,7 +1495,7 @@ void OutputObjectBase::writeHexItem( const String& rName, Type nData, const Name
template< typename Type >
void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeShortHex( nData );
addNameToItem( nData, rListWrp );
}
@@ -1503,7 +1503,7 @@ void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const
template< typename Type >
void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeBin( nData );
addNameToItem( nData, rListWrp );
}
@@ -1511,7 +1511,7 @@ void OutputObjectBase::writeBinItem( const String& rName, Type nData, const Name
template< typename Type >
void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeFix( nData );
addNameToItem( nData, rListWrp );
}
@@ -1519,7 +1519,7 @@ void OutputObjectBase::writeFixItem( const String& rName, Type nData, const Name
template< typename Type >
void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeDec( nData );
aItem.cont();
mxOut->writeBool( nData != 0 );
@@ -1533,7 +1533,7 @@ void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatTy
writeDecBoolItem( rName, nData, rListWrp );
else
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeValue( nData, eFmtType );
addNameToItem( nData, rListWrp );
}
@@ -1549,7 +1549,7 @@ void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData )
template< typename Type >
void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeDec( nData1 );
mxOut->writeChar( cSep );
mxOut->writeDec( nData2 );
@@ -1558,7 +1558,7 @@ void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type
template< typename Type >
void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeHex( nData1 );
mxOut->writeChar( cSep );
mxOut->writeHex( nData2 );
@@ -1586,7 +1586,6 @@ protected:
// ------------------------------------------------------------------------
- inline BinaryInputStream& in() const { return *mxStrm; }
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
getXInputStream() const;
@@ -1655,7 +1654,7 @@ protected:
template< typename Type >
void dumpHexPair( const String& rName, sal_Unicode cSep = ',' );
-private:
+protected:
BinaryInputStreamRef mxStrm;
};
@@ -1822,16 +1821,12 @@ public:
rtl_TextEncoding eTextEnc );
protected:
+ virtual bool implIsValid() const;
virtual void implDump();
virtual void implDumpLine( const ::rtl::OUString& rLine, sal_uInt32 nLine );
private:
- bool readCharLine( ::rtl::OUString& orLine, sal_Unicode& orcNextLineChar );
- bool readUcs2Line( ::rtl::OUString& orLine, sal_Unicode& orcNextLineChar );
- bool readLine( ::rtl::OUString& orLine, sal_Unicode& orcNextLineChar );
-
-private:
- rtl_TextEncoding meTextEnc;
+ ::boost::shared_ptr< TextInputStream > mxTextStrm;
};
// ============================================================================
diff --git a/oox/inc/oox/dump/oledumper.hxx b/oox/inc/oox/dump/oledumper.hxx
index 539ca2a412d1..a0e9cd55e337 100644
--- a/oox/inc/oox/dump/oledumper.hxx
+++ b/oox/inc/oox/dump/oledumper.hxx
@@ -43,7 +43,26 @@ namespace dump {
// ============================================================================
// ============================================================================
-class StdFontObject : public InputObjectBase
+class OleInputObjectBase : public InputObjectBase
+{
+protected:
+ inline explicit OleInputObjectBase() {}
+
+ ::rtl::OUString dumpAnsiString32( const String& rName );
+ ::rtl::OUString dumpUniString32( const String& rName );
+
+ sal_Int32 dumpStdClipboardFormat( const String& rName = EMPTY_STRING );
+ ::rtl::OUString dumpAnsiString32OrStdClip( const String& rName );
+ ::rtl::OUString dumpUniString32OrStdClip( const String& rName );
+
+ void writeOleColorItem( const String& rName, sal_uInt32 nColor );
+ sal_uInt32 dumpOleColor( const String& rName );
+};
+
+// ============================================================================
+// ============================================================================
+
+class StdFontObject : public OleInputObjectBase
{
public:
explicit StdFontObject( const InputObjectBase& rParent );
@@ -54,7 +73,7 @@ protected:
// ============================================================================
-class StdPicObject : public InputObjectBase
+class StdPicObject : public OleInputObjectBase
{
public:
explicit StdPicObject( const InputObjectBase& rParent );
@@ -65,7 +84,7 @@ protected:
// ============================================================================
-class StdHlinkObject : public InputObjectBase
+class StdHlinkObject : public OleInputObjectBase
{
public:
explicit StdHlinkObject( const InputObjectBase& rParent );
@@ -87,7 +106,27 @@ private:
// ============================================================================
// ============================================================================
-class OlePropertyStreamObject : public BinaryStreamObject
+class OleStreamObject : public OleInputObjectBase
+{
+public:
+ explicit OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class OleCompObjObject : public OleStreamObject
+{
+public:
+ explicit OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OlePropertyStreamObject : public InputObjectBase
{
public:
explicit OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
@@ -146,35 +185,140 @@ protected:
// ============================================================================
// ============================================================================
-struct OcxFormSiteInfo
+class ComCtlObjectBase : public OleInputObjectBase
{
- ::rtl::OUString maProgId;
- sal_Int32 mnId;
- sal_uInt32 mnLength;
- bool mbInStream;
+protected:
+ explicit ComCtlObjectBase(
+ const InputObjectBase& rParent,
+ sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual void implDump();
+ virtual void implDumpProperties() = 0;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+
+private:
+ bool dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor = SAL_MAX_UINT16, sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+ bool dumpComCtlSize();
+ bool dumpComCtlData( sal_uInt32& ornCommonPartSize );
+ bool dumpComCtlCommon( sal_uInt32 nPartSize );
+ bool dumpComCtlComplex();
- inline explicit OcxFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
+protected:
+ sal_uInt32 mnDataId5;
+ sal_uInt32 mnDataId6;
+ sal_uInt16 mnVersion;
+ bool mbCommonPart;
+ bool mbComplexPart;
};
-typedef ::std::vector< OcxFormSiteInfo > OcxFormSiteInfoVector;
+// ============================================================================
-// ----------------------------------------------------------------------------
+class ComCtlScrollBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
-struct OcxFormSharedData
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlProgressBarObject : public ComCtlObjectBase
{
- OUStringVector maClassInfoProgIds;
- OcxFormSiteInfoVector maSiteInfos;
+public:
+ explicit ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlSliderObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
};
// ============================================================================
+
+class ComCtlUpDownObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
// ============================================================================
-class OcxPropertyObjectBase : public InputObjectBase
+class ComCtlImageListObject : public ComCtlObjectBase
{
+public:
+ explicit ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
protected:
- inline explicit OcxPropertyObjectBase() {}
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
+
+// ============================================================================
+
+class ComCtlTabStripObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+};
+
+// ============================================================================
+
+class ComCtlTreeViewObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+
+private:
+ sal_uInt32 mnStringFlags;
+};
+
+// ============================================================================
+
+class ComCtlStatusBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
- using InputObjectBase::construct;
+// ============================================================================
+// ============================================================================
+
+class AxPropertyObjectBase : public OleInputObjectBase
+{
+protected:
+ inline explicit AxPropertyObjectBase() {}
+
+ using OleInputObjectBase::construct;
void construct(
const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm,
@@ -213,19 +357,19 @@ protected:
inline bool dumpBoolProperty() { return startNextProperty(); }
inline sal_Int32 dumpHmmProperty() { return dumpDecProperty< sal_Int32 >( 0, "CONV-HMM-TO-CM" ); }
- inline sal_uInt8 dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OCX-MOUSEPTR" ); }
+ inline sal_uInt8 dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OLE-MOUSEPTR" ); }
template< typename Type >
- inline Type dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "OCX-BORDERSTYLE" ); }
+ inline Type dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-BORDERSTYLE" ); }
template< typename Type >
- inline Type dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "OCX-SPECIALEFFECT" ); }
- inline sal_uInt32 dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "OCX-ENABLED" ); }
- inline sal_Int32 dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "OCX-ORIENTATION" ); }
- inline sal_Int32 dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "OCX-CONV-MS" ); }
- inline sal_uInt32 dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "OCX-IMAGEPOS" ); }
- inline sal_uInt8 dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OCX-IMAGESIZEMODE" ); }
- inline sal_uInt8 dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "OCX-IMAGEALIGN" ); }
-
- sal_uInt32 dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList = "OCX-FLAGS" );
+ inline Type dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-SPECIALEFFECT" ); }
+ inline sal_uInt32 dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "AX-ENABLED" ); }
+ inline sal_Int32 dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "AX-ORIENTATION" ); }
+ inline sal_Int32 dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "AX-CONV-MS" ); }
+ inline sal_uInt32 dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "AX-IMAGEPOS" ); }
+ inline sal_uInt8 dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "AX-IMAGESIZEMODE" ); }
+ inline sal_uInt8 dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "AX-IMAGEALIGN" ); }
+
+ sal_uInt32 dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList = "AX-FLAGS" );
sal_uInt32 dumpColorProperty( sal_uInt32 nDefault );
sal_Unicode dumpUnicodeProperty();
void dumpUnknownProperty();
@@ -241,7 +385,7 @@ protected:
void dumpToPosition( sal_Int64 nPos );
private:
- void constructOcxPropObj( const String& rPropNameList, bool b64BitPropFlags );
+ void constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags );
void dumpVersion();
::rtl::OUString dumpString( const String& rName, sal_uInt32 nSize, bool bArray );
@@ -285,13 +429,13 @@ private:
// ----------------------------------------------------------------------------
template< typename Type >
-void OcxPropertyObjectBase::alignInput()
+void AxPropertyObjectBase::alignInput()
{
- in().skip( (sizeof( Type ) - ((in().tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
+ mxStrm->skip( (sizeof( Type ) - ((mxStrm->tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
}
template< typename Type >
-Type OcxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
+Type AxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
{
if( startNextProperty() )
{
@@ -302,7 +446,7 @@ Type OcxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrappe
}
template< typename Type >
-Type OcxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
+Type AxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
{
if( startNextProperty() )
{
@@ -314,10 +458,10 @@ Type OcxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrappe
// ============================================================================
-class OcxCFontNewObject : public OcxPropertyObjectBase
+class AxCFontNewObject : public AxPropertyObjectBase
{
public:
- explicit OcxCFontNewObject( const InputObjectBase& rParent );
+ explicit AxCFontNewObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -325,10 +469,10 @@ protected:
// ============================================================================
-class OcxColumnInfoObject : public OcxPropertyObjectBase
+class AxColumnInfoObject : public AxPropertyObjectBase
{
public:
- explicit OcxColumnInfoObject( const InputObjectBase& rParent );
+ explicit AxColumnInfoObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -336,10 +480,10 @@ protected:
// ============================================================================
-class OcxCommandButtonObject : public OcxPropertyObjectBase
+class AxCommandButtonObject : public AxPropertyObjectBase
{
public:
- explicit OcxCommandButtonObject( const InputObjectBase& rParent );
+ explicit AxCommandButtonObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -348,10 +492,10 @@ protected:
// ============================================================================
-class OcxMorphControlObject : public OcxPropertyObjectBase
+class AxMorphControlObject : public AxPropertyObjectBase
{
public:
- explicit OcxMorphControlObject( const InputObjectBase& rParent );
+ explicit AxMorphControlObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -367,10 +511,10 @@ private:
// ============================================================================
-class OcxLabelObject : public OcxPropertyObjectBase
+class AxLabelObject : public AxPropertyObjectBase
{
public:
- explicit OcxLabelObject( const InputObjectBase& rParent );
+ explicit AxLabelObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -379,10 +523,10 @@ protected:
// ============================================================================
-class OcxImageObject : public OcxPropertyObjectBase
+class AxImageObject : public AxPropertyObjectBase
{
public:
- explicit OcxImageObject( const InputObjectBase& rParent );
+ explicit AxImageObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -390,10 +534,10 @@ protected:
// ============================================================================
-class OcxScrollBarObject : public OcxPropertyObjectBase
+class AxScrollBarObject : public AxPropertyObjectBase
{
public:
- explicit OcxScrollBarObject( const InputObjectBase& rParent );
+ explicit AxScrollBarObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -401,10 +545,10 @@ protected:
// ============================================================================
-class OcxSpinButtonObject : public OcxPropertyObjectBase
+class AxSpinButtonObject : public AxPropertyObjectBase
{
public:
- explicit OcxSpinButtonObject( const InputObjectBase& rParent );
+ explicit AxSpinButtonObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -412,10 +556,10 @@ protected:
// ============================================================================
-class OcxTabStripObject : public OcxPropertyObjectBase
+class AxTabStripObject : public AxPropertyObjectBase
{
public:
- explicit OcxTabStripObject( const InputObjectBase& rParent );
+ explicit AxTabStripObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
@@ -426,181 +570,188 @@ private:
};
// ============================================================================
+// ============================================================================
-class OcxControlObject : public InputObjectBase
+class FormControlStreamObject : public OleInputObjectBase
{
public:
- explicit OcxControlObject(
- const InputObjectBase& rParent,
- const ::rtl::OUString& rProgId,
- sal_Int64 nLength );
+ explicit FormControlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const ::rtl::OUString& rSysFileName,
+ const ::rtl::OUString* pProgId = 0 );
+ explicit FormControlStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const ::rtl::OUString* pProgId = 0 );
protected:
virtual void implDump();
private:
+ void constructFormCtrlStrmObj( const ::rtl::OUString* pProgId );
+
+private:
::rtl::OUString maProgId;
- sal_Int64 mnLength;
+ bool mbReadGuid;
};
// ============================================================================
+// ============================================================================
-class OcxGuidControlObject : public InputObjectBase
+struct VbaFormSiteInfo
{
-public:
- explicit OcxGuidControlObject(
- const InputObjectBase& rParent,
- sal_Int64 nLength );
- explicit OcxGuidControlObject(
- const OutputObjectBase& rParent,
- const BinaryInputStreamRef& rxStrm );
- explicit OcxGuidControlObject(
- const ObjectBase& rParent,
- const BinaryInputStreamRef& rxStrm,
- const ::rtl::OUString& rSysFileName );
+ ::rtl::OUString maProgId;
+ sal_Int32 mnId;
+ sal_uInt32 mnLength;
+ bool mbInStream;
-protected:
- virtual void implDump();
+ inline explicit VbaFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
+};
-private:
- sal_Int64 mnLength;
+typedef ::std::vector< VbaFormSiteInfo > VbaFormSiteInfoVector;
+
+// ============================================================================
+
+struct VbaFormSharedData
+{
+ OUStringVector maClassInfoProgIds;
+ VbaFormSiteInfoVector maSiteInfos;
};
// ============================================================================
-class OcxControlsStreamObject : public InputObjectBase
+class VbaFormClassInfoObject : public AxPropertyObjectBase
{
public:
- explicit OcxControlsStreamObject(
- const ObjectBase& rParent,
- const BinaryInputStreamRef& rxStrm,
- const ::rtl::OUString& rSysFileName,
- OcxFormSharedData& rFormData );
+ explicit VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
protected:
- virtual void implDump();
+ virtual void implDumpShortProperties();
private:
- OcxFormSharedData& mrFormData;
+ VbaFormSharedData& mrFormData;
};
// ============================================================================
-// ============================================================================
-class OcxPageObject : public OcxPropertyObjectBase
+class VbaFormSiteObject : public AxPropertyObjectBase
{
public:
- explicit OcxPageObject( const InputObjectBase& rParent );
+ explicit VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
protected:
virtual void implDumpShortProperties();
+
+private:
+ VbaFormSharedData& mrFormData;
};
// ============================================================================
-class OcxMultiPageObject : public OcxPropertyObjectBase
+class VbaFormDesignExtObject : public AxPropertyObjectBase
{
public:
- explicit OcxMultiPageObject( const InputObjectBase& rParent );
+ explicit VbaFormDesignExtObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
- virtual void implDumpExtended();
-
-private:
- sal_Int32 mnPageCount;
};
// ============================================================================
-class OcxMultiPageStreamObject : public InputObjectBase
+class VbaFStreamObject : public AxPropertyObjectBase
{
public:
- explicit OcxMultiPageStreamObject(
+ explicit VbaFStreamObject(
const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm,
const ::rtl::OUString& rSysFileName,
- OcxFormSharedData& rFormData );
+ VbaFormSharedData& rFormData );
protected:
- virtual void implDump();
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ void dumpClassInfos();
+ void dumpFormSites( sal_uInt32 nCount );
+ void dumpSiteData();
+ void dumpDesignExtender();
private:
- OcxFormSharedData& mrFormData;
+ VbaFormSharedData& mrFormData;
+ sal_uInt32 mnFlags;
};
// ============================================================================
-// ============================================================================
-class OcxFormClassInfoObject : public OcxPropertyObjectBase
+class VbaOStreamObject : public OleInputObjectBase
{
public:
- explicit OcxFormClassInfoObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData );
+ explicit VbaOStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const ::rtl::OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
protected:
- virtual void implDumpShortProperties();
+ virtual void implDump();
private:
- OcxFormSharedData& mrFormData;
+ VbaFormSharedData& mrFormData;
};
// ============================================================================
-class OcxFormSiteObject : public OcxPropertyObjectBase
+class VbaPageObject : public AxPropertyObjectBase
{
public:
- explicit OcxFormSiteObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData );
+ explicit VbaPageObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
-
-private:
- OcxFormSharedData& mrFormData;
};
// ============================================================================
-class OcxFormDesignExtObject : public OcxPropertyObjectBase
+class VbaMultiPageObject : public AxPropertyObjectBase
{
public:
- explicit OcxFormDesignExtObject( const InputObjectBase& rParent );
+ explicit VbaMultiPageObject( const InputObjectBase& rParent );
protected:
virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ sal_Int32 mnPageCount;
};
// ============================================================================
-class OcxFormObject : public OcxPropertyObjectBase
+class VbaXStreamObject : public InputObjectBase
{
public:
- explicit OcxFormObject(
+ explicit VbaXStreamObject(
const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm,
const ::rtl::OUString& rSysFileName,
- OcxFormSharedData& rFormData );
+ VbaFormSharedData& rFormData );
protected:
- virtual void implDumpShortProperties();
- virtual void implDumpExtended();
-
-private:
- void dumpClassInfos();
- void dumpFormSites( sal_uInt32 nCount );
- void dumpSiteData();
- void dumpDesignExtender();
+ virtual void implDump();
private:
- OcxFormSharedData& mrFormData;
- sal_uInt32 mnFlags;
+ VbaFormSharedData& mrFormData;
};
// ============================================================================
-class OcxFormStorageObject : public OleStorageObject
+class VbaContainerStorageObject : public OleStorageObject
{
public:
- explicit OcxFormStorageObject(
+ explicit VbaContainerStorageObject(
const ObjectBase& rParent,
const StorageRef& rxStrg,
const ::rtl::OUString& rSysPath );
@@ -621,7 +772,7 @@ private:
bool isFormStorage( const ::rtl::OUString& rStrgPath ) const;
private:
- OcxFormSharedData maFormData;
+ VbaFormSharedData maFormData;
};
// ============================================================================
@@ -713,7 +864,7 @@ private:
// ============================================================================
-class VbaFormStorageObject : public OcxFormStorageObject
+class VbaFormStorageObject : public VbaContainerStorageObject
{
public:
explicit VbaFormStorageObject(
@@ -759,6 +910,23 @@ private:
// ============================================================================
// ============================================================================
+class ActiveXStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit ActiveXStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const ::rtl::OUString& rSysPath );
+
+protected:
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const ::rtl::OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
} // namespace dump
} // namespace oox
diff --git a/oox/inc/oox/dump/xlsbdumper.hxx b/oox/inc/oox/dump/xlsbdumper.hxx
index 95723f6b8d4e..345202f67a4a 100644
--- a/oox/inc/oox/dump/xlsbdumper.hxx
+++ b/oox/inc/oox/dump/xlsbdumper.hxx
@@ -98,7 +98,7 @@ private:
private:
typedef ::boost::shared_ptr< RecordInputStream > RecordInputStreamRef;
- RecordInputStreamRef mxStrm;
+ RecordInputStreamRef mxBiffStrm;
NameListRef mxErrCodes;
};
diff --git a/oox/inc/oox/helper/binaryinputstream.hxx b/oox/inc/oox/helper/binaryinputstream.hxx
index 19933ca03c04..8f58e2de4d9e 100644
--- a/oox/inc/oox/helper/binaryinputstream.hxx
+++ b/oox/inc/oox/helper/binaryinputstream.hxx
@@ -34,6 +34,8 @@
namespace oox {
+class BinaryOutputStream;
+
// ============================================================================
/** Interface for binary input stream classes.
@@ -108,6 +110,8 @@ public:
False = NUL characters are replaced by question marks (default). */
::rtl::OUString readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars = false );
+ /** Copies nBytes bytes from the current position to the passed output stream. */
+ void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64 );
private:
/** Used by the readValue() template functions to read built-in types.
@@ -216,6 +220,71 @@ typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef;
// ============================================================================
+/** Wraps a BinaryInputStream and provides access to a specific part of the
+ stream data.
+
+ @descr
+ Provides access to the stream data block starting at the current
+ position of the stream, and with a specific length. If the wrapped
+ stream is seekable, this wrapper will treat the position the wrapped
+ has at construction time as position "0" (therefore the class name).
+ */
+class RelativeInputStream : public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed stream.
+
+ @attention
+ The passed input stream MUST live at least as long as this stream
+ wrapper. The stream MUST NOT be changed from outside as long as
+ this stream wrapper is used to read from it.
+
+ @param nLength
+ If specified, restricts the amount of data that can be read from
+ the passed input stream.
+ */
+ explicit RelativeInputStream(
+ BinaryInputStream& rInStrm,
+ sal_Int64 nLength = SAL_MAX_INT64 );
+
+ /** Returns whether the wrapped stream is seekable. */
+ virtual bool isSeekable() const;
+ /** Returns the size of the data block in the wrapped stream offered by
+ this wrapper. */
+ virtual sal_Int64 getLength() const;
+ /** Returns the current relative stream position. */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed relative position, if the wrapped stream
+ is seekable. */
+ virtual void seek( sal_Int64 nPos );
+
+ /** Reads nBytes bytes to the passed sequence. Does not read out of the
+ data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes );
+ /** Reads nBytes bytes to the (existing) buffer opMem. Does not read out of
+ the data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes );
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. Does not seek out of the data block. */
+ virtual void skip( sal_Int32 nBytes );
+
+ /** Stream operator for integral and floating-point types. */
+ template< typename Type >
+ inline RelativeInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+private:
+ BinaryInputStream& mrInStrm;
+ sal_Int64 mnStartPos;
+ sal_Int64 mnRelPos;
+ sal_Int64 mnLength;
+};
+
+typedef ::boost::shared_ptr< RelativeInputStream > RelativeInputStreamRef;
+
+// ============================================================================
+
} // namespace oox
#endif
diff --git a/oox/inc/oox/helper/binaryoutputstream.hxx b/oox/inc/oox/helper/binaryoutputstream.hxx
index b229dbd18901..d2f0f8b36ffa 100644
--- a/oox/inc/oox/helper/binaryoutputstream.hxx
+++ b/oox/inc/oox/helper/binaryoutputstream.hxx
@@ -34,8 +34,6 @@
namespace oox {
-class BinaryInputStream;
-
// ============================================================================
/** Interface for binary output stream classes.
@@ -50,9 +48,6 @@ public:
/** Derived classes implement writing from the (existing) buffer pMem. */
virtual void writeMemory( const void* pMem, sal_Int32 nBytes ) = 0;
- /** Copies nBytes bytes from the current position of the passed input stream. */
- void copyStream( BinaryInputStream& rInStrm, sal_Int64 nBytes = SAL_MAX_INT64 );
-
/** Writes a value to the stream and converts it to platform byte order.
Supported types: SAL integers (8 to 64 bit), float, double. */
template< typename Type >
diff --git a/oox/inc/oox/helper/binarystreambase.hxx b/oox/inc/oox/helper/binarystreambase.hxx
index 18d868660faa..abe4c5f1c274 100644
--- a/oox/inc/oox/helper/binarystreambase.hxx
+++ b/oox/inc/oox/helper/binarystreambase.hxx
@@ -38,7 +38,8 @@ typedef ::com::sun::star::uno::Sequence< sal_Int8 > StreamDataSequence;
// ============================================================================
-/** Base interface for seekable binary stream classes. */
+/** Base interface for binary stream classes. Implemenetations may or may not
+ support seeking the stream. */
class BinaryStreamBase
{
public:
@@ -46,11 +47,14 @@ public:
/** Derived classes return whether the stream is seekable. Default: false. */
virtual bool isSeekable() const;
- /** Derived classes returns the size of the stream, if seekable, otherwise/default: -1. */
+ /** Derived classes return the size of the stream, if possible,
+ otherwise/default: -1. May return something for unseekable streams. */
virtual sal_Int64 getLength() const;
- /** Derived classes return the current stream position, if seekable, otherwise/default: -1. */
+ /** Derived classes return the current stream position, if possible,
+ otherwise/default: -1. May return something for unseekable streams. */
virtual sal_Int64 tell() const;
- /** Derived classes implement seeking the stream to the passed position, if seekable. */
+ /** Derived classes implement seeking the stream to the passed position, if
+ the stream is seekable. */
virtual void seek( sal_Int64 nPos );
/** Returns true, if the stream position is invalid (EOF). This flag turns
@@ -63,6 +67,9 @@ public:
inline void seekToStart() { seek( 0 ); }
/** Seeks the stream to the end, if stream is seekable. */
inline void seekToEnd() { seek( getLength() ); }
+ /** Seeks the stream forward to a position that is a multiple of the passed
+ block size, relative to the passed stream position, if stream is seekable. */
+ void alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos = 0 );
protected:
inline explicit BinaryStreamBase() : mbEof( false ) {}
diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx
index a077c667ae4c..f4f3717eac3f 100644
--- a/oox/inc/oox/helper/containerhelper.hxx
+++ b/oox/inc/oox/helper/containerhelper.hxx
@@ -84,34 +84,86 @@ public:
Does *not* check whether the last element is an empty reference. */
inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; }
- /** Calls the passed member function of ObjType on every contained object. */
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
template< typename FunctorType >
- inline void forEach( const FunctorType& rFunctor ) const
+ inline void forEach( FunctorType aFunctor ) const
{
- ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) );
}
- /** Calls the passed member function of ObjType on every contained object. */
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
template< typename FuncType >
inline void forEachMem( FuncType pFunc ) const
{
forEach( ::boost::bind( pFunc, _1 ) );
}
- /** Calls the passed member function of ObjType on every contained object. */
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
template< typename FuncType, typename ParamType >
inline void forEachMem( FuncType pFunc, ParamType aParam ) const
{
forEach( ::boost::bind( pFunc, _1, aParam ) );
}
- /** Calls the passed member function of ObjType on every contained object. */
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
template< typename FuncType, typename ParamType1, typename ParamType2 >
inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
{
forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
}
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Calls the passed functor for every contained object. Passes the index as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ inline void forEachWithIndex( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index to the member function. */
+ template< typename FuncType >
+ inline void forEachMemWithIndex( FuncType pFunc ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
/** Searches for an element by using the passed functor that takes a
constant reference of the object type (const ObjType&). */
template< typename FunctorType >
@@ -125,17 +177,26 @@ private:
template< typename FunctorType >
struct ForEachFunctor
{
- const FunctorType& mrFunctor;
- inline explicit ForEachFunctor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
- inline void operator()( const value_type& rxValue ) const { if( rxValue.get() ) mrFunctor( *rxValue ); }
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithIndex
+ {
+ FunctorType maFunctor;
+ sal_Int32 mnIndex;
+ inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; }
};
template< typename FunctorType >
struct FindFunctor
{
- const FunctorType& mrFunctor;
- inline explicit FindFunctor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
- inline bool operator()( const value_type& rxValue ) const { return rxValue.get() && mrFunctor( *rxValue ); }
+ FunctorType maFunctor;
+ inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); }
};
inline const value_type* getRef( sal_Int32 nIndex ) const
@@ -173,41 +234,53 @@ public:
return pxRef && pxRef->get();
}
- /** Returns a reference to the object accossiated to the passed key, or 0 on error. */
+ /** Returns a reference to the object accossiated to the passed key, or an
+ empty reference on error. */
inline mapped_type get( key_type nKey ) const
{
if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef;
return mapped_type();
}
- /** Calls the passed functor for every contained object. */
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
template< typename FunctorType >
inline void forEach( const FunctorType& rFunctor ) const
{
::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
}
- /** Calls the passed member function of ObjType on every contained object. */
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
template< typename FuncType >
inline void forEachMem( FuncType pFunc ) const
{
forEach( ::boost::bind( pFunc, _1 ) );
}
- /** Calls the passed member function of ObjType on every contained object. */
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
template< typename FuncType, typename ParamType >
inline void forEachMem( FuncType pFunc, ParamType aParam ) const
{
forEach( ::boost::bind( pFunc, _1, aParam ) );
}
- /** Calls the passed member function of ObjType on every contained object. */
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
template< typename FuncType, typename ParamType1, typename ParamType2 >
inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
{
forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
}
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
/** Calls the passed functor for every contained object. Passes the key as
first argument and the object reference as second argument to rFunctor. */
template< typename FunctorType >
@@ -240,21 +313,29 @@ public:
forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
}
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
private:
template< typename FunctorType >
struct ForEachFunctor
{
- const FunctorType& mrFunctor;
- inline explicit ForEachFunctor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
- inline void operator()( const value_type& rValue ) const { if( rValue.second.get() ) mrFunctor( *rValue.second ); }
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); }
};
template< typename FunctorType >
struct ForEachFunctorWithKey
{
- const FunctorType& mrFunctor;
- inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
- inline void operator()( const value_type& rValue ) const { if( rValue.second.get() ) mrFunctor( rValue.first, *rValue.second ); }
+ FunctorType maFunctor;
+ inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); }
};
inline const mapped_type* getRef( key_type nKey ) const
@@ -453,7 +534,7 @@ public:
/** Returns the reference to an existing element of the passed vector, or
the passed default value, if the passed index is out of bounds. */
template< typename Type >
- static Type& getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault );
+ static Type& getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault );
/** Returns the pointer to an existing element of the passed map, or a null
pointer, if an element with the passed key does not exist. */
@@ -522,7 +603,7 @@ const Type& ContainerHelper::getVectorElement( const ::std::vector< Type >& rVec
}
template< typename Type >
-Type& ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault )
+Type& ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault )
{
return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
}
diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx
index d6e01d0fff6b..2d0964b37715 100644
--- a/oox/inc/oox/helper/graphichelper.hxx
+++ b/oox/inc/oox/helper/graphichelper.hxx
@@ -29,24 +29,31 @@
#define OOX_HELPER_GRAPHICHELPER_HXX
#include <deque>
+#include <map>
#include <rtl/ustring.hxx>
+#include <com/sun/star/awt/DeviceInfo.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include "oox/helper/binarystreambase.hxx"
namespace com { namespace sun { namespace star {
- namespace uno { class XComponentContext; }
- namespace lang { class XMultiServiceFactory; }
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace awt { class XUnitConversion; }
namespace io { class XInputStream; }
+ namespace frame { class XFrame; }
namespace graphic { class XGraphic; }
namespace graphic { class XGraphicObject; }
namespace graphic { class XGraphicProvider; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace uno { class XComponentContext; }
} } }
namespace oox {
// ============================================================================
-/** Provides helper functions for graphics and graphic objects handling.
+/** Provides helper functions for colors, device measurement conversion,
+ graphics, and graphic objects handling.
All createGraphicObject() and importGraphicObject() functions create
persistent graphic objects internally and store them in an internal
@@ -60,39 +67,84 @@ class GraphicHelper
{
public:
explicit GraphicHelper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
- ~GraphicHelper();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxTargetFrame );
+ virtual ~GraphicHelper();
+
+ /** Returns a system color specified by the passed XML token identifier. */
+ sal_Int32 getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb = API_RGB_TRANSPARENT ) const;
+ /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
+ virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+ /** Derived classes may implement to resolve a palette index to an RGB color. */
+ virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
+
+ /** Returns information about the output device. */
+ const ::com::sun::star::awt::DeviceInfo& getDeviceInfo() const;
+
+ /** Converts the passed value from horizontal screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelXToHmm( double fPixelX ) const;
+ /** Converts the passed value from vertical screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelYToHmm( double fPixelY ) const;
+ /** Converts the passed point from screen pixels to 1/100 mm. */
+ ::com::sun::star::awt::Point convertScreenPixelToHmm( const ::com::sun::star::awt::Point& rPixel ) const;
+ /** Converts the passed size from screen pixels to 1/100 mm. */
+ ::com::sun::star::awt::Size convertScreenPixelToHmm( const ::com::sun::star::awt::Size& rPixel ) const;
+
+ /** Converts the passed value from 1/100 mm to horizontal screen pixels. */
+ double convertHmmToScreenPixelX( sal_Int32 nHmmX ) const;
+ /** Converts the passed value from 1/100 mm to vertical screen pixels. */
+ double convertHmmToScreenPixelY( sal_Int32 nHmmY ) const;
+ /** Converts the passed point from 1/100 mm to screen pixels. */
+ ::com::sun::star::awt::Point convertHmmToScreenPixel( const ::com::sun::star::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to screen pixels. */
+ ::com::sun::star::awt::Size convertHmmToScreenPixel( const ::com::sun::star::awt::Size& rHmm ) const;
+
+ /** Converts the passed point from AppFont units to 1/100 mm. */
+ ::com::sun::star::awt::Point convertAppFontToHmm( const ::com::sun::star::awt::Point& rAppFont ) const;
+ /** Converts the passed point from AppFont units to 1/100 mm. */
+ ::com::sun::star::awt::Size convertAppFontToHmm( const ::com::sun::star::awt::Size& rAppFont ) const;
+
+ /** Converts the passed point from 1/100 mm to AppFont units. */
+ ::com::sun::star::awt::Point convertHmmToAppFont( const ::com::sun::star::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to AppFont units. */
+ ::com::sun::star::awt::Size convertHmmToAppFont( const ::com::sun::star::awt::Size& rHmm ) const;
/** Imports a graphic from the passed input stream. */
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
importGraphic(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) const;
/** Imports a graphic from the passed binary memory block. */
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
- importGraphic( const StreamDataSequence& rGraphicData );
+ importGraphic( const StreamDataSequence& rGraphicData ) const;
/** Creates a persistent graphic object from the passed graphic.
@return The URL of the created and internally cached graphic object. */
::rtl::OUString createGraphicObject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const;
/** Creates a persistent graphic object from the passed input stream.
@return The URL of the created and internally cached graphic object. */
::rtl::OUString importGraphicObject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) const;
/** Creates a persistent graphic object from the passed binary memory block.
@return The URL of the created and internally cached graphic object. */
- ::rtl::OUString importGraphicObject( const StreamDataSequence& rGraphicData );
+ ::rtl::OUString importGraphicObject( const StreamDataSequence& rGraphicData ) const;
private:
+ typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette;
typedef ::std::deque< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > > GraphicObjectDeque;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext;
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicProvider > mxGraphicProvider;
- GraphicObjectDeque maGraphicObjects;
- const ::rtl::OUString maGraphicObjScheme;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnitConversion > mxUnitConversion;
+ ::com::sun::star::awt::DeviceInfo maDeviceInfo; /// Current output device info.
+ SystemPalette maSystemPalette; /// Maps system colors (XML tokens) to RGB color values.
+ mutable GraphicObjectDeque maGraphicObjects; /// Caches all created graphic objects to keep them alive.
+ const ::rtl::OUString maGraphicObjScheme; /// The URL scheme name for graphic objects.
+ double mfPixelPerHmmX; /// Number of screen pixels per 1/100 mm in X direction.
+ double mfPixelPerHmmY; /// Number of screen pixels per 1/100 mm in Y direction.
};
// ============================================================================
diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx
index 5884855bc50d..c68fe9ce83f8 100644
--- a/oox/inc/oox/helper/helper.hxx
+++ b/oox/inc/oox/helper/helper.hxx
@@ -69,7 +69,29 @@ namespace oox {
#define OUSTRING_TO_CSTR( str ) \
::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
-// ============================================================================
+// Common constants ===========================================================
+
+const sal_uInt8 WINDOWS_CHARSET_ANSI = 0;
+const sal_uInt8 WINDOWS_CHARSET_DEFAULT = 1;
+const sal_uInt8 WINDOWS_CHARSET_SYMBOL = 2;
+const sal_uInt8 WINDOWS_CHARSET_APPLE_ROMAN = 77;
+const sal_uInt8 WINDOWS_CHARSET_SHIFTJIS = 128;
+const sal_uInt8 WINDOWS_CHARSET_HANGEUL = 129;
+const sal_uInt8 WINDOWS_CHARSET_JOHAB = 130;
+const sal_uInt8 WINDOWS_CHARSET_GB2312 = 134;
+const sal_uInt8 WINDOWS_CHARSET_BIG5 = 136;
+const sal_uInt8 WINDOWS_CHARSET_GREEK = 161;
+const sal_uInt8 WINDOWS_CHARSET_TURKISH = 162;
+const sal_uInt8 WINDOWS_CHARSET_VIETNAMESE = 163;
+const sal_uInt8 WINDOWS_CHARSET_HEBREW = 177;
+const sal_uInt8 WINDOWS_CHARSET_ARABIC = 178;
+const sal_uInt8 WINDOWS_CHARSET_BALTIC = 186;
+const sal_uInt8 WINDOWS_CHARSET_RUSSIAN = 204;
+const sal_uInt8 WINDOWS_CHARSET_THAI = 222;
+const sal_uInt8 WINDOWS_CHARSET_EASTERN = 238;
+const sal_uInt8 WINDOWS_CHARSET_OEM = 255;
+
+// ----------------------------------------------------------------------------
const sal_Int32 API_RGB_TRANSPARENT = -1; /// Transparent color for API calls.
const sal_Int32 API_RGB_BLACK = 0x00000; /// Black color for API calls.
diff --git a/oox/inc/oox/helper/modelobjecthelper.hxx b/oox/inc/oox/helper/modelobjecthelper.hxx
index cead2ad74fb1..a9ef27e8cb98 100644
--- a/oox/inc/oox/helper/modelobjecthelper.hxx
+++ b/oox/inc/oox/helper/modelobjecthelper.hxx
@@ -53,7 +53,7 @@ class ModelObjectHelper
{
public:
explicit ModelObjectHelper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory );
/** Returns true, if the model contains a line marker with the passed name. */
bool hasLineMarker( const ::rtl::OUString& rMarkerName ) const;
diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx
index bdb81c6c3e83..a1769374d959 100644
--- a/oox/inc/oox/helper/propertyset.hxx
+++ b/oox/inc/oox/helper/propertyset.hxx
@@ -92,6 +92,10 @@ public:
template< typename Type >
inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const;
+ /** Gets the specified property from the property set.
+ @return the property value, or an empty Any, if the property is missing. */
+ ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
+
/** Gets the specified boolean property from the property set.
@return true = property contains true; false = property contains false or error occured. */
bool getBoolProperty( sal_Int32 nPropId ) const;
diff --git a/oox/inc/oox/helper/storagebase.hxx b/oox/inc/oox/helper/storagebase.hxx
index b23032fe2ac0..5a179e73cf75 100644
--- a/oox/inc/oox/helper/storagebase.hxx
+++ b/oox/inc/oox/helper/storagebase.hxx
@@ -28,12 +28,8 @@
#ifndef OOX_HELPER_STORAGEBASE_HXX
#define OOX_HELPER_STORAGEBASE_HXX
-#include <vector>
-#include <map>
-#include <boost/shared_ptr.hpp>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <oox/dllapi.h>
+#include "oox/dllapi.h"
+#include "oox/helper/containerhelper.hxx"
namespace com { namespace sun { namespace star {
namespace embed { class XStorage; }
@@ -71,6 +67,13 @@ public:
/** Returns true, if the object represents a valid storage. */
bool isStorage() const;
+ /** Returns true, if the object represents the root storage. */
+ bool isRootStorage() const;
+
+ /** Returns true, if the storage operates in read-only mode (based on an
+ input stream). */
+ bool isReadOnly() const;
+
/** Returns the com.sun.star.embed.XStorage interface of the current storage. */
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
getXStorage() const;
@@ -81,7 +84,8 @@ public:
/** Returns the full path of this storage. */
::rtl::OUString getPath() const;
- /** Fills the passed vector with the names of all elements of this storage. */
+ /** Fills the passed vector with the names of all direct elements of this
+ storage. */
void getElementNames( ::std::vector< ::rtl::OUString >& orElementNames ) const;
/** Opens and returns the specified sub storage from the storage.
@@ -89,10 +93,11 @@ public:
@param rStorageName
The name of the embedded storage. The name may contain slashes to
open storages from embedded substorages.
- @param bCreate
- True = create missing sub storages (for export filters).
+ @param bCreateMissing
+ True = create missing sub storages (for export filters). Must be
+ false for storages based on input streams.
*/
- StorageRef openSubStorage( const ::rtl::OUString& rStorageName, bool bCreate );
+ StorageRef openSubStorage( const ::rtl::OUString& rStorageName, bool bCreateMissing );
/** Opens and returns the specified input stream from the storage.
@@ -116,13 +121,27 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
openOutputStream( const ::rtl::OUString& rStreamName );
- /** Commits the changes to the storage and all the substorages. (in case it is transacted object)
+ /** Copies the specified element from this storage to the passed
+ destination storage.
+
+ @param rElementName
+ The name of the embedded storage or stream. The name may contain
+ slashes to specify an element in an embedded substorage. In this
+ case, the element will be copied to the same substorage in the
+ destination storage.
*/
- void commit();
+ void copyToStorage( StorageBase& rDestStrg, const ::rtl::OUString& rElementName );
+
+ /** Copies all streams of this storage and of all substorages to the passed
+ destination. */
+ void copyStorageToStorage( StorageBase& rDestStrg );
+
+ /** Commits the changes to the storage and all substorages. */
+ void commit();
protected:
/** Special constructor for sub storage objects. */
- explicit StorageBase( const StorageBase& rParentStorage, const ::rtl::OUString& rStorageName );
+ explicit StorageBase( const StorageBase& rParentStorage, const ::rtl::OUString& rStorageName, bool bReadOnly );
private:
StorageBase( const StorageBase& );
@@ -149,19 +168,24 @@ private:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
implOpenOutputStream( const ::rtl::OUString& rElementName ) = 0;
- StorageRef getSubStorage( const ::rtl::OUString& rElementName, bool bCreate );
+ /** Commits the current storage. */
+ virtual void implCommit() const = 0;
+
+ /** Helper that opens and caches the specified direct substorage. */
+ StorageRef getSubStorage( const ::rtl::OUString& rElementName, bool bCreateMissing );
private:
- typedef ::std::map< ::rtl::OUString, StorageRef > SubStorageMap;
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > XInputStreamRef;
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > XStreamRef;
+ typedef RefMap< ::rtl::OUString, StorageBase > SubStorageMap;
SubStorageMap maSubStorages; /// Map of direct sub storages.
- XInputStreamRef mxInStream; /// Cached base input stream (to keep it alive).
- XStreamRef mxOutStream; /// Cached base output stream (to keep it alive).
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ mxInStream; /// Cached base input stream (to keep it alive).
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ mxOutStream; /// Cached base output stream (to keep it alive).
+ ::rtl::OUString maParentPath; /// Full path of parent storage.
::rtl::OUString maStorageName; /// Name of this storage, if it is a substorage.
- const StorageBase* mpParentStorage; /// Parent storage if this is a sub storage.
bool mbBaseStreamAccess; /// True = access base streams with empty stream name.
+ bool mbReadOnly; /// True = storage opened read-only (based on input stream).
};
// ============================================================================
@@ -169,4 +193,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/textinputstream.hxx b/oox/inc/oox/helper/textinputstream.hxx
new file mode 100755
index 000000000000..1e74825ee713
--- /dev/null
+++ b/oox/inc/oox/helper/textinputstream.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_HELPER_RECORDINPUTSTREAM_HXX
+#define OOX_HELPER_RECORDINPUTSTREAM_HXX
+
+#include "oox/helper/binaryinputstream.hxx"
+
+namespace oox {
+
+// ============================================================================
+
+class TextInputStream
+{
+public:
+ explicit TextInputStream( BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc );
+
+ /** Returns true, if the wrapped input stream is in EOF state. */
+ bool isEof() const;
+ /** Reads a text line from the stream. */
+ ::rtl::OUString readLine();
+
+private:
+ BinaryInputStream& mrInStrm;
+ rtl_TextEncoding meTextEnc;
+ sal_Unicode mcLastEolChar;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
diff --git a/oox/inc/oox/helper/zipstorage.hxx b/oox/inc/oox/helper/zipstorage.hxx
index b6eef63b47de..0c9a15c10077 100644
--- a/oox/inc/oox/helper/zipstorage.hxx
+++ b/oox/inc/oox/helper/zipstorage.hxx
@@ -69,7 +69,7 @@ private:
virtual void implGetElementNames( ::std::vector< ::rtl::OUString >& orElementNames ) const;
/** Opens and returns the specified sub storage from the storage. */
- virtual StorageRef implOpenSubStorage( const ::rtl::OUString& rElementName, bool bCreate );
+ virtual StorageRef implOpenSubStorage( const ::rtl::OUString& rElementName, bool bCreateMissing );
/** Opens and returns the specified input stream from the storage. */
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
@@ -79,6 +79,9 @@ private:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
implOpenOutputStream( const ::rtl::OUString& rElementName );
+ /** Commits the current storage. */
+ virtual void implCommit() const;
+
private:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > XStorageRef;
@@ -90,4 +93,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx
index 3db0bae7cee4..d036e958a446 100644..100755
--- a/oox/inc/oox/ole/axbinaryreader.hxx
+++ b/oox/inc/oox/ole/axbinaryreader.hxx
@@ -28,6 +28,7 @@
#ifndef OOX_OLE_AXBINARYREADER_HXX
#define OOX_OLE_AXBINARYREADER_HXX
+#include <utility>
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/containerhelper.hxx"
@@ -36,15 +37,24 @@ namespace ole {
// ============================================================================
-/** A wrapper for an unseekable binary input stream. */
+/** A wrapper for a binary input stream that supports aligned read operations.
+
+ The implementation does not support seeking back the wrapped stream. All
+ seeking operations (tell, seek, align) are performed relative to the
+ position of the wrapped stream at construction time of this wrapper. It is
+ possible to construct this wrapper with an unseekable input stream without
+ loosing any functionality.
+ */
class AxAlignedInputStream : public BinaryInputStream
{
public:
explicit AxAlignedInputStream( BinaryInputStream& rInStrm );
- /** Return the current stream position (relative to position at construction time). */
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
virtual sal_Int64 tell() const;
- /** Seeks the stream to the passed position, if it is behind the current position. */
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
virtual void seek( sal_Int64 nPos );
/** Reads nBytes bytes to the passed sequence.
@@ -56,7 +66,8 @@ public:
/** Seeks the stream forward by the passed number of bytes. */
virtual void skip( sal_Int32 nBytes );
- /** Aligns the stream to a multiple of the passed size. */
+ /** Aligns the stream to a multiple of the passed size (relative to the
+ position of the wrapped stream at construction time). */
void align( size_t nSize );
/** Aligns the stream according to the passed type and reads an atomar value. */
@@ -73,6 +84,50 @@ private:
// ============================================================================
+/** A pair of integer values as a property. */
+typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData;
+
+// ============================================================================
+
+const sal_uInt32 AX_FONTDATA_BOLD = 0x00000001;
+const sal_uInt32 AX_FONTDATA_ITALIC = 0x00000002;
+const sal_uInt32 AX_FONTDATA_UNDERLINE = 0x00000004;
+const sal_uInt32 AX_FONTDATA_STRIKEOUT = 0x00000008;
+const sal_uInt32 AX_FONTDATA_DISABLED = 0x00002000;
+const sal_uInt32 AX_FONTDATA_AUTOCOLOR = 0x40000000;
+
+const sal_Int32 AX_FONTDATA_LEFT = 1;
+const sal_Int32 AX_FONTDATA_RIGHT = 2;
+const sal_Int32 AX_FONTDATA_CENTER = 3;
+
+/** All entries of a font property. */
+struct AxFontData
+{
+ ::rtl::OUString maFontName; /// Name of the used font.
+ sal_uInt32 mnFontEffects; /// Font effect flags.
+ sal_Int32 mnFontHeight; /// Height of the font (not really twips, see code).
+ sal_Int32 mnFontCharSet; /// Windows character set of the font.
+ sal_Int32 mnHorAlign; /// Horizontal text alignment.
+
+ explicit AxFontData();
+
+ /** Converts the internal representation of the font height to points. */
+ sal_Int16 getHeightPoints() const;
+ /** Converts the passed font height from points to the internal representation. */
+ void setHeightPoints( sal_Int16 nPoints );
+
+ /** Reads the font data settings from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Reads the font data settings from the passed input stream that contains
+ an OLE StdFont structure. */
+ bool importStdFont( BinaryInputStream& rInStrm );
+ /** Reads the font data settings from the passed input stream depending on
+ the GUID preceding the actual font data. */
+ bool importGuidAndFont( BinaryInputStream& rInStrm );
+};
+
+// ============================================================================
+
/** Import helper to read simple and complex ActiveX form control properties
from a binary input stream. */
class AxBinaryPropertyReader
@@ -90,10 +145,16 @@ public:
void readBoolProperty( bool& orbValue, bool bReverse = false );
/** Reads the next pair property from the stream, if the respective flag in
the property mask is set. */
- void readPairProperty( sal_Int32& ornValue1, sal_Int32& ornValue2 );
+ void readPairProperty( AxPairData& orPairData );
/** Reads the next string property from the stream, if the respective flag
in the property mask is set. */
void readStringProperty( ::rtl::OUString& orValue );
+ /** Reads the next GUID property from the stream, if the respective flag
+ in the property mask is set. The GUID will be enclosed in braces. */
+ void readGuidProperty( ::rtl::OUString& orGuid );
+ /** Reads the next font property from the stream, if the respective flag in
+ the property mask is set. */
+ void readFontProperty( AxFontData& orFontData );
/** Reads the next picture property from the stream, if the respective flag
in the property mask is set. */
void readPictureProperty( StreamDataSequence& orPicData );
@@ -105,9 +166,18 @@ public:
/** Skips the next boolean property value in the stream, if the respective
flag in the property mask is set. */
inline void skipBoolProperty() { startNextProperty(); }
+ /** Skips the next pair property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipPairProperty() { readPairProperty( maDummyPairData ); }
/** Skips the next string property in the stream, if the respective flag in
the property mask is set. */
inline void skipStringProperty() { readStringProperty( maDummyString ); }
+ /** Skips the next GUID property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipGuidProperty() { readGuidProperty( maDummyString ); }
+ /** Skips the next font property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipFontProperty() { readFontProperty( maDummyFontData ); }
/** Skips the next picture property in the stream, if the respective flag
in the property mask is set. */
inline void skipPictureProperty() { readPictureProperty( maDummyPicData ); }
@@ -133,11 +203,10 @@ private:
/** Complex property for a 32-bit value pair, e.g. point or size. */
struct PairProperty : public ComplexProperty
{
- sal_Int32& mrnValue1;
- sal_Int32& mrnValue2;
+ AxPairData& mrPairData;
- inline explicit PairProperty( sal_Int32& rnValue1, sal_Int32& rnValue2 ) :
- mrnValue1( rnValue1 ), mrnValue2( rnValue2 ) {}
+ inline explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
virtual bool readProperty( AxAlignedInputStream& rInStrm );
};
@@ -152,6 +221,26 @@ private:
virtual bool readProperty( AxAlignedInputStream& rInStrm );
};
+ /** Complex property for a GUID value. */
+ struct GuidProperty : public ComplexProperty
+ {
+ ::rtl::OUString& mrGuid;
+
+ inline explicit GuidProperty( ::rtl::OUString& rGuid ) :
+ mrGuid( rGuid ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Stream property for a font structure. */
+ struct FontProperty : public ComplexProperty
+ {
+ AxFontData& mrFontData;
+
+ inline explicit FontProperty( AxFontData& rFontData ) :
+ mrFontData( rFontData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
/** Stream property for a picture or mouse icon. */
struct PictureProperty : public ComplexProperty
{
@@ -168,6 +257,8 @@ private:
AxAlignedInputStream maInStrm; /// The input stream to read from.
ComplexPropVector maLargeProps; /// Stores info for all used large properties.
ComplexPropVector maStreamProps; /// Stores info for all used stream data properties.
+ AxPairData maDummyPairData; /// Dummy pair for unsupported properties.
+ AxFontData maDummyFontData; /// Dummy font for unsupported properties.
StreamDataSequence maDummyPicData; /// Dummy picture for unsupported properties.
::rtl::OUString maDummyString; /// Dummy string for unsupported properties.
sal_Int64 mnPropFlags; /// Flags specifying existing properties.
diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx
index b5a5741d134d..7c533334cc49 100644
--- a/oox/inc/oox/ole/axcontrol.hxx
+++ b/oox/inc/oox/ole/axcontrol.hxx
@@ -28,82 +28,389 @@
#ifndef OOX_OLE_AXCONTROL_HXX
#define OOX_OLE_AXCONTROL_HXX
-#include <memory>
+#include <boost/shared_ptr.hpp>
#include "oox/helper/binarystreambase.hxx"
+#include "oox/ole/axbinaryreader.hxx"
+#include "oox/ole/olehelper.hxx"
namespace com { namespace sun { namespace star {
namespace awt { class XControlModel; }
+ namespace container { class XIndexContainer; }
+ namespace drawing { class XDrawPage; }
+ namespace form { class XFormsSupplier; }
+ namespace lang { class XMultiServiceFactory; }
} } }
namespace oox {
class BinaryInputStream;
+ class GraphicHelper;
class PropertyMap;
}
namespace oox {
namespace ole {
-class AxControlHelper;
+// ============================================================================
+
+const sal_Char* const COMCTL_GUID_SCROLLBAR_60 = "{FE38753A-44A3-11D1-B5B7-0000C09000C4}";
+const sal_Char* const COMCTL_GUID_PROGRESSBAR_50 = "{0713E8D2-850A-101B-AFC0-4210102A8DA7}";
+const sal_Char* const COMCTL_GUID_PROGRESSBAR_60 = "{35053A22-8589-11D1-B16A-00C0F0283628}";
+
+// ----------------------------------------------------------------------------
+
+const sal_Char* const AX_GUID_COMMANDBUTTON = "{D7053240-CE69-11CD-A777-00DD01143C57}";
+const sal_Char* const AX_GUID_LABEL = "{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}";
+const sal_Char* const AX_GUID_IMAGE = "{4C599241-6926-101B-9992-00000B65C6F9}";
+const sal_Char* const AX_GUID_TOGGLEBUTTON = "{8BD21D60-EC42-11CE-9E0D-00AA006002F3}";
+const sal_Char* const AX_GUID_CHECKBOX = "{8BD21D40-EC42-11CE-9E0D-00AA006002F3}";
+const sal_Char* const AX_GUID_OPTIONBUTTON = "{8BD21D50-EC42-11CE-9E0D-00AA006002F3}";
+const sal_Char* const AX_GUID_TEXTBOX = "{8BD21D10-EC42-11CE-9E0D-00AA006002F3}";
+const sal_Char* const AX_GUID_LISTBOX = "{8BD21D20-EC42-11CE-9E0D-00AA006002F3}";
+const sal_Char* const AX_GUID_COMBOBOX = "{8BD21D30-EC42-11CE-9E0D-00AA006002F3}";
+const sal_Char* const AX_GUID_SPINBUTTON = "{79176FB0-B7F2-11CE-97EF-00AA006D2776}";
+const sal_Char* const AX_GUID_SCROLLBAR = "{DFD181E0-5E2F-11CE-A449-00AA004A803D}";
+const sal_Char* const AX_GUID_FRAME = "{6E182020-F460-11CE-9BCD-00AA00608E01}";
+
+const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005;
+const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006;
+const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008;
+const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F;
+const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012;
+
+const sal_Int32 AX_BORDERSTYLE_NONE = 0;
+const sal_Int32 AX_BORDERSTYLE_SINGLE = 1;
+
+const sal_Int32 AX_SPECIALEFFECT_FLAT = 0;
+const sal_Int32 AX_SPECIALEFFECT_RAISED = 1;
+const sal_Int32 AX_SPECIALEFFECT_SUNKEN = 2;
+const sal_Int32 AX_SPECIALEFFECT_ETCHED = 3;
+const sal_Int32 AX_SPECIALEFFECT_BUMPED = 6;
+
+const sal_Int32 AX_PICSIZE_CLIP = 0;
+const sal_Int32 AX_PICSIZE_STRETCH = 1;
+const sal_Int32 AX_PICSIZE_ZOOM = 3;
+
+const sal_Int32 AX_PICALIGN_TOPLEFT = 0;
+const sal_Int32 AX_PICALIGN_TOPRIGHT = 1;
+const sal_Int32 AX_PICALIGN_CENTER = 2;
+const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3;
+const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4;
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates all UNO API control types supported by these filters. */
+enum ApiControlType
+{
+ API_CONTROL_BUTTON,
+ API_CONTROL_FIXEDTEXT,
+ API_CONTROL_IMAGE,
+ API_CONTROL_CHECKBOX,
+ API_CONTROL_RADIOBUTTON,
+ API_CONTROL_EDIT,
+ API_CONTROL_LISTBOX,
+ API_CONTROL_COMBOBOX,
+ API_CONTROL_SPINBUTTON,
+ API_CONTROL_SCROLLBAR,
+ API_CONTROL_PROGRESSBAR,
+ API_CONTROL_GROUPBOX,
+ API_CONTROL_DIALOG
+};
+
+// ============================================================================
+
+/** Specifies how a form control supports transparent background. */
+enum ApiTransparencyMode
+{
+ API_TRANSPARENCY_NOTSUPPORTED, /// Control does not support transparency.
+ API_TRANSPARENCY_VOID, /// Transparency is enabled by missing fill color.
+ API_TRANSPARENCY_PAINTTRANSPARENT /// Transparency is enabled by the 'PaintTransparent' property.
+};
+
+/** Specifies how a form control supports the DefaultState property. */
+enum ApiDefaultStateMode
+{
+ API_DEFAULTSTATE_BOOLEAN, /// Control does not support tri-state, state is given as boolean.
+ API_DEFAULTSTATE_SHORT, /// Control does not support tri-state, state is given as short.
+ API_DEFAULTSTATE_TRISTATE /// Control supports tri-state, state is given as short.
+};
+
+// ----------------------------------------------------------------------------
+
+/** A base class with useful helper functions for something that is able to
+ convert ActiveX and ComCtl form controls.
+ */
+class ControlConverter
+{
+public:
+ explicit ControlConverter(
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+ virtual ~ControlConverter();
+
+ // Generic conversion -----------------------------------------------------
+
+ /** Converts the passed position in 1/100 mm to UNO properties. */
+ void convertPosition(
+ PropertyMap& rPropMap,
+ const AxPairData& rPos ) const;
+
+ /** Converts the passed size in 1/100 mm to UNO properties. */
+ void convertSize(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize ) const;
+
+ /** Converts the passed encoded OLE color to UNO properties. */
+ void convertColor(
+ PropertyMap& rPropMap,
+ sal_Int32 nPropId,
+ sal_uInt32 nOleColor ) const;
+
+ /** Converts the passed StdPic picture stream to UNO properties. */
+ void convertPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData ) const;
+
+ /** Converts the control orientation to UNO properties. */
+ void convertOrientation(
+ PropertyMap& rPropMap,
+ bool bHorizontal ) const;
+
+ /** Converts common scrollbar settings to UNO properties. */
+ void convertScrollBar(
+ PropertyMap& rPropMap,
+ sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
+ sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const;
+
+ // ActiveX (Forms 2.0) specific conversion --------------------------------
+
+ /** Converts the Forms 2.0 background formatting to UNO properties. */
+ void convertAxBackground(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBackColor,
+ sal_uInt32 nFlags,
+ ApiTransparencyMode eTranspMode ) const;
+
+ /** Converts the Forms 2.0 border formatting to UNO properties. */
+ void convertAxBorder(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBorderColor,
+ sal_Int32 nBorderStyle,
+ sal_Int32 nSpecialEffect ) const;
+
+ /** Converts the Forms 2.0 special effect to UNO properties. */
+ void convertAxVisualEffect(
+ PropertyMap& rPropMap,
+ sal_Int32 nSpecialEffect ) const;
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_uInt32 nPicPos ) const;
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_Int32 nPicSizeMode,
+ sal_Int32 nPicAlign,
+ bool bPicTiling ) const;
+
+ /** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
+ properties. */
+ void convertAxState(
+ PropertyMap& rPropMap,
+ const ::rtl::OUString& rValue,
+ sal_Int32 nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel ) const;
+
+ /** Converts the Forms 2.0 control orientation to UNO properties. */
+ void convertAxOrientation(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize,
+ sal_Int32 nOrientation ) const;
+
+private:
+ const GraphicHelper& mrGraphicHelper;
+ bool mbDefaultColorBgr;
+};
// ============================================================================
-/** Base class for all models of ActiveX form controls. */
-class AxControlModelBase
+/** Base class for all models of form controls. */
+class ControlModelBase
{
public:
- virtual ~AxControlModelBase();
+ explicit ControlModelBase();
+ virtual ~ControlModelBase();
+
+ /** Sets this control model to AWT model mode. */
+ inline void setAwtModelMode() { mbAwtModel = true; }
+ /** Sets this control model to form component mode. */
+ inline void setFormComponentMode() { mbAwtModel = false; }
+
+ /** Returns the UNO service name used to construct the AWT control model,
+ or the control form component. */
+ ::rtl::OUString getServiceName() const;
/** Derived classes set specific OOXML properties at the model structure. */
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
/** Derived classes set binary data (picture, mouse icon) at the model structure. */
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
/** Derived classes import a form control model from the passed input stream. */
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) = 0;
- /** Derived classes return the UNO service name used to construct the control component. */
- virtual ::rtl::OUString getServiceName() const = 0;
+ /** Derived classes return the UNO control type enum value. */
+ virtual ApiControlType getControlType() const = 0;
/** Derived classes convert all control properties. */
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+ /** Converts the control size to UNO properties. */
+ void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
protected:
- explicit AxControlModelBase();
+ AxPairData maSize; /// Size of the control in 1/100 mm.
+ bool mbAwtModel; /// True = AWT control model, false = form component.
+};
+
+typedef ::boost::shared_ptr< ControlModelBase > ControlModelRef;
+
+// ============================================================================
+
+/** Base class for all models of ComCtl form controls. */
+class ComCtlModelBase : public ControlModelBase
+{
+public:
+ explicit ComCtlModelBase(
+ sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm ) = 0;
+ virtual void importCommonExtraData( BinaryInputStream& rInStrm );
+ virtual void importCommonTrailingData( BinaryInputStream& rInStrm );
+
+private:
+ /** Returns the data part identifier according to the model version. */
+ sal_uInt32 getDataPartId() const;
+
+ bool readPartHeader( BinaryInputStream& rInStrm,
+ sal_uInt32 nExpPartId,
+ sal_uInt16 nExpMajor = SAL_MAX_UINT16,
+ sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+
+ bool importSizePart( BinaryInputStream& rInStrm );
+ bool importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize );
+ bool importComplexPart( BinaryInputStream& rInStrm );
+
+protected:
+ StdFontInfo maFontData; /// Font formatting.
+ StreamDataSequence maMouseIcon; /// Binary picture stream for mouse icon.
+ sal_uInt32 mnFlags; /// Common flags for ComCtl controls.
+ const sal_uInt16 mnVersion; /// Current version of the ComCtl control model.
+
+private:
+ sal_uInt32 mnDataPartId5; /// Identifier for version 5.0 control data.
+ sal_uInt32 mnDataPartId6; /// Identifier for version 6.0 control data.
+ bool mbCommonPart; /// True = the COMCTL_COMMONDATA part exists.
+ bool mbComplexPart; /// True = the COMCTL_COMPLEXDATA part exists.
+};
+
+// ============================================================================
+
+/** Model for a ComCtl scroll bar. */
+class ComCtlScrollBarModel : public ComCtlModelBase
+{
+public:
+ explicit ComCtlScrollBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm );
+
+private:
+ sal_uInt32 mnScrollBarFlags; /// Special flags for scroll bar model.
+ sal_Int32 mnLargeChange; /// Increment step size (thumb).
+ sal_Int32 mnSmallChange; /// Increment step size (buttons).
+ sal_Int32 mnMin; /// Minimum of the value range.
+ sal_Int32 mnMax; /// Maximum of the value range.
+ sal_Int32 mnPosition; /// Value of the spin button.
+};
+
+// ============================================================================
+
+/** Model for a ComCtl progress bar. */
+class ComCtlProgressBarModel : public ComCtlModelBase
+{
+public:
+ explicit ComCtlProgressBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
protected:
- sal_Int32 mnWidth;
- sal_Int32 mnHeight;
+ virtual void importControlData( BinaryInputStream& rInStrm );
+
+private:
+ float mfMin; /// Minimum of the value range.
+ float mfMax; /// Maximum of the value range.
+ sal_uInt16 mnVertical; /// 0 = horizontal, 1 = vertical.
+ sal_uInt16 mnSmooth; /// 0 = progress blocks, 1 = pixel resolution.
};
// ============================================================================
+/** Base class for all models of Form 2.0 form controls. */
+class AxControlModelBase : public ControlModelBase
+{
+public:
+ explicit AxControlModelBase();
+
+ virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
+};
+
+// ============================================================================
+
+/** Base class for Forms 2.0 controls supporting text formatting. */
class AxFontDataModel : public AxControlModelBase
{
public:
- explicit AxFontDataModel();
+ explicit AxFontDataModel( bool bSupportsAlign = true );
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
-private:
- ::rtl::OUString maFontName; /// Name of the used font.
- sal_uInt32 mnFontEffects; /// Font effect flags.
- sal_Int32 mnFontHeight; /// Height of the font (not really twips, see code).
- sal_Int32 mnFontCharSet; /// Windows character set of the font.
- sal_Int32 mnHorAlign; /// Horizontal text alignment.
+ /** Returns the font height in points. */
+ inline sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
+
+protected:
+ AxFontData maFontData; /// The font settings.
+ bool mbSupportsAlign; /// True = UNO model supports Align property.
};
// ============================================================================
+/** Model for a Forms 2.0 command button. */
class AxCommandButtonModel : public AxFontDataModel
{
public:
explicit AxCommandButtonModel();
- virtual ::rtl::OUString getServiceName() const;
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
private:
StreamDataSequence maPictureData; /// Binary picture stream.
@@ -117,15 +424,17 @@ private:
// ============================================================================
+/** Model for a Forms 2.0 label. */
class AxLabelModel : public AxFontDataModel
{
public:
explicit AxLabelModel();
- virtual ::rtl::OUString getServiceName() const;
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
private:
::rtl::OUString maCaption; /// Visible caption of the button.
@@ -139,16 +448,18 @@ private:
// ============================================================================
+/** Model for a Forms 2.0 image. */
class AxImageModel : public AxControlModelBase
{
public:
explicit AxImageModel();
- virtual ::rtl::OUString getServiceName() const;
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
private:
StreamDataSequence maPictureData; /// Binary picture stream.
@@ -164,15 +475,16 @@ private:
// ============================================================================
-class AxMorphDataModel : public AxFontDataModel
+/** Base class for a Forms 2.0 morph data control. */
+class AxMorphDataModelBase : public AxFontDataModel
{
public:
- explicit AxMorphDataModel();
+ explicit AxMorphDataModelBase();
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
protected:
StreamDataSequence maPictureData; /// Binary picture stream.
@@ -198,81 +510,92 @@ protected:
// ============================================================================
-class AxToggleButtonModel : public AxMorphDataModel
+/** Model for a Forms 2.0 toggle button. */
+class AxToggleButtonModel : public AxMorphDataModelBase
{
public:
explicit AxToggleButtonModel();
- virtual ::rtl::OUString getServiceName() const;
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
};
// ============================================================================
-class AxCheckBoxModel : public AxMorphDataModel
+/** Model for a Forms 2.0 check box. */
+class AxCheckBoxModel : public AxMorphDataModelBase
{
public:
explicit AxCheckBoxModel();
- virtual ::rtl::OUString getServiceName() const;
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
};
// ============================================================================
-class AxOptionButtonModel : public AxMorphDataModel
+/** Model for a Forms 2.0 option button. */
+class AxOptionButtonModel : public AxMorphDataModelBase
{
public:
explicit AxOptionButtonModel();
- virtual ::rtl::OUString getServiceName() const;
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ /** Returns the group name used to goup several option buttons gogether. */
+ inline const ::rtl::OUString& getGroupName() const { return maGroupName; }
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
};
// ============================================================================
-class AxTextBoxModel : public AxMorphDataModel
+/** Model for a Forms 2.0 text box. */
+class AxTextBoxModel : public AxMorphDataModelBase
{
public:
explicit AxTextBoxModel();
- virtual ::rtl::OUString getServiceName() const;
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
};
// ============================================================================
-class AxListBoxModel : public AxMorphDataModel
+/** Model for a Forms 2.0 list box. */
+class AxListBoxModel : public AxMorphDataModelBase
{
public:
explicit AxListBoxModel();
- virtual ::rtl::OUString getServiceName() const;
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
};
// ============================================================================
-class AxComboBoxModel : public AxMorphDataModel
+/** Model for a Forms 2.0 combo box. */
+class AxComboBoxModel : public AxMorphDataModelBase
{
public:
explicit AxComboBoxModel();
- virtual ::rtl::OUString getServiceName() const;
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
};
// ============================================================================
+/** Model for a Forms 2.0 spin button. */
class AxSpinButtonModel : public AxControlModelBase
{
public:
explicit AxSpinButtonModel();
- virtual ::rtl::OUString getServiceName() const;
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
private:
sal_uInt32 mnArrowColor; /// Button arrow color.
@@ -288,15 +611,17 @@ private:
// ============================================================================
+/** Model for a Forms 2.0 scroll bar. */
class AxScrollBarModel : public AxControlModelBase
{
public:
explicit AxScrollBarModel();
- virtual ::rtl::OUString getServiceName() const;
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
- virtual void importBinaryModel( BinaryInputStream& rInStrm );
- virtual void convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const;
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
private:
sal_uInt32 mnArrowColor; /// Button arrow color.
@@ -314,39 +639,130 @@ private:
// ============================================================================
-/** Container for all ActiveX form control model implementations. */
-class AxControl
+typedef ::std::vector< ::rtl::OUString > AxClassTable;
+
+/** Base class for ActiveX container controls. */
+class AxContainerModelBase : public AxFontDataModel
{
public:
- explicit AxControl( const ::rtl::OUString& rName );
- ~AxControl();
+ explicit AxContainerModelBase();
+
+ /** Allows to set single properties specified by XML token identifier. */
+ virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
+ /** Reads the leading structure in the 'f' stream containing the model for
+ this control. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Reads the class table structure for embedded controls following the own
+ model from the 'f' stream. */
+ bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
+
+protected:
+ StreamDataSequence maPictureData; /// Binary picture stream.
+ ::rtl::OUString maCaption; /// Visible caption of the form.
+ AxPairData maLogicalSize; /// Logical form size (scroll area).
+ AxPairData maScrollPos; /// Scroll position.
+ sal_uInt32 mnBackColor; /// Fill color.
+ sal_uInt32 mnTextColor; /// Text color.
+ sal_uInt32 mnFlags; /// Various flags.
+ sal_uInt32 mnBorderColor; /// Flat border color.
+ sal_Int32 mnBorderStyle; /// Flat border style.
+ sal_Int32 mnScrollBars; /// Horizontal/vertical scroll bar.
+ sal_Int32 mnCycleType; /// Cycle in all forms or in this form.
+ sal_Int32 mnSpecialEffect; /// 3D border effect.
+ sal_Int32 mnPicAlign; /// Anchor position of the picture.
+ sal_Int32 mnPicSizeMode; /// Clip, stretch, zoom.
+ bool mbPicTiling; /// True = picture is repeated.
+};
+
+typedef ::boost::shared_ptr< AxContainerModelBase > AxContainerModelRef;
+
+// ============================================================================
+
+/** Model for a Forms 2.0 frame (group box). */
+class AxFrameModel : public AxContainerModelBase
+{
+public:
+ explicit AxFrameModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 user form. */
+class AxUserFormModel : public AxContainerModelBase
+{
+public:
+ explicit AxUserFormModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+// ============================================================================
+
+/** A form control embedded in a document draw page. Contains a specific model
+ structure according to the type of the control. */
+class EmbeddedControl
+{
+public:
+ explicit EmbeddedControl( const ::rtl::OUString& rName );
+ ~EmbeddedControl();
/** Creates and returns the internal control model according to the passed
MS class identifier. */
- AxControlModelBase* createModel( const ::rtl::OUString& rClassId );
- /** Imports a form control model from the passed input stream. */
- void importBinaryModel( BinaryInputStream& rInStrm );
+ ControlModelRef createModel( const ::rtl::OUString& rClassId );
- /** Returns the internal control model. */
- inline const AxControlModelBase* getModel() const { return mxModel.get(); }
- /** Returns the MS class identifier used to create the internal control model. */
- inline const ::rtl::OUString& getClassId() const { return maClassId; }
+ /** Returns true, if the internal control model exists. */
+ inline bool hasModel() const { return mxModel.get() != 0; }
+ /** Returns the UNO service name needed to construct the control model. */
+ ::rtl::OUString getServiceName() const;
- /** Creates and returns the UNO form component object for this control and
- inserts it into the form wrapped by the passed helper. */
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
- convertAndInsert( AxControlHelper& rHelper ) const;
+ /** Converts all control properties and inserts them into the passed model. */
+ bool convertProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv ) const;
private:
- ::std::auto_ptr< AxControlModelBase > mxModel;
- ::rtl::OUString maClassId; /// Class identifier of the control model.
+ ControlModelRef mxModel; /// Control model containing the properties.
::rtl::OUString maName; /// Name of the control.
};
// ============================================================================
+/** A wrapper for a control form embedded directly in a draw page. */
+class EmbeddedForm : public ControlConverter
+{
+public:
+ explicit EmbeddedForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Converts the passed ActiveX control and inserts it into the form.
+ @return The API control model, if conversion was successful. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
+ convertAndInsert( const EmbeddedControl& rControl );
+
+private:
+ /** Tries to insert the passed control model into the form. */
+ bool insertControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel );
+
+ /** Creates the form that will hold the form controls. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
+ createForm();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxModelFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier > mxFormsSupp;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxFormIC;
+};
+
+// ============================================================================
+
} // namespace ole
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/axcontrolfragment.hxx b/oox/inc/oox/ole/axcontrolfragment.hxx
index 9bccbd11a0de..3c9aed61bd3e 100644
--- a/oox/inc/oox/ole/axcontrolfragment.hxx
+++ b/oox/inc/oox/ole/axcontrolfragment.hxx
@@ -33,8 +33,8 @@
namespace oox {
namespace ole {
-class AxControl;
-class AxControlModelBase;
+class ControlModelBase;
+class EmbeddedControl;
// ============================================================================
@@ -44,32 +44,32 @@ class AxControlPropertyContext : public ::oox::core::ContextHandler2
public:
explicit AxControlPropertyContext(
::oox::core::FragmentHandler2& rFragment,
- AxControlModelBase& rModel );
+ ControlModelBase& rModel );
virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
private:
- AxControlModelBase& mrModel;
+ ControlModelBase& mrModel;
sal_Int32 mnPropId; /// Identifier of currently processed property.
};
// ============================================================================
-/** Fragment handler for an ActiveX form control fragment. */
+/** Fragment handler for an embedded ActiveX form control fragment. */
class AxControlFragment : public ::oox::core::FragmentHandler2
{
public:
explicit AxControlFragment(
::oox::core::XmlFilterBase& rFilter,
const ::rtl::OUString& rFragmentPath,
- AxControl& rControl );
+ EmbeddedControl& rControl );
virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
private:
- AxControl& mrControl;
+ EmbeddedControl& mrControl;
};
// ============================================================================
diff --git a/oox/inc/oox/ole/axcontrolhelper.hxx b/oox/inc/oox/ole/axcontrolhelper.hxx
deleted file mode 100644
index d34cf45f3654..000000000000
--- a/oox/inc/oox/ole/axcontrolhelper.hxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_OLE_AXCONTROLHELPER_HXX
-#define OOX_OLE_AXCONTROLHELPER_HXX
-
-#include <com/sun/star/uno/Reference.hxx>
-
-namespace com { namespace sun { namespace star {
- namespace graphic { class XGraphic; }
- namespace drawing { class XDrawPage; }
- namespace form { class XForm; }
-} } }
-
-namespace oox { namespace core { class FilterBase; } }
-
-namespace oox {
-namespace ole {
-
-// ============================================================================
-
-const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005;
-const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006;
-const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008;
-const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F;
-const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012;
-
-// ============================================================================
-
-enum AxDefaultColorMode
-{
- AX_DEFAULTCOLORMODE_BGR, /// OLE default color type is interpreted as BGR color.
- AX_DEFAULTCOLORMODE_PALETTE /// OLE default color type is interpreted as palette color.
-};
-
-// ============================================================================
-
-/** Helper functions and callbacks for ActiveX form control filters. */
-class AxControlHelper
-{
-public:
- explicit AxControlHelper(
- const ::oox::core::FilterBase& rFilter,
- AxDefaultColorMode eColorMode = AX_DEFAULTCOLORMODE_BGR );
- virtual ~AxControlHelper();
-
- /** Returns the filter object that imports/exports the form controls. */
- inline const ::oox::core::FilterBase& getFilter() const { return mrFilter; }
- /** Returns the UNO form used to insert the control models. */
- ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
- getControlForm() const;
- /** Returns the UNO RGB color from the passed encoded OLE color. */
- sal_Int32 convertColor( sal_uInt32 nAxColor ) const;
-
-protected:
- /** Derived classes returns the UNO form of the current context. Called exactly once. */
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
- createControlForm() const = 0;
-
-private:
- const ::oox::core::FilterBase& mrFilter;
- const AxDefaultColorMode meColorMode;
- mutable ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > mxForm;
- mutable bool mbHasFormQuerried;
-};
-
-// ============================================================================
-
-/** Helper functions and callbacks for ActiveX form controls embedded in a
- document. */
-class AxEmbeddedControlHelper : public AxControlHelper
-{
-public:
- explicit AxEmbeddedControlHelper(
- const ::oox::core::FilterBase& rFilter,
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
- AxDefaultColorMode eColorMode = AX_DEFAULTCOLORMODE_BGR );
-
-protected:
- /** Creates and returns the standard UNO form in the wrapped draw page. */
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
- createControlForm() const;
-
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage;
-};
-
-// ============================================================================
-
-} // namespace ole
-} // namespace oox
-
-#endif
-
diff --git a/oox/inc/oox/ole/olehelper.hxx b/oox/inc/oox/ole/olehelper.hxx
index 91ca73a38a67..ba46d3baf6df 100644
--- a/oox/inc/oox/ole/olehelper.hxx
+++ b/oox/inc/oox/ole/olehelper.hxx
@@ -31,13 +31,49 @@
#include <rtl/ustring.hxx>
#include "oox/helper/binarystreambase.hxx"
-namespace oox { class BinaryInputStream; }
+namespace oox {
+ class BinaryInputStream;
+ class GraphicHelper;
+}
namespace oox {
namespace ole {
// ============================================================================
+const sal_Char* const OLE_GUID_STDFONT = "{0BE35203-8F91-11CE-9DE3-00AA004BB851}";
+const sal_Char* const OLE_GUID_STDPIC = "{0BE35204-8F91-11CE-9DE3-00AA004BB851}";
+const sal_Char* const OLE_GUID_STDHLINK = "{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}";
+
+// ============================================================================
+
+const sal_uInt16 OLE_STDFONT_NORMAL = 400;
+const sal_uInt16 OLE_STDFONT_BOLD = 700;
+
+const sal_uInt8 OLE_STDFONT_ITALIC = 0x02;
+const sal_uInt8 OLE_STDFONT_UNDERLINE = 0x04;
+const sal_uInt8 OLE_STDFONT_STRIKE = 0x08;
+
+/** Stores data about a StdFont font structure. */
+struct StdFontInfo
+{
+ ::rtl::OUString maName; /// Font name.
+ sal_uInt32 mnHeight; /// Font height (1/10,000 points).
+ sal_uInt16 mnWeight; /// Font weight (normal/bold).
+ sal_uInt16 mnCharSet; /// Font charset.
+ sal_uInt8 mnFlags; /// Font flags.
+
+ explicit StdFontInfo();
+ explicit StdFontInfo(
+ const ::rtl::OUString& rName,
+ sal_uInt32 nHeight,
+ sal_uInt16 nWeight = OLE_STDFONT_NORMAL,
+ sal_uInt16 nCharSet = WINDOWS_CHARSET_ANSI,
+ sal_uInt8 nFlags = 0 );
+};
+
+// ============================================================================
+
/** Stores data about a StdHlink hyperlink. */
struct StdHlinkInfo
{
@@ -53,14 +89,45 @@ struct StdHlinkInfo
class OleHelper
{
public:
- /** Imports a GUID from the passed binary stream and returns its string representation. */
+ /** Returns the UNO RGB color from the passed encoded OLE color.
+
+ @param bDefaultColorBgr
+ True = OLE default color type is treated as BGR color.
+ False = OLE default color type is treated as palette color.
+ */
+ static sal_Int32 decodeOleColor(
+ const GraphicHelper& rGraphicHelper,
+ sal_uInt32 nOleColor,
+ bool bDefaultColorBgr = true );
+
+ /** Imports a GUID from the passed binary stream and returns its string
+ representation (in uppercase characters).
+ */
static ::rtl::OUString importGuid( BinaryInputStream& rInStrm );
- /** Imports an OLE StdPic picture from the current position of the passed binary stream. */
- static bool importStdPic( StreamDataSequence& orGraphicData, BinaryInputStream& rInStrm, bool bWithGuid );
+ /** Imports an OLE StdFont font structure from the current position of the
+ passed binary stream.
+ */
+ static bool importStdFont(
+ StdFontInfo& orFontInfo,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
+
+ /** Imports an OLE StdPic picture from the current position of the passed
+ binary stream.
+ */
+ static bool importStdPic(
+ StreamDataSequence& orGraphicData,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
- /** Imports an OLE StdHlink from the current position of the passed binary stream. */
- static bool importStdHlink( StdHlinkInfo& orHlinkInfo, BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc, bool bWithGuid );
+ /** Imports an OLE StdHlink from the current position of the passed binary
+ stream.
+ */
+ static bool importStdHlink(
+ StdHlinkInfo& orHlinkInfo,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
private:
OleHelper(); // not implemented
diff --git a/oox/inc/oox/helper/olestorage.hxx b/oox/inc/oox/ole/olestorage.hxx
index a8174a167729..a84fadfadc92 100644..100755
--- a/oox/inc/oox/helper/olestorage.hxx
+++ b/oox/inc/oox/ole/olestorage.hxx
@@ -25,18 +25,18 @@
*
************************************************************************/
-#ifndef OOX_HELPER_OLESTORAGE_HXX
-#define OOX_HELPER_OLESTORAGE_HXX
+#ifndef OOX_OLE_OLESTORAGE_HXX
+#define OOX_OLE_OLESTORAGE_HXX
#include "oox/helper/storagebase.hxx"
namespace com { namespace sun { namespace star {
namespace lang { class XMultiServiceFactory; }
namespace container { class XNameContainer; }
- namespace container { class XNameAccess; }
} } }
namespace oox {
+namespace ole {
// ============================================================================
@@ -51,7 +51,7 @@ public:
explicit OleStorage(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
bool bBaseStreamAccess );
virtual ~OleStorage();
@@ -59,9 +59,19 @@ public:
private:
explicit OleStorage(
const OleStorage& rParentStorage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxElementsAccess,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxStorage,
+ const ::rtl::OUString& rElementName,
+ bool bReadOnly );
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
const ::rtl::OUString& rElementName );
+ /** Initializes the API storage object for input. */
+ void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream );
+ /** Initializes the API storage object for input/output. */
+ void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream );
+
/** Returns true, if the object represents a valid storage. */
virtual bool implIsStorage() const;
@@ -77,7 +87,7 @@ private:
virtual void implGetElementNames( ::std::vector< ::rtl::OUString >& orElementNames ) const;
/** Opens and returns the specified sub storage from the storage. */
- virtual StorageRef implOpenSubStorage( const ::rtl::OUString& rElementName, bool bCreate );
+ virtual StorageRef implOpenSubStorage( const ::rtl::OUString& rElementName, bool bCreateMissing );
/** Opens and returns the specified input stream from the storage. */
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
@@ -87,17 +97,20 @@ private:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
implOpenOutputStream( const ::rtl::OUString& rElementName );
-private:
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > XNameContainerRef;
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > XNameAccessRef;
+ /** Commits the current storage. */
+ virtual void implCommit() const;
- XNameContainerRef mxStorage; /// Complete storage based on input or output stream.
- XNameAccessRef mxElements; /// Access to elements of current sub storage.
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ mxFactory; /// Factory for storage/stream creation.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxStorage; /// Access to elements of this sub storage.
+ const OleStorage* mpParentStorage; /// Parent OLE storage that contains this storage.
};
// ============================================================================
+} // namespace ole
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx
new file mode 100755
index 000000000000..ec1c25be6952
--- /dev/null
+++ b/oox/inc/oox/ole/vbacontrol.hxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * 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 OOX_OLE_VBACONTROL_HXX
+#define OOX_OLE_VBACONTROL_HXX
+
+#include "oox/ole/axcontrol.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+} } }
+
+namespace oox { class StorageBase; }
+
+namespace oox {
+namespace ole {
+
+class VbaFormControl;
+
+// ============================================================================
+
+/** Common properties for all controls that are part of a VBA user form or of
+ another container control in a VBA user form. */
+class VbaSiteModel
+{
+public:
+ explicit VbaSiteModel();
+ virtual ~VbaSiteModel();
+
+ /** Allows to set single properties specified by XML token identifier. */
+ void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
+ /** Imports the site model data from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+
+ /** Returns the programmatical name of the control. */
+ inline const ::rtl::OUString& getName() const { return maName; }
+ /** Returns the position of the control in its parent. */
+ inline const AxPairData& getPosition() const { return maPos; }
+ /** Returns true, if this control is a container control. */
+ bool isContainer() const;
+ /** Returns the length of the stream data for stream based controls. */
+ sal_uInt32 getStreamLength() const;
+ /** Returns the name of the substorage for the container control data. */
+ ::rtl::OUString getSubStorageName() const;
+ /** Returns the tab index of the control. */
+ inline sal_Int16 getTabIndex() const { return mnTabIndex; }
+
+ /** Tries to create the control model according to the site model. */
+ ControlModelRef createControlModel( const AxClassTable& rClassTable ) const;
+ /** Converts all form site properties. */
+ void convertProperties(
+ PropertyMap& rPropMap,
+ const ControlConverter& rConv,
+ ApiControlType eCtrlType,
+ sal_Int32 nCtrlIndex ) const;
+
+protected:
+ ::rtl::OUString maName; /// Name of the control.
+ ::rtl::OUString maTag; /// User defined tag.
+ ::rtl::OUString maToolTip; /// Tool tip for the control.
+ ::rtl::OUString maLinkedCell; /// Linked cell for the control value in a spreadsheet.
+ ::rtl::OUString maSourceRange; /// Source data for the control in a spreadsheet.
+ AxPairData maPos; /// Position in parent container.
+ sal_Int32 mnId; /// Control identifier.
+ sal_Int32 mnHelpContextId; /// Help context identifier.
+ sal_uInt32 mnFlags; /// Various flags.
+ sal_uInt32 mnStreamLen; /// Size of control stream data.
+ sal_Int16 mnTabIndex; /// Tab order index.
+ sal_uInt16 mnClassIdOrCache; /// Class name identifier or GUID cache index.
+ sal_uInt16 mnGroupId; /// Group identifier for grouped controls.
+};
+
+typedef ::boost::shared_ptr< VbaSiteModel > VbaSiteModelRef;
+
+// ============================================================================
+
+/** A control that is embedded in a VBA user form or in another container
+ control in a VBA user form.
+
+ The control may be a 'simple' control with its data stored in the 'o'
+ stream, or it may be a container control with its data stored in an own
+ substorage.
+ */
+class VbaFormControl
+{
+public:
+ explicit VbaFormControl();
+ virtual ~VbaFormControl();
+
+ /** Imports the model from the passed stream or storage, depending on the
+ control's type. Imports all embedded controls, if this is a container. */
+ void importModelOrStorage(
+ BinaryInputStream& rInStrm,
+ StorageBase& rStrg,
+ const AxClassTable& rClassTable );
+
+ /** Returns the programmatical name of the control. */
+ ::rtl::OUString getControlName() const;
+
+ /** Creates the UNO control model, inserts it into the passed container,
+ and converts all control properties. */
+ void createAndConvert(
+ sal_Int32 nCtrlIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxParentNC,
+ const ControlConverter& rConv ) const;
+
+protected:
+ /** Creates and imports the control model containing properties of the control. */
+ void importControlModel( BinaryInputStream& rInStrm, const AxClassTable& rClassTable );
+ /** Creates and imports the control model, and imports all embedded
+ controls from the passed substorage. */
+ void importStorage( StorageBase& rStrg, const AxClassTable& rClassTable );
+
+ /** Converts all control properties, and inserts and converts embedded controls. */
+ bool convertProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv,
+ sal_Int32 nCtrlIndex ) const;
+
+private:
+ typedef RefVector< VbaFormControl > VbaFormControlVector;
+ typedef VbaFormControlVector::value_type VbaFormControlRef;
+
+ /** Creates the control model according to the current site model. */
+ void createControlModel( const AxClassTable& rClassTable );
+ /** Imports the site model data containing common properties of the control. */
+ bool importSiteModel( BinaryInputStream& rInStrm );
+
+ /** Imports the site models of all embedded controls from the 'f' stream. */
+ bool importEmbeddedSiteModels( BinaryInputStream& rInStrm );
+ /* Final processing of all embedded controls after import. */
+ void finalizeEmbeddedControls();
+
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+ /** Moves all embedded controls from their relative position in this
+ control to an absolute position in the parent of this control. */
+ void moveEmbeddedToAbsoluteParent();
+
+ /** Functor for comparing controls by their tab index. */
+ static bool compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight );
+
+protected:
+ VbaSiteModelRef mxSiteModel; /// Common control properties.
+ ControlModelRef mxCtrlModel; /// Specific control properties.
+
+private:
+ VbaFormControlVector maControls; /// All embedded form controls.
+ AxClassTable maClassTable; /// Class identifiers for exotic embedded controls.
+};
+
+// ============================================================================
+
+class VbaUserForm : public VbaFormControl, public ControlConverter
+{
+public:
+ explicit VbaUserForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Imports the form and its embedded controls, and inserts the form with
+ all its controls into the passed dialog library. */
+ void importForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxDialogLib,
+ StorageBase& rVbaFormStrg,
+ const ::rtl::OUString& rModuleName,
+ rtl_TextEncoding eTextEnc );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxGlobalFactory;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/ole/vbahelper.hxx b/oox/inc/oox/ole/vbahelper.hxx
new file mode 100755
index 000000000000..76dc1c736025
--- /dev/null
+++ b/oox/inc/oox/ole/vbahelper.hxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * 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 OOX_OLE_VBAHELPER_HXX
+#define OOX_OLE_VBAHELPER_HXX
+
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace document { class XEventsSupplier; }
+} } }
+
+namespace oox { class BinaryInputStream; }
+
+namespace oox {
+namespace ole {
+
+// Directory stream record identifiers ========================================
+
+const sal_uInt16 VBA_ID_MODULECOOKIE = 0x002C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRING = 0x001C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRINGUNICODE = 0x0048;
+const sal_uInt16 VBA_ID_MODULEEND = 0x002B;
+const sal_uInt16 VBA_ID_MODULEHELPCONTEXT = 0x001E;
+const sal_uInt16 VBA_ID_MODULENAME = 0x0019;
+const sal_uInt16 VBA_ID_MODULENAMEUNICODE = 0x0047;
+const sal_uInt16 VBA_ID_MODULEOFFSET = 0x0031;
+const sal_uInt16 VBA_ID_MODULEPRIVATE = 0x0028;
+const sal_uInt16 VBA_ID_MODULEREADONLY = 0x0025;
+const sal_uInt16 VBA_ID_MODULESTREAMNAME = 0x001A;
+const sal_uInt16 VBA_ID_MODULESTREAMNAMEUNICODE = 0x0032;
+const sal_uInt16 VBA_ID_MODULETYPEDOCUMENT = 0x0022;
+const sal_uInt16 VBA_ID_MODULETYPEPROCEDURAL = 0x0021;
+const sal_uInt16 VBA_ID_PROJECTCODEPAGE = 0x0003;
+const sal_uInt16 VBA_ID_PROJECTEND = 0x0010;
+const sal_uInt16 VBA_ID_PROJECTMODULES = 0x000F;
+const sal_uInt16 VBA_ID_PROJECTVERSION = 0x0009;
+
+// ============================================================================
+
+/** Static helper functions for the VBA filters. */
+class VbaHelper
+{
+public:
+ /** Returns the full Basic script URL from a VBA module and macro name.
+ The script is assumed to be in a document library. */
+ static ::rtl::OUString getBasicScriptUrl(
+ const ::rtl::OUString& rLibraryName,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName );
+
+ /** Reads the next record from the VBA directory stream 'dir'.
+
+ @param rnRecId (out parameter) The record identifier of the new record.
+ @param rRecData (out parameter) The contents of the new record.
+ @param rInStrm The 'dir' stream.
+
+ @return True = next record successfully read. False on any error, or
+ if the stream is EOF.
+ */
+ static bool readDirRecord(
+ sal_uInt16& rnRecId,
+ StreamDataSequence& rRecData,
+ BinaryInputStream& rInStrm );
+
+ /** Extracts a key/value pair from a string separated by an equality sign.
+
+ @param rKey (out parameter) The key before the separator.
+ @param rValue (out parameter) The value following the separator.
+ @param rCodeLine The source key/value pair.
+
+ @return True = Equality sign separator found, and the returned key and
+ value are not empty. False otherwise.
+ */
+ static bool extractKeyValue(
+ ::rtl::OUString& rKey,
+ ::rtl::OUString& rValue,
+ const ::rtl::OUString& rKeyValue );
+
+ /** Removes whitespace characters from the beginning of the passed string.
+
+ @param rCodeLine (in/out parameter) The string to be modified.
+
+ @return True = at least one whitespace character found and removed
+ from rCodeLine. False = rCodeLine is empty or does not start with
+ a whitespace character.
+ */
+ static bool eatWhitespace( ::rtl::OUString& rCodeLine );
+
+ /** Removes the passed keyword from the beginning of the passed string.
+
+ @param rCodeLine (in/out parameter) The string to be modified.
+
+ @param rKeyword The keyword to be removed from the beginning of the
+ rCodeLine string.
+
+ @return True = rCodeLine starts with the passed keyword (case
+ insensitive), and is followed by whitespace characters, or it ends
+ right after the keyword. The keyword and the following whitespace
+ characters have been removed from rCodeLine. False = rCodeLine is
+ empty or does not start with the specified keyword, or the keyword
+ is not followed by whitespace characters.
+ */
+ static bool eatKeyword( ::rtl::OUString& rCodeLine, const ::rtl::OUString& rKeyword );
+
+ /** Returns the VBA source code of the specified module, or an empty
+ string, if the module does not exist.
+
+ @param rxBasicLib The container for all VBA code modules.
+ @param rModuleName The name of the VBA code module.
+ */
+ static ::rtl::OUString getSourceCode(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::rtl::OUString& rModuleName );
+
+ /** Checks, if a macro with the specified name exists in the passed VBA
+ source code.
+
+ @param rSourceCode The VBA source code.
+ @param rMacroName The name of the macro.
+ */
+ static bool hasMacro(
+ const ::rtl::OUString& rSourceCode,
+ const ::rtl::OUString& rMacroName );
+
+ /** Checks, if a macro with the specified name exists in the specified
+ module.
+
+ @param rxBasicLib The container for all VBA code modules.
+ @param rModuleName The name of the VBA module to check for the macro.
+ @param rMacroName The name of the macro.
+ */
+ static bool hasMacro(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName );
+
+ /** Tries to insert a VBA macro into the specified code module.
+
+ @descr If the specified macro does not exist, it will be generated as
+ following, using the passed parameters. If the parameter rMacroType
+ is left empty, a sub procedure macro will be generated:
+
+ Private Sub <rMacroName> ( <rMacroArgs> )
+ <rMacroCode>
+ End Sub
+
+ If the parameter rMacroType is not empty, a function macro
+ will be generated. Note that the parameter rMacroCode has to
+ provide the code that returns the function value.
+
+ Private Function <rMacroName> ( <rMacroArgs> ) As <rMacroType>
+ <rMacroCode>
+ End Function
+
+ The source code in rMacroCode may contain a special placeholder
+ $MACRO that will be replaced by the macro name passed in rMacroName
+ before the macro will be inserted into the module.
+
+ @param rModuleName The name of the VBA module to be used.
+ @param rMacroName The name of the VBA macro to be inserted.
+ @param rMacroArgs The argument list of the VBA macro.
+ @param rMacroType Macro return type (empty for sub procedure).
+ @param rMacroCode The VBA source code for the macro.
+
+ @return True, if the specified VBA macro has been inserted. False, if
+ there already exists a macro with the specified name, or if any
+ error has occurred, for example, Office configuration forbids to
+ generate executable VBA code or the specified module does not
+ exist.
+ */
+ static bool insertMacro(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName,
+ const ::rtl::OUString& rMacroArgs,
+ const ::rtl::OUString& rMacroType,
+ const ::rtl::OUString& rMacroCode );
+
+ /** Tries to attach a VBA macro to an event of the passed events supplier.
+
+ @descr The function checks if the specified macro exists and attaches
+ it to the event of the passed events supplier.
+
+ @param rxEventsSupp The events supplier for the event to be attached.
+ @param rEventName The event name used in the office API.
+ @param rLibraryName The name of the Basic library containing the macro.
+ @param rModuleName The name of the VBA module containing the macro.
+ @param rMacroName The name of the VBA macro to attach to the event.
+ */
+ static bool attachMacroToEvent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
+ const ::rtl::OUString& rEventName,
+ const ::rtl::OUString& rLibraryName,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName );
+
+private:
+ VbaHelper();
+ ~VbaHelper();
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/ole/vbamodule.hxx b/oox/inc/oox/ole/vbamodule.hxx
new file mode 100755
index 000000000000..3b529ceee129
--- /dev/null
+++ b/oox/inc/oox/ole/vbamodule.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_OLE_VBAMODULE_HXX
+#define OOX_OLE_VBAMODULE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameAccess; }
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+} } }
+
+namespace oox {
+ class BinaryInputStream;
+ class StorageBase;
+}
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+class VbaModule
+{
+public:
+ explicit VbaModule(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const ::rtl::OUString& rName,
+ rtl_TextEncoding eTextEnc,
+ bool bExecutable );
+
+ /** Returns the module type (com.sun.star.script.ModuleType constant). */
+ inline sal_Int32 getType() const { return mnType; }
+ /** Sets the passed module type. */
+ inline void setType( sal_Int32 nType ) { mnType = nType; }
+
+ /** Returns the name of the module. */
+ inline const ::rtl::OUString& getName() const { return maName; }
+ /** Returns the stream name of the module. */
+ inline const ::rtl::OUString& getStreamName() const { return maStreamName; }
+
+ /** Imports all records for this module until the MODULEEND record. */
+ void importDirRecords( BinaryInputStream& rDirStrm );
+ /** Imports the Basic source code into the passed Basic library. */
+ void importSourceCode(
+ StorageBase& rVbaStrg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ mxDocModel; /// Document model used to import/export the VBA project.
+ ::rtl::OUString maName;
+ ::rtl::OUString maStreamName;
+ ::rtl::OUString maDocString;
+ rtl_TextEncoding meTextEnc;
+ sal_Int32 mnType;
+ sal_uInt32 mnOffset;
+ bool mbReadOnly;
+ bool mbPrivate;
+ bool mbExecutable;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx
new file mode 100755
index 000000000000..0422ccbd0cf8
--- /dev/null
+++ b/oox/inc/oox/ole/vbaproject.hxx
@@ -0,0 +1,289 @@
+/*************************************************************************
+ *
+ * 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 OOX_OLE_VBAPROJECT_HXX
+#define OOX_OLE_VBAPROJECT_HXX
+
+#include "oox/helper/storagebase.hxx"
+#include <com/sun/star/uno/XInterface.hpp>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace document { class XEventsSupplier; }
+ namespace frame { class XModel; }
+ namespace script { class XLibraryContainer; }
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace oox { class GraphicHelper; }
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC VbaFilterConfig
+{
+public:
+ explicit VbaFilterConfig(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::rtl::OUString& rConfigCompName );
+ ~VbaFilterConfig();
+
+ /** Returns true, if the VBA source code and forms should be imported. */
+ bool isImportVba() const;
+ /** Returns true, if the VBA source code should be imported executable. */
+ bool isImportVbaExecutable() const;
+ /** Returns true, if the VBA source code and forms should be exported. */
+ bool isExportVba() const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ mxConfigAccess;
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig
+{
+public:
+ explicit VbaProject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const ::rtl::OUString& rConfigCompName );
+ virtual ~VbaProject();
+
+ /** Imports the entire VBA project from the passed storage.
+
+ @param rVbaPrjStrg The root storage of the entire VBA project.
+ */
+ void importVbaProject(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Returns true, if the document contains at least one code module. */
+ bool hasModules() const;
+ /** Returns true, if the document contains the specified code module. */
+ bool hasModule( const ::rtl::OUString& rModuleName ) const;
+
+ /** Returns true, if the document contains at least one dialog. */
+ bool hasDialogs() const;
+ /** Returns true, if the document contains the specified dialog. */
+ bool hasDialog( const ::rtl::OUString& rDialogName ) const;
+
+ // Insert VBA code modules and VBA macros into modules --------------------
+
+ /** Tries to insert a VBA macro into the specified code module.
+
+ @descr If the specified macro does not exist, it will be generated as
+ following, using the passed parameters. If the parameter rMacroType
+ is left empty, a sub procedure macro will be generated:
+
+ Private Sub <rMacroName> ( <rMacroArgs> )
+ <rMacroCode>
+ End Sub
+
+ If the parameter rMacroType is not empty, a function macro
+ will be generated. Note that the parameter rMacroCode has to
+ provide the code that returns the function value.
+
+ Private Function <rMacroName> ( <rMacroArgs> ) As <rMacroType>
+ <rMacroCode>
+ End Function
+
+ The source code in rMacroCode may contain a special placeholder
+ $MACRO that will be replaced by the macro name passed in rMacroName
+ before the macro will be inserted into the module.
+
+ @param rModuleName The name of the VBA module to be used.
+ @param rMacroName The name of the VBA macro to be inserted.
+ @param rMacroArgs The argument list of the VBA macro.
+ @param rMacroType Macro return type (empty for sub procedure).
+ @param rMacroCode The VBA source code for the macro.
+
+ @return True, if the specified VBA macro has been inserted. False, if
+ there already exists a macro with the specified name, or if any
+ error has occurred, for example, Office configuration forbids to
+ generate executable VBA code or the specified module does not
+ exist.
+ */
+ bool insertMacro(
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName,
+ const ::rtl::OUString& rMacroArgs,
+ const ::rtl::OUString& rMacroType,
+ const ::rtl::OUString& rMacroCode );
+
+ // Attach VBA macros to generic or document events ------------------------
+
+ /** Tries to attach the specified VBA macro to an event directly.
+
+ @descr The function checks if the specified macro exists and attaches
+ it to the event of the passed events supplier.
+
+ @param rxEventsSupp The events supplier for the event to be attached.
+ @param rEventName The event name used in the office API.
+ @param rModuleName The name of the VBA module containing the macro.
+ @param rMacroName The name of the VBA macro to attach to the event.
+
+ @return True, if the specified VBA macro exists and could be attached
+ to the specified event.
+ */
+ bool attachMacroToEvent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
+ const ::rtl::OUString& rEventName,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName );
+
+ /** Tries to attach the specified VBA macro to a document event directly.
+
+ @descr The function checks if the specified macro exists and attaches
+ it to the document event.
+
+ @param rEventName The document event name used in the office API.
+ @param rModuleName The name of the VBA module containing the macro.
+ @param rMacroName The name of the VBA macro to attach to the event.
+
+ @return True, if the specified VBA macro exists and could be attached
+ to the specified document event.
+ */
+ bool attachMacroToDocumentEvent(
+ const ::rtl::OUString& rEventName,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName );
+
+ /** Tries to attach the specified VBA macro to an event via a generated
+ proxy macro that implements necessary conversion between VBA and UNO.
+
+ @descr The function checks if the specified VBA macro exists, then it
+ tries to generate a proxy macro using the parameters passed to this
+ function, appends it to the code module, and attaches it to the
+ event.
+
+ The proxy macro will execute the code specified in the rProxyCode
+ parameter. This code may contain special placeholders that will be
+ replaced before the proxy macro will be inserted into the module:
+ - $MACRO will be replaced by the original VBA macro name passed
+ in the rMacroName parameter.
+ - $PROXY will be replaced by the name of the proxy macro
+ generated by this function.
+
+ @param rxEventsSupp The events supplier for the event to be attached.
+ @param rEventName The event name used in the office API.
+ @param rModuleName The name of the VBA module containing the macro.
+ @param rMacroName The name of the VBA macro to attach to the event.
+ @param rProxyArgs The argument list of the generated proxy macro.
+ @param rProxyType Proxy macro return type (empty for procedure).
+ @param rProxyCode Proxy macro source code.
+
+ @return True, if the specified VBA macro exists and could be attached
+ to the specified event.
+ */
+ bool attachMacroToEvent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
+ const ::rtl::OUString& rEventName,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName,
+ const ::rtl::OUString& rProxyArgs,
+ const ::rtl::OUString& rProxyType,
+ const ::rtl::OUString& rProxyCode );
+
+ /** Tries to attach the specified VBA macro to a document event via a
+ proxy macro that implements necessary conversion between VBA and UNO.
+
+ @descr The function checks if the specified VBA macro exists, then it
+ tries to generate a proxy macro using the parameters passed to this
+ function, appends it to the code module, and attaches it to the
+ document event.
+
+ The proxy macro will execute the code specified in the rProxyCode
+ parameter. This code may contain special placeholders that will be
+ replaced before the proxy macro will be inserted into the module:
+ - $MACRO will be replaced by the original VBA macro name passed
+ in the rMacroName parameter.
+ - $PROXY will be replaced by the name of the proxy macro
+ generated by this function.
+
+ @param rEventName The document event name used in the office API.
+ @param rModuleName The name of the VBA module containing the macro.
+ @param rMacroName The name of the VBA macro to attach to the event.
+ @param rProxyArgs The argument list of the generated proxy macro.
+ @param rProxyType Proxy macro return type (empty for procedure).
+ @param rProxyCode Proxy macro source code.
+
+ @return True, if the specified VBA macro exists and could be attached
+ to the specified event.
+ */
+ bool attachMacroToDocumentEvent(
+ const ::rtl::OUString& rEventName,
+ const ::rtl::OUString& rModuleName,
+ const ::rtl::OUString& rMacroName,
+ const ::rtl::OUString& rProxyArgs,
+ const ::rtl::OUString& rProxyType,
+ const ::rtl::OUString& rProxyCode );
+
+private:
+ VbaProject( const VbaProject& );
+ VbaProject& operator=( const VbaProject& );
+
+ /** Returns the Basic or dialog library container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >
+ getLibraryContainer( sal_Int32 nPropId );
+ /** Opens a Basic or dialog library (creates missing if specified). */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ openLibrary( sal_Int32 nPropId, bool bCreateMissing );
+ /** Creates and returns the Basic library of the document used for import. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ createBasicLibrary();
+ /** Creates and returns the dialog library of the document used for import. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ createDialogLibrary();
+ /** Imports the VBA code modules and forms. */
+ void importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr );
+ /** Copies the entire VBA project storage to the passed document model. */
+ void copyStorage( StorageBase& rVbaPrjStrg );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ mxGlobalFactory; /// Global service factory.
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ mxDocModel; /// Document model used to import/export the VBA project.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxBasicLib; /// The Basic library of the document used for import.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxDialogLib; /// The dialog library of the document used for import.
+ const ::rtl::OUString maLibName; /// Name for Basic and dialog library used for import.
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/ppt/pptimport.hxx b/oox/inc/oox/ppt/pptimport.hxx
index 7d04e1c492fa..c4ee29447c64 100644
--- a/oox/inc/oox/ppt/pptimport.hxx
+++ b/oox/inc/oox/ppt/pptimport.hxx
@@ -53,8 +53,6 @@ public:
virtual bool importDocument() throw();
virtual bool exportDocument() throw();
- virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
-
virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
virtual ::oox::vml::Drawing* getVmlDrawing();
virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
@@ -66,7 +64,10 @@ public:
std::vector< SlidePersistPtr >& getMasterPages(){ return maMasterPages; };
std::vector< SlidePersistPtr >& getNotesPages(){ return maNotesPages; };
+ sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+
private:
+ virtual GraphicHelper* implCreateGraphicHelper() const;
virtual ::rtl::OUString implGetImplementationName() const;
private:
diff --git a/oox/inc/oox/vml/vmldrawing.hxx b/oox/inc/oox/vml/vmldrawing.hxx
index 1af14903793b..2312514d7117 100644
--- a/oox/inc/oox/vml/vmldrawing.hxx
+++ b/oox/inc/oox/vml/vmldrawing.hxx
@@ -39,7 +39,7 @@ namespace com { namespace sun { namespace star {
} } }
namespace oox { namespace core { class XmlFilterBase; } }
-namespace oox { namespace ole { class AxControlHelper; } }
+namespace oox { namespace ole { class EmbeddedForm; } }
namespace oox {
namespace vml {
@@ -110,8 +110,8 @@ public:
inline ShapeContainer& getShapes() { return *mxShapes; }
/** Returns read access to the container of shapes and templates. */
inline const ShapeContainer& getShapes() const { return *mxShapes; }
- /** Returns the helper object used to process ActiveX form controls. */
- ::oox::ole::AxControlHelper& getControlHelper() const;
+ /** Returns the form object used to process ActiveX form controls. */
+ ::oox::ole::EmbeddedForm& getControlForm() const;
/** Registers the passed embedded OLE object. The related shape will then
load the OLE object data from the specified fragment. */
@@ -146,12 +146,8 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
const ShapeClientData& rClientData ) const;
-protected:
- /** Derived classes may create a specialized form control helper object. */
- virtual ::oox::ole::AxControlHelper* createControlHelper() const;
-
private:
- typedef ::std::auto_ptr< ::oox::ole::AxControlHelper > AxControlHelperPtr;
+ typedef ::std::auto_ptr< ::oox::ole::EmbeddedForm > EmbeddedFormPtr;
typedef ::std::auto_ptr< ShapeContainer > ShapeContainerPtr;
typedef ::std::map< ::rtl::OUString, OleObjectInfo > OleObjectInfoMap;
typedef ::std::map< ::rtl::OUString, ControlInfo > ControlInfoMap;
@@ -159,7 +155,7 @@ private:
::oox::core::XmlFilterBase& mrFilter; /// Filter object that imports/exports the VML drawing.
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
mxDrawPage; /// UNO draw page used to insert the shapes.
- mutable AxControlHelperPtr mxCtrlHelper;/// Form control helper.
+ mutable EmbeddedFormPtr mxCtrlForm; /// The control form used to process ActiveX controls.
ShapeContainerPtr mxShapes; /// All shapes and shape templates.
OleObjectInfoMap maOleObjects; /// Info about all embedded OLE objects, mapped by shape id.
ControlInfoMap maControls; /// Info about all embedded form controls, mapped by control name.
diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx
index b997c7451fe4..1a9c1811cf6b 100644
--- a/oox/inc/oox/vml/vmlformatting.hxx
+++ b/oox/inc/oox/vml/vmlformatting.hxx
@@ -30,8 +30,11 @@
#include "oox/helper/helper.hxx"
-namespace oox { class PropertyMap; }
-namespace oox { namespace core { class FilterBase; } }
+namespace oox {
+ class GraphicHelper;
+ class ModelObjectHelper;
+ class PropertyMap;
+}
namespace oox {
namespace vml {
@@ -71,7 +74,7 @@ public:
/** Converts the passed VML measure string to EMU (English Metric Units).
- @param rFilter The core filter object needed to perform pixel
+ @param rGraphicHelper The graphic helper needed to perform pixel
conversion according to the current output device.
@param rValue The VML measure value. This is a floating-point value
@@ -88,7 +91,7 @@ public:
pixel. Set to false if omitted measure unit means EMU.
*/
static sal_Int32 decodeMeasureToEmu(
- const ::oox::core::FilterBase& rFilter,
+ const GraphicHelper& rGraphicHelper,
const ::rtl::OUString& rValue,
sal_Int32 nRefValue,
bool bPixelX,
@@ -96,14 +99,14 @@ public:
/** Converts the passed VML measure string to 1/100 mm.
- @param rFilter See above.
+ @param rGraphicHelper See above.
@param rValue See above.
@param nRefValue See above.
@param bPixelX See above.
@param bDefaultAsPixel See above.
*/
static sal_Int32 decodeMeasureToHmm(
- const ::oox::core::FilterBase& rFilter,
+ const GraphicHelper& rGraphicHelper,
const ::rtl::OUString& rValue,
sal_Int32 nRefValue,
bool bPixelX,
@@ -147,7 +150,8 @@ struct StrokeModel
/** Writes the properties to the passed property map. */
void pushToPropMap(
PropertyMap& rPropMap,
- const ::oox::core::FilterBase& rFilter ) const;
+ ModelObjectHelper& rModelObjectHelper,
+ const GraphicHelper& rGraphicHelper ) const;
};
// ============================================================================
@@ -172,7 +176,8 @@ struct FillModel
/** Writes the properties to the passed property map. */
void pushToPropMap(
PropertyMap& rPropMap,
- const ::oox::core::FilterBase& rFilter ) const;
+ ModelObjectHelper& rModelObjectHelper,
+ const GraphicHelper& rGraphicHelper ) const;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx
index f425b983ada2..b4f36c113c3d 100644
--- a/oox/inc/oox/xls/biffhelper.hxx
+++ b/oox/inc/oox/xls/biffhelper.hxx
@@ -493,6 +493,8 @@ const sal_uInt16 BIFF_ID_TOPMARGIN = 0x0028;
const sal_uInt16 BIFF_ID_TXO = 0x01B6;
const sal_uInt16 BIFF_ID_UNCALCED = 0x005E;
const sal_uInt16 BIFF_ID_USESELFS = 0x0160;
+const sal_uInt16 BIFF_ID_VBAPROJECT = 0x00D3;
+const sal_uInt16 BIFF_ID_VBAPROJECTEMPTY = 0x01BD;
const sal_uInt16 BIFF_ID_VCENTER = 0x0084;
const sal_uInt16 BIFF_ID_VERPAGEBREAKS = 0x001A;
const sal_uInt16 BIFF_ID_WINDOW1 = 0x003D;
diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx
index 5da8b50d7f92..b5d7a97f33b5 100644
--- a/oox/inc/oox/xls/excelfilter.hxx
+++ b/oox/inc/oox/xls/excelfilter.hxx
@@ -34,22 +34,23 @@
namespace oox {
namespace xls {
-// ============================================================================
+class WorkbookData;
-class WorkbookHelper;
+// ============================================================================
class ExcelFilterBase
{
+public:
+ void registerWorkbookData( WorkbookData& rData );
+ WorkbookData& getWorkbookData() const;
+ void unregisterWorkbookData();
+
protected:
explicit ExcelFilterBase();
virtual ~ExcelFilterBase();
- void setWorkbookHelper( WorkbookHelper& rHelper );
- WorkbookHelper& getWorkbookHelper() const;
- void clearWorkbookHelper();
-
private:
- WorkbookHelper* mpHelper; /// Nonowning pointer to helper base.
+ WorkbookData* mpData;
};
// ============================================================================
@@ -64,15 +65,13 @@ public:
virtual bool importDocument() throw();
virtual bool exportDocument() throw();
- virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
- virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
-
virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
virtual ::oox::vml::Drawing* getVmlDrawing();
virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
private:
+ virtual GraphicHelper* implCreateGraphicHelper() const;
virtual ::rtl::OUString implGetImplementationName() const;
};
@@ -88,9 +87,8 @@ public:
virtual bool importDocument() throw();
virtual bool exportDocument() throw();
- virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
-
private:
+ virtual GraphicHelper* implCreateGraphicHelper() const;
virtual ::rtl::OUString implGetImplementationName() const;
};
diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx
new file mode 100755
index 000000000000..6a517d13cd88
--- /dev/null
+++ b/oox/inc/oox/xls/excelvbaproject.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 OOX_XLS_EXCELVBAPROJECT_HXX
+#define OOX_XLS_EXCELVBAPROJECT_HXX
+
+#include "oox/ole/vbaproject.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace sheet { class XSpreadsheetDocument; }
+} } }
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+/** Special implementation of the VBA project for the Excel filters. */
+class OOX_DLLPUBLIC VbaProject : public ::oox::ole::VbaProject
+{
+public:
+ explicit VbaProject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument );
+
+ /** Attaches all document and sheet events to existing VBA macros. */
+ void attachToEvents();
+
+private:
+ /** Attaches VBA macros to all supported document events. */
+ void attachToDocumentEvents( const ::rtl::OUString& rCodeName );
+
+ /** Attaches VBA macros to all supported sheet events. */
+ void attachToSheetEvents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventsSupplier >& rxEventsSupp,
+ const ::rtl::OUString& rCodeName );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
+ mxDocument;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx
index 7eb00d4bd57d..4fa9c964108e 100644
--- a/oox/inc/oox/xls/stylesbuffer.hxx
+++ b/oox/inc/oox/xls/stylesbuffer.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/table/CellVertJustify.hpp>
#include <com/sun/star/table/TableBorder.hpp>
#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/graphichelper.hxx"
#include "oox/drawingml/color.hxx"
#include "oox/xls/numberformatsbuffer.hxx"
@@ -78,6 +79,22 @@ const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; /// Relative character h
// ============================================================================
+/** Special implementation of the GraphicHelper for Excel palette and scheme
+ colors.
+ */
+class ExcelGraphicHelper : public GraphicHelper, public WorkbookHelper
+{
+public:
+ explicit ExcelGraphicHelper( const WorkbookHelper& rHelper );
+
+ /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
+ virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+ /** Derived classes may implement to resolve a palette index to an RGB color. */
+ virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
+};
+
+// ============================================================================
+
class Color : public ::oox::drawingml::Color
{
public:
@@ -205,7 +222,7 @@ struct ApiScriptFontName
{
::rtl::OUString maName; /// Font name.
sal_Int16 mnFamily; /// Font family.
- sal_Int16 mnCharSet; /// Font character set.
+ sal_Int16 mnTextEnc; /// Font text encoding.
explicit ApiScriptFontName();
};
diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx
index 90c0f33c3c50..0ff8c0f9d3e5 100644
--- a/oox/inc/oox/xls/workbookhelper.hxx
+++ b/oox/inc/oox/xls/workbookhelper.hxx
@@ -29,9 +29,8 @@
#define OOX_XLS_WORKBOOKHELPER_HXX
#include <boost/shared_ptr.hpp>
-#include <osl/time.h>
#include <rtl/ref.hxx>
-#include <com/sun/star/uno/Reference.hxx>
+#include "oox/helper/storagebase.hxx"
#include "oox/xls/biffhelper.hxx"
namespace com { namespace sun { namespace star {
@@ -72,87 +71,8 @@ namespace oox { namespace drawingml {
namespace oox {
namespace xls {
-// DEBUG ======================================================================
-
-// Set this define to 1 to show the load/save time of a document in an assertion (nonpro only).
-#define OOX_SHOW_LOADSAVE_TIME 0
-
-// ----------------------------------------------------------------------------
-
-#define OOX_LOADSAVE_TIMER( eTimerType ) (void)0
-
-#if OSL_DEBUG_LEVEL > 0
-namespace dbg {
-
-// ----------------------------------------------------------------------------
-
-#if OOX_SHOW_LOADSAVE_TIME > 0
-
-enum TimerType
-{
- TIMER_IMPORTFORMULA,
- TIMER_IMPORTSHEETFRAGMENT,
- TIMER_ONCREATESHEETCONTEXT,
- TIMER_IMPORTROW,
- TIMER_CONVERTROWFORMAT,
- TIMER_CONVERTCOLUMNFORMAT,
- TIMER_IMPORTCELL,
- TIMER_ONENDSHEETELEMENT,
- TIMER_SETCELL,
- TIMER_SETCELLFORMAT,
- TIMER_MERGECELLFORMAT,
- TIMER_WRITECELLPROPERTIES,
- TIMER_FINALIZESHEETDATA,
- TIMER_FINALIZEDRAWING,
- TIMER_FINALIZEBOOKDATA,
-
- // TIMER_TOTAL must be the last entry!
- TIMER_TOTAL
-};
-
-// ----------------------------------------------------------------------------
-
-struct TimeCount;
-
-class Timer
-{
-public:
- explicit Timer( TimeCount& rTimeCount );
- ~Timer();
-private:
- TimeCount& mrTimeCount;
- TimeValue maStartTime;
-};
-
-// ----------------------------------------------------------------------------
-
-#undef OOX_LOADSAVE_TIMER
-#define OOX_LOADSAVE_TIMER( TimerType ) ::oox::xls::dbg::Timer aDbgTimer##TimerType( getTimeCount( ::oox::xls::dbg::TIMER_##TimerType ) )
-
-#endif
-
-// ----------------------------------------------------------------------------
-
-struct WorkbookData;
-
-class WorkbookHelper
-{
-protected:
- explicit WorkbookHelper( WorkbookData& rBookData );
- explicit WorkbookHelper( const WorkbookHelper& rCopy );
- virtual ~WorkbookHelper();
-#if OOX_SHOW_LOADSAVE_TIME > 0
-public:
- TimeCount& getTimeCount( TimerType eType ) const;
-#endif
-private:
- WorkbookData& mrDbgBookData;
-};
-
-// ----------------------------------------------------------------------------
-
-} // namespace dbg
-#endif
+class ExcelFilter;
+class ExcelBiffFilter;
// ============================================================================
@@ -201,14 +121,15 @@ class BiffCodecHelper;
object of type WorkbookData containing global workbook settings, buffers,
converters, etc. Nearly all classes in this filter implementation are
derived directly or indirectly from this class.
+
+ This class contains just a simple reference to the WorkbookData object to
+ prevent circular references, as the WorkbookData object contains a lot of
+ objects derived from this class.
*/
class WorkbookHelper
-#if OSL_DEBUG_LEVEL > 0
- : public dbg::WorkbookHelper
-#endif
{
public:
- /*implicit*/ WorkbookHelper( WorkbookData& rBookData );
+ inline /*implicit*/ WorkbookHelper( WorkbookData& rBookData ) : mrBookData( rBookData ) {}
virtual ~WorkbookHelper();
// filter -----------------------------------------------------------------
@@ -229,6 +150,8 @@ public:
/** Sets the index of the current sheet in the Calc document. */
void setCurrentSheetIndex( sal_Int16 nSheet );
+ /** Sets the VBA project storage. */
+ void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg );
/** Final conversion after importing the workbook. */
void finalizeWorkbookImport();
@@ -334,7 +257,7 @@ public:
/** Returns the page and print settings converter. */
PageSettingsConverter& getPageSettingsConverter() const;
- // OOX specific -----------------------------------------------------------
+ // OOX specific (MUST NOT be called in BIFF filter) -----------------------
/** Returns the base OOX filter object.
Must not be called, if current filter is not the OOX filter. */
@@ -344,7 +267,7 @@ public:
the full path to the fragment stream. */
bool importOoxFragment( const ::rtl::Reference< ::oox::core::FragmentHandler >& rxHandler );
- // BIFF specific ----------------------------------------------------------
+ // BIFF specific (MUST NOT be called in OOX filter) -----------------------
/** Returns the base BIFF filter object. */
::oox::core::BinaryFilterBase& getBiffFilter() const;
@@ -392,8 +315,8 @@ struct WorkbookDataOwner
class WorkbookHelperRoot : private prv::WorkbookDataOwner, public WorkbookHelper
{
public:
- explicit WorkbookHelperRoot( ::oox::core::XmlFilterBase& rFilter );
- explicit WorkbookHelperRoot( ::oox::core::BinaryFilterBase& rFilter, BiffType eBiff );
+ explicit WorkbookHelperRoot( ExcelFilter& rFilter );
+ explicit WorkbookHelperRoot( ExcelBiffFilter& rFilter, BiffType eBiff );
/** Returns true, if this helper refers to a valid document. */
bool isValid() const;
@@ -409,4 +332,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx
index c96f12605911..17e22dc5342c 100644
--- a/oox/inc/oox/xls/worksheetsettings.hxx
+++ b/oox/inc/oox/xls/worksheetsettings.hxx
@@ -120,6 +120,8 @@ public:
void importPassword( BiffInputStream& rStrm );
/** Imports protection settings from the SHEETPROTECTION record. */
void importSheetProtection( BiffInputStream& rStrm );
+ /** Imports the VBA code module name from the CODENAME record. */
+ void importCodeName( BiffInputStream& rStrm );
/** Imports phonetic settings from the PHONETICPR record. */
void importPhoneticPr( BiffInputStream& rStrm );
diff --git a/oox/prj/build.lst b/oox/prj/build.lst
index a1dfa584543c..345c72e00558 100644
--- a/oox/prj/build.lst
+++ b/oox/prj/build.lst
@@ -1,4 +1,4 @@
-oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx tools vcl BOOST:boost OPENSSL:openssl NULL
+oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx xmlscript tools vcl BOOST:boost OPENSSL:openssl NULL
oox oox usr1 - all oox_mkout NULL
oox oox\prj get - all oox_prj NULL
oox oox\source\token nmake - all oox_token NULL
diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index 2c9d8d5bae74..482a270926a3 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -4,7 +4,9 @@ mkdir: %_DEST%\inc%_EXT%\oox\core
mkdir: %_DEST%\inc%_EXT%\oox\drawingml
mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart
mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
+mkdir: %_DEST%\inc%_EXT%\oox\ole
mkdir: %_DEST%\inc%_EXT%\oox\vml
+mkdir: %_DEST%\inc%_EXT%\oox\xls
..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib
@@ -22,6 +24,7 @@ mkdir: %_DEST%\inc%_EXT%\oox\vml
..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx
..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
+..\inc\oox\helper\containerhelper.hxx %_DEST%\inc%_EXT%\oox\helper\containerhelper.hxx
..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx
..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx
..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
@@ -30,8 +33,10 @@ mkdir: %_DEST%\inc%_EXT%\oox\vml
..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx
..\inc\oox\drawingml\chart\chartconverter.hxx %_DEST%\inc%_EXT%\oox\drawingml\chart\chartconverter.hxx
..\inc\oox\drawingml\table\tablestylelist.hxx %_DEST%\inc%_EXT%\oox\drawingml\table\tablestylelist.hxx
+..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx
..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx
..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx
+..\inc\oox\xls\excelvbaproject.hxx %_DEST%\inc%_EXT%\oox\xls\excelvbaproject.hxx
dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
diff --git a/oox/source/core/binaryfilterbase.cxx b/oox/source/core/binaryfilterbase.cxx
index 1dd2e0e9086c..f308f02ac9dc 100644
--- a/oox/source/core/binaryfilterbase.cxx
+++ b/oox/source/core/binaryfilterbase.cxx
@@ -26,7 +26,7 @@
************************************************************************/
#include "oox/core/binaryfilterbase.hxx"
-#include "oox/helper/olestorage.hxx"
+#include "oox/ole/olestorage.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -52,12 +52,12 @@ BinaryFilterBase::~BinaryFilterBase()
StorageRef BinaryFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const
{
- return StorageRef( new OleStorage( getGlobalFactory(), rxInStream, true ) );
+ return StorageRef( new ::oox::ole::OleStorage( getGlobalFactory(), rxInStream, true ) );
}
StorageRef BinaryFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const
{
- return StorageRef( new OleStorage( getGlobalFactory(), rxOutStream, true ) );
+ return StorageRef( new ::oox::ole::OleStorage( getGlobalFactory(), rxOutStream, true ) );
}
// ============================================================================
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 07c31736e9e7..902784cafe80 100755
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -27,8 +27,6 @@
#include "oox/core/filterbase.hxx"
#include <set>
-#include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
@@ -57,10 +55,7 @@ using ::com::sun::star::lang::IllegalArgumentException;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::lang::XComponent;
using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::awt::DeviceInfo;
-using ::com::sun::star::awt::XDevice;
using ::com::sun::star::frame::XFrame;
-using ::com::sun::star::frame::XFramesSupplier;
using ::com::sun::star::frame::XModel;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
@@ -139,12 +134,10 @@ struct FilterBaseImpl
typedef ::boost::shared_ptr< ModelObjectHelper > ModelObjHelperRef;
typedef ::boost::shared_ptr< OleObjectHelper > OleObjHelperRef;
typedef ::std::map< OUString, Reference< XGraphic > > EmbeddedGraphicMap;
- typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette;
FilterDirection meDirection;
SequenceAsHashMap maArguments;
MediaDescriptor maMediaDesc;
- DeviceInfo maDeviceInfo;
OUString maFileUrl;
StorageRef mxStorage;
@@ -152,11 +145,11 @@ struct FilterBaseImpl
ModelObjHelperRef mxModelObjHelper; /// Tables to create new named drawing objects.
OleObjHelperRef mxOleObjHelper; /// OLE object handling.
EmbeddedGraphicMap maEmbeddedGraphics; /// Maps all imported embedded graphics by their path.
- SystemPalette maSystemPalette; /// Maps system colors (XML tokens) to RGB color values.
Reference< XMultiServiceFactory > mxGlobalFactory;
Reference< XModel > mxModel;
Reference< XMultiServiceFactory > mxModelFactory;
+ Reference< XFrame > mxTargetFrame;
Reference< XInputStream > mxInStream;
Reference< XStream > mxOutStream;
Reference< XStatusIndicator > mxStatusIndicator;
@@ -178,53 +171,6 @@ FilterBaseImpl::FilterBaseImpl( const Reference< XMultiServiceFactory >& rxGloba
mxGlobalFactory( rxGlobalFactory )
{
OSL_ENSURE( mxGlobalFactory.is(), "FilterBaseImpl::FilterBaseImpl - missing service factory" );
- if( mxGlobalFactory.is() )
- {
- // get the metric of the output device
- try
- {
- Reference< XFramesSupplier > xFramesSupp( mxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW );
- Reference< XFrame > xFrame( xFramesSupp->getActiveFrame(), UNO_SET_THROW );
- Reference< XDevice > xDevice( xFrame->getContainerWindow(), UNO_QUERY_THROW );
- maDeviceInfo = xDevice->getInfo();
- }
- catch( Exception& )
- {
- OSL_ENSURE( false, "FilterBaseImpl::FilterBaseImpl - cannot get output device info" );
- }
- }
-
- //! TODO: get colors from system
- maSystemPalette[ XML_3dDkShadow ] = 0x716F64;
- maSystemPalette[ XML_3dLight ] = 0xF1EFE2;
- maSystemPalette[ XML_activeBorder ] = 0xD4D0C8;
- maSystemPalette[ XML_activeCaption ] = 0x0054E3;
- maSystemPalette[ XML_appWorkspace ] = 0x808080;
- maSystemPalette[ XML_background ] = 0x004E98;
- maSystemPalette[ XML_btnFace ] = 0xECE9D8;
- maSystemPalette[ XML_btnHighlight ] = 0xFFFFFF;
- maSystemPalette[ XML_btnShadow ] = 0xACA899;
- maSystemPalette[ XML_btnText ] = 0x000000;
- maSystemPalette[ XML_captionText ] = 0xFFFFFF;
- maSystemPalette[ XML_gradientActiveCaption ] = 0x3D95FF;
- maSystemPalette[ XML_gradientInactiveCaption ] = 0xD8E4F8;
- maSystemPalette[ XML_grayText ] = 0xACA899;
- maSystemPalette[ XML_highlight ] = 0x316AC5;
- maSystemPalette[ XML_highlightText ] = 0xFFFFFF;
- maSystemPalette[ XML_hotLight ] = 0x000080;
- maSystemPalette[ XML_inactiveBorder ] = 0xD4D0C8;
- maSystemPalette[ XML_inactiveCaption ] = 0x7A96DF;
- maSystemPalette[ XML_inactiveCaptionText ] = 0xD8E4F8;
- maSystemPalette[ XML_infoBk ] = 0xFFFFE1;
- maSystemPalette[ XML_infoText ] = 0x000000;
- maSystemPalette[ XML_menu ] = 0xFFFFFF;
- maSystemPalette[ XML_menuBar ] = 0xECE9D8;
- maSystemPalette[ XML_menuHighlight ] = 0x316AC5;
- maSystemPalette[ XML_menuText ] = 0x000000;
- maSystemPalette[ XML_scrollBar ] = 0xD4D0C8;
- maSystemPalette[ XML_window ] = 0xFFFFFF;
- maSystemPalette[ XML_windowFrame ] = 0x000000;
- maSystemPalette[ XML_windowText ] = 0x000000;
}
void FilterBaseImpl::setDocumentModel( const Reference< XComponent >& rxComponent )
@@ -317,6 +263,11 @@ const Reference< XMultiServiceFactory >& FilterBase::getModelFactory() const
return mxImpl->mxModelFactory;
}
+const Reference< XFrame >& FilterBase::getTargetFrame() const
+{
+ return mxImpl->mxTargetFrame;
+}
+
const Reference< XStatusIndicator >& FilterBase::getStatusIndicator() const
{
return mxImpl->mxStatusIndicator;
@@ -404,9 +355,9 @@ StorageRef FilterBase::getStorage() const
return mxImpl->mxStorage;
}
-StorageRef FilterBase::openSubStorage( const OUString& rStorageName, bool bCreate ) const
+StorageRef FilterBase::openSubStorage( const OUString& rStorageName, bool bCreateMissing ) const
{
- return mxImpl->mxStorage->openSubStorage( rStorageName, bCreate );
+ return mxImpl->mxStorage->openSubStorage( rStorageName, bCreateMissing );
}
Reference< XInputStream > FilterBase::openInputStream( const OUString& rStreamName ) const
@@ -429,7 +380,7 @@ void FilterBase::commitStorage() const
GraphicHelper& FilterBase::getGraphicHelper() const
{
if( !mxImpl->mxGraphicHelper )
- mxImpl->mxGraphicHelper.reset( new GraphicHelper( mxImpl->mxGlobalFactory ) );
+ mxImpl->mxGraphicHelper.reset( implCreateGraphicHelper() );
return *mxImpl->mxGraphicHelper;
}
@@ -447,42 +398,6 @@ OleObjectHelper& FilterBase::getOleObjectHelper() const
return *mxImpl->mxOleObjHelper;
}
-const DeviceInfo& FilterBase::getDeviceInfo() const
-{
- return mxImpl->maDeviceInfo;
-}
-
-sal_Int32 FilterBase::convertScreenPixelX( double fPixelX ) const
-{
- return (mxImpl->maDeviceInfo.PixelPerMeterX > 0) ?
- static_cast< sal_Int32 >( (fPixelX * 100000.0) / mxImpl->maDeviceInfo.PixelPerMeterX ) : 0;
-}
-
-sal_Int32 FilterBase::convertScreenPixelY( double fPixelY ) const
-{
- return (mxImpl->maDeviceInfo.PixelPerMeterY > 0) ?
- static_cast< sal_Int32 >( (fPixelY * 100000.0) / mxImpl->maDeviceInfo.PixelPerMeterY ) : 0;
-}
-
-sal_Int32 FilterBase::getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb ) const
-{
- FilterBaseImpl::SystemPalette::const_iterator aIt = mxImpl->maSystemPalette.find( nToken );
- OSL_ENSURE( aIt != mxImpl->maSystemPalette.end(), "FilterBase::getSystemColor - invalid token identifier" );
- return (aIt == mxImpl->maSystemPalette.end()) ? nDefaultRgb : aIt->second;
-}
-
-sal_Int32 FilterBase::getSchemeColor( sal_Int32 /*nToken*/ ) const
-{
- OSL_ENSURE( false, "FilterBase::getSchemeColor - scheme colors not implemented" );
- return API_RGB_TRANSPARENT;
-}
-
-sal_Int32 FilterBase::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const
-{
- OSL_ENSURE( false, "FilterBase::getPaletteColor - palette colors not implemented" );
- return API_RGB_TRANSPARENT;
-}
-
OUString FilterBase::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const
{
::std::vector< OUString > aDefaultPasswords;
@@ -504,7 +419,7 @@ bool FilterBase::importBinaryData( StreamDataSequence& orDataSeq, const OUString
// copy the entire stream to the passed sequence
SequenceOutputStream aOutStrm( orDataSeq );
- aOutStrm.copyStream( aInStrm );
+ aInStrm.copyToStream( aOutStrm );
return true;
}
@@ -664,10 +579,16 @@ void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDesc
}
mxImpl->maFileUrl = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() );
+ mxImpl->mxTargetFrame = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_FRAME(), Reference< XFrame >() );
mxImpl->mxStatusIndicator = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), Reference< XStatusIndicator >() );
mxImpl->mxInteractionHandler = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), Reference< XInteractionHandler >() );
}
+GraphicHelper* FilterBase::implCreateGraphicHelper() const
+{
+ // default: return base implementation without any special behaviour
+ return new GraphicHelper( mxImpl->mxGlobalFactory, mxImpl->mxTargetFrame );
+}
// ============================================================================
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 3997d0b9af6d..12cafc48305a 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -35,10 +35,10 @@
#include "oox/helper/attributelist.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
-#include "oox/helper/olestorage.hxx"
#include "oox/helper/zipstorage.hxx"
#include "oox/core/fasttokenhandler.hxx"
#include "oox/core/namespaces.hxx"
+#include "oox/ole/olestorage.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Exception;
@@ -485,7 +485,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
}
// try to decrypt an encrypted OLE package
- OleStorage aOleStorage( mxFactory, xInStrm, false );
+ ::oox::ole::OleStorage aOleStorage( mxFactory, xInStrm, false );
if( aOleStorage.isStorage() ) try
{
// open the required input streams in the encrypted package
diff --git a/oox/source/core/recordparser.cxx b/oox/source/core/recordparser.cxx
index b1749ae7be07..8f0de9c2894a 100644
--- a/oox/source/core/recordparser.cxx
+++ b/oox/source/core/recordparser.cxx
@@ -277,7 +277,6 @@ void RecordParser::parseStream( const RecordInputSource& rInputSource ) throw( S
// try to leave a context, there may be other incomplete contexts on the stack
if( const RecordInfo* pEndRecInfo = getEndRecordInfo( nRecId ) )
{
- (void)pEndRecInfo; // shut warning up in non-debug
// finalize contexts without record identifier for context end
while( !mxStack->empty() && !mxStack->hasCurrentEndRecId() )
mxStack->popContext();
@@ -288,7 +287,7 @@ void RecordParser::parseStream( const RecordInputSource& rInputSource ) throw( S
if( xCurrContext.is() )
{
// context end record may contain some data, handle it as simple record
- aRecStrm.seek( 0 );
+ aRecStrm.seekToStart();
xCurrContext->startRecord( nRecId, aRecStrm );
xCurrContext->endRecord( nRecId );
}
@@ -303,7 +302,7 @@ void RecordParser::parseStream( const RecordInputSource& rInputSource ) throw( S
ContextHandlerRef xCurrContext = mxStack->getCurrentContext();
if( xCurrContext.is() )
{
- aRecStrm.seek( 0 );
+ aRecStrm.seekToStart();
xCurrContext = xCurrContext->createRecordContext( nRecId, aRecStrm );
}
// track all context identifiers on the stack (do not push simple records)
@@ -314,7 +313,7 @@ void RecordParser::parseStream( const RecordInputSource& rInputSource ) throw( S
if( xCurrContext.is() )
{
// import the record
- aRecStrm.seek( 0 );
+ aRecStrm.seekToStart();
xCurrContext->startRecord( nRecId, aRecStrm );
// end simple records (context records are finished in ContextStack::popContext)
if( !pStartRecInfo )
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index da7daa9a058e..97453d5bddb0 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -179,7 +179,7 @@ uno::Sequence< ::rtl::OUString > OOXMLDocPropHandler::GetKeywordsSet( const ::rt
case (sal_Unicode)',':
case (sal_Unicode)';':
case (sal_Unicode)':':
- case (sal_Unicode)' ':
+ case (sal_Unicode)'\t':
// this is a delimiter
// unfortunately I did not find any specification for the possible delimiters
if ( aResult[nCounter].getLength() )
diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx b/oox/source/drawingml/chart/chartdrawingfragment.cxx
index 9df064125457..fcc350b583c3 100644
--- a/oox/source/drawingml/chart/chartdrawingfragment.cxx
+++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx
@@ -2,14 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: chartdrawingfragment.cxx,v $
- *
- * $Revision: 1.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 08ca5f44bec3..5b898d4da6ed 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -847,7 +847,7 @@ sal_Int32 DetailFormatterBase::getPhColor( sal_Int32 nSeriesIdx ) const
Color aColor;
aColor.setSrgbClr( nPhClr );
aColor.addChartTintTransformation( fShadeTint );
- nPhClr = aColor.getColor( mrData.mrFilter );
+ nPhClr = aColor.getColor( mrData.mrFilter.getGraphicHelper() );
}
return nPhClr;
@@ -859,7 +859,7 @@ sal_Int32 DetailFormatterBase::getSchemeColor( sal_Int32 nColorToken, sal_Int32
aColor.setSchemeClr( nColorToken );
if( nModToken != XML_TOKEN_INVALID )
aColor.addTransformation( nModToken, nModValue );
- return aColor.getColor( mrData.mrFilter );
+ return aColor.getColor( mrData.mrFilter.getGraphicHelper() );
}
// ============================================================================
@@ -888,7 +888,7 @@ void LineFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Sh
aLineProps.assignUsed( *mxAutoLine );
if( rxShapeProp.is() )
aLineProps.assignUsed( rxShapeProp->getLineProperties() );
- aLineProps.pushToPropSet( rPropSet, mrData.mrFilter, mrData.maModelObjHelper, mrLinePropIds, getPhColor( nSeriesIdx ) );
+ aLineProps.pushToPropSet( rPropSet, mrData.maModelObjHelper, mrData.mrFilter.getGraphicHelper(), mrLinePropIds, getPhColor( nSeriesIdx ) );
}
// ============================================================================
@@ -916,7 +916,7 @@ void FillFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Sh
aFillProps.assignUsed( rxShapeProp->getFillProperties() );
if( pPicOptions )
lclConvertPictureOptions( aFillProps, *pPicOptions );
- aFillProps.pushToPropSet( rPropSet, mrData.mrFilter, mrData.maModelObjHelper, mrFillPropIds, 0, getPhColor( nSeriesIdx ) );
+ aFillProps.pushToPropSet( rPropSet, mrData.maModelObjHelper, mrData.mrFilter.getGraphicHelper(), mrFillPropIds, 0, getPhColor( nSeriesIdx ) );
}
// ============================================================================
diff --git a/oox/source/drawingml/clrschemecontext.cxx b/oox/source/drawingml/clrschemecontext.cxx
index d91f15c56e18..996ddef2ab0f 100644
--- a/oox/source/drawingml/clrschemecontext.cxx
+++ b/oox/source/drawingml/clrschemecontext.cxx
@@ -73,7 +73,7 @@ clrSchemeColorContext::clrSchemeColorContext( ContextHandler& rParent, ClrScheme
clrSchemeColorContext::~clrSchemeColorContext()
{
- mrClrScheme.setColor( mnColorToken, getColor( getFilter() ) );
+ mrClrScheme.setColor( mnColorToken, getColor( getFilter().getGraphicHelper() ) );
}
clrSchemeContext::clrSchemeContext( ContextHandler& rParent, ClrScheme& rClrScheme ) :
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index ebf62f17a01e..8653d787517d 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -30,8 +30,8 @@
#include <math.h>
#include "tokens.hxx"
#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/graphichelper.hxx"
#include "oox/core/namespaces.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
using ::rtl::OUString;
@@ -350,7 +350,7 @@ void Color::clearTransparence()
mnAlpha = MAX_PERCENT;
}
-sal_Int32 Color::getColor( const ::oox::core::FilterBase& rFilter, sal_Int32 nPhClr ) const
+sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const
{
/* Special handling for theme style list placeholder colors (state
COLOR_PH), Color::getColor() may be called with different placeholder
@@ -368,10 +368,10 @@ sal_Int32 Color::getColor( const ::oox::core::FilterBase& rFilter, sal_Int32 nPh
case COLOR_CRGB: break; // nothing to do
case COLOR_HSL: break; // nothing to do
- case COLOR_SCHEME: setResolvedRgb( rFilter.getSchemeColor( mnC1 ) ); break;
- case COLOR_PALETTE: setResolvedRgb( rFilter.getPaletteColor( mnC1 ) ); break;
- case COLOR_SYSTEM: setResolvedRgb( rFilter.getSystemColor( mnC1, mnC2 ) ); break;
- case COLOR_PH: setResolvedRgb( nPhClr ); bIsPh = true; break;
+ case COLOR_SCHEME: setResolvedRgb( rGraphicHelper.getSchemeColor( mnC1 ) ); break;
+ case COLOR_PALETTE: setResolvedRgb( rGraphicHelper.getPaletteColor( mnC1 ) ); break;
+ case COLOR_SYSTEM: setResolvedRgb( rGraphicHelper.getSystemColor( mnC1, mnC2 ) ); break;
+ case COLOR_PH: setResolvedRgb( nPhClr ); bIsPh = true; break;
case COLOR_FINAL: return mnC1;
}
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 28e84e72e2cc..4459c5936cfa 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -39,7 +39,6 @@
#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
using rtl::OUString;
-using namespace ::oox::core;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -60,8 +59,8 @@ void CustomShapeProperties::apply( const CustomShapePropertiesPtr& /* rSourceCus
// not sure if this needs to be implemented
}
-void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFilterBase */,
- const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape ) const
+void CustomShapeProperties::pushToPropSet(
+ const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape ) const
{
if ( maShapePresetType.getLength() )
{
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 0e4d56a6634b..168055935104 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -41,7 +41,6 @@
#include "oox/helper/modelobjecthelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
using namespace ::com::sun::star;
@@ -54,7 +53,6 @@ using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::geometry::IntegerRectangle2D;
-using ::oox::core::FilterBase;
namespace oox {
namespace drawingml {
@@ -105,30 +103,26 @@ RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
return RectanglePoint_LEFT_TOP;
}
-const awt::Size lclGetOriginalSize( const FilterBase& rFilter, const Reference< XGraphic >& rxGraphic )
+const awt::Size lclGetOriginalSize( const GraphicHelper& rGraphicHelper, const Reference< XGraphic >& rxGraphic )
{
- awt::Size aSize100thMM( 0, 0 );
+ awt::Size aSizeHmm( 0, 0 );
try
{
Reference< beans::XPropertySet > xGraphicPropertySet( rxGraphic, UNO_QUERY_THROW );
- if( xGraphicPropertySet->getPropertyValue( CREATE_OUSTRING( "Size100thMM" ) ) >>= aSize100thMM )
+ if( xGraphicPropertySet->getPropertyValue( CREATE_OUSTRING( "Size100thMM" ) ) >>= aSizeHmm )
{
- if( !aSize100thMM.Width && !aSize100thMM.Height )
+ if( !aSizeHmm.Width && !aSizeHmm.Height )
{ // MAPMODE_PIXEL USED :-(
awt::Size aSourceSizePixel( 0, 0 );
if( xGraphicPropertySet->getPropertyValue( CREATE_OUSTRING( "SizePixel" ) ) >>= aSourceSizePixel )
- {
- aSize100thMM = awt::Size(
- rFilter.convertScreenPixelX( aSourceSizePixel.Width ),
- rFilter.convertScreenPixelY( aSourceSizePixel.Height ) );
- }
+ aSizeHmm = rGraphicHelper.convertScreenPixelToHmm( aSourceSizePixel );
}
}
}
catch( Exception& )
{
}
- return aSize100thMM;
+ return aSizeHmm;
}
} // namespace
@@ -221,8 +215,8 @@ Color FillProperties::getBestSolidColor() const
return aSolidColor;
}
-void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter,
- ModelObjectHelper& rModelObjHelper, const FillPropertyIds& rPropIds,
+void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper, const FillPropertyIds& rPropIds,
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const
{
if( moFillType.has() )
@@ -237,7 +231,7 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
case XML_solidFill:
if( maFillColor.isUsed() )
{
- rPropMap.setProperty( rPropIds[ FillColorId ], maFillColor.getColor( rFilter, nPhClr ) );
+ rPropMap.setProperty( rPropIds[ FillColorId ], maFillColor.getColor( rGraphicHelper, nPhClr ) );
if( maFillColor.hasTransparence() )
rPropMap.setProperty( rPropIds[ FillTransparenceId ], maFillColor.getTransparence() );
eFillStyle = FillStyle_SOLID;
@@ -256,8 +250,8 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
size_t nColorCount = maGradientProps.maGradientStops.size();
if( nColorCount > 1 )
{
- aGradient.StartColor = maGradientProps.maGradientStops.begin()->second.getColor( rFilter, nPhClr );
- aGradient.EndColor = maGradientProps.maGradientStops.rbegin()->second.getColor( rFilter, nPhClr );
+ aGradient.StartColor = maGradientProps.maGradientStops.begin()->second.getColor( rGraphicHelper, nPhClr );
+ aGradient.EndColor = maGradientProps.maGradientStops.rbegin()->second.getColor( rGraphicHelper, nPhClr );
}
// "rotate with shape" not set, or set to false -> do not rotate
@@ -288,7 +282,7 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
{
GradientFillProperties::GradientStopMap::const_iterator aIt = maGradientProps.maGradientStops.begin();
// API StartColor is inner color in axial gradient
- aGradient.StartColor = (++aIt)->second.getColor( rFilter, nPhClr );
+ aGradient.StartColor = (++aIt)->second.getColor( rGraphicHelper, nPhClr );
}
nDmlAngle = maGradientProps.moShadeAngle.get( 0 ) - nShapeRotation;
}
@@ -319,7 +313,7 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
{
// TODO: "rotate with shape" is not possible with our current core
- OUString aGraphicUrl = rFilter.getGraphicHelper().createGraphicObject( maBlipProps.mxGraphic );
+ OUString aGraphicUrl = rGraphicHelper.createGraphicObject( maBlipProps.mxGraphic );
if( aGraphicUrl.getLength() > 0 )
{
// push bitmap or named bitmap to property map
@@ -353,7 +347,7 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
RectanglePoint eRectPoint = lclGetRectanglePoint( maBlipProps.moTileAlign.get( XML_tl ) );
rPropMap.setProperty( rPropIds[ FillBitmapRectanglePointId ], eRectPoint );
- awt::Size aOriginalSize = lclGetOriginalSize( rFilter, maBlipProps.mxGraphic );
+ awt::Size aOriginalSize = lclGetOriginalSize( rGraphicHelper, maBlipProps.mxGraphic );
if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) )
{
// size of one bitmap tile (given as 1/1000 percent of bitmap size), convert to 1/100 mm
@@ -381,7 +375,7 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
Color aColor = getBestSolidColor();
if( aColor.isUsed() )
{
- rPropMap.setProperty( rPropIds[ FillColorId ], aColor.getColor( rFilter, nPhClr ) );
+ rPropMap.setProperty( rPropIds[ FillColorId ], aColor.getColor( rGraphicHelper, nPhClr ) );
if( aColor.hasTransparence() )
rPropMap.setProperty( rPropIds[ FillTransparenceId ], aColor.getTransparence() );
eFillStyle = FillStyle_SOLID;
@@ -400,12 +394,12 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
}
}
-void FillProperties::pushToPropSet( PropertySet& rPropSet, const FilterBase& rFilter,
- ModelObjectHelper& rModelObjHelper, const FillPropertyIds& rPropIds,
+void FillProperties::pushToPropSet( PropertySet& rPropSet, ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper, const FillPropertyIds& rPropIds,
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const
{
PropertyMap aPropMap;
- pushToPropMap( aPropMap, rFilter, rModelObjHelper, rPropIds, nShapeRotation, nPhClr );
+ pushToPropMap( aPropMap, rModelObjHelper, rGraphicHelper, rPropIds, nShapeRotation, nPhClr );
rPropSet.setProperties( aPropMap );
}
@@ -416,7 +410,7 @@ void GraphicProperties::assignUsed( const GraphicProperties& rSourceProps )
maBlipProps.assignUsed( rSourceProps.maBlipProps );
}
-void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter, sal_Int32 nPhClr ) const
+void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const
{
if( maBlipProps.mxGraphic.is() )
{
@@ -424,8 +418,8 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase&
Reference< XGraphic > xGraphic = maBlipProps.mxGraphic;
if( maBlipProps.maColorChangeFrom.isUsed() && maBlipProps.maColorChangeTo.isUsed() )
{
- sal_Int32 nFromColor = maBlipProps.maColorChangeFrom.getColor( rFilter, nPhClr );
- sal_Int32 nToColor = maBlipProps.maColorChangeTo.getColor( rFilter, nPhClr );
+ sal_Int32 nFromColor = maBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
+ sal_Int32 nToColor = maBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
if ( (nFromColor != nToColor) || maBlipProps.maColorChangeTo.hasTransparence() ) try
{
sal_Int16 nToTransparence = maBlipProps.maColorChangeTo.getTransparence();
@@ -438,7 +432,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase&
}
}
- OUString aGraphicUrl = rFilter.getGraphicHelper().createGraphicObject( xGraphic );
+ OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
if( aGraphicUrl.getLength() > 0 )
rPropMap[ PROP_GraphicURL ] <<= aGraphicUrl;
}
@@ -461,10 +455,10 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase&
rPropMap[ PROP_AdjustContrast ] <<= nContrast;
}
-void GraphicProperties::pushToPropSet( PropertySet& rPropSet, const FilterBase& rFilter, sal_Int32 nPhClr ) const
+void GraphicProperties::pushToPropSet( PropertySet& rPropSet, const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const
{
PropertyMap aPropMap;
- pushToPropMap( aPropMap, rFilter, nPhClr );
+ pushToPropMap( aPropMap, rGraphicHelper, nPhClr );
rPropSet.setProperties( aPropMap );
}
diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
index 454222bc52e6..8adffb265240 100644
--- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx
+++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
@@ -270,12 +270,12 @@ Reference< XFastContextHandler > FillPropertiesContext::createFastChildContext(
{
switch( nElement )
{
- case A_TOKEN( noFill ): { rFillProps.moFillType = getToken( nElement ); return 0; };
- case A_TOKEN( solidFill ): { rFillProps.moFillType = getToken( nElement ); return new SolidFillContext( rParent, rxAttribs, rFillProps ); };
- case A_TOKEN( gradFill ): { rFillProps.moFillType = getToken( nElement ); return new GradientFillContext( rParent, rxAttribs, rFillProps.maGradientProps ); };
- case A_TOKEN( pattFill ): { rFillProps.moFillType = getToken( nElement ); return new PatternFillContext( rParent, rxAttribs, rFillProps.maPatternProps ); };
- case A_TOKEN( blipFill ): { rFillProps.moFillType = getToken( nElement ); return new BlipFillContext( rParent, rxAttribs, rFillProps.maBlipProps ); };
- case A_TOKEN( grpFill ): { rFillProps.moFillType = getToken( nElement ); return 0; }; // TODO
+ case A_TOKEN( noFill ): { rFillProps.moFillType = getToken( nElement ); return 0; };
+ case A_TOKEN( solidFill ): { rFillProps.moFillType = getToken( nElement ); return new SolidFillContext( rParent, rxAttribs, rFillProps ); };
+ case A_TOKEN( gradFill ): { rFillProps.moFillType = getToken( nElement ); return new GradientFillContext( rParent, rxAttribs, rFillProps.maGradientProps ); };
+ case A_TOKEN( pattFill ): { rFillProps.moFillType = getToken( nElement ); return new PatternFillContext( rParent, rxAttribs, rFillProps.maPatternProps ); };
+ case A_TOKEN( blipFill ): { rFillProps.moFillType = getToken( nElement ); return new BlipFillContext( rParent, rxAttribs, rFillProps.maBlipProps ); };
+ case A_TOKEN( grpFill ): { rFillProps.moFillType = getToken( nElement ); return 0; }; // TODO
}
return 0;
}
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index 4a9a0d04e1e5..9f23cf466d30 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -37,10 +37,10 @@
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
#include "properties.hxx"
#include "tokens.hxx"
+#include "oox/helper/graphichelper.hxx"
#include "oox/helper/modelobjecthelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/core/namespaces.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
@@ -52,7 +52,6 @@ using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::awt::Point;
using ::com::sun::star::container::XNameContainer;
-using ::oox::core::FilterBase;
namespace oox {
namespace drawingml {
@@ -395,8 +394,8 @@ void LineProperties::assignUsed( const LineProperties& rSourceProps )
moLineJoint.assignIfUsed( rSourceProps.moLineJoint );
}
-void LineProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter,
- ModelObjectHelper& rModelObjHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const
+void LineProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const
{
// line fill type must exist, otherwise ignore other properties
if( maLineFill.moFillType.has() )
@@ -453,7 +452,7 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
Color aLineColor = maLineFill.getBestSolidColor();
if( aLineColor.isUsed() )
{
- rPropMap.setProperty( rPropIds[ LineColorId ], aLineColor.getColor( rFilter, nPhClr ) );
+ rPropMap.setProperty( rPropIds[ LineColorId ], aLineColor.getColor( rGraphicHelper, nPhClr ) );
if( aLineColor.hasTransparence() )
rPropMap.setProperty( rPropIds[ LineTransparenceId ], aLineColor.getTransparence() );
}
@@ -464,11 +463,11 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFi
}
}
-void LineProperties::pushToPropSet( PropertySet& rPropSet, const FilterBase& rFilter,
- ModelObjectHelper& rModelObjHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const
+void LineProperties::pushToPropSet( PropertySet& rPropSet, ModelObjectHelper& rModelObjHelper,
+ const GraphicHelper& rGraphicHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const
{
PropertyMap aPropMap;
- pushToPropMap( aPropMap, rFilter, rModelObjHelper, rPropIds, nPhClr );
+ pushToPropMap( aPropMap, rModelObjHelper, rGraphicHelper, rPropIds, nPhClr );
rPropSet.setProperties( aPropMap );
}
diff --git a/oox/source/drawingml/linepropertiescontext.cxx b/oox/source/drawingml/linepropertiescontext.cxx
index 200af2eb6fb5..a2cf4111a524 100644
--- a/oox/source/drawingml/linepropertiescontext.cxx
+++ b/oox/source/drawingml/linepropertiescontext.cxx
@@ -93,7 +93,7 @@ Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext(
case A_TOKEN( headEnd ): // CT_LineEndProperties
case A_TOKEN( tailEnd ): // CT_LineEndProperties
- { // ST_LineEndType
+ { // ST_LineEndType
bool bTailEnd = nElement == A_TOKEN( tailEnd );
LineArrowProperties& rArrowProps = bTailEnd ? mrLineProperties.maEndArrow : mrLineProperties.maStartArrow;
rArrowProps.moArrowType = aAttribs.getToken( XML_type );
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 15c390a8162e..59b3f35dc8cc 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -384,6 +384,9 @@ Reference< XShape > Shape::createAndInsert(
}
}
+ ModelObjectHelper& rModelObjectHelper = rFilterBase.getModelObjectHelper();
+ const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
+
LineProperties aLineProperties;
aLineProperties.maLineFill.moFillType = XML_noFill;
sal_Int32 nLinePhClr = -1;
@@ -397,19 +400,19 @@ Reference< XShape > Shape::createAndInsert(
{
if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
aLineProperties.assignUsed( *pLineProps );
- nLinePhClr = pLineRef->maPhClr.getColor( rFilterBase );
+ nLinePhClr = pLineRef->maPhClr.getColor( rGraphicHelper );
}
if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
{
if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) )
aFillProperties.assignUsed( *pFillProps );
- nFillPhClr = pFillRef->maPhClr.getColor( rFilterBase );
+ nFillPhClr = pFillRef->maPhClr.getColor( rGraphicHelper );
}
// if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_fillRef ) )
// {
// if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) )
// aEffectProperties.assignUsed( *pEffectProps );
-// nEffectPhClr = pEffectRef->maPhClr.getColor( rFilterBase );
+// nEffectPhClr = pEffectRef->maPhClr.getColor( rGraphicHelper );
// }
}
@@ -438,11 +441,11 @@ Reference< XShape > Shape::createAndInsert(
// applying properties
PropertySet aPropSet( xSet );
if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) )
- mpGraphicPropertiesPtr->pushToPropSet( aPropSet, rFilterBase );
+ mpGraphicPropertiesPtr->pushToPropSet( aPropSet, rGraphicHelper );
if ( mpTablePropertiesPtr.get() && ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.TableShape" ) ) )
mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
- aFillProperties.pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper(), FillProperties::DEFAULT_IDS, mnRotation, nFillPhClr );
- aLineProperties.pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper(), LineProperties::DEFAULT_IDS, nLinePhClr );
+ aFillProperties.pushToPropSet( aPropSet, rModelObjectHelper, rGraphicHelper, FillProperties::DEFAULT_IDS, mnRotation, nFillPhClr );
+ aLineProperties.pushToPropSet( aPropSet, rModelObjectHelper, rGraphicHelper, LineProperties::DEFAULT_IDS, nLinePhClr );
// applying autogrowheight property before setting shape size, because
// the shape size might be changed if currently autogrowheight is true
@@ -458,7 +461,7 @@ Reference< XShape > Shape::createAndInsert(
aPropSet.setProperties( aShapeProperties );
if( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) )
- mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape );
+ mpCustomShapePropertiesPtr->pushToPropSet( xSet, mxShape );
// in some cases, we don't have any text body.
if( getTextBody() )
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 1684414eea2b..ee3ac495f4d6 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -80,7 +80,7 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ) )
{
Color aColor = rLineProperties.maLineFill.getBestSolidColor();
- aBorderLine.Color = aColor.getColor( rFilterBase );
+ aBorderLine.Color = aColor.getColor( rFilterBase.getGraphicHelper() );
aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
aBorderLine.LineDistance = 0;
@@ -360,7 +360,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
aFillProperties.assignUsed( maFillProperties );
PropertySet aPropSet( xPropSet );
// TODO: phClr?
- aFillProperties.pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper() );
+ aFillProperties.pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), rFilterBase.getGraphicHelper() );
}
} } }
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index aa08218053ac..4dbd632b2191 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -98,7 +98,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
// symbol font not supported
if( maCharColor.isUsed() )
- rPropMap[ PROP_CharColor ] <<= maCharColor.getColor( rFilter );
+ rPropMap[ PROP_CharColor ] <<= maCharColor.getColor( rFilter.getGraphicHelper() );
if( moLang.has() && (moLang.get().getLength() > 0) )
{
@@ -144,7 +144,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
if( moUnderline.has() && maUnderlineColor.isUsed() && !bUnderlineFillFollowText )
{
rPropMap[ PROP_CharUnderlineHasColor ] <<= true;
- rPropMap[ PROP_CharUnderlineColor ] <<= maUnderlineColor.getColor( rFilter );
+ rPropMap[ PROP_CharUnderlineColor ] <<= maUnderlineColor.getColor( rFilter.getGraphicHelper() );
}
}
diff --git a/oox/source/drawingml/textfont.cxx b/oox/source/drawingml/textfont.cxx
index f20c9b53511b..8d58787e544a 100644
--- a/oox/source/drawingml/textfont.cxx
+++ b/oox/source/drawingml/textfont.cxx
@@ -63,7 +63,7 @@ sal_Int16 lclGetFontFamily( sal_Int32 nOoxValue )
TextFont::TextFont() :
mnPitch( 0 ),
- mnCharset( 0 )
+ mnCharset( WINDOWS_CHARSET_ANSI )
{
}
@@ -72,7 +72,7 @@ void TextFont::setAttributes( const AttributeList& rAttribs )
maTypeface = rAttribs.getString( XML_typeface, OUString() );
maPanose = rAttribs.getString( XML_panose, OUString() );
mnPitch = rAttribs.getInteger( XML_pitchFamily, 0 );
- mnCharset = rAttribs.getInteger( XML_charset, 1 );
+ mnCharset = rAttribs.getInteger( XML_charset, WINDOWS_CHARSET_DEFAULT );
}
void TextFont::assignIfUsed( const TextFont& rTextFont )
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index 3416d4918e7b..2f5954168d37 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -322,7 +322,7 @@ void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase& rFilterBase, P
if ( maStyleName.hasValue() )
rPropMap[ PROP_CharStyleName ] <<= maStyleName;
if ( maBulletColorPtr->isUsed() )
- rPropMap[ PROP_BulletColor ] <<= maBulletColorPtr->getColor( rFilterBase );
+ rPropMap[ PROP_BulletColor ] <<= maBulletColorPtr->getColor( rFilterBase.getGraphicHelper() );
}
TextParagraphProperties::TextParagraphProperties()
diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx
index 21aa341107fa..ea1944d935a4 100644
--- a/oox/source/dump/biffdumper.cxx
+++ b/oox/source/dump/biffdumper.cxx
@@ -30,8 +30,8 @@
#include <osl/thread.h>
#include <rtl/tencinfo.h>
#include "oox/dump/oledumper.hxx"
-#include "oox/helper/olestorage.hxx"
#include "oox/core/filterbase.hxx"
+#include "oox/ole/olestorage.hxx"
#include "oox/xls/biffdetector.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/formulabase.hxx"
@@ -100,30 +100,30 @@ const sal_uInt16 BIFF_PT_NOSTRING = 0xFFFF;
namespace {
-void lclDumpDffClientPos( Output& rOut, BinaryInputStream& rStrm, const String& rName, sal_uInt16 nSubScale )
+void lclDumpDffClientPos( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm, const String& rName, sal_uInt16 nSubScale )
{
- MultiItemsGuard aMultiGuard( rOut );
- TableGuard aTabGuard( rOut, 17 );
+ MultiItemsGuard aMultiGuard( rxOut );
+ TableGuard aTabGuard( rxOut, 17 );
{
- sal_uInt16 nPos = rStrm.readuInt16();
- ItemGuard aItem( rOut, rName );
- rOut.writeDec( nPos );
+ sal_uInt16 nPos = rxStrm->readuInt16();
+ ItemGuard aItem( rxOut, rName );
+ rxOut->writeDec( nPos );
}
{
- sal_uInt16 nSubUnits = rStrm.readuInt16();
- ItemGuard aItem( rOut, "sub-units" );
- rOut.writeDec( nSubUnits );
- rOut.writeChar( '/' );
- rOut.writeDec( nSubScale );
+ sal_uInt16 nSubUnits = rxStrm->readuInt16();
+ ItemGuard aItem( rxOut, "sub-units" );
+ rxOut->writeDec( nSubUnits );
+ rxOut->writeChar( '/' );
+ rxOut->writeDec( nSubScale );
}
}
-void lclDumpDffClientRect( Output& rOut, BinaryInputStream& rStrm )
+void lclDumpDffClientRect( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm )
{
- lclDumpDffClientPos( rOut, rStrm, "start-col", 1024 );
- lclDumpDffClientPos( rOut, rStrm, "start-row", 256 );
- lclDumpDffClientPos( rOut, rStrm, "end-col", 1024 );
- lclDumpDffClientPos( rOut, rStrm, "end-row", 256 );
+ lclDumpDffClientPos( rxOut, rxStrm, "start-col", 1024 );
+ lclDumpDffClientPos( rxOut, rxStrm, "start-row", 256 );
+ lclDumpDffClientPos( rxOut, rxStrm, "end-col", 1024 );
+ lclDumpDffClientPos( rxOut, rxStrm, "end-row", 256 );
}
} // namespace
@@ -138,7 +138,7 @@ BiffDffStreamObject::BiffDffStreamObject( const OutputObjectBase& rParent, const
void BiffDffStreamObject::implDumpClientAnchor()
{
dumpHex< sal_uInt16 >( "flags", "DFF-CLIENTANCHOR-FLAGS" );
- lclDumpDffClientRect( out(), in() );
+ lclDumpDffClientRect( mxOut, mxStrm );
}
// ============================================================================
@@ -161,15 +161,16 @@ void BiffCtlsStreamObject::implDump()
{
if( mnLength > 0 )
{
- out().emptyLine();
+ mxOut->emptyLine();
writeEmptyItem( "CTLS-START" );
{
- IndentGuard aIndGuard( out() );
- in().seek( mnStartPos );
- OcxGuidControlObject( *this, mnLength ).dump();
+ IndentGuard aIndGuard( mxOut );
+ mxStrm->seek( mnStartPos );
+ RelativeInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, mnLength ) );
+ FormControlStreamObject( *this, xRelStrm ).dump();
}
writeEmptyItem( "CTLS-END" );
- out().emptyLine();
+ mxOut->emptyLine();
}
}
@@ -315,7 +316,7 @@ bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos,
switch( mnLastRecId )
{
case BIFF_ID_CHBEGIN:
- out().incIndent();
+ mxOut->incIndent();
break;
}
@@ -351,7 +352,7 @@ bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos,
mxBiffStrm->enableDecoder( false );
break;
case BIFF_ID_CHEND:
- out().decIndent();
+ mxOut->decIndent();
break;
}
@@ -416,10 +417,10 @@ void BiffObjectBase::writeFontPortions( const FontPortionModelList& rPortions )
if( !rPortions.empty() )
{
writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
- TableGuard aTabGuard( out(), 14 );
+ TableGuard aTabGuard( mxOut, 14 );
for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeDecItem( "char-pos", aIt->mnPos );
writeDecItem( "font-idx", aIt->mnFontId, "FONTNAMES" );
}
@@ -497,7 +498,7 @@ OUString BiffObjectBase::dumpUniString( const String& rName, BiffStringFlags nFl
// #122185# bRich flag may be set, but format runs may be missing
if( nFontCount > 0 )
{
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
FontPortionModelList aPortions;
aPortions.importPortions( *mxBiffStrm, nFontCount, BIFF_FONTPORTION_16BIT );
writeFontPortions( aPortions );
@@ -508,7 +509,7 @@ OUString BiffObjectBase::dumpUniString( const String& rName, BiffStringFlags nFl
if( nPhoneticSize > 0 )
{
sal_Int64 nStrmPos = mxBiffStrm->tell();
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
writeEmptyItem( "phonetic-data" );
dumpUnused( 2 );
dumpDec< sal_uInt16 >( "size" );
@@ -520,7 +521,7 @@ OUString BiffObjectBase::dumpUniString( const String& rName, BiffStringFlags nFl
if( nLen == 0 ) dumpUnused( 2 );
for( sal_uInt16 nPortion = 0; !mxBiffStrm->isEof() && (nPortion < nCount); ++nPortion )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
dumpDec< sal_uInt16 >( "first-portion-char" );
dumpDec< sal_uInt16 >( "first-main-char" );
dumpDec< sal_uInt16 >( "main-char-count" );
@@ -560,7 +561,7 @@ rtl_TextEncoding BiffObjectBase::dumpCodePage( const String& rName )
void BiffObjectBase::dumpFormulaResult( const String& rName )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
sal_uInt8 pnResult[ 8 ];
mxBiffStrm->readMemory( pnResult, 8 );
writeArrayItem( rName( "result" ), pnResult, 8 );
@@ -638,8 +639,7 @@ void BiffObjectBase::dumpRangeList( const String& rName, bool bCol16Bit, bool bR
void BiffObjectBase::dumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows )
{
- Output& rOut = out();
- MultiItemsGuard aMultiGuard( rOut );
+ MultiItemsGuard aMultiGuard( mxOut );
rnCols = dumpDec< sal_uInt8 >( "width" );
rnRows = dumpDec< sal_uInt16 >( "height" );
switch( getBiff() )
@@ -651,18 +651,17 @@ void BiffObjectBase::dumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRow
case BIFF8: ++rnCols; ++rnRows; break;
case BIFF_UNKNOWN: break;
}
- ItemGuard aItem( rOut, "size" );
- rOut.writeDec( rnCols );
- rOut.writeChar( 'x' );
- rOut.writeDec( rnRows );
+ ItemGuard aItem( mxOut, "size" );
+ mxOut->writeDec( rnCols );
+ mxOut->writeChar( 'x' );
+ mxOut->writeDec( rnRows );
aItem.cont();
- rOut.writeDec( rnCols * rnRows );
+ mxOut->writeDec( rnCols * rnRows );
}
OUString BiffObjectBase::dumpConstValue( sal_Unicode cStrQuote )
{
- Output& rOut = out();
- MultiItemsGuard aMultiGuard( rOut );
+ MultiItemsGuard aMultiGuard( mxOut );
OUStringBuffer aValue;
switch( dumpDec< sal_uInt8 >( "type", mxConstType ) )
{
@@ -672,7 +671,7 @@ OUString BiffObjectBase::dumpConstValue( sal_Unicode cStrQuote )
break;
case BIFF_DATATYPE_DOUBLE:
dumpDec< double >( "value" );
- aValue.append( rOut.getLastItemValue() );
+ aValue.append( mxOut->getLastItemValue() );
break;
case BIFF_DATATYPE_STRING:
aValue.append( dumpString( "value", BIFF_STR_8BITLENGTH ) );
@@ -680,12 +679,12 @@ OUString BiffObjectBase::dumpConstValue( sal_Unicode cStrQuote )
break;
case BIFF_DATATYPE_BOOL:
dumpBoolean( "value" );
- aValue.append( rOut.getLastItemValue() );
+ aValue.append( mxOut->getLastItemValue() );
dumpUnused( 7 );
break;
case BIFF_DATATYPE_ERROR:
dumpErrorCode( "value" );
- aValue.append( rOut.getLastItemValue() );
+ aValue.append( mxOut->getLastItemValue() );
dumpUnused( 7 );
break;
}
@@ -712,22 +711,22 @@ void BiffObjectBase::dumpFrHeader( bool bWithFlags, bool bWithRange )
void BiffObjectBase::dumpDffClientRect()
{
- lclDumpDffClientRect( out(), in() );
+ lclDumpDffClientRect( mxOut, mxStrm );
}
void BiffObjectBase::dumpEmbeddedDff()
{
- out().decIndent();
+ mxOut->decIndent();
writeEmptyItem( "EMBEDDED-DFF-START" );
- out().incIndent();
+ mxOut->incIndent();
mxDffObj->dump();
- out().emptyLine();
- out().decIndent();
+ mxOut->emptyLine();
+ mxOut->decIndent();
writeEmptyItem( "EMBEDDED-DFF-END" );
- out().incIndent();
+ mxOut->incIndent();
}
-void BiffObjectBase::dumpOcxControl()
+void BiffObjectBase::dumpControl()
{
sal_uInt32 nStartPos = dumpHex< sal_uInt32 >( "ctls-stream-pos", "CONV-DEC" );
sal_uInt32 nLength = dumpHex< sal_uInt32 >( "ctls-stream-length", "CONV-DEC" );
@@ -784,26 +783,25 @@ void FormulaObject::dumpNameFormula( const String& rName )
void FormulaObject::implDump()
{
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( maName );
writeDecItem( "formula-size", mnSize );
}
if( mnSize == 0 ) return;
- BinaryInputStream& rStrm = in();
- sal_Int64 nStartPos = rStrm.tell();
- sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, rStrm.getLength() );
+ sal_Int64 nStartPos = mxStrm->tell();
+ sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->getLength() );
bool bValid = mxTokens.get();
mxStack.reset( new FormulaStack );
maAddData.clear();
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
{
- TableGuard aTabGuard( out(), 8, 18 );
- while( bValid && !rStrm.isEof() && (rStrm.tell() < nEndPos) )
+ TableGuard aTabGuard( mxOut, 8, 18 );
+ while( bValid && !mxStrm->isEof() && (mxStrm->tell() < nEndPos) )
{
- MultiItemsGuard aMultiGuard( out() );
- writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( rStrm.tell() - nStartPos ) );
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( mxStrm->tell() - nStartPos ) );
sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
bValid = mxTokens->hasName( nTokenId );
if( bValid )
@@ -881,7 +879,7 @@ void FormulaObject::implDump()
}
}
}
- bValid = nEndPos == rStrm.tell();
+ bValid = nEndPos == mxStrm->tell();
if( bValid )
{
dumpAddTokenData();
@@ -889,7 +887,7 @@ void FormulaObject::implDump()
writeInfoItem( "classes", mxStack->getClassesString() );
}
else
- dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), nEndPos - rStrm.tell(), false );
+ dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), nEndPos - mxStrm->tell(), false );
mnSize = 0;
}
@@ -1006,12 +1004,12 @@ OUString FormulaObject::createPlaceHolder() const
sal_uInt16 FormulaObject::readFuncId()
{
- return (getBiff() >= BIFF4) ? in().readuInt16() : in().readuInt8();
+ return (getBiff() >= BIFF4) ? mxStrm->readuInt16() : mxStrm->readuInt8();
}
OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
{
- ItemGuard aItemGuard( out(), "func-id" );
+ ItemGuard aItemGuard( mxOut, "func-id" );
writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
OUStringBuffer aBuffer;
const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromBiffFuncId( nFuncId );
@@ -1025,9 +1023,9 @@ OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo*
}
OUString aFuncName = aBuffer.makeStringAndClear();
aItemGuard.cont();
- out().writeChar( OOX_DUMP_STRQUOTE );
- out().writeString( aFuncName );
- out().writeChar( OOX_DUMP_STRQUOTE );
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+ mxOut->writeString( aFuncName );
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
return aFuncName;
}
@@ -1133,13 +1131,13 @@ OUString FormulaObject::dumpTokenRefTabIdxs()
void FormulaObject::dumpIntToken()
{
dumpDec< sal_uInt16 >( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpDoubleToken()
{
dumpDec< double >( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpStringToken()
@@ -1153,13 +1151,13 @@ void FormulaObject::dumpStringToken()
void FormulaObject::dumpBoolToken()
{
dumpBoolean( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpErrorToken()
{
dumpErrorCode( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpMissArgToken()
@@ -1201,14 +1199,14 @@ void FormulaObject::dumpRefToken( const OUString& rTokClass, bool bNameMode )
{
TokenAddress aPos = dumpTokenAddress( bNameMode );
writeTokenAddressItem( "addr", aPos, bNameMode );
- mxStack->pushOperand( createRef( out().getLastItemValue() ), rTokClass );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
}
void FormulaObject::dumpAreaToken( const OUString& rTokClass, bool bNameMode )
{
TokenRange aRange = dumpTokenRange( bNameMode );
writeTokenRangeItem( "range", aRange, bNameMode );
- mxStack->pushOperand( createRef( out().getLastItemValue() ), rTokClass );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
}
void FormulaObject::dumpRefErrToken( const OUString& rTokClass, bool bArea )
@@ -1222,7 +1220,7 @@ void FormulaObject::dumpRef3dToken( const OUString& rTokClass, bool bNameMode )
OUString aRef = dumpTokenRefTabIdxs();
TokenAddress aPos = dumpTokenAddress( bNameMode );
writeTokenAddress3dItem( "addr", aRef, aPos, bNameMode );
- mxStack->pushOperand( out().getLastItemValue(), rTokClass );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
}
void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
@@ -1230,7 +1228,7 @@ void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
OUString aRef = dumpTokenRefTabIdxs();
TokenRange aRange = dumpTokenRange( bNameMode );
writeTokenRange3dItem( "range", aRef, aRange, bNameMode );
- mxStack->pushOperand( out().getLastItemValue(), rTokClass );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
}
void FormulaObject::dumpRefErr3dToken( const OUString& rTokClass, bool bArea )
@@ -1260,7 +1258,7 @@ void FormulaObject::dumpExpToken( const String& rName )
aPos.mnCol = dumpDec< sal_uInt16, sal_uInt8 >( getBiff() != BIFF2, "col" );
writeAddressItem( "base-addr", aPos );
OUStringBuffer aOp( rName );
- StringHelper::appendIndex( aOp, out().getLastItemValue() );
+ StringHelper::appendIndex( aOp, mxOut->getLastItemValue() );
mxStack->pushOperand( aOp.makeStringAndClear() );
}
@@ -1288,7 +1286,7 @@ void FormulaObject::dumpFuncToken( const OUString& rTokClass )
void FormulaObject::dumpFuncVarToken( const OUString& rTokClass )
{
sal_uInt8 nParamCount;
- in() >> nParamCount;
+ *mxStrm >> nParamCount;
sal_uInt16 nFuncId = readFuncId();
bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
if( bCmd )
@@ -1345,7 +1343,7 @@ bool FormulaObject::dumpAttrToken()
case BIFF_TOK_ATTR_CHOOSE:
{
sal_uInt16 nCount = dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "choices" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "#skip" );
dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip-err" );
@@ -1431,7 +1429,7 @@ void FormulaObject::dumpNlrColRowToken( const OUString& rTokClass, bool bAddData
{
TokenAddress aPos = dumpTokenAddress( false );
writeInfoItem( "addr", lclCreateNlr( aPos ) );
- mxStack->pushOperand( out().getLastItemValue(), rTokClass );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
}
}
@@ -1447,7 +1445,7 @@ void FormulaObject::dumpNlrRangeToken( const OUString& rTokClass, bool bAddData
{
TokenAddress aPos = dumpTokenAddress( false );
writeInfoItem( "addr", lclCreateNlr( aPos ) );
- mxStack->pushOperand( out().getLastItemValue(), rTokClass );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
}
dumpUnknown( 1 );
dumpRange( "target-range" );
@@ -1462,24 +1460,23 @@ void FormulaObject::dumpNlrRangeErrToken()
void FormulaObject::dumpAddTokenData()
{
- Output& rOut = out();
- rOut.resetItemIndex();
+ mxOut->resetItemIndex();
for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); aIt != aEnd; ++aIt )
{
AddDataType eType = *aIt;
{
- ItemGuard aItem( rOut, "#add-data" );
+ ItemGuard aItem( mxOut, "#add-data" );
switch( eType )
{
- case ADDDATA_NLR: rOut.writeAscii( "tNlr" ); break;
- case ADDDATA_ARRAY: rOut.writeAscii( "tArray" ); break;
- case ADDDATA_MEMAREA: rOut.writeAscii( "tMemArea" ); break;
+ case ADDDATA_NLR: mxOut->writeAscii( "tNlr" ); break;
+ case ADDDATA_ARRAY: mxOut->writeAscii( "tArray" ); break;
+ case ADDDATA_MEMAREA: mxOut->writeAscii( "tMemArea" ); break;
}
}
size_t nIdx = aIt - maAddData.begin();
- IndentGuard aIndGuard( rOut );
+ IndentGuard aIndGuard( mxOut );
switch( eType )
{
case ADDDATA_NLR: dumpAddDataNlr( nIdx ); break;
@@ -1513,7 +1510,7 @@ void FormulaObject::dumpAddDataArray( size_t nIdx )
dumpConstArrayHeader( nCols, nRows );
OUStringBuffer aOp;
- TableGuard aTabGuard( out(), 17 );
+ TableGuard aTabGuard( mxOut, 17 );
for( sal_uInt32 nRow = 0; nRow < nRows; ++nRow )
{
OUStringBuffer aArrayLine;
@@ -1779,7 +1776,7 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpDec< sal_uInt8 >( "creator", "CHFRINFO-APPVERSION" );
dumpDec< sal_uInt8 >( "writer", "CHFRINFO-APPVERSION" );
sal_uInt16 nCount = dumpDec< sal_uInt16 >( "rec-range-count" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
dumpHexPair< sal_uInt16 >( "#rec-range", '-' );
}
@@ -1995,7 +1992,7 @@ void WorkbookStreamObject::implDumpRecordBody()
break;
case BIFF_ID_COLUMNDEFAULT:
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_Int32 nCol = 0, nCount = dumpColRange(); nCol < nCount; ++nCol )
dumpXfIdx( "#xf-idx", true );
dumpUnused( 2 );
@@ -2018,11 +2015,11 @@ void WorkbookStreamObject::implDumpRecordBody()
case BIFF_ID_COORDLIST:
{
- out().resetItemIndex();
- TableGuard aTabGuard( out(), 12, 10 );
+ mxOut->resetItemIndex();
+ TableGuard aTabGuard( mxOut, 12, 10 );
while( rStrm.getRemaining() >= 4 )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "#point" );
dumpDec< sal_uInt16 >( "x" );
dumpDec< sal_uInt16 >( "y" );
@@ -2040,10 +2037,10 @@ void WorkbookStreamObject::implDumpRecordBody()
sal_Int32 nCol2 = dumpColIndex( "last-col-idx", false );
sal_Int32 nCol1 = dumpColIndex( "first-col-idx", false );
sal_Int32 nRow = dumpRowIndex( "row-idx" );
- TableGuard aTabGuard( out(), 14, 17 );
+ TableGuard aTabGuard( mxOut, 14, 17 );
for( Address aPos( nCol1, nRow ); !rStrm.isEof() && (aPos.mnCol <= nCol2); ++aPos.mnCol )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeAddressItem( "pos", aPos );
dumpConstValue();
}
@@ -2117,7 +2114,7 @@ void WorkbookStreamObject::implDumpRecordBody()
case BIFF_ID_DBCELL:
dumpDec< sal_uInt32 >( "reverse-offset-to-row" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
while( rStrm.getRemaining() >= 2 )
dumpDec< sal_uInt16 >( "#cell-offset" );
break;
@@ -2181,7 +2178,7 @@ void WorkbookStreamObject::implDumpRecordBody()
else
{
dumpString( "workbook-url" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nSheet = 0; !rStrm.isEof() && (nSheet < nCount); ++nSheet )
dumpString( "#sheet-name" );
}
@@ -2214,11 +2211,11 @@ void WorkbookStreamObject::implDumpRecordBody()
if( eBiff == BIFF8 )
{
sal_uInt16 nCount = dumpDec< sal_uInt16 >( "ref-count" );
- TableGuard aTabGuard( out(), 10, 17, 24 );
- out().resetItemIndex();
+ TableGuard aTabGuard( mxOut, 10, 17, 24 );
+ mxOut->resetItemIndex();
for( sal_uInt16 nRefId = 0; !rStrm.isEof() && (nRefId < nCount); ++nRefId )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "#ref" );
dumpDec< sal_uInt16 >( "extbook-idx" );
dumpDec< sal_Int16 >( "first-sheet", "EXTERNSHEET-IDX" );
@@ -2353,7 +2350,7 @@ void WorkbookStreamObject::implDumpRecordBody()
if( nFormat == 9 )
{
writeEmptyItem( "bitmap-header" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
if( dumpDec< sal_uInt32 >( "header-size" ) == 12 )
{
dumpDec< sal_Int16 >( "width" );
@@ -2374,7 +2371,7 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpRowIndex( "first-row-with-cell", eBiff == BIFF8 );
dumpRowIndex( "first-free-row", eBiff == BIFF8 );
if( nRecId == BIFF3_ID_INDEX ) dumpHex< sal_uInt32 >( (eBiff <= BIFF4) ? "first-xf-pos" : "defcolwidth-pos", "CONV-DEC" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
while( rStrm.getRemaining() >= 4 )
dumpHex< sal_uInt32 >( "#first-row-pos-of-block", "CONV-DEC" );
break;
@@ -2424,10 +2421,10 @@ void WorkbookStreamObject::implDumpRecordBody()
{
Address aPos = dumpAddress();
{
- TableGuard aTabGuard( out(), 12 );
+ TableGuard aTabGuard( mxOut, 12 );
for( ; rStrm.getRemaining() >= 4; ++aPos.mnCol )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeAddressItem( "pos", aPos );
dumpXfIdx();
}
@@ -2440,10 +2437,10 @@ void WorkbookStreamObject::implDumpRecordBody()
{
Address aPos = dumpAddress();
{
- TableGuard aTabGuard( out(), 12, 12 );
+ TableGuard aTabGuard( mxOut, 12, 12 );
for( ; rStrm.getRemaining() >= 8; ++aPos.mnCol )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeAddressItem( "pos", aPos );
dumpXfIdx();
dumpRk( "value" );
@@ -2611,13 +2608,13 @@ void WorkbookStreamObject::implDumpRecordBody()
case BIFF_ID_PTPAGEFIELDS:
{
- out().resetItemIndex();
- TableGuard aTabGuard( out(), 17, 17, 17 );
+ mxOut->resetItemIndex();
+ TableGuard aTabGuard( mxOut, 17, 17, 17 );
while( rStrm.getRemaining() >= 6 )
{
writeEmptyItem( "#page-field" );
- MultiItemsGuard aMultiGuard( out() );
- IndentGuard aIndGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
+ IndentGuard aIndGuard( mxOut );
dumpDec< sal_Int16 >( "base-field" );
dumpDec< sal_Int16 >( "item", "PTPAGEFIELDS-ITEM" );
dumpDec< sal_uInt16 >( "dropdown-obj-id" );
@@ -2626,7 +2623,7 @@ void WorkbookStreamObject::implDumpRecordBody()
break;
case BIFF_ID_PTROWCOLFIELDS:
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_Int64 nIdx = 0, nCount = rStrm.getRemaining() / 2; nIdx < nCount; ++nIdx )
dumpDec< sal_Int16 >( "#field-idx" );
break;
@@ -2636,19 +2633,19 @@ void WorkbookStreamObject::implDumpRecordBody()
{
sal_uInt16 nCount = (mnPTRowColItemsIdx == 0) ? mnPTRowFields : mnPTColFields;
sal_Int64 nLineSize = 8 + 2 * nCount;
- out().resetItemIndex();
+ mxOut->resetItemIndex();
while( rStrm.getRemaining() >= nLineSize )
{
writeEmptyItem( "#line-data" );
- IndentGuard aIndGuard( out() );
- MultiItemsGuard aMultiGuard( out() );
+ IndentGuard aIndGuard( mxOut );
+ MultiItemsGuard aMultiGuard( mxOut );
dumpDec< sal_uInt16 >( "ident-count" );
dumpDec< sal_uInt16 >( "item-type", "PTROWCOLITEMS-ITEMTYPE" );
dumpDec< sal_uInt16 >( "used-count" );
dumpHex< sal_uInt16 >( "flags", "PTROWCOLITEMS-FLAGS" );
OUStringBuffer aItemList;
for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
- StringHelper::appendToken( aItemList, in().readInt16() );
+ StringHelper::appendToken( aItemList, mxStrm->readInt16() );
writeInfoItem( "item-idxs", aItemList.makeStringAndClear() );
}
++mnPTRowColItemsIdx;
@@ -2714,10 +2711,10 @@ void WorkbookStreamObject::implDumpRecordBody()
writeStringItem( "name", rStrm.readUniStringBody( nNameLen, true ) );
if( nUserLen > 0 ) dumpUniString( "user" ); // repeated string length
if( nCommentLen > 0 ) dumpUniString( "comment" ); // repeated string length
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nCell = 0; !rStrm.isEof() && (nCell < nCellCount); ++nCell )
dumpAddress( "#pos" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nCell = 0; !rStrm.isEof() && (nCell < nCellCount); ++nCell )
dumpString( "#value" );
dumpUnused( 2 * nCellCount );
@@ -2803,7 +2800,7 @@ void WorkbookStreamObject::implDumpRecordBody()
case BIFF_ID_SST:
dumpDec< sal_uInt32 >( "string-cell-count" );
dumpDec< sal_uInt32 >( "sst-size" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
while( !rStrm.isEof() && (rStrm.getRemaining() >= 3) )
dumpUniString( "#entry" );
break;
@@ -3029,7 +3026,7 @@ void WorkbookStreamObject::dumpExtColorValue( sal_uInt32 nColorType )
void WorkbookStreamObject::dumpExtColor( const String& rName )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( rName( "color" ) );
switch( extractValue< sal_uInt8 >( dumpDec< sal_uInt8 >( "flags", "EXTCOLOR-FLAGS" ), 1, 7 ) )
{
@@ -3046,7 +3043,7 @@ void WorkbookStreamObject::dumpExtColor( const String& rName )
void WorkbookStreamObject::dumpExtCfColor( const String& rName )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( rName( "color" ) );
dumpExtColorValue( dumpExtColorType< sal_uInt32 >() );
dumpDec< double >( "tint", "CONV-FLOAT-TO-PERC" );
@@ -3089,7 +3086,7 @@ sal_uInt16 WorkbookStreamObject::dumpCellHeader( bool bBiff2Style )
void WorkbookStreamObject::dumpBoolErr()
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
sal_uInt8 nValue = dumpHex< sal_uInt8 >( "value" );
bool bErrCode = dumpBool< sal_uInt8 >( "is-errorcode" );
if( bErrCode )
@@ -3106,7 +3103,7 @@ void WorkbookStreamObject::dumpCfRuleProp()
if( getFlag< sal_uInt32 >( nFlags1, 0x02000000 ) )
{
writeEmptyItem( "numfmt-block" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
if( getFlag< sal_uInt16 >( nFlags2, 0x0001 ) )
{
dumpDec< sal_uInt16 >( "size" );
@@ -3121,7 +3118,7 @@ void WorkbookStreamObject::dumpCfRuleProp()
if( getFlag< sal_uInt32 >( nFlags1, 0x04000000 ) )
{
writeEmptyItem( "font-block" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
sal_Int64 nRecPos = rStrm.tell();
dumpUniString( "name", BIFF_STR_8BITLENGTH );
dumpUnused( static_cast< sal_Int32 >( nRecPos + 64 - rStrm.tell() ) );
@@ -3147,7 +3144,7 @@ void WorkbookStreamObject::dumpCfRuleProp()
if( getFlag< sal_uInt32 >( nFlags1, 0x08000000 ) )
{
writeEmptyItem( "alignment-block" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpHex< sal_uInt8 >( "alignent", "CFRULE-ALIGNMENT" );
dumpHex< sal_uInt8 >( "rotation", "TEXTROTATION" );
dumpHex< sal_uInt16 >( "indent", "CFRULE-INDENT" );
@@ -3156,7 +3153,7 @@ void WorkbookStreamObject::dumpCfRuleProp()
if( getFlag< sal_uInt32 >( nFlags1, 0x10000000 ) )
{
writeEmptyItem( "border-block" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpHex< sal_uInt16 >( "border-style", "XF-BORDERSTYLE" );
dumpHex< sal_uInt16 >( "border-color1", "XF-BORDERCOLOR1" );
dumpHex< sal_uInt32 >( "border-color2", "CFRULE-BORDERCOLOR2" );
@@ -3164,13 +3161,13 @@ void WorkbookStreamObject::dumpCfRuleProp()
if( getFlag< sal_uInt32 >( nFlags1, 0x20000000 ) )
{
writeEmptyItem( "pattern-block" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpHex< sal_uInt32 >( "pattern", "CFRULE-FILLBLOCK" );
}
if( getFlag< sal_uInt32 >( nFlags1, 0x40000000 ) )
{
writeEmptyItem( "protection-block" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpHex< sal_uInt16 >( "flags", "CFRULE-PROTECTION-FLAGS" );
}
}
@@ -3180,14 +3177,14 @@ void WorkbookStreamObject::dumpXfExtProp()
BiffInputStream& rStrm = getBiffStream();
for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !rStrm.isEof() && (nIndex < nCount); ++nIndex )
{
- out().startMultiItems();
+ mxOut->startMultiItems();
sal_Int64 nStartPos = rStrm.tell();
writeEmptyItem( "SUBREC" );
sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "XFEXT-SUBREC" );
sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
sal_Int64 nEndPos = nStartPos + nSubRecSize;
- out().endMultiItems();
- IndentGuard aIndGuard( out() );
+ mxOut->endMultiItems();
+ IndentGuard aIndGuard( mxOut );
switch( nSubRecId )
{
case 4: case 5: case 7: case 8: case 9: case 10: case 11: case 13:
@@ -3200,11 +3197,11 @@ void WorkbookStreamObject::dumpXfExtProp()
break;
case 6:
dumpExtGradientHead();
- out().resetItemIndex();
- for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !in().isEof(); ++nStop )
+ mxOut->resetItemIndex();
+ for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !mxStrm->isEof(); ++nStop )
{
writeEmptyItem( "#stop" );
- IndentGuard aIndGuard2( out() );
+ IndentGuard aIndGuard2( mxOut );
sal_uInt16 nColorType = dumpExtColorType< sal_uInt16 >();
dumpExtColorValue( nColorType );
dumpDec< double >( "stop-pos" );
@@ -3228,14 +3225,14 @@ void WorkbookStreamObject::dumpDxfProp()
dumpUnused( 2 );
for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !rStrm.isEof() && (nIndex < nCount); ++nIndex )
{
- out().startMultiItems();
+ mxOut->startMultiItems();
sal_Int64 nStartPos = rStrm.tell();
writeEmptyItem( "SUBREC" );
sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "DXF-SUBREC" );
sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
sal_Int64 nEndPos = nStartPos + nSubRecSize;
- out().endMultiItems();
- IndentGuard aIndGuard( out() );
+ mxOut->endMultiItems();
+ IndentGuard aIndGuard( mxOut );
switch( nSubRecId )
{
case 0:
@@ -3325,7 +3322,7 @@ void WorkbookStreamObject::dumpDxf12Prop()
{
BiffInputStream& rStrm = getBiffStream();
writeEmptyItem( "dxf-data" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
sal_uInt32 nSize = dumpDec< sal_uInt32 >( "dxf-size" );
if( nSize == 0 )
{
@@ -3350,7 +3347,7 @@ void WorkbookStreamObject::dumpCfRule12Param( sal_uInt16 nSubType )
sal_Int64 nEndPos = getBiffStream().tell() + nSize;
{
writeEmptyItem( "params" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
switch( nSubType )
{
case 5:
@@ -3380,7 +3377,7 @@ void WorkbookStreamObject::dumpCfRule12Param( sal_uInt16 nSubType )
void WorkbookStreamObject::dumpFontRec()
{
sal_uInt16 nFontId = getBiffData().getFontCount();
- out().resetItemIndex( nFontId );
+ mxOut->resetItemIndex( nFontId );
writeEmptyItem( "#font" );
sal_uInt16 nHeight = dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "FONT-FLAGS" );
@@ -3420,19 +3417,19 @@ void WorkbookStreamObject::dumpFormatRec()
case BIFF2:
case BIFF3:
nFormatIdx = mnFormatIdx++;
- out().resetItemIndex( nFormatIdx );
+ mxOut->resetItemIndex( nFormatIdx );
writeEmptyItem( "#fmt" );
break;
case BIFF4:
nFormatIdx = mnFormatIdx++;
- out().resetItemIndex( nFormatIdx );
+ mxOut->resetItemIndex( nFormatIdx );
writeEmptyItem( "#fmt" );
dumpUnused( 2 );
break;
case BIFF5:
case BIFF8:
getBiffStream() >> nFormatIdx;
- out().resetItemIndex( nFormatIdx );
+ mxOut->resetItemIndex( nFormatIdx );
writeEmptyItem( "#fmt" );
writeDecItem( "fmt-idx", nFormatIdx );
break;
@@ -3445,7 +3442,7 @@ void WorkbookStreamObject::dumpFormatRec()
void WorkbookStreamObject::dumpXfRec()
{
sal_uInt16 nXfId = getBiffData().getXfCount();
- out().resetItemIndex( nXfId );
+ mxOut->resetItemIndex( nXfId );
writeEmptyItem( "#xf" );
sal_uInt16 nFontId = dumpFontIdx( EMPTY_STRING, getBiff() >= BIFF5 );
switch( getBiff() )
@@ -3824,7 +3821,6 @@ void WorkbookStreamObject::dumpObjRecBiff5()
void WorkbookStreamObject::dumpObjRecBiff8()
{
- Output& rOut = out();
BiffInputStream& rStrm = getBiffStream();
NameListRef xRecNames = cfg().getNameList( "OBJ-RECNAMES" );
sal_uInt16 nObjType = 0xFFFF;
@@ -3833,10 +3829,10 @@ void WorkbookStreamObject::dumpObjRecBiff8()
bool bLoop = true;
while( bLoop && (rStrm.getRemaining() >= 4) )
{
- rOut.emptyLine();
+ mxOut->emptyLine();
sal_uInt16 nSubRecId, nSubRecSize;
{
- MultiItemsGuard aMultiGuard( rOut );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "OBJREC" );
writeHexItem( "pos", static_cast< sal_uInt32 >( rStrm.tell() ) );
rStrm >> nSubRecId >> nSubRecSize;
@@ -3849,7 +3845,7 @@ void WorkbookStreamObject::dumpObjRecBiff8()
sal_Int64 nRealRecSize = ::std::min< sal_Int64 >( nSubRecSize, rStrm.getRemaining() );
sal_Int64 nSubRecEnd = nSubRecStart + nRealRecSize;
- IndentGuard aIndGuard( rOut );
+ IndentGuard aIndGuard( mxOut );
switch( nSubRecId )
{
case BIFF_ID_OBJMACRO:
@@ -3871,7 +3867,7 @@ void WorkbookStreamObject::dumpObjRecBiff8()
if( rStrm.tell() + 4 <= nSubRecEnd )
{
if( bControl && bCtlsStrm )
- dumpOcxControl();
+ dumpControl();
else
dumpHex< sal_uInt32 >( "ole-storage-id" );
}
@@ -3880,7 +3876,7 @@ void WorkbookStreamObject::dumpObjRecBiff8()
sal_uInt32 nKeySize = dumpDec< sal_uInt32 >( "licence-key-size" );
if( nKeySize > 0 )
{
- IndentGuard aIndGuard2( rOut );
+ IndentGuard aIndGuard2( mxOut );
sal_Int64 nKeyEnd = rStrm.tell() + nKeySize;
dumpArray( "licence-key", static_cast< sal_Int32 >( nKeySize ) );
rStrm.seek( nKeyEnd );
@@ -4052,7 +4048,7 @@ void WorkbookStreamObject::dumpObjRecPadding()
{
if( getBiffStream().tell() & 1 )
{
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpHex< sal_uInt8 >( "padding" );
}
}
@@ -4090,7 +4086,7 @@ void WorkbookStreamObject::dumpObjRecFmla( const String& rName, sal_uInt16 nFmla
if( nFmlaSize > 0 )
{
writeEmptyItem( rName );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
dumpObjRecFmlaRaw();
if( rStrm.isEof() || (rStrm.tell() != nStrmEnd) )
@@ -4105,7 +4101,7 @@ void WorkbookStreamObject::dumpObjRecPictFmla( sal_uInt16 nFmlaSize )
if( nFmlaSize > 0 )
{
writeEmptyItem( "pic-link" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
if( (getBiff() == BIFF3) && (nStrmEnd & 1) ) ++nStrmEnd; // BIFF3 size without padding
dumpObjRecFmlaRaw();
@@ -4152,7 +4148,7 @@ void PivotCacheStreamObject::implDumpRecordBody()
break;
case BIFF_ID_PCDFDISCRETEPR:
- out().resetItemIndex();
+ mxOut->resetItemIndex();
while( !rStrm.isEof() && (rStrm.getRemaining() >= 2) )
dumpDec< sal_uInt16 >( "#item-index" );
break;
@@ -4172,12 +4168,12 @@ void PivotCacheStreamObject::implDumpRecordBody()
case BIFF_ID_PCITEM_DATE:
{
DateTime aDateTime;
- aDateTime.Year = in().readuInt16();
- aDateTime.Month = in().readuInt16();
- aDateTime.Day = in().readuInt8();
- aDateTime.Hours = in().readuInt8();
- aDateTime.Minutes = in().readuInt8();
- aDateTime.Seconds = in().readuInt8();
+ aDateTime.Year = mxStrm->readuInt16();
+ aDateTime.Month = mxStrm->readuInt16();
+ aDateTime.Day = mxStrm->readuInt8();
+ aDateTime.Hours = mxStrm->readuInt8();
+ aDateTime.Minutes = mxStrm->readuInt8();
+ aDateTime.Seconds = mxStrm->readuInt8();
writeDateTimeItem( "value", aDateTime );
}
break;
@@ -4214,10 +4210,17 @@ void RootStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUStrin
{
if( rStrgPath.equalsAscii( "_VBA_PROJECT_CUR" ) )
VbaProjectStorageObject( *this, rxStrg, rSysPath ).dump();
+ else if( rStrgPath.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "MBD" ) ) )
+ VbaContainerStorageObject( *this, rxStrg, rSysPath ).dump();
else
OleStorageObject::implDumpStorage( rxStrg, rStrgPath, rSysPath );
}
+void RootStorageObject::implDumpBaseStream( const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump();
+}
+
// ============================================================================
// ============================================================================
@@ -4233,7 +4236,7 @@ Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Refere
{
if( rxFactory.is() && rxInStrm.is() )
{
- StorageRef xStrg( new OleStorage( rxFactory, rxInStrm, true ) );
+ StorageRef xStrg( new ::oox::ole::OleStorage( rxFactory, rxInStrm, true ) );
MediaDescriptor aMediaDesc;
ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) );
DumperBase::construct( xCfg );
@@ -4242,17 +4245,7 @@ Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Refere
void Dumper::implDump()
{
- RootStorageObject aRootStrg( *this );
- if( aRootStrg.isValid() )
- {
- aRootStrg.dump();
- }
- else if( StorageBase* pRootStrg = cfg().getRootStorage().get() )
- {
- // try to dump plain BIFF stream
- BinaryInputStreamRef xStrm( new BinaryXInputStream( pRootStrg->openInputStream( OUString() ), false ) );
- WorkbookStreamObject( *this, xStrm, cfg().getSysFileName() ).dump();
- }
+ RootStorageObject( *this ).dump();
}
// ============================================================================
diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini
index 618e89c996e0..16c3fb883149 100644
--- a/oox/source/dump/biffdumper.ini
+++ b/oox/source/dump/biffdumper.ini
@@ -350,7 +350,7 @@ multilist=RECORD-NAMES-BIFF5
0x00B8=DOCROUTE,RECIPNAME,,,,MULTRK,MULTBLANK,TOOLBARHDR
0x00C0=TOOLBAREND,MMS,ADDMENU,DELMENU,,PTDATAFIELD,PCDEFINITION,PCDFIELD
0x00C8=PCITEM_INDEXLIST,PCITEM_DOUBLE,PCITEM_BOOL,PCITEM_ERROR,PCITEM_INTEGER,PCITEM_STRING,PCITEM_DATE,PCITEM_MISSING
- 0x00D0=SXTBL,SXTBRGITEM,SXTBPG,OBPROJ,,PIVOTCACHE,RSTRING,DBCELL
+ 0x00D0=SXTBL,SXTBRGITEM,SXTBPG,VBAPROJECT,,PIVOTCACHE,RSTRING,DBCELL
0x00D8=PCDFRANGEPR,PCDFDISCRETEPR,BOOKBOOL,REVERT,SXEXT|PARAMQRY,SCENPROTECT,OLESIZE,UDDESC
0x00E0=XF,INTERFACEHDR,INTERFACEEND,PCDSOURCE,,,,
0x0206=FORMULA
@@ -381,7 +381,7 @@ multilist=RECORD-NAMES-BIFF8
0x0190=,,,,,,CHTRHEADER,
0x01A8=,USERBVIEW,USERSVIEWBEGIN,USERSVIEWEND,,QSI,EXTERNALBOOK,PROT4REV
0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBINAME,TXO,REFRESHALL
- 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,,DATAVALIDATION,
+ 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,VBAPROJECTEMPTY,DATAVALIDATION,
0x01C0=XL9FILE,RECALCID,INTCACHEDDATA,,,,,
0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,,
0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,,CHFRUNITPROPS
diff --git a/oox/source/dump/dffdumper.cxx b/oox/source/dump/dffdumper.cxx
index 599687f5bd50..8730698561ce 100644
--- a/oox/source/dump/dffdumper.cxx
+++ b/oox/source/dump/dffdumper.cxx
@@ -93,7 +93,7 @@ void DffStreamObject::implWriteExtHeader()
case DFF_ID_SP: pcListName = "DFFSP-RECORD-INST"; break; // shape type
case DFF_ID_SPLITMENUCOLORS: pcListName = "DFFSPLITMENUC-RECORD-INST"; break; // number of colors
}
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeHexItem( "instance", mnInstVer, pcListName );
if( isContainer() ) writeDecItem( "container-size", mnRealSize );
}
@@ -137,11 +137,11 @@ void DffStreamObject::implDumpRecordBody()
sal_uInt32 nClusters = dumpDec< sal_uInt32 >( "id-cluster-count" );
dumpDec< sal_uInt32 >( "shape-count" );
dumpDec< sal_uInt32 >( "drawing-count" );
- out().resetItemIndex( 1 );
- TableGuard aTabGuard( out(), 15, 16 );
- for( sal_uInt32 nCluster = 1; !in().isEof() && (nCluster < nClusters); ++nCluster )
+ mxOut->resetItemIndex( 1 );
+ TableGuard aTabGuard( mxOut, 15, 16 );
+ for( sal_uInt32 nCluster = 1; !mxStrm->isEof() && (nCluster < nClusters); ++nCluster )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "#cluster" );
dumpDec< sal_uInt32 >( "drawing-id" );
dumpHex< sal_uInt32 >( "next-free-id", "CONV-DEC" );
@@ -223,14 +223,14 @@ void DffStreamObject::dumpDffOpt()
{
sal_uInt16 nPropCount = getInst();
PropInfoVector aPropInfos;
- out().resetItemIndex();
- for( sal_uInt16 nPropIdx = 0; !in().isEof() && (nPropIdx < nPropCount); ++nPropIdx )
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nPropIdx = 0; !mxStrm->isEof() && (nPropIdx < nPropCount); ++nPropIdx )
{
sal_uInt16 nPropId = dumpDffOptPropHeader();
sal_uInt16 nBaseId = nPropId & DFF_OPT_IDMASK;
- sal_uInt32 nValue = in().readuInt32();
+ sal_uInt32 nValue = mxStrm->readuInt32();
- IndentGuard aIndent( out() );
+ IndentGuard aIndent( mxOut );
if( getFlag( nPropId, DFF_OPT_COMPLEX ) )
{
writeHexItem( "complex-size", nValue, "CONV-DEC" );
@@ -280,14 +280,14 @@ void DffStreamObject::dumpDffOpt()
}
}
- out().resetItemIndex();
- for( PropInfoVector::iterator aIt = aPropInfos.begin(), aEnd = aPropInfos.end(); !in().isEof() && (aIt != aEnd); ++aIt )
+ mxOut->resetItemIndex();
+ for( PropInfoVector::iterator aIt = aPropInfos.begin(), aEnd = aPropInfos.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
{
- out().startMultiItems();
+ mxOut->startMultiItems();
writeEmptyItem( "#complex-data" );
writeHexItem( "id", aIt->mnId, "DFFOPT-PROPERTY-NAMES" );
- out().endMultiItems();
- IndentGuard aIndent( out() );
+ mxOut->endMultiItems();
+ IndentGuard aIndent( mxOut );
switch( aIt->meType )
{
case PROPTYPE_BINARY:
@@ -308,8 +308,8 @@ void DffStreamObject::dumpDffOpt()
sal_uInt16 DffStreamObject::dumpDffOptPropHeader()
{
- MultiItemsGuard aMultiGuard( out() );
- TableGuard aTabGuard( out(), 11 );
+ MultiItemsGuard aMultiGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 11 );
writeEmptyItem( "#prop" );
return dumpHex< sal_uInt16 >( "id", "DFFOPT-PROPERTY-ID" );
}
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index 8e0e9a4e1225..807a5ec74715 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -38,6 +38,7 @@
#include <osl/file.hxx>
#include <comphelper/docpasswordhelper.hxx>
#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/helper/textinputstream.hxx"
#include "oox/core/filterbase.hxx"
#include "oox/xls/biffhelper.hxx"
@@ -1042,31 +1043,31 @@ ConfigItemBase::~ConfigItemBase()
{
}
-void ConfigItemBase::readConfigBlock( const ConfigInputStreamRef& rxStrm )
+void ConfigItemBase::readConfigBlock( TextInputStream& rStrm )
{
- readConfigBlockContents( rxStrm );
+ readConfigBlockContents( rStrm );
}
void ConfigItemBase::implProcessConfigItemStr(
- const ConfigInputStreamRef& /*rxStrm*/, const OUString& /*rKey*/, const OUString& /*rData*/ )
+ TextInputStream& /*rStrm*/, const OUString& /*rKey*/, const OUString& /*rData*/ )
{
}
void ConfigItemBase::implProcessConfigItemInt(
- const ConfigInputStreamRef& /*rxStrm*/, sal_Int64 /*nKey*/, const OUString& /*rData*/ )
+ TextInputStream& /*rStrm*/, sal_Int64 /*nKey*/, const OUString& /*rData*/ )
{
}
-void ConfigItemBase::readConfigBlockContents( const ConfigInputStreamRef& rxStrm )
+void ConfigItemBase::readConfigBlockContents( TextInputStream& rStrm )
{
bool bLoop = true;
- while( bLoop && !rxStrm->isEOF() )
+ while( bLoop && !rStrm.isEof() )
{
OUString aKey, aData;
- switch( readConfigLine( rxStrm, aKey, aData ) )
+ switch( readConfigLine( rStrm, aKey, aData ) )
{
case LINETYPE_DATA:
- processConfigItem( rxStrm, aKey, aData );
+ processConfigItem( rStrm, aKey, aData );
break;
case LINETYPE_END:
bLoop = false;
@@ -1076,12 +1077,12 @@ void ConfigItemBase::readConfigBlockContents( const ConfigInputStreamRef& rxStrm
}
ConfigItemBase::LineType ConfigItemBase::readConfigLine(
- const ConfigInputStreamRef& rxStrm, OUString& orKey, OUString& orData ) const
+ TextInputStream& rStrm, OUString& orKey, OUString& orData ) const
{
OUString aLine;
- while( !rxStrm->isEOF() && (aLine.getLength() == 0) )
+ while( !rStrm.isEof() && (aLine.getLength() == 0) )
{
- try { aLine = rxStrm->readLine(); } catch( Exception& ) { aLine = OUString(); }
+ aLine = rStrm.readLine();
if( (aLine.getLength() > 0) && (aLine[ 0 ] == OOX_DUMP_BOM) )
aLine = aLine.copy( 1 );
aLine = StringHelper::trimSpaces( aLine );
@@ -1101,20 +1102,20 @@ ConfigItemBase::LineType ConfigItemBase::readConfigLine(
LINETYPE_DATA : LINETYPE_END;
}
-ConfigItemBase::LineType ConfigItemBase::readConfigLine( const ConfigInputStreamRef& rxStrm ) const
+ConfigItemBase::LineType ConfigItemBase::readConfigLine( TextInputStream& rStrm ) const
{
OUString aKey, aData;
- return readConfigLine( rxStrm, aKey, aData );
+ return readConfigLine( rStrm, aKey, aData );
}
void ConfigItemBase::processConfigItem(
- const ConfigInputStreamRef& rxStrm, const OUString& rKey, const OUString& rData )
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
{
sal_Int64 nKey;
if( StringHelper::convertStringToInt( nKey, rKey ) )
- implProcessConfigItemInt( rxStrm, nKey, rData );
+ implProcessConfigItemInt( rStrm, nKey, rData );
else
- implProcessConfigItemStr( rxStrm, rKey, rData );
+ implProcessConfigItemStr( rStrm, rKey, rData );
}
// ============================================================================
@@ -1144,18 +1145,18 @@ bool NameListBase::implIsValid() const
}
void NameListBase::implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm, const OUString& rKey, const OUString& rData )
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
{
if( rKey.equalsAscii( "include" ) )
include( rData );
else if( rKey.equalsAscii( "exclude" ) )
exclude( rData );
else
- ConfigItemBase::implProcessConfigItemStr( rxStrm, rKey, rData );
+ ConfigItemBase::implProcessConfigItemStr( rStrm, rKey, rData );
}
void NameListBase::implProcessConfigItemInt(
- const ConfigInputStreamRef& /*rxStrm*/, sal_Int64 nKey, const OUString& rData )
+ TextInputStream& /*rStrm*/, sal_Int64 nKey, const OUString& rData )
{
implSetName( nKey, rData );
}
@@ -1206,14 +1207,14 @@ ConstList::ConstList( const SharedConfigData& rCfgData ) :
}
void ConstList::implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm, const OUString& rKey, const OUString& rData )
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
{
if( rKey.equalsAscii( "default" ) )
setDefaultName( rData );
else if( rKey.equalsAscii( "quote-names" ) )
setQuoteNames( StringHelper::convertStringToBool( rData ) );
else
- NameListBase::implProcessConfigItemStr( rxStrm, rKey, rData );
+ NameListBase::implProcessConfigItemStr( rStrm, rKey, rData );
}
void ConstList::implSetName( sal_Int64 nKey, const OUString& rName )
@@ -1265,12 +1266,12 @@ void MultiList::setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNam
}
void MultiList::implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm, const OUString& rKey, const OUString& rData )
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
{
if( rKey.equalsAscii( "ignore-empty" ) )
mbIgnoreEmpty = StringHelper::convertStringToBool( rData );
else
- ConstList::implProcessConfigItemStr( rxStrm, rKey, rData );
+ ConstList::implProcessConfigItemStr( rStrm, rKey, rData );
}
void MultiList::implSetName( sal_Int64 nKey, const OUString& rName )
@@ -1289,7 +1290,7 @@ FlagsList::FlagsList( const SharedConfigData& rCfgData ) :
}
void FlagsList::implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm, const OUString& rKey, const OUString& rData )
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
{
if( rKey.equalsAscii( "ignore" ) )
{
@@ -1299,7 +1300,7 @@ void FlagsList::implProcessConfigItemStr(
}
else
{
- NameListBase::implProcessConfigItemStr( rxStrm, rKey, rData );
+ NameListBase::implProcessConfigItemStr( rStrm, rKey, rData );
}
}
@@ -1600,18 +1601,18 @@ bool SharedConfigData::implIsValid() const
}
void SharedConfigData::implProcessConfigItemStr(
- const ConfigInputStreamRef& rxStrm, const OUString& rKey, const OUString& rData )
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
{
if( rKey.equalsAscii( "include-config-file" ) )
readConfigFile( maConfigPath + rData );
else if( rKey.equalsAscii( "constlist" ) )
- readNameList< ConstList >( rxStrm, rData );
+ readNameList< ConstList >( rStrm, rData );
else if( rKey.equalsAscii( "multilist" ) )
- readNameList< MultiList >( rxStrm, rData );
+ readNameList< MultiList >( rStrm, rData );
else if( rKey.equalsAscii( "flagslist" ) )
- readNameList< FlagsList >( rxStrm, rData );
+ readNameList< FlagsList >( rStrm, rData );
else if( rKey.equalsAscii( "combilist" ) )
- readNameList< CombiList >( rxStrm, rData );
+ readNameList< CombiList >( rStrm, rData );
else if( rKey.equalsAscii( "shortlist" ) )
createShortList( rData );
else if( rKey.equalsAscii( "unitconverter" ) )
@@ -1625,12 +1626,13 @@ bool SharedConfigData::readConfigFile( const OUString& rFileUrl )
bool bLoaded = maConfigFiles.count( rFileUrl ) > 0;
if( !bLoaded )
{
- Reference< XTextInputStream > xTextInStrm =
- InputOutputHelper::openTextInputStream( mxFactory, rFileUrl, CREATE_OUSTRING( "UTF-8" ) );
- if( xTextInStrm.is() )
+ Reference< XInputStream > xInStrm = InputOutputHelper::openInputStream( mxFactory, rFileUrl );
+ BinaryXInputStream aInStrm( xInStrm, true );
+ TextInputStream aTxtStrm( aInStrm, RTL_TEXTENCODING_UTF8 );
+ if( !aTxtStrm.isEof() )
{
maConfigFiles.insert( rFileUrl );
- readConfigBlockContents( xTextInStrm );
+ readConfigBlockContents( aTxtStrm );
bLoaded = true;
}
}
@@ -2220,20 +2222,38 @@ void StorageObjectBase::construct( const ObjectBase& rParent )
bool StorageObjectBase::implIsValid() const
{
- return mxStrg.get() && mxStrg->isStorage() && (maSysPath.getLength() > 0) && ObjectBase::implIsValid();
+ return mxStrg.get() && (maSysPath.getLength() > 0) && ObjectBase::implIsValid();
}
void StorageObjectBase::implDump()
{
- try
+ bool bIsStrg = mxStrg->isStorage();
+ bool bIsRoot = mxStrg->isRootStorage();
+ Reference< XInputStream > xBaseStrm;
+ if( !bIsStrg )
+ xBaseStrm = mxStrg->openInputStream( OUString() );
+
+ OUString aSysOutPath = maSysPath;
+ if( bIsRoot ) try
{
+ aSysOutPath += OOX_DUMP_DUMPEXT;
Reference< XSimpleFileAccess > xFileAccess( getFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
- xFileAccess->kill( maSysPath + OOX_DUMP_DUMPEXT );
+ xFileAccess->kill( aSysOutPath );
}
catch( Exception& )
{
}
- extractStorage( mxStrg, OUString(), maSysPath );
+
+ if( bIsStrg )
+ {
+ extractStorage( mxStrg, OUString(), aSysOutPath );
+ }
+ else if( xBaseStrm.is() )
+ {
+ BinaryInputStreamRef xInStrm( new BinaryXInputStream( xBaseStrm, false ) );
+ xInStrm->seekToStart();
+ implDumpBaseStream( xInStrm, aSysOutPath );
+ }
}
void StorageObjectBase::implDumpStream( const BinaryInputStreamRef&, const OUString&, const OUString&, const OUString& )
@@ -2245,6 +2265,10 @@ void StorageObjectBase::implDumpStorage( const StorageRef& rxStrg, const OUStrin
extractStorage( rxStrg, rStrgPath, rSysPath );
}
+void StorageObjectBase::implDumpBaseStream( const BinaryInputStreamRef&, const OUString& )
+{
+}
+
void StorageObjectBase::addPreferredStream( const String& rStrmName )
{
if( rStrmName.has() )
@@ -2280,7 +2304,7 @@ void StorageObjectBase::extractStream( StorageBase& rStrg, const OUString& rStrg
{
BinaryXOutputStream aOutStrm( InputOutputHelper::openOutputStream( getFactory(), rSysFileName ), true );
if( !aOutStrm.isEof() )
- aOutStrm.copyStream( aInStrm );
+ aInStrm.copyToStream( aOutStrm );
}
BinaryXInputStreamRef xDumpStrm( new BinaryXInputStream( InputOutputHelper::openInputStream( getFactory(), rSysFileName ), true ) );
if( !xDumpStrm->isEof() )
@@ -2289,17 +2313,15 @@ void StorageObjectBase::extractStream( StorageBase& rStrg, const OUString& rStrg
void StorageObjectBase::extractStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
{
- OUString aSysOutPath = rSysPath + OOX_DUMP_DUMPEXT;
-
// create directory in file system
- ::osl::FileBase::RC eRes = ::osl::Directory::create( aSysOutPath );
+ ::osl::FileBase::RC eRes = ::osl::Directory::create( rSysPath );
if( (eRes != ::osl::FileBase::E_None) && (eRes != ::osl::FileBase::E_EXIST) )
return;
// process preferred storages and streams in root storage first
if( rStrgPath.getLength() == 0 )
for( PreferredItemVector::iterator aIt = maPreferred.begin(), aEnd = maPreferred.end(); aIt != aEnd; ++aIt )
- extractItem( rxStrg, rStrgPath, aIt->maName, aSysOutPath, aIt->mbStorage, !aIt->mbStorage );
+ extractItem( rxStrg, rStrgPath, aIt->maName, rSysPath, aIt->mbStorage, !aIt->mbStorage );
// process children of the storage
for( StorageIterator aIt( rxStrg ); aIt.isValid(); ++aIt )
@@ -2311,13 +2333,13 @@ void StorageObjectBase::extractStorage( const StorageRef& rxStrg, const OUString
for( PreferredItemVector::iterator aIIt = maPreferred.begin(), aIEnd = maPreferred.end(); !bFound && (aIIt != aIEnd); ++aIIt )
bFound = aIIt->maName == aItemName;
if( !bFound )
- extractItem( rxStrg, rStrgPath, aItemName, aSysOutPath, aIt.isStorage(), aIt.isStream() );
+ extractItem( rxStrg, rStrgPath, aItemName, rSysPath, aIt.isStorage(), aIt.isStream() );
}
}
-void StorageObjectBase::extractItem( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rItemName, const OUString& rSysOutPath, bool bIsStrg, bool bIsStrm )
+void StorageObjectBase::extractItem( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rItemName, const OUString& rSysPath, bool bIsStrg, bool bIsStrm )
{
- OUString aSysFileName = getSysFileName( rItemName, rSysOutPath );
+ OUString aSysFileName = getSysFileName( rItemName, rSysPath );
if( bIsStrg )
{
OUStringBuffer aStrgPath( rStrgPath );
@@ -2362,18 +2384,18 @@ bool OutputObjectBase::implIsValid() const
void OutputObjectBase::writeEmptyItem( const String& rName )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
}
void OutputObjectBase::writeInfoItem( const String& rName, const String& rData )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeString( rData );
}
void OutputObjectBase::writeCharItem( const String& rName, sal_Unicode cData )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeChar( OOX_DUMP_STRQUOTE );
mxOut->writeChar( cData );
mxOut->writeChar( OOX_DUMP_STRQUOTE );
@@ -2381,7 +2403,7 @@ void OutputObjectBase::writeCharItem( const String& rName, sal_Unicode cData )
void OutputObjectBase::writeStringItem( const String& rName, const OUString& rData )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeAscii( "(len=" );
mxOut->writeDec( rData.getLength() );
mxOut->writeAscii( ")," );
@@ -2394,19 +2416,19 @@ void OutputObjectBase::writeStringItem( const String& rName, const OUString& rDa
void OutputObjectBase::writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeArray( pnData, nSize, cSep );
}
void OutputObjectBase::writeBoolItem( const String& rName, bool bData )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeBool( bData );
}
double OutputObjectBase::writeRkItem( const String& rName, sal_Int32 nRk )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeHexItem( rName, static_cast< sal_uInt32 >( nRk ), "RK-FLAGS" );
double fValue = ::oox::xls::BiffHelper::calcDoubleFromRk( nRk );
writeDecItem( "decoded", fValue );
@@ -2415,20 +2437,20 @@ double OutputObjectBase::writeRkItem( const String& rName, sal_Int32 nRk )
void OutputObjectBase::writeColorABGRItem( const String& rName, sal_Int32 nColor )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
writeHexItem( rName, nColor );
mxOut->writeColorABGR( nColor );
}
void OutputObjectBase::writeDateTimeItem( const String& rName, const DateTime& rDateTime )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeDateTime( rDateTime );
}
void OutputObjectBase::writeGuidItem( const String& rName, const OUString& rGuid )
{
- ItemGuard aItem( *mxOut, rName );
+ ItemGuard aItem( mxOut, rName );
mxOut->writeString( rGuid );
aItem.cont();
mxOut->writeString( cfg().getStringOption( rGuid, OUString() ) );
@@ -2436,85 +2458,81 @@ void OutputObjectBase::writeGuidItem( const String& rName, const OUString& rGuid
void OutputObjectBase::writeColIndexItem( const String& rName, sal_Int32 nCol )
{
- Output& rOut = out();
- ItemGuard aItem( rOut, rName );
- rOut.writeDec( nCol );
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nCol );
aItem.cont();
- rOut.writeColIndex( nCol );
+ mxOut->writeColIndex( nCol );
}
void OutputObjectBase::writeRowIndexItem( const String& rName, sal_Int32 nRow )
{
- Output& rOut = out();
- ItemGuard aItem( rOut, rName );
- rOut.writeDec( nRow );
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nRow );
aItem.cont();
- rOut.writeRowIndex( nRow );
+ mxOut->writeRowIndex( nRow );
}
void OutputObjectBase::writeColRangeItem( const String& rName, sal_Int32 nCol1, sal_Int32 nCol2 )
{
- Output& rOut = out();
- ItemGuard aItem( rOut, rName );
- rOut.writeColRowRange( nCol1, nCol2 );
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeColRowRange( nCol1, nCol2 );
aItem.cont();
- rOut.writeColRange( nCol1, nCol2 );
+ mxOut->writeColRange( nCol1, nCol2 );
}
void OutputObjectBase::writeRowRangeItem( const String& rName, sal_Int32 nRow1, sal_Int32 nRow2 )
{
- Output& rOut = out();
- ItemGuard aItem( rOut, rName );
- rOut.writeColRowRange( nRow1, nRow2 );
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeColRowRange( nRow1, nRow2 );
aItem.cont();
- rOut.writeRowRange( nRow1, nRow2 );
+ mxOut->writeRowRange( nRow1, nRow2 );
}
void OutputObjectBase::writeAddressItem( const String& rName, const Address& rPos )
{
- ItemGuard aItem( out(), rName );
- StringHelper::appendAddress( out().getLine(), rPos );
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendAddress( mxOut->getLine(), rPos );
}
void OutputObjectBase::writeRangeItem( const String& rName, const Range& rRange )
{
- ItemGuard aItem( out(), rName );
- StringHelper::appendRange( out().getLine(), rRange );
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendRange( mxOut->getLine(), rRange );
}
void OutputObjectBase::writeRangeListItem( const String& rName, const RangeList& rRanges )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( rName );
writeDecItem( "count", static_cast< sal_uInt16 >( rRanges.size() ) );
- ItemGuard aItem( out(), "ranges" );
- StringHelper::appendRangeList( out().getLine(), rRanges );
+ ItemGuard aItem( mxOut, "ranges" );
+ StringHelper::appendRangeList( mxOut->getLine(), rRanges );
}
void OutputObjectBase::writeTokenAddressItem( const String& rName, const TokenAddress& rPos, bool bNameMode )
{
- ItemGuard aItem( out(), rName );
- StringHelper::appendAddress( out().getLine(), rPos, bNameMode );
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendAddress( mxOut->getLine(), rPos, bNameMode );
}
void OutputObjectBase::writeTokenAddress3dItem( const String& rName, const OUString& rRef, const TokenAddress& rPos, bool bNameMode )
{
- ItemGuard aItem( out(), rName );
- out().writeString( rRef );
- StringHelper::appendAddress( out().getLine(), rPos, bNameMode );
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeString( rRef );
+ StringHelper::appendAddress( mxOut->getLine(), rPos, bNameMode );
}
void OutputObjectBase::writeTokenRangeItem( const String& rName, const TokenRange& rRange, bool bNameMode )
{
- ItemGuard aItem( out(), rName );
- StringHelper::appendRange( out().getLine(), rRange, bNameMode );
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendRange( mxOut->getLine(), rRange, bNameMode );
}
void OutputObjectBase::writeTokenRange3dItem( const String& rName, const OUString& rRef, const TokenRange& rRange, bool bNameMode )
{
- ItemGuard aItem( out(), rName );
- out().writeString( rRef );
- StringHelper::appendRange( out().getLine(), rRange, bNameMode );
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeString( rRef );
+ StringHelper::appendRange( mxOut->getLine(), rRange, bNameMode );
}
// ============================================================================
@@ -2565,8 +2583,7 @@ void InputObjectBase::skipBlock( sal_Int64 nBytes, bool bShowSize )
void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bStream )
{
- Output& rOut = out();
- TableGuard aTabGuard( rOut,
+ TableGuard aTabGuard( mxOut,
bShowOffset ? 12 : 0,
3 * OOX_DUMP_BYTESPERLINE / 2 + 1,
3 * OOX_DUMP_BYTESPERLINE / 2 + 1,
@@ -2583,8 +2600,8 @@ void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bS
while( bLoop && (nPos < nDumpEnd) )
{
- rOut.writeHex( static_cast< sal_uInt32 >( nPos ) );
- rOut.tab();
+ mxOut->writeHex( static_cast< sal_uInt32 >( nPos ) );
+ mxOut->tab();
sal_uInt8 pnLineData[ OOX_DUMP_BYTESPERLINE ];
sal_Int32 nLineSize = bSeekable ? ::std::min( static_cast< sal_Int32 >( nDumpEnd - mxStrm->tell() ), OOX_DUMP_BYTESPERLINE ) : OOX_DUMP_BYTESPERLINE;
@@ -2598,18 +2615,18 @@ void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bS
const sal_uInt8* pnEnd = 0;
for( pnByte = pnLineData, pnEnd = pnLineData + nReadSize; pnByte != pnEnd; ++pnByte )
{
- if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) rOut.tab();
- rOut.writeHex( *pnByte, false );
- rOut.writeChar( ' ' );
+ if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) mxOut->tab();
+ mxOut->writeHex( *pnByte, false );
+ mxOut->writeChar( ' ' );
}
aTabGuard.tab( 3 );
for( pnByte = pnLineData, pnEnd = pnLineData + nReadSize; pnByte != pnEnd; ++pnByte )
{
- if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) rOut.tab();
- rOut.writeChar( static_cast< sal_Unicode >( (*pnByte < 0x20) ? '.' : *pnByte ) );
+ if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) mxOut->tab();
+ mxOut->writeChar( static_cast< sal_Unicode >( (*pnByte < 0x20) ? '.' : *pnByte ) );
}
- rOut.newLine();
+ mxOut->newLine();
}
}
@@ -2621,11 +2638,11 @@ void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bS
void InputObjectBase::dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset )
{
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( rName );
writeDecItem( "size", nBytes );
}
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpRawBinary( nBytes, bShowOffset );
}
@@ -2642,7 +2659,7 @@ void InputObjectBase::dumpRemaining( sal_Int64 nBytes )
void InputObjectBase::dumpRemainingTo( sal_Int64 nPos )
{
- if( mxStrm->isEof() )
+ if( mxStrm->isEof() || (mxStrm->tell() > nPos) )
writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
else
dumpRemaining( nPos - mxStrm->tell() );
@@ -2760,7 +2777,7 @@ DateTime InputObjectBase::dumpFileTime( const String& rName )
{
DateTime aDateTime;
- ItemGuard aItem( out(), rName( "file-time" ) );
+ ItemGuard aItem( mxOut, rName( "file-time" ) );
sal_Int64 nFileTime = dumpDec< sal_Int64 >( EMPTY_STRING );
// file time is in 10^-7 seconds (100 nanoseconds), convert to 1/100 seconds
nFileTime /= 100000;
@@ -2871,9 +2888,9 @@ BinaryStreamObject::BinaryStreamObject( const OutputObjectBase& rParent, const B
void BinaryStreamObject::dumpBinaryStream( bool bShowOffset )
{
- in().seek( 0 );
- dumpRawBinary( in().getLength(), bShowOffset, true );
- out().emptyLine();
+ mxStrm->seekToStart();
+ dumpRawBinary( mxStrm->getLength(), bShowOffset, true );
+ mxOut->emptyLine();
}
void BinaryStreamObject::implDump()
@@ -2883,110 +2900,47 @@ void BinaryStreamObject::implDump()
// ============================================================================
-namespace {
-
-bool lclIsEof( BinaryInputStream& rStrm )
-{
- return rStrm.isEof() || (rStrm.isSeekable() && (rStrm.tell() >= rStrm.getLength()));
-}
-
-template< typename BufferType, typename CharType >
-CharType lclAppendChar( BufferType& orBuffer, CharType cChar )
-{
- if( (cChar == 0x0A) || (cChar == 0x0D) )
- return cChar;
- orBuffer.append( cChar );
- return 0;
-}
-
-template< typename BufferType, typename CharType, typename StreamDataType >
-bool lclReadLine( BufferType& orBuffer, sal_Unicode& orcNextLineChar, BinaryInputStream& rStrm )
-{
- CharType cLineEndChar = (orcNextLineChar == 0) ? 0 : lclAppendChar( orBuffer, static_cast< CharType >( orcNextLineChar ) );
- orcNextLineChar = 0;
-
- // read chars until EOF or line end character (LF or CR)
- bool bIsEof = lclIsEof( rStrm );
- while( !bIsEof && (cLineEndChar == 0) )
- {
- CharType cChar = static_cast< CharType >( rStrm.readValue< StreamDataType >() );
- bIsEof = rStrm.isEof();
- cLineEndChar = bIsEof ? 0 : lclAppendChar( orBuffer, cChar );
- }
-
- // try to skip LF following CR, or CR following LF
- if( !lclIsEof( rStrm ) && (cLineEndChar != 0) )
- {
- CharType cChar = static_cast< CharType >( rStrm.readValue< StreamDataType >() );
- bool bLineEnd = ((cChar == 0x0A) || (cChar == 0x0D)) && (cChar != cLineEndChar);
- if( !rStrm.isEof() && !bLineEnd )
- orcNextLineChar = static_cast< sal_Unicode >( cChar );
- }
-
- return (cLineEndChar != 0) || (orBuffer.getLength() > 0);
-}
-
-} // namespace
-
-// ----------------------------------------------------------------------------
-
TextStreamObject::TextStreamObject( const ObjectBase& rParent,
- const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName ) :
- meTextEnc( eTextEnc )
+ const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName )
{
InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+ if( rxStrm.get() )
+ mxTextStrm.reset( new TextInputStream( *rxStrm, eTextEnc ) );
}
TextStreamObject::TextStreamObject( const OutputObjectBase& rParent,
- const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc ) :
- meTextEnc( eTextEnc )
+ const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc )
{
InputObjectBase::construct( rParent, rxStrm );
+ if( rxStrm.get() )
+ mxTextStrm.reset( new TextInputStream( *rxStrm, eTextEnc ) );
+}
+
+bool TextStreamObject::implIsValid() const
+{
+ return InputObjectBase::implIsValid() && mxTextStrm.get();
}
void TextStreamObject::implDump()
{
OUString aLine;
- sal_Unicode cNextLineChar = 0;
sal_uInt32 nLine = 0;
- while( readLine( aLine, cNextLineChar ) )
- implDumpLine( aLine, ++nLine );
- out().emptyLine();
+ while( !mxTextStrm->isEof() )
+ {
+ aLine = mxTextStrm->readLine();
+ if( !mxTextStrm->isEof() )
+ implDumpLine( aLine, ++nLine );
+ }
+ mxOut->emptyLine();
}
void TextStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 nLine )
{
- Output& rOut = out();
- TableGuard aTabGuard( rOut, 8 );
- rOut.writeDec( nLine, 6 );
- rOut.tab();
- rOut.writeString( rLine );
- rOut.newLine();
-}
-
-bool TextStreamObject::readCharLine( OUString& orLine, sal_Unicode& orcNextLineChar )
-{
- OStringBuffer aBuffer;
- bool bHasData = lclReadLine< OStringBuffer, sal_Char, sal_uInt8 >( aBuffer, orcNextLineChar, in() );
- if( bHasData )
- orLine = OStringToOUString( aBuffer.makeStringAndClear(), meTextEnc );
- return bHasData;
-}
-
-bool TextStreamObject::readUcs2Line( OUString& orLine, sal_Unicode& orcNextLineChar )
-{
- OUStringBuffer aBuffer;
- bool bHasData = lclReadLine< OUStringBuffer, sal_Unicode, sal_uInt16 >( aBuffer, orcNextLineChar, in() );
- if( bHasData )
- orLine = aBuffer.makeStringAndClear();
- return bHasData;
-}
-
-bool TextStreamObject::readLine( OUString& orLine, sal_Unicode& orcNextLineChar )
-{
- return (meTextEnc == RTL_TEXTENCODING_UCS2) ?
- readUcs2Line( orLine, orcNextLineChar ) :
- readCharLine( orLine, orcNextLineChar );
+ TableGuard aTabGuard( mxOut, 8 );
+ mxOut->writeDec( nLine, 6 );
+ mxOut->tab();
+ mxOut->writeString( rLine );
+ mxOut->newLine();
}
// ============================================================================
@@ -3002,9 +2956,9 @@ void XmlStreamObject::implDump()
TextStreamObject::implDump();
if( maIncompleteLine.getLength() > 0 )
{
- out().resetIndent();
- out().writeString( maIncompleteLine );
- out().emptyLine();
+ mxOut->resetIndent();
+ mxOut->writeString( maIncompleteLine );
+ mxOut->emptyLine();
writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
}
}
@@ -3018,10 +2972,9 @@ void XmlStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 )
aLine.append( rLine );
maIncompleteLine = OUString();
- Output& rOut = out();
if( aLine.getLength() == 0 )
{
- rOut.newLine();
+ mxOut->newLine();
return;
}
@@ -3092,10 +3045,10 @@ void XmlStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 )
// flush output line
if( maIncompleteLine.getLength() == 0 )
{
- if( !bIsStartElement && bIsEndElement ) rOut.decIndent();
- rOut.writeString( aOutLine.makeStringAndClear() );
- rOut.newLine();
- if( bIsStartElement && !bIsEndElement ) rOut.incIndent();
+ if( !bIsStartElement && bIsEndElement ) mxOut->decIndent();
+ mxOut->writeString( aOutLine.makeStringAndClear() );
+ mxOut->newLine();
+ if( bIsStartElement && !bIsEndElement ) mxOut->incIndent();
}
}
}
@@ -3131,11 +3084,11 @@ void RecordObjectBase::implDump()
while( implStartRecord( *mxBaseStrm, mnRecPos, mnRecId, mnRecSize ) )
{
// record header
- out().emptyLine();
+ mxOut->emptyLine();
writeHeader();
implWriteExtHeader();
- IndentGuard aIndGuard( out() );
- sal_Int64 nRecPos = in().tell();
+ IndentGuard aIndGuard( mxOut );
+ sal_Int64 nRecPos = mxStrm->tell();
// record body
if( !mbBinaryOnly && cfg().hasName( xRecNames, mnRecId ) )
@@ -3148,7 +3101,7 @@ void RecordObjectBase::implDump()
}
// remaining undumped data
- if( !in().isEof() && (in().tell() == nRecPos) )
+ if( !mxStrm->isEof() && (mxStrm->tell() == nRecPos) )
dumpRawBinary( mnRecSize, false );
else
dumpRemainingTo( nRecPos + mnRecSize );
@@ -3176,13 +3129,13 @@ void RecordObjectBase::constructRecObjBase( const BinaryInputStreamRef& rxBaseSt
void RecordObjectBase::writeHeader()
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "REC" );
if( mbShowRecPos && mxBaseStrm->isSeekable() )
writeShortHexItem( "pos", mnRecPos, "CONV-DEC" );
writeShortHexItem( "size", mnRecSize, "CONV-DEC" );
- ItemGuard aItem( out(), "id" );
- out().writeShortHex( mnRecId );
+ ItemGuard aItem( mxOut, "id" );
+ mxOut->writeShortHex( mnRecId );
addNameToItem( mnRecId, "CONV-DEC" );
addNameToItem( mnRecId, maRecNames );
}
@@ -3224,7 +3177,7 @@ bool SequenceRecordObjectBase::implStartRecord( BinaryInputStream& rBaseStrm, sa
sal_Int32 nRecSize = static_cast< sal_Int32 >( ornRecSize );
mxRecData->realloc( nRecSize );
bValid = (nRecSize == 0) || (rBaseStrm.readData( *mxRecData, nRecSize ) == nRecSize);
- in().seekToStart();
+ mxStrm->seekToStart();
}
return bValid;
}
diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx
index b7750d4113b8..cc49ee050ea6 100644
--- a/oox/source/dump/oledumper.cxx
+++ b/oox/source/dump/oledumper.cxx
@@ -33,8 +33,8 @@
#include <rtl/tencinfo.h>
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/core/filterbase.hxx"
+#include "oox/ole/olestorage.hxx"
#include "oox/ole/vbainputstream.hxx"
-#include "oox/xls/biffhelper.hxx"
#if OOX_INCLUDE_DUMPER
@@ -52,9 +52,52 @@ namespace dump {
// ============================================================================
// ============================================================================
-StdFontObject::StdFontObject( const InputObjectBase& rParent ) :
- InputObjectBase( rParent )
+OUString OleInputObjectBase::dumpAnsiString32( const String& rName )
{
+ return dumpCharArray( rName, mxStrm->readInt32(), RTL_TEXTENCODING_MS_1252 );
+}
+
+OUString OleInputObjectBase::dumpUniString32( const String& rName )
+{
+ return dumpUnicodeArray( rName, mxStrm->readInt32() );
+}
+
+sal_Int32 OleInputObjectBase::dumpStdClipboardFormat( const String& rName )
+{
+ return dumpDec< sal_Int32 >( rName( "clipboard-format" ), "OLE-STD-CLIPBOARD-FORMAT" );
+}
+
+OUString OleInputObjectBase::dumpAnsiString32OrStdClip( const String& rName )
+{
+ sal_Int32 nLen = mxStrm->readInt32();
+ return (nLen < 0) ? OUString::valueOf( dumpStdClipboardFormat( rName ) ) : dumpCharArray( rName, nLen, RTL_TEXTENCODING_MS_1252 );
+}
+
+OUString OleInputObjectBase::dumpUniString32OrStdClip( const String& rName )
+{
+ sal_Int32 nLen = mxStrm->readInt32();
+ return (nLen < 0) ? OUString::valueOf( dumpStdClipboardFormat( rName ) ) : dumpUnicodeArray( rName, nLen );
+}
+
+void OleInputObjectBase::writeOleColorItem( const String& rName, sal_uInt32 nColor )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( rName, nColor, "OLE-COLOR" );
+}
+
+sal_uInt32 OleInputObjectBase::dumpOleColor( const String& rName )
+{
+ sal_uInt32 nOleColor = mxStrm->readuInt32();
+ writeOleColorItem( rName, nOleColor );
+ return nOleColor;
+}
+
+// ============================================================================
+// ============================================================================
+
+StdFontObject::StdFontObject( const InputObjectBase& rParent )
+{
+ construct( rParent );
}
void StdFontObject::implDump()
@@ -64,19 +107,19 @@ void StdFontObject::implDump()
dumpHex< sal_uInt8 >( "flags", "STDFONT-FLAGS" );
dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
dumpDec< sal_uInt32 >( "height", "STDFONT-HEIGHT" );
- dumpCharArray( "name", in().readuInt8(), RTL_TEXTENCODING_ASCII_US );
+ dumpCharArray( "name", mxStrm->readuInt8(), RTL_TEXTENCODING_ASCII_US );
}
// ============================================================================
-StdPicObject::StdPicObject( const InputObjectBase& rParent ) :
- InputObjectBase( rParent )
+StdPicObject::StdPicObject( const InputObjectBase& rParent )
{
+ construct( rParent );
}
void StdPicObject::implDump()
{
- dumpHex< sal_uInt32 >( "identifier" );
+ dumpHex< sal_uInt32 >( "identifier", "STDPIC-ID" );
sal_uInt32 nSize = dumpHex< sal_uInt32 >( "image-size", "CONV-DEC" );
dumpBinary( "image-data", nSize );
}
@@ -96,9 +139,9 @@ const sal_uInt32 STDHLINK_ASSTRING = 0x00000100; /// Hyperlink as sim
} // namespace
-StdHlinkObject::StdHlinkObject( const InputObjectBase& rParent ) :
- InputObjectBase( rParent )
+StdHlinkObject::StdHlinkObject( const InputObjectBase& rParent )
{
+ construct( rParent );
}
void StdHlinkObject::implDump()
@@ -126,15 +169,14 @@ void StdHlinkObject::implDump()
OUString StdHlinkObject::dumpHyperlinkString( const String& rName, bool bUnicode )
{
- sal_Int32 nLen = in().readInt32();
- return bUnicode ? dumpUnicodeArray( rName, nLen ) : dumpCharArray( rName, nLen, osl_getThreadTextEncoding() );
+ return bUnicode ? dumpUniString32( rName ) : dumpAnsiString32( rName );
}
bool StdHlinkObject::dumpGuidAndMoniker()
{
bool bValidMoniker = true;
OUString aGuid = cfg().getStringOption( dumpGuid( "moniker" ), OUString() );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
if( aGuid.equalsAscii( "URLMoniker" ) )
dumpUrlMoniker();
else if( aGuid.equalsAscii( "FileMoniker" ) )
@@ -153,9 +195,9 @@ bool StdHlinkObject::dumpGuidAndMoniker()
void StdHlinkObject::dumpUrlMoniker()
{
sal_Int32 nBytes = dumpDec< sal_Int32 >( "url-bytes" );
- sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
dumpNullUnicodeArray( "url" );
- if( in().tell() + 24 == nEndPos )
+ if( mxStrm->tell() + 24 == nEndPos )
{
dumpGuid( "implementation-id" );
dumpDec< sal_uInt32 >( "version" );
@@ -172,7 +214,7 @@ void StdHlinkObject::dumpFileMoniker()
dumpHex< sal_uInt16 >( "version" );
dumpUnused( 20 );
sal_Int32 nBytes = dumpDec< sal_Int32 >( "total-bytes" );
- sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
if( nBytes > 0 )
{
sal_Int32 nFileBytes = dumpDec< sal_Int32 >( "uni-filename-bytes" );
@@ -185,18 +227,18 @@ void StdHlinkObject::dumpFileMoniker()
void StdHlinkObject::dumpItemMoniker()
{
sal_Int32 nBytes = dumpDec< sal_Int32 >( "delimiter-bytes" );
- sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
- dumpNullCharArray( "ansi-delimiter", osl_getThreadTextEncoding() );
- if( in().tell() < nEndPos )
- dumpUnicodeArray( "unicode-delimiter", (nEndPos - in().tell()) / 2 );
- in().seek( nEndPos );
+ sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ dumpNullCharArray( "ansi-delimiter", RTL_TEXTENCODING_MS_1252 );
+ if( mxStrm->tell() < nEndPos )
+ dumpUnicodeArray( "unicode-delimiter", (nEndPos - mxStrm->tell()) / 2 );
+ mxStrm->seek( nEndPos );
nBytes = dumpDec< sal_Int32 >( "item-bytes" );
- nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
- dumpNullCharArray( "ansi-item", osl_getThreadTextEncoding() );
- if( in().tell() < nEndPos )
- dumpUnicodeArray( "unicode-item", (nEndPos - in().tell()) / 2 );
- in().seek( nEndPos );
+ nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ dumpNullCharArray( "ansi-item", RTL_TEXTENCODING_MS_1252 );
+ if( mxStrm->tell() < nEndPos )
+ dumpUnicodeArray( "unicode-item", (nEndPos - mxStrm->tell()) / 2 );
+ mxStrm->seek( nEndPos );
}
void StdHlinkObject::dumpAntiMoniker()
@@ -207,13 +249,54 @@ void StdHlinkObject::dumpAntiMoniker()
void StdHlinkObject::dumpCompositeMoniker()
{
sal_Int32 nCount = dumpDec< sal_Int32 >( "moniker-count" );
- for( sal_Int32 nIndex = 0; !in().isEof() && (nIndex < nCount); ++nIndex )
+ for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nCount); ++nIndex )
dumpGuidAndMoniker();
}
// ============================================================================
// ============================================================================
+OleStreamObject::OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ construct( rParent, rxStrm, rSysFileName );
+}
+
+// ============================================================================
+
+OleCompObjObject::OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
+ OleStreamObject( rParent, rxStrm, rSysFileName )
+{
+}
+
+void OleCompObjObject::implDump()
+{
+ dumpUnused( 4 );
+ dumpDec< sal_uInt32 >( "version" );
+ dumpUnused( 20 );
+ dumpAnsiString32( "ansi-display-name" );
+ dumpAnsiString32OrStdClip( "ansi-clipboard-format" );
+ if( mxStrm->getRemaining() >= 4 )
+ {
+ sal_Int32 nLen = mxStrm->readInt32();
+ if( (0 <= nLen) && (nLen <= 40) )
+ {
+ dumpCharArray( "ansi-unused", nLen, RTL_TEXTENCODING_MS_1252 );
+ if( (mxStrm->getRemaining() >= 4) && (dumpHex< sal_Int32 >( "unicode-marker" ) == 0x71B239F4) )
+ {
+ dumpUniString32( "unicode-display-name" );
+ dumpUniString32OrStdClip( "unicode-clipboard-format" );
+ dumpUniString32( "unicode-unused" );
+ }
+ }
+ else
+ writeDecItem( "length", nLen );
+ }
+ dumpRemainingStream();
+}
+
+// ============================================================================
+// ============================================================================
+
namespace {
const sal_Int32 OLEPROP_ID_DICTIONARY = 0;
@@ -244,29 +327,26 @@ const sal_Int32 OLEPROP_TYPE_CLIPFMT = 71;
const sal_uInt16 CODEPAGE_UNICODE = 1200;
-const sal_uInt32 OCX_STRING_COMPRESSED = 0x80000000;
+const sal_uInt32 AX_STRING_COMPRESSED = 0x80000000;
} // namespace
// ============================================================================
-OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
- BinaryStreamObject( rParent, rxStrm, rSysFileName )
+OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
{
+ construct( rParent, rxStrm, rSysFileName );
}
void OlePropertyStreamObject::implDump()
{
- BinaryInputStream& rStrm = in();
- Output& rOut = out();
-
OUStringVector aGuidVec;
::std::vector< sal_uInt32 > aStartPosVec;
// dump header
writeEmptyItem( "HEADER" );
{
- IndentGuard aIndGuard( rOut );
+ IndentGuard aIndGuard( mxOut );
dumpHex< sal_uInt16 >( "byte-order", "OLEPROP-BYTE-ORDER" );
dumpDec< sal_uInt16 >( "version" );
dumpDec< sal_uInt16 >( "os-minor" );
@@ -276,29 +356,26 @@ void OlePropertyStreamObject::implDump()
// dump table of section positions
{
- TableGuard aTabGuard( rOut, 15, 60 );
- rOut.resetItemIndex();
- for( sal_Int32 nSectIdx = 0; !rStrm.isEof() && (nSectIdx < nSectCount); ++nSectIdx )
+ TableGuard aTabGuard( mxOut, 15, 60 );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nSectIdx = 0; !mxStrm->isEof() && (nSectIdx < nSectCount); ++nSectIdx )
{
- MultiItemsGuard aMultiGuard( rOut );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "#section" );
aGuidVec.push_back( dumpGuid( "guid" ) );
aStartPosVec.push_back( dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" ) );
}
}
}
- rOut.emptyLine();
+ mxOut->emptyLine();
// dump sections
- for( size_t nSectIdx = 0; !rStrm.isEof() && (nSectIdx < aStartPosVec.size()); ++nSectIdx )
+ for( size_t nSectIdx = 0; !mxStrm->isEof() && (nSectIdx < aStartPosVec.size()); ++nSectIdx )
dumpSection( aGuidVec[ nSectIdx ], aStartPosVec[ nSectIdx ] );
}
void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nStartPos )
{
- BinaryInputStream& rStrm = in();
- Output& rOut = out();
-
// property ID names
mxPropIds = cfg().createNameList< ConstList >( "OLEPROP-IDS" );
OUString aGuidName = cfg().getStringOption( rGuid, OUString() );
@@ -317,7 +394,7 @@ void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nSt
writeSectionHeader( rGuid, nStartPos );
// seek to section
- IndentGuard aIndGuard( rOut );
+ IndentGuard aIndGuard( mxOut );
if( startElement( nStartPos ) )
{
// dump section header
@@ -326,11 +403,11 @@ void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nSt
// dump table of property positions
{
- TableGuard aTabGuard( rOut, 15, 25 );
- rOut.resetItemIndex();
- for( sal_Int32 nPropIdx = 0; !rStrm.isEof() && (nPropIdx < nPropCount); ++nPropIdx )
+ TableGuard aTabGuard( mxOut, 15, 25 );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nPropIdx = 0; !mxStrm->isEof() && (nPropIdx < nPropCount); ++nPropIdx )
{
- MultiItemsGuard aMultiGuard( rOut );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "#property" );
sal_Int32 nPropId = dumpDec< sal_Int32 >( "id", mxPropIds );
sal_uInt32 nPropPos = nStartPos + dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" );
@@ -338,10 +415,10 @@ void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nSt
}
}
}
- rOut.emptyLine();
+ mxOut->emptyLine();
// code page property
- meTextEnc = osl_getThreadTextEncoding();
+ meTextEnc = RTL_TEXTENCODING_MS_1252;
mbIsUnicode = false;
PropertyPosMap::iterator aCodePageIt = aPropMap.find( OLEPROP_ID_CODEPAGE );
if( aCodePageIt != aPropMap.end() )
@@ -369,16 +446,16 @@ void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nSt
void OlePropertyStreamObject::dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos )
{
writePropertyHeader( nPropId, nStartPos );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
if( startElement( nStartPos ) )
dumpPropertyContents( nPropId );
- out().emptyLine();
+ mxOut->emptyLine();
}
void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
{
writePropertyHeader( OLEPROP_ID_CODEPAGE, nStartPos );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
if( startElement( nStartPos ) )
{
sal_Int32 nType = dumpPropertyType();
@@ -393,27 +470,27 @@ void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
else
dumpPropertyContents( OLEPROP_ID_CODEPAGE );
}
- out().emptyLine();
+ mxOut->emptyLine();
}
void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos )
{
writePropertyHeader( OLEPROP_ID_DICTIONARY, nStartPos );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
if( startElement( nStartPos ) )
{
sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
- for( sal_Int32 nIdx = 0; !in().isEof() && (nIdx < nCount); ++nIdx )
+ for( sal_Int32 nIdx = 0; !mxStrm->isEof() && (nIdx < nCount); ++nIdx )
{
- MultiItemsGuard aMultiGuard( out() );
- TableGuard aTabGuard( out(), 10, 20 );
+ MultiItemsGuard aMultiGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 10, 20 );
sal_Int32 nId = dumpDec< sal_Int32 >( "id" );
OUString aName = dumpString8( "name" );
if( mxPropIds.get() )
mxPropIds->setName( nId, aName );
}
}
- out().emptyLine();
+ mxOut->emptyLine();
}
void OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
@@ -423,11 +500,11 @@ void OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
{
sal_Int32 nBaseType = nType & 0x0FFF;
sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
- for( sal_Int32 nElemIdx = 0; !in().isEof() && (nElemIdx < nElemCount); ++nElemIdx )
+ for( sal_Int32 nElemIdx = 0; !mxStrm->isEof() && (nElemIdx < nElemCount); ++nElemIdx )
{
- out().resetItemIndex( nElemIdx );
+ mxOut->resetItemIndex( nElemIdx );
writeEmptyItem( "#element" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpPropertyValue( nPropId, nBaseType );
}
}
@@ -491,7 +568,7 @@ OUString OlePropertyStreamObject::dumpCharArray8( const String& rName, sal_Int32
if( nNewLen > 0 )
{
::std::vector< sal_Char > aBuffer( nNewLen + 1 );
- in().readMemory( &aBuffer.front(), nNewLen );
+ mxStrm->readMemory( &aBuffer.front(), nNewLen );
aBuffer[ nNewLen ] = 0;
aData = OStringToOUString( OString( &aBuffer.front() ), meTextEnc );
}
@@ -511,7 +588,7 @@ OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int3
::std::vector< sal_Unicode > aBuffer;
aBuffer.reserve( nNewLen + 1 );
for( size_t nIdx = 0; nIdx < nNewLen; ++nIdx )
- aBuffer.push_back( static_cast< sal_Unicode >( in().readuInt16() ) );
+ aBuffer.push_back( static_cast< sal_Unicode >( mxStrm->readuInt16() ) );
aBuffer.push_back( 0 );
OUString aData( &aBuffer.front() );
writeStringItem( rName, aData );
@@ -521,15 +598,15 @@ OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int3
bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos )
{
- in().seek( nStartPos );
- if( in().isEof() )
+ mxStrm->seek( nStartPos );
+ if( mxStrm->isEof() )
writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
- return !in().isEof();
+ return !mxStrm->isEof();
}
void OlePropertyStreamObject::writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "SECTION" );
writeHexItem( "pos", nStartPos, "CONV-DEC" );
writeGuidItem( "guid", rGuid );
@@ -537,7 +614,7 @@ void OlePropertyStreamObject::writeSectionHeader( const OUString& rGuid, sal_uIn
void OlePropertyStreamObject::writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "PROPERTY" );
writeHexItem( "pos", nStartPos, "CONV-DEC" );
writeDecItem( "id", nPropId, mxPropIds );
@@ -562,7 +639,9 @@ void OleStorageObject::construct( const ObjectBase& rParent )
void OleStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName )
{
- if( rStrmName.equalsAscii( "\005SummaryInformation" ) || rStrmName.equalsAscii( "\005DocumentSummaryInformation" ) )
+ if( rStrmName.equalsAscii( "\001CompObj" ) )
+ OleCompObjObject( *this, rxStrm, rSysFileName ).dump();
+ else if( rStrmName.equalsAscii( "\005SummaryInformation" ) || rStrmName.equalsAscii( "\005DocumentSummaryInformation" ) )
OlePropertyStreamObject( *this, rxStrm, rSysFileName ).dump();
else
BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
@@ -571,40 +650,394 @@ void OleStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const
// ============================================================================
// ============================================================================
-void OcxPropertyObjectBase::construct( const ObjectBase& rParent,
+ComCtlObjectBase::ComCtlObjectBase( const InputObjectBase& rParent,
+ sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion, bool bCommonPart, bool bComplexPart ) :
+ mnDataId5( nDataId5 ),
+ mnDataId6( nDataId6 ),
+ mnVersion( nVersion ),
+ mbCommonPart( bCommonPart ),
+ mbComplexPart( bComplexPart )
+{
+ construct( rParent );
+}
+
+void ComCtlObjectBase::implDump()
+{
+ sal_uInt32 nCommonSize = 0;
+ dumpComCtlSize() && dumpComCtlData( nCommonSize ) && (!mbCommonPart || dumpComCtlCommon( nCommonSize )) && (!mbComplexPart || dumpComCtlComplex());
+}
+
+void ComCtlObjectBase::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+}
+
+void ComCtlObjectBase::implDumpCommonTrailing()
+{
+}
+
+bool ComCtlObjectBase::dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor, sal_uInt16 nExpMinor )
+{
+ // no idea if all this is correct...
+ sal_uInt32 nId = dumpHex< sal_uInt32 >( "header-id", "COMCTL-HEADER-IDS" );
+ ItemGuard aItem( mxOut, "version" );
+ sal_uInt16 nMinor, nMajor;
+ *mxStrm >> nMinor >> nMajor;
+ mxOut->writeDec( nMajor );
+ mxOut->writeChar( '.' );
+ mxOut->writeDec( nMinor );
+ return !mxStrm->isEof() && (nId == nExpId) && ((nExpMajor == SAL_MAX_UINT16) || (nExpMajor == nMajor)) && ((nExpMinor == SAL_MAX_UINT16) || (nExpMinor == nMinor));
+}
+
+bool ComCtlObjectBase::dumpComCtlSize()
+{
+ if( dumpComCtlHeader( 0x12344321, 0, 8 ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
+ dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+bool ComCtlObjectBase::dumpComCtlData( sal_uInt32& ornCommonPartSize )
+{
+ if( dumpComCtlHeader( (mnVersion == 5) ? mnDataId5 : mnDataId6, mnVersion ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ if( mbCommonPart )
+ ornCommonPartSize = dumpDec< sal_uInt32 >( "common-part-size" );
+ implDumpProperties();
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+bool ComCtlObjectBase::dumpComCtlCommon( sal_uInt32 nPartSize )
+{
+ sal_Int64 nEndPos = mxStrm->tell() + nPartSize;
+ if( (nPartSize >= 16) && dumpComCtlHeader( 0xABCDEF01, 5, 0 ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ dumpUnknown( 4 );
+ dumpHex< sal_uInt32 >( "common-flags", "COMCTL-COMMON-FLAGS" );
+ implDumpCommonExtra( nEndPos );
+ dumpRemainingTo( nEndPos );
+ implDumpCommonTrailing();
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+bool ComCtlObjectBase::dumpComCtlComplex()
+{
+ if( dumpComCtlHeader( 0xBDECDE1F, 5, 1 ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "comctl-complex-flags", "COMCTL-COMPLEX-FLAGS" );
+ if( !mxStrm->isEof() && (nFlags & 0x01) )
+ {
+ writeEmptyItem( "font" );
+ IndentGuard aIndGuard2( mxOut );
+ OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
+ if( aClassName.equalsAscii( "StdFont" ) )
+ StdFontObject( *this ).dump();
+ }
+ if( !mxStrm->isEof() && (nFlags & 0x02) )
+ {
+ writeEmptyItem( "mouse-icon" );
+ IndentGuard aIndGuard2( mxOut );
+ OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
+ if( aClassName.equalsAscii( "StdPic" ) )
+ StdPicObject( *this ).dump();
+ }
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+// ============================================================================
+
+ComCtlScrollBarObject::ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, SAL_MAX_UINT32, 0x99470A83, nVersion, true, true )
+{
+}
+
+void ComCtlScrollBarObject::implDumpProperties()
+{
+ dumpHex< sal_uInt32 >( "flags", "COMCTL-SCROLLBAR-FLAGS" );
+ dumpDec< sal_Int32 >( "large-change" );
+ dumpDec< sal_Int32 >( "small-change" );
+ dumpDec< sal_Int32 >( "min" );
+ dumpDec< sal_Int32 >( "max" );
+ dumpDec< sal_Int32 >( "value" );
+}
+
+// ============================================================================
+
+ComCtlProgressBarObject::ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E84, 0x97AB8A01, nVersion, true, true )
+{
+}
+
+void ComCtlProgressBarObject::implDumpProperties()
+{
+ dumpDec< float >( "min" );
+ dumpDec< float >( "max" );
+ if( mnVersion == 6 )
+ {
+ dumpBool< sal_uInt16 >( "vertical" );
+ dumpBool< sal_uInt16 >( "smooth-scroll" );
+ }
+}
+
+// ============================================================================
+
+ComCtlSliderObject::ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E86, 0x0A2BAE11, nVersion, true, true )
+{
+}
+
+void ComCtlSliderObject::implDumpProperties()
+{
+ dumpBool< sal_Int32 >( "vertical" );
+ dumpDec< sal_Int32 >( "large-change" );
+ dumpDec< sal_Int32 >( "small-change" );
+ dumpDec< sal_Int32 >( "min" );
+ dumpDec< sal_Int32 >( "max" );
+ dumpDec< sal_Int16 >( "select-range", "COMCTL-SLIDER-SELECTRANGE" );
+ dumpUnused( 2 );
+ dumpDec< sal_Int32 >( "select-start" );
+ dumpDec< sal_Int32 >( "select-length" );
+ dumpDec< sal_Int32 >( "tick-style", "COMCTL-SLIDER-TICKSTYLE" );
+ dumpDec< sal_Int32 >( "tick-frequency" );
+ dumpDec< sal_Int32 >( "value" );
+ if( mnVersion == 6 )
+ dumpBool< sal_Int32 >( "tooltip-below" );
+}
+
+// ============================================================================
+
+ComCtlUpDownObject::ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xFF3626A0, 0xFF3626A0, nVersion, false, false )
+{
+}
+
+void ComCtlUpDownObject::implDumpProperties()
+{
+ dumpUnknown( 16 ); // buddy-property, somehow
+ dumpDec< sal_Int32 >( "buddy-control" );
+ dumpUnknown( 8 );
+ dumpDec< sal_Int32 >( "value" );
+ dumpUnknown( 4 );
+ dumpDec< sal_Int32 >( "increment" );
+ dumpDec< sal_Int32 >( "max" );
+ dumpDec< sal_Int32 >( "min" );
+ dumpHex< sal_uInt32 >( "flags-1", "COMCTL-UPDOWN-FLAGS1" );
+ dumpHex< sal_uInt32 >( "flags-2", "COMCTL-UPDOWN-FLAGS2" );
+ dumpUnknown( 4 );
+}
+
+// ============================================================================
+
+ComCtlImageListObject::ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E80, 0xE6E17E80, nVersion, true, false )
+{
+}
+
+void ComCtlImageListObject::implDumpProperties()
+{
+ dumpDec< sal_uInt16 >( "image-width" );
+ dumpDec< sal_uInt16 >( "image-height" );
+ dumpOleColor( "mask-color" );
+ dumpBool< sal_Int16 >( "use-mask-color" );
+ dumpUnknown( 2 );
+}
+
+void ComCtlImageListObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpUnknown( 4 );
+ dumpOleColor( "back-color" );
+ dumpUnknown( 4 );
+ sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
+ {
+ writeEmptyItem( "#image" );
+ IndentGuard aIndGuard( mxOut );
+ sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "text-flags", "COMCTL-IMAGELIST-TEXTFLAGS" );
+ if( nFlags & 0x01 ) dumpUniString32( "caption" );
+ if( nFlags & 0x02 ) dumpUniString32( "key" );
+ }
+}
+
+void ComCtlImageListObject::implDumpCommonTrailing()
+{
+ sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
+ {
+ writeEmptyItem( "#image" );
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_Int32 >( "index" );
+ StdPicObject( *this ).dump();
+ }
+}
+
+// ============================================================================
+
+ComCtlTabStripObject::ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E8A, 0xD12A7AC1, nVersion, true, true )
+{
+}
+
+void ComCtlTabStripObject::implDumpProperties()
+{
+ dumpHex< sal_uInt32 >( "flags-1", "COMCTL-TABSTRIP-FLAGS1" );
+ dumpDec< sal_uInt16 >( "tab-fixed-width", "CONV-HMM-TO-CM" );
+ dumpDec< sal_uInt16 >( "tab-fixed-height", "CONV-HMM-TO-CM" );
+ if( mnVersion == 6 )
+ {
+ dumpHex< sal_uInt32 >( "flags-2", "COMCTL-TABSTRIP-FLAGS2" );
+ dumpDec< sal_uInt16 >( "tab-min-width", "CONV-HMM-TO-CM" );
+ dumpUnknown( 2 );
+ dumpHex< sal_uInt32 >( "flags-3", "COMCTL-TABSTRIP-FLAGS3" );
+ }
+}
+
+void ComCtlTabStripObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpUnknown( 12 );
+ dumpUniString32( "image-list" );
+ sal_Int32 nTabCount = dumpDec< sal_Int32 >( "tab-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nTabIndex = 0; (nTabIndex < nTabCount) && !mxStrm->isEof(); ++nTabIndex )
+ {
+ writeEmptyItem( "#tab" );
+ IndentGuard aIndGuard( mxOut );
+ dumpUnknown( 4 );
+ sal_uInt32 nTabFlags = dumpHex< sal_uInt32 >( "tab-flags", "COMCTL-TABSTRIP-TABFLAGS" );
+ if( nTabFlags & 0x01 ) dumpUniString32( "caption" );
+ if( nTabFlags & 0x02 ) dumpUniString32( "key" );
+ if( nTabFlags & 0x04 ) dumpUniString32( "tag" );
+ if( nTabFlags & 0x08 ) dumpUniString32( "tooltip" );
+ dumpDec< sal_uInt16 >( "image-id" );
+ }
+}
+
+// ============================================================================
+
+ComCtlTreeViewObject::ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E8E, 0x6AC13CB1, nVersion, true, true ),
+ mnStringFlags( 0 )
+{
+}
+
+void ComCtlTreeViewObject::implDumpProperties()
+{
+ dumpHex< sal_uInt32 >( "flags", "COMCTL-TREEVIEW-FLAGS" );
+ dumpDec< sal_Int32 >( "indentation", "CONV-HMM-TO-CM" );
+ if( mnVersion == 6 )
+ dumpHex< sal_uInt32 >( "flags-2", "COMCTL-TREEVIEW-FLAGS2" );
+ mnStringFlags = dumpHex< sal_uInt32 >( "string-flags", "COMCTL-TREEVIEW-STRINGFLAGS" );
+}
+
+void ComCtlTreeViewObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpOleColor( "text-color" );
+ dumpOleColor( "back-color" );
+ dumpUnknown( 4 );
+ if( mnStringFlags & 0x02 )
+ dumpUniString32( "image-list" );
+ dumpUniString32( "path-separator" );
+}
+
+// ============================================================================
+
+ComCtlStatusBarObject::ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E88, SAL_MAX_UINT32, nVersion, true, true )
+{
+}
+
+void ComCtlStatusBarObject::implDumpProperties()
+{
+ dumpBool< sal_Int32 >( "style-simple-text" );
+ dumpBool< sal_Int16 >( "show-tips" );
+ dumpUnknown( 2 );
+}
+
+void ComCtlStatusBarObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpUnknown( 12 );
+ dumpUniString32( "simple-text" );
+ sal_Int32 nPanelCount = dumpDec< sal_Int32 >( "panel-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nPanelIndex = 0; (nPanelIndex < nPanelCount) && !mxStrm->isEof(); ++nPanelIndex )
+ {
+ writeEmptyItem( "#panel" );
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt32 >( "panel-flags", "COMCTL-STATUSBAR-PANELFLAGS" );
+ dumpDec< sal_Int32 >( "current-width", "CONV-HMM-TO-CM" );
+ dumpDec< sal_Int32 >( "minimal-width", "CONV-HMM-TO-CM" );
+ sal_uInt32 nTextFlags = dumpHex< sal_uInt32 >( "text-flags", "COMCTL-STATUSBAR-TEXTFLAGS" );
+ if( nTextFlags & 0x01 ) dumpUniString32( "text" );
+ if( nTextFlags & 0x02 ) dumpUniString32( "vis-text" );
+ if( nTextFlags & 0x04 ) dumpUniString32( "key" );
+ if( nTextFlags & 0x08 ) dumpUniString32( "tag" );
+ if( nTextFlags & 0x10 ) dumpUniString32( "tooltip" );
+ }
+}
+
+void ComCtlStatusBarObject::implDumpCommonTrailing()
+{
+ sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
+ {
+ writeEmptyItem( "#image" );
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_Int32 >( "panel-index" );
+ StdPicObject( *this ).dump();
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+void AxPropertyObjectBase::construct( const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const String& rPropNameList, bool b64BitPropFlags )
{
- InputObjectBase::construct( rParent, rxStrm, rSysFileName );
- constructOcxPropObj( rPropNameList, b64BitPropFlags );
+ OleInputObjectBase::construct( rParent, rxStrm, rSysFileName );
+ constructAxPropObj( rPropNameList, b64BitPropFlags );
}
-void OcxPropertyObjectBase::construct( const OutputObjectBase& rParent,
+void AxPropertyObjectBase::construct( const OutputObjectBase& rParent,
const BinaryInputStreamRef& rxStrm, const String& rPropNameList, bool b64BitPropFlags )
{
- InputObjectBase::construct( rParent, rxStrm );
- constructOcxPropObj( rPropNameList, b64BitPropFlags );
+ OleInputObjectBase::construct( rParent, rxStrm );
+ constructAxPropObj( rPropNameList, b64BitPropFlags );
}
-void OcxPropertyObjectBase::construct( const InputObjectBase& rParent,
+void AxPropertyObjectBase::construct( const InputObjectBase& rParent,
const String& rPropNameList, bool b64BitPropFlags )
{
- InputObjectBase::construct( rParent );
- constructOcxPropObj( rPropNameList, b64BitPropFlags );
+ OleInputObjectBase::construct( rParent );
+ constructAxPropObj( rPropNameList, b64BitPropFlags );
}
-bool OcxPropertyObjectBase::implIsValid() const
+bool AxPropertyObjectBase::implIsValid() const
{
- return InputObjectBase::implIsValid() && in().isSeekable();
+ return OleInputObjectBase::implIsValid() && mxStrm->isSeekable();
}
-void OcxPropertyObjectBase::implDump()
+void AxPropertyObjectBase::implDump()
{
mbValid = true;
// header
setAlignAnchor();
dumpVersion();
sal_uInt16 nSize = dumpDec< sal_uInt16 >( "size" );
- mnPropertiesEnd = in().tell() + nSize;
+ mnPropertiesEnd = mxStrm->tell() + nSize;
// property flags
maLargeProps.clear();
maStreamProps.clear();
@@ -618,17 +1051,17 @@ void OcxPropertyObjectBase::implDump()
implDumpExtended();
}
-void OcxPropertyObjectBase::implDumpShortProperties()
+void AxPropertyObjectBase::implDumpShortProperties()
{
}
-void OcxPropertyObjectBase::implDumpExtended()
+void AxPropertyObjectBase::implDumpExtended()
{
}
-bool OcxPropertyObjectBase::ensureValid( bool bCondition )
+bool AxPropertyObjectBase::ensureValid( bool bCondition )
{
- if( mbValid && (!bCondition || in().isEof()) )
+ if( mbValid && (!bCondition || mxStrm->isEof()) )
{
if( !bCondition )
writeInfoItem( "state", OOX_DUMP_ERRASCII( "format-error" ) );
@@ -637,12 +1070,12 @@ bool OcxPropertyObjectBase::ensureValid( bool bCondition )
return mbValid;
}
-void OcxPropertyObjectBase::setAlignAnchor()
+void AxPropertyObjectBase::setAlignAnchor()
{
- mnPropertiesStart = in().tell();
+ mnPropertiesStart = mxStrm->tell();
}
-bool OcxPropertyObjectBase::startNextProperty()
+bool AxPropertyObjectBase::startNextProperty()
{
if( mnCurrProp == 0 ) mnCurrProp = 1; else mnCurrProp <<= 1;
bool bHasProp = getFlag( mnPropFlags, mnCurrProp );
@@ -650,12 +1083,12 @@ bool OcxPropertyObjectBase::startNextProperty()
return ensureValid() && bHasProp;
}
-OUString OcxPropertyObjectBase::getPropertyName() const
+OUString AxPropertyObjectBase::getPropertyName() const
{
return cfg().getName( mxPropNames, mnCurrProp );
}
-sal_uInt32 OcxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList )
+sal_uInt32 AxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList )
{
if( startNextProperty() )
{
@@ -665,18 +1098,17 @@ sal_uInt32 OcxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault, const
return nDefault;
}
-sal_uInt32 OcxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault )
+sal_uInt32 AxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault )
{
if( startNextProperty() )
{
- MultiItemsGuard aMultiGuard( out() );
alignInput< sal_uInt32 >();
- return dumpHex< sal_uInt32 >( getPropertyName(), "OCX-COLOR" );
+ return dumpOleColor( getPropertyName() );
}
return nDefault;
}
-sal_Unicode OcxPropertyObjectBase::dumpUnicodeProperty()
+sal_Unicode AxPropertyObjectBase::dumpUnicodeProperty()
{
if( startNextProperty() )
{
@@ -686,41 +1118,41 @@ sal_Unicode OcxPropertyObjectBase::dumpUnicodeProperty()
return '\0';
}
-void OcxPropertyObjectBase::dumpUnknownProperty()
+void AxPropertyObjectBase::dumpUnknownProperty()
{
if( startNextProperty() )
ensureValid( false );
}
-void OcxPropertyObjectBase::dumpPosProperty()
+void AxPropertyObjectBase::dumpPosProperty()
{
if( startNextProperty() )
maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_POS, getPropertyName(), 8 ) );
}
-void OcxPropertyObjectBase::dumpSizeProperty()
+void AxPropertyObjectBase::dumpSizeProperty()
{
if( startNextProperty() )
maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_SIZE, getPropertyName(), 8 ) );
}
-void OcxPropertyObjectBase::dumpGuidProperty( OUString* pValue )
+void AxPropertyObjectBase::dumpGuidProperty( OUString* pValue )
{
if( startNextProperty() )
maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_GUID, getPropertyName(), 16, pValue ) );
}
-void OcxPropertyObjectBase::dumpStringProperty( OUString* pValue )
+void AxPropertyObjectBase::dumpStringProperty( OUString* pValue )
{
if( startNextProperty() )
{
alignInput< sal_uInt32 >();
- sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "OCX-STRINGLEN" );
+ sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "AX-STRINGLEN" );
maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRING, getPropertyName(), nLen, pValue ) );
}
}
-void OcxPropertyObjectBase::dumpStringArrayProperty()
+void AxPropertyObjectBase::dumpStringArrayProperty()
{
if( startNextProperty() )
{
@@ -730,7 +1162,7 @@ void OcxPropertyObjectBase::dumpStringArrayProperty()
}
}
-void OcxPropertyObjectBase::dumpStreamProperty()
+void AxPropertyObjectBase::dumpStreamProperty()
{
if( startNextProperty() )
{
@@ -740,26 +1172,26 @@ void OcxPropertyObjectBase::dumpStreamProperty()
}
}
-void OcxPropertyObjectBase::dumpEmbeddedFont()
+void AxPropertyObjectBase::dumpEmbeddedFont()
{
if( ensureValid() )
{
writeEmptyItem( "embedded-fontdata" );
- IndentGuard aIndGuard( out() );
- OcxCFontNewObject( *this ).dump();
+ IndentGuard aIndGuard( mxOut );
+ AxCFontNewObject( *this ).dump();
}
}
-void OcxPropertyObjectBase::dumpToPosition( sal_Int64 nPos )
+void AxPropertyObjectBase::dumpToPosition( sal_Int64 nPos )
{
dumpRemainingTo( nPos );
mbValid = true;
ensureValid();
}
-void OcxPropertyObjectBase::constructOcxPropObj( const String& rPropNameList, bool b64BitPropFlags )
+void AxPropertyObjectBase::constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags )
{
- if( InputObjectBase::implIsValid() )
+ if( OleInputObjectBase::implIsValid() )
{
mxPropNames = cfg().getNameList( rPropNameList );
mb64BitPropFlags = b64BitPropFlags;
@@ -767,19 +1199,19 @@ void OcxPropertyObjectBase::constructOcxPropObj( const String& rPropNameList, bo
}
}
-void OcxPropertyObjectBase::dumpVersion()
+void AxPropertyObjectBase::dumpVersion()
{
- ItemGuard aItem( out(), "version" );
+ ItemGuard aItem( mxOut, "version" );
sal_uInt8 nMinor, nMajor;
- in() >> nMinor >> nMajor;
- out().writeDec( nMajor );
- out().writeChar( '.' );
- out().writeDec( nMinor );
+ *mxStrm >> nMinor >> nMajor;
+ mxOut->writeDec( nMajor );
+ mxOut->writeChar( '.' );
+ mxOut->writeDec( nMinor );
}
-OUString OcxPropertyObjectBase::dumpString( const String& rName, sal_uInt32 nSize, bool bArray )
+OUString AxPropertyObjectBase::dumpString( const String& rName, sal_uInt32 nSize, bool bArray )
{
- bool bCompressed = getFlag( nSize, OCX_STRING_COMPRESSED );
+ bool bCompressed = getFlag( nSize, AX_STRING_COMPRESSED );
sal_uInt32 nBufSize = extractValue< sal_uInt32 >( nSize, 0, 31 );
OUString aString = bCompressed ?
dumpCharArray( rName, nBufSize, RTL_TEXTENCODING_ISO_8859_1 ) :
@@ -788,30 +1220,30 @@ OUString OcxPropertyObjectBase::dumpString( const String& rName, sal_uInt32 nSiz
return aString;
}
-void OcxPropertyObjectBase::dumpShortProperties()
+void AxPropertyObjectBase::dumpShortProperties()
{
if( ensureValid() )
{
writeEmptyItem( "short-properties" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
implDumpShortProperties();
alignInput< sal_uInt32 >();
}
}
-void OcxPropertyObjectBase::dumpLargeProperties()
+void AxPropertyObjectBase::dumpLargeProperties()
{
if( ensureValid( mnPropFlags == 0 ) && !maLargeProps.empty() )
{
writeEmptyItem( "large-properties" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
for( LargePropertyVector::iterator aIt = maLargeProps.begin(), aEnd = maLargeProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
{
switch( aIt->mePropType )
{
case LargeProperty::PROPTYPE_POS:
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( aIt->maItemName );
dumpDec< sal_Int32 >( "top", "CONV-HMM-TO-CM" );
dumpDec< sal_Int32 >( "left", "CONV-HMM-TO-CM" );
@@ -819,7 +1251,7 @@ void OcxPropertyObjectBase::dumpLargeProperties()
break;
case LargeProperty::PROPTYPE_SIZE:
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( aIt->maItemName );
dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
@@ -842,13 +1274,13 @@ void OcxPropertyObjectBase::dumpLargeProperties()
case LargeProperty::PROPTYPE_STRINGARRAY:
{
writeEmptyItem( aIt->maItemName );
- IndentGuard aIndGuard2( out() );
- out().resetItemIndex();
- sal_Int64 nEndPos = in().tell() + aIt->mnDataSize;
- while( in().tell() < nEndPos )
+ IndentGuard aIndGuard2( mxOut );
+ mxOut->resetItemIndex();
+ sal_Int64 nEndPos = mxStrm->tell() + aIt->mnDataSize;
+ while( mxStrm->tell() < nEndPos )
{
- MultiItemsGuard aMultiGuard( out() );
- sal_uInt32 nDataSize = dumpHex< sal_uInt32 >( "#flags", "OCX-ARRAYSTRINGLEN" );
+ MultiItemsGuard aMultiGuard( mxOut );
+ sal_uInt32 nDataSize = dumpHex< sal_uInt32 >( "#flags", "AX-ARRAYSTRINGLEN" );
dumpString( "string", nDataSize, true );
}
dumpToPosition( nEndPos );
@@ -862,20 +1294,20 @@ void OcxPropertyObjectBase::dumpLargeProperties()
if( ensureValid() && !maStreamProps.empty() )
{
writeEmptyItem( "stream-properties" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
for( StreamPropertyVector::iterator aIt = maStreamProps.begin(), aEnd = maStreamProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
{
writeEmptyItem( aIt->maItemName );
if( ensureValid( aIt->mnData == 0xFFFF ) )
{
- IndentGuard aIndGuard2( out() );
+ IndentGuard aIndGuard2( mxOut );
OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
if( aClassName.equalsAscii( "StdFont" ) )
StdFontObject( *this ).dump();
else if( aClassName.equalsAscii( "StdPic" ) )
StdPicObject( *this ).dump();
else if( aClassName.equalsAscii( "CFontNew" ) )
- OcxCFontNewObject( *this ).dump();
+ AxCFontNewObject( *this ).dump();
else
ensureValid( false );
}
@@ -885,43 +1317,43 @@ void OcxPropertyObjectBase::dumpLargeProperties()
// ============================================================================
-OcxCFontNewObject::OcxCFontNewObject( const InputObjectBase& rParent )
+AxCFontNewObject::AxCFontNewObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-CFONTNEW-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-CFONTNEW-PROPERTIES" );
}
-void OcxCFontNewObject::implDumpShortProperties()
+void AxCFontNewObject::implDumpShortProperties()
{
dumpStringProperty();
- dumpFlagsProperty( 0, "OCX-CFONTNEW-FLAGS" );
+ dumpFlagsProperty( 0, "AX-CFONTNEW-FLAGS" );
dumpDecProperty< sal_Int32 >( 160 );
dumpDecProperty< sal_Int32 >( 0 );
- dumpDecProperty< sal_uInt8 >( 1, "CHARSET" );
+ dumpDecProperty< sal_uInt8 >( WINDOWS_CHARSET_DEFAULT, "CHARSET" );
dumpDecProperty< sal_uInt8 >( 0, "FONT-PITCHFAMILY" );
- dumpDecProperty< sal_uInt8 >( 1, "OCX-CFONTNEW-ALIGNMENT" );
+ dumpDecProperty< sal_uInt8 >( 1, "AX-CFONTNEW-ALIGNMENT" );
dumpDecProperty< sal_uInt16 >( 400, "FONT-WEIGHT" );
}
// ============================================================================
-OcxColumnInfoObject::OcxColumnInfoObject( const InputObjectBase& rParent )
+AxColumnInfoObject::AxColumnInfoObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-COLUMNINFO-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-COLUMNINFO-PROPERTIES" );
}
-void OcxColumnInfoObject::implDumpShortProperties()
+void AxColumnInfoObject::implDumpShortProperties()
{
dumpDecProperty< sal_Int32 >( -1, "CONV-HMM-TO-CM" );
}
// ============================================================================
-OcxCommandButtonObject::OcxCommandButtonObject( const InputObjectBase& rParent )
+AxCommandButtonObject::AxCommandButtonObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-COMMANDBUTTON-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-COMMANDBUTTON-PROPERTIES" );
}
-void OcxCommandButtonObject::implDumpShortProperties()
+void AxCommandButtonObject::implDumpShortProperties()
{
dumpColorProperty( 0x80000012 );
dumpColorProperty( 0x80000008 );
@@ -936,42 +1368,42 @@ void OcxCommandButtonObject::implDumpShortProperties()
dumpStreamProperty();
}
-void OcxCommandButtonObject::implDumpExtended()
+void AxCommandButtonObject::implDumpExtended()
{
dumpEmbeddedFont();
}
// ============================================================================
-OcxMorphControlObject::OcxMorphControlObject( const InputObjectBase& rParent )
+AxMorphControlObject::AxMorphControlObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-MORPH-PROPERTIES", true );
+ AxPropertyObjectBase::construct( rParent, "AX-MORPH-PROPERTIES", true );
}
-void OcxMorphControlObject::implDumpShortProperties()
+void AxMorphControlObject::implDumpShortProperties()
{
dumpFlagsProperty( 0x2C80081B );
dumpColorProperty( 0x80000005 );
dumpColorProperty( 0x80000008 );
dumpDecProperty< sal_uInt32 >( 0 );
dumpBorderStyleProperty< sal_uInt8 >( 0 );
- dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SCROLLBARS" );
- mnCtrlType = dumpDecProperty< sal_uInt8 >( 1, "OCX-MORPH-CONTROLTYPE" );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SCROLLBARS" );
+ mnCtrlType = dumpDecProperty< sal_uInt8 >( 1, "AX-MORPH-CONTROLTYPE" );
dumpMousePtrProperty();
dumpSizeProperty();
dumpUnicodeProperty();
dumpDecProperty< sal_uInt32 >( 0, "CONV-HMM-TO-CM" );
- dumpDecProperty< sal_uInt16 >( 1, "OCX-MORPH-BOUNDCOLUMN" );
- dumpDecProperty< sal_Int16 >( -1, "OCX-MORPH-TEXTCOLUMN" );
- dumpDecProperty< sal_Int16 >( 1, "OCX-MORPH-COLUMNCOUNT" );
+ dumpDecProperty< sal_uInt16 >( 1, "AX-MORPH-BOUNDCOLUMN" );
+ dumpDecProperty< sal_Int16 >( -1, "AX-MORPH-TEXTCOLUMN" );
+ dumpDecProperty< sal_Int16 >( 1, "AX-MORPH-COLUMNCOUNT" );
dumpDecProperty< sal_uInt16 >( 8 );
mnColInfoCount = dumpDecProperty< sal_uInt16 >( 1 );
- dumpDecProperty< sal_uInt8 >( 2, "OCX-MORPH-MATCHENTRYTYPE" );
- dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-LISTSTYLE" );
- dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SHOWDROPDOWNMODE" );
+ dumpDecProperty< sal_uInt8 >( 2, "AX-MORPH-MATCHENTRYTYPE" );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-LISTSTYLE" );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SHOWDROPDOWNMODE" );
dumpUnknownProperty();
- dumpDecProperty< sal_uInt8 >( 1, "OCX-MORPH-DROPDOWNSTYLE" );
- dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SELECTIONTYPE" );
+ dumpDecProperty< sal_uInt8 >( 1, "AX-MORPH-DROPDOWNSTYLE" );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SELECTIONTYPE" );
dumpStringProperty();
dumpStringProperty();
dumpImagePosProperty();
@@ -985,34 +1417,34 @@ void OcxMorphControlObject::implDumpShortProperties()
dumpStringProperty();
}
-void OcxMorphControlObject::implDumpExtended()
+void AxMorphControlObject::implDumpExtended()
{
dumpEmbeddedFont();
dumpColumnInfos();
}
-void OcxMorphControlObject::dumpColumnInfos()
+void AxMorphControlObject::dumpColumnInfos()
{
if( ensureValid() && (mnColInfoCount > 0) && ((mnCtrlType == 2) || (mnCtrlType == 3)) )
{
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < mnColInfoCount); ++nIdx )
{
writeEmptyItem( "#column-info" );
- IndentGuard aIndGuard( out() );
- OcxColumnInfoObject( *this ).dump();
+ IndentGuard aIndGuard( mxOut );
+ AxColumnInfoObject( *this ).dump();
}
}
}
// ============================================================================
-OcxLabelObject::OcxLabelObject( const InputObjectBase& rParent )
+AxLabelObject::AxLabelObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-LABEL-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-LABEL-PROPERTIES" );
}
-void OcxLabelObject::implDumpShortProperties()
+void AxLabelObject::implDumpShortProperties()
{
dumpColorProperty( 0x80000012 );
dumpColorProperty( 0x8000000F );
@@ -1029,19 +1461,19 @@ void OcxLabelObject::implDumpShortProperties()
dumpStreamProperty();
}
-void OcxLabelObject::implDumpExtended()
+void AxLabelObject::implDumpExtended()
{
dumpEmbeddedFont();
}
// ============================================================================
-OcxImageObject::OcxImageObject( const InputObjectBase& rParent )
+AxImageObject::AxImageObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-IMAGE-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-IMAGE-PROPERTIES" );
}
-void OcxImageObject::implDumpShortProperties()
+void AxImageObject::implDumpShortProperties()
{
dumpUnknownProperty();
dumpUnknownProperty();
@@ -1062,12 +1494,12 @@ void OcxImageObject::implDumpShortProperties()
// ============================================================================
-OcxScrollBarObject::OcxScrollBarObject( const InputObjectBase& rParent )
+AxScrollBarObject::AxScrollBarObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-SCROLLBAR-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-SCROLLBAR-PROPERTIES" );
}
-void OcxScrollBarObject::implDumpShortProperties()
+void AxScrollBarObject::implDumpShortProperties()
{
dumpColorProperty( 0x80000012 );
dumpColorProperty( 0x8000000F );
@@ -1083,19 +1515,19 @@ void OcxScrollBarObject::implDumpShortProperties()
dumpDecProperty< sal_Int32 >( 1 );
dumpDecProperty< sal_Int32 >( 1 );
dumpOrientationProperty();
- dumpDecProperty< sal_Int16 >( -1, "OCX-SCROLLBAR-PROPTHUMB" );
+ dumpDecProperty< sal_Int16 >( -1, "AX-SCROLLBAR-PROPTHUMB" );
dumpDelayProperty();
dumpStreamProperty();
}
// ============================================================================
-OcxSpinButtonObject::OcxSpinButtonObject( const InputObjectBase& rParent )
+AxSpinButtonObject::AxSpinButtonObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-SPINBUTTON-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-SPINBUTTON-PROPERTIES" );
}
-void OcxSpinButtonObject::implDumpShortProperties()
+void AxSpinButtonObject::implDumpShortProperties()
{
dumpColorProperty( 0x80000012 );
dumpColorProperty( 0x8000000F );
@@ -1116,12 +1548,12 @@ void OcxSpinButtonObject::implDumpShortProperties()
// ============================================================================
-OcxTabStripObject::OcxTabStripObject( const InputObjectBase& rParent )
+AxTabStripObject::AxTabStripObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-TABSTRIP-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "AX-TABSTRIP-PROPERTIES" );
}
-void OcxTabStripObject::implDumpShortProperties()
+void AxTabStripObject::implDumpShortProperties()
{
dumpDecProperty< sal_Int32 >( -1 );
dumpColorProperty( 0x8000000F );
@@ -1131,8 +1563,8 @@ void OcxTabStripObject::implDumpShortProperties()
dumpStringArrayProperty();
dumpMousePtrProperty();
dumpUnknownProperty();
- dumpDecProperty< sal_uInt32 >( 0, "OCX-TABSTRIP-ORIENTATION" );
- dumpDecProperty< sal_uInt32 >( 0, "OCX-TABSTRIP-TABSTYLE" );
+ dumpDecProperty< sal_uInt32 >( 0, "AX-TABSTRIP-ORIENTATION" );
+ dumpDecProperty< sal_uInt32 >( 0, "AX-TABSTRIP-TABSTYLE" );
dumpBoolProperty();
dumpHmmProperty();
dumpHmmProperty();
@@ -1150,35 +1582,43 @@ void OcxTabStripObject::implDumpShortProperties()
dumpStreamProperty();
}
-void OcxTabStripObject::implDumpExtended()
+void AxTabStripObject::implDumpExtended()
{
dumpEmbeddedFont();
if( mnTabFlagCount > 0 )
{
writeEmptyItem( "tab-flags" );
- IndentGuard aIndGuard( out() );
- out().resetItemIndex();
+ IndentGuard aIndGuard( mxOut );
+ mxOut->resetItemIndex();
for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnTabFlagCount); ++nIdx )
- dumpHex< sal_uInt32 >( "#flags", "OCX-TABSTRIP-FLAGS" );
+ dumpHex< sal_uInt32 >( "#flags", "AX-TABSTRIP-FLAGS" );
}
}
// ============================================================================
+// ============================================================================
-OcxControlObject::OcxControlObject( const InputObjectBase& rParent, const OUString& rProgId, sal_Int64 nLength ) :
- maProgId( rProgId ),
- mnLength( nLength )
+FormControlStreamObject::FormControlStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const OUString* pProgId )
{
- InputObjectBase::construct( rParent );
+ construct( rParent, rxStrm, rSysFileName );
+ constructFormCtrlStrmObj( pProgId );
}
-void OcxControlObject::implDump()
+FormControlStreamObject::FormControlStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString* pProgId )
{
- sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int64 >( mnLength, 0 );
- if( (maProgId.getLength() > 0) && (mnLength > 0) && !in().isEof() )
+ construct( rParent, rxStrm );
+ constructFormCtrlStrmObj( pProgId );
+}
+
+void FormControlStreamObject::implDump()
+{
+ if( mbReadGuid )
+ maProgId = cfg().getStringOption( dumpGuid(), OUString() );
+
+ if( (maProgId.getLength() > 0) && !mxStrm->isEof() )
{
if( maProgId.equalsAscii( "Forms.CommandButton.1" ) )
- OcxCommandButtonObject( *this ).dump();
+ AxCommandButtonObject( *this ).dump();
else if( maProgId.equalsAscii( "Forms.TextBox.1" ) ||
maProgId.equalsAscii( "Forms.ListBox.1" ) ||
maProgId.equalsAscii( "Forms.ComboBox.1" ) ||
@@ -1186,161 +1626,76 @@ void OcxControlObject::implDump()
maProgId.equalsAscii( "Forms.OptionButton.1" ) ||
maProgId.equalsAscii( "Forms.ToggleButton.1" ) ||
maProgId.equalsAscii( "RefEdit.Ctrl" ) )
- OcxMorphControlObject( *this ).dump();
+ AxMorphControlObject( *this ).dump();
else if( maProgId.equalsAscii( "Forms.Label.1" ) )
- OcxLabelObject( *this ).dump();
+ AxLabelObject( *this ).dump();
else if( maProgId.equalsAscii( "Forms.Image.1" ) )
- OcxImageObject( *this ).dump();
+ AxImageObject( *this ).dump();
else if( maProgId.equalsAscii( "Forms.ScrollBar.1" ) )
- OcxScrollBarObject( *this ).dump();
+ AxScrollBarObject( *this ).dump();
else if( maProgId.equalsAscii( "Forms.SpinButton.1" ) )
- OcxSpinButtonObject( *this ).dump();
+ AxSpinButtonObject( *this ).dump();
else if( maProgId.equalsAscii( "Forms.TabStrip.1" ) )
- OcxTabStripObject( *this ).dump();
+ AxTabStripObject( *this ).dump();
+ else if( maProgId.equalsAscii( "MSComCtl2.FlatScrollBar.2" ) )
+ ComCtlScrollBarObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.ProgCtrl.1" ) )
+ ComCtlProgressBarObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.ProgCtrl.2" ) )
+ ComCtlProgressBarObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.Slider.1" ) )
+ ComCtlSliderObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.Slider.2" ) )
+ ComCtlSliderObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "ComCtl2.UpDown.1" ) )
+ ComCtlUpDownObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComCtl2.UpDown.2" ) )
+ ComCtlUpDownObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.ImageListCtrl.1" ) )
+ ComCtlImageListObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.ImageListCtrl.2" ) )
+ ComCtlImageListObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.TabStrip.1" ) )
+ ComCtlTabStripObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.TabStrip.2" ) )
+ ComCtlTabStripObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.TreeCtrl.1" ) )
+ ComCtlTreeViewObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.TreeCtrl.2" ) )
+ ComCtlTreeViewObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.SBarCtrl.1" ) )
+ ComCtlStatusBarObject( *this, 5 ).dump();
else if( maProgId.equalsAscii( "StdPic" ) )
StdPicObject( *this ).dump();
}
- dumpRemainingTo( nEndPos );
-}
-
-// ============================================================================
-
-OcxGuidControlObject::OcxGuidControlObject( const InputObjectBase& rParent, sal_Int64 nLength ) :
- mnLength( nLength )
-{
- InputObjectBase::construct( rParent );
-}
-
-OcxGuidControlObject::OcxGuidControlObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
-{
- mnLength = rxStrm.get() ? rxStrm->getLength() : -1;
- InputObjectBase::construct( rParent, rxStrm );
-}
-
-OcxGuidControlObject::OcxGuidControlObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
-{
- mnLength = rxStrm.get() ? rxStrm->getLength() : -1;
- InputObjectBase::construct( rParent, rxStrm, rSysFileName );
-}
-
-void OcxGuidControlObject::implDump()
-{
- OUString aProgId = cfg().getStringOption( dumpGuid(), OUString() );
- OcxControlObject( *this, aProgId, mnLength - 16 ).dump();
-}
-
-// ============================================================================
-
-OcxControlsStreamObject::OcxControlsStreamObject( const ObjectBase& rParent,
- const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
- mrFormData( rFormData )
-{
- InputObjectBase::construct( rParent, rxStrm, rSysFileName );
-}
-
-void OcxControlsStreamObject::implDump()
-{
- for( OcxFormSiteInfoVector::iterator aIt = mrFormData.maSiteInfos.begin(), aEnd = mrFormData.maSiteInfos.end(); !in().isEof() && (aIt != aEnd); ++aIt )
- {
- if( (aIt->mbInStream) && (aIt->mnLength > 0) )
- {
- out().emptyLine();
- writeDecItem( "control-id", aIt->mnId );
- writeInfoItem( "prog-id", aIt->maProgId );
- IndentGuard aIndGuard( out() );
- OcxControlObject( *this, aIt->maProgId, aIt->mnLength ).dump();
- }
- }
dumpRemainingStream();
}
-// ============================================================================
-// ============================================================================
-
-OcxPageObject::OcxPageObject( const InputObjectBase& rParent )
+void FormControlStreamObject::constructFormCtrlStrmObj( const OUString* pProgId )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-PAGE-PROPERTIES" );
-}
-
-void OcxPageObject::implDumpShortProperties()
-{
- dumpUnknownProperty();
- dumpDecProperty< sal_uInt32 >( 0, "OCX-PAGE-TRANSITIONEFFECT" );
- dumpDecProperty< sal_uInt32 >( 0, "OCX-CONV-MS" );
+ mbReadGuid = pProgId == 0;
+ if( pProgId )
+ maProgId = *pProgId;
}
// ============================================================================
-
-OcxMultiPageObject::OcxMultiPageObject( const InputObjectBase& rParent )
-{
- OcxPropertyObjectBase::construct( rParent, "OCX-MULTIPAGE-PROPERTIES" );
-}
-
-void OcxMultiPageObject::implDumpShortProperties()
-{
- dumpUnknownProperty();
- mnPageCount = dumpDecProperty< sal_Int32 >( 0 );
- dumpDecProperty< sal_Int32 >( 0 );
- dumpBoolProperty();
-}
-
-void OcxMultiPageObject::implDumpExtended()
-{
- if( ensureValid() && (mnPageCount > 0) )
- {
- writeEmptyItem( "page-ids" );
- IndentGuard aIndGuard( out() );
- out().resetItemIndex();
- for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnPageCount); ++nIdx )
- dumpDec< sal_Int32 >( "#id" );
- }
-}
-
// ============================================================================
-OcxMultiPageStreamObject::OcxMultiPageStreamObject( const ObjectBase& rParent,
- const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
+VbaFormClassInfoObject::VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData ) :
mrFormData( rFormData )
{
- InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+ AxPropertyObjectBase::construct( rParent, "VBA-CLASSINFO-PROPERTIES" );
}
-void OcxMultiPageStreamObject::implDump()
-{
- for( size_t nIdx = 0, nCount = mrFormData.maSiteInfos.size(); !in().isEof() && (nIdx < nCount); ++nIdx )
- {
- out().emptyLine();
- writeEmptyItem( "page" );
- IndentGuard aIndGuard( out() );
- OcxPageObject( *this ).dump();
- }
- if( !in().isEof() )
- {
- out().emptyLine();
- writeEmptyItem( "multi-page" );
- IndentGuard aIndGuard( out() );
- OcxMultiPageObject( *this ).dump();
- }
- dumpRemainingStream();
-}
-
-// ============================================================================
-// ============================================================================
-
-OcxFormClassInfoObject::OcxFormClassInfoObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData ) :
- mrFormData( rFormData )
-{
- OcxPropertyObjectBase::construct( rParent, "OCX-CLASSINFO-PROPERTIES" );
-}
-
-void OcxFormClassInfoObject::implDumpShortProperties()
+void VbaFormClassInfoObject::implDumpShortProperties()
{
mrFormData.maClassInfoProgIds.push_back( OUString() );
dumpGuidProperty( &mrFormData.maClassInfoProgIds.back() );
dumpGuidProperty();
dumpUnknownProperty();
dumpGuidProperty();
- dumpFlagsProperty( 0, "OCX-CLASSINFO-FLAGS" );
+ dumpFlagsProperty( 0, "VBA-CLASSINFO-FLAGS" );
+ dumpDecProperty< sal_uInt32 >( 0 );
dumpDecProperty< sal_Int32 >( -1 );
dumpDecProperty< sal_uInt16 >( 0 );
dumpDecProperty< sal_uInt16 >( 0 );
@@ -1356,32 +1711,32 @@ void OcxFormClassInfoObject::implDumpShortProperties()
namespace {
-const sal_uInt32 OCX_FORMSITE_OBJSTREAM = 0x0010;
+const sal_uInt32 VBA_FORMSITE_OBJSTREAM = 0x0010;
-const sal_uInt16 OCX_FORMSITE_CLASSTABLEINDEX = 0x8000;
-const sal_uInt16 OCX_FORMSITE_CLASSTABLEMASK = 0x7FFF;
+const sal_uInt16 VBA_FORMSITE_CLASSTABLEINDEX = 0x8000;
+const sal_uInt16 VBA_FORMSITE_CLASSTABLEMASK = 0x7FFF;
} // namespace
// ----------------------------------------------------------------------------
-OcxFormSiteObject::OcxFormSiteObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData ) :
+VbaFormSiteObject::VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData ) :
mrFormData( rFormData )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-FORMSITE-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "VBA-FORMSITE-PROPERTIES" );
}
-void OcxFormSiteObject::implDumpShortProperties()
+void VbaFormSiteObject::implDumpShortProperties()
{
- OcxFormSiteInfo aSiteInfo;
+ VbaFormSiteInfo aSiteInfo;
dumpStringProperty();
dumpStringProperty();
sal_Int32 nId = dumpDecProperty< sal_Int32 >( 0 );
dumpDecProperty< sal_Int32 >( 0 );
- sal_uInt32 nFlags = dumpFlagsProperty( 0x00000033, "OCX-FORMSITE-FLAGS" );
+ sal_uInt32 nFlags = dumpFlagsProperty( 0x00000033, "VBA-FORMSITE-FLAGS" );
sal_uInt32 nLength = dumpDecProperty< sal_uInt32 >( 0 );
dumpDecProperty< sal_Int16 >( -1 );
- sal_uInt16 nClassId = dumpHexProperty< sal_uInt16 >( 0x7FFF, "OCX-FORMSITE-CLASSIDCACHE" );
+ sal_uInt16 nClassId = dumpHexProperty< sal_uInt16 >( 0x7FFF, "VBA-FORMSITE-CLASSIDCACHE" );
dumpPosProperty();
dumpDecProperty< sal_uInt16 >( 0 );
dumpUnknownProperty();
@@ -1390,61 +1745,61 @@ void OcxFormSiteObject::implDumpShortProperties()
dumpStringProperty();
dumpStringProperty();
- sal_uInt16 nIndex = nClassId & OCX_FORMSITE_CLASSTABLEMASK;
- if( getFlag( nClassId, OCX_FORMSITE_CLASSTABLEINDEX ) )
+ sal_uInt16 nIndex = nClassId & VBA_FORMSITE_CLASSTABLEMASK;
+ if( getFlag( nClassId, VBA_FORMSITE_CLASSTABLEINDEX ) )
{
if( nIndex < mrFormData.maClassInfoProgIds.size() )
aSiteInfo.maProgId = mrFormData.maClassInfoProgIds[ nIndex ];
}
else
{
- if( cfg().hasName( "OCX-FORMSITE-CLASSNAMES", nIndex ) )
- aSiteInfo.maProgId = cfg().getName( "OCX-FORMSITE-CLASSNAMES", nIndex );
+ if( cfg().hasName( "VBA-FORMSITE-CLASSNAMES", nIndex ) )
+ aSiteInfo.maProgId = cfg().getName( "VBA-FORMSITE-CLASSNAMES", nIndex );
}
aSiteInfo.mnId = nId;
aSiteInfo.mnLength = nLength;
- aSiteInfo.mbInStream = getFlag( nFlags, OCX_FORMSITE_OBJSTREAM );
+ aSiteInfo.mbInStream = getFlag( nFlags, VBA_FORMSITE_OBJSTREAM );
mrFormData.maSiteInfos.push_back( aSiteInfo );
}
// ============================================================================
-OcxFormDesignExtObject::OcxFormDesignExtObject( const InputObjectBase& rParent )
+VbaFormDesignExtObject::VbaFormDesignExtObject( const InputObjectBase& rParent )
{
- OcxPropertyObjectBase::construct( rParent, "OCX-FORMDESIGNEXT-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, "VBA-FORMDESIGNEXT-PROPERTIES" );
}
-void OcxFormDesignExtObject::implDumpShortProperties()
+void VbaFormDesignExtObject::implDumpShortProperties()
{
- dumpFlagsProperty( 0x00015F55, "OCX-FORMDESIGNEXT-FLAGS" );
+ dumpFlagsProperty( 0x00015F55, "VBA-FORMDESIGNEXT-FLAGS" );
dumpHmmProperty();
dumpHmmProperty();
- dumpDecProperty< sal_Int8 >( 0, "OCX-FORMDESIGNEXT-CLICKCTRLMODE" );
- dumpDecProperty< sal_Int8 >( 0, "OCX-FORMDESIGNEXT-DBLCLICKCTRLMODE" );
+ dumpDecProperty< sal_Int8 >( 0, "VBA-FORMDESIGNEXT-CLICKCTRLMODE" );
+ dumpDecProperty< sal_Int8 >( 0, "VBA-FORMDESIGNEXT-DBLCLICKCTRLMODE" );
}
// ============================================================================
namespace {
-const sal_uInt32 OCX_FORM_HASDESIGNEXTENDER = 0x00004000;
-const sal_uInt32 OCX_FORM_SKIPCLASSTABLE = 0x00008000;
+const sal_uInt32 AX_FORM_HASDESIGNEXTENDER = 0x00004000;
+const sal_uInt32 AX_FORM_SKIPCLASSTABLE = 0x00008000;
-const sal_uInt8 OCX_FORM_SITECOUNTTYPE_COUNT = 0x80;
-const sal_uInt8 OCX_FORM_SITECOUNTTYPE_MASK = 0x7F;
+const sal_uInt8 AX_FORM_SITECOUNTTYPE_COUNT = 0x80;
+const sal_uInt8 AX_FORM_SITECOUNTTYPE_MASK = 0x7F;
} // namespace
// ----------------------------------------------------------------------------
-OcxFormObject::OcxFormObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
+VbaFStreamObject::VbaFStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
mrFormData( rFormData )
{
- OcxPropertyObjectBase::construct( rParent, rxStrm, rSysFileName, "OCX-FORM-PROPERTIES" );
+ AxPropertyObjectBase::construct( rParent, rxStrm, rSysFileName, "VBA-FORM-PROPERTIES" );
}
-void OcxFormObject::implDumpShortProperties()
+void VbaFStreamObject::implDumpShortProperties()
{
dumpUnknownProperty();
dumpColorProperty( 0x8000000F );
@@ -1452,17 +1807,17 @@ void OcxFormObject::implDumpShortProperties()
dumpDecProperty< sal_uInt32 >( 0 );
dumpUnknownProperty();
dumpUnknownProperty();
- mnFlags = dumpFlagsProperty( 0x00000004, "OCX-FORM-FLAGS" );
+ mnFlags = dumpFlagsProperty( 0x00000004, "VBA-FORM-FLAGS" );
dumpBorderStyleProperty< sal_uInt8 >( 0 );
dumpMousePtrProperty();
- dumpHexProperty< sal_uInt8 >( 0x0C, "OCX-FORM-SCROLLBARS" );
+ dumpHexProperty< sal_uInt8 >( 0x0C, "VBA-FORM-SCROLLBARS" );
dumpSizeProperty();
dumpSizeProperty();
dumpPosProperty();
dumpDecProperty< sal_uInt32 >( 0 );
dumpUnknownProperty();
dumpStreamProperty();
- dumpDecProperty< sal_uInt8 >( 0, "OCX-FORM-CYCLE" );
+ dumpDecProperty< sal_uInt8 >( 0, "VBA-FORM-CYCLE" );
dumpSpecialEffectProperty< sal_uInt8 >( 0 );
dumpColorProperty( 0x80000012 );
dumpStringProperty();
@@ -1476,7 +1831,7 @@ void OcxFormObject::implDumpShortProperties()
dumpDecProperty< sal_uInt32 >( 0 );
}
-void OcxFormObject::implDumpExtended()
+void VbaFStreamObject::implDumpExtended()
{
dumpClassInfos();
dumpSiteData();
@@ -1484,58 +1839,58 @@ void OcxFormObject::implDumpExtended()
dumpRemainingStream();
}
-void OcxFormObject::dumpClassInfos()
+void VbaFStreamObject::dumpClassInfos()
{
- if( ensureValid() && !getFlag( mnFlags, OCX_FORM_SKIPCLASSTABLE ) )
+ if( ensureValid() && !getFlag( mnFlags, AX_FORM_SKIPCLASSTABLE ) )
{
- out().emptyLine();
+ mxOut->emptyLine();
sal_uInt16 nCount = dumpDec< sal_uInt16 >( "class-info-count" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
{
writeEmptyItem( "#class-info" );
- IndentGuard aIndGuard( out() );
- OcxFormClassInfoObject( *this, mrFormData ).dump();
+ IndentGuard aIndGuard( mxOut );
+ VbaFormClassInfoObject( *this, mrFormData ).dump();
}
}
}
-void OcxFormObject::dumpFormSites( sal_uInt32 nCount )
+void VbaFStreamObject::dumpFormSites( sal_uInt32 nCount )
{
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt32 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
{
- out().emptyLine();
+ mxOut->emptyLine();
writeEmptyItem( "#form-site" );
- IndentGuard aIndGuard( out() );
- OcxFormSiteObject( *this, mrFormData ).dump();
+ IndentGuard aIndGuard( mxOut );
+ VbaFormSiteObject( *this, mrFormData ).dump();
}
}
-void OcxFormObject::dumpSiteData()
+void VbaFStreamObject::dumpSiteData()
{
if( ensureValid() )
{
- out().emptyLine();
+ mxOut->emptyLine();
setAlignAnchor();
sal_uInt32 nSiteCount = dumpDec< sal_uInt32 >( "site-count" );
sal_uInt32 nSiteLength = dumpDec< sal_uInt32 >( "site-data-size" );
- sal_Int64 nEndPos = in().tell() + nSiteLength;
- if( ensureValid( nEndPos <= in().getLength() ) )
+ sal_Int64 nEndPos = mxStrm->tell() + nSiteLength;
+ if( ensureValid( nEndPos <= mxStrm->getLength() ) )
{
- out().resetItemIndex();
+ mxOut->resetItemIndex();
sal_uInt32 nSiteIdx = 0;
while( ensureValid() && (nSiteIdx < nSiteCount) )
{
- out().emptyLine();
+ mxOut->emptyLine();
writeEmptyItem( "#site-info" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpDec< sal_uInt8 >( "depth" );
- sal_uInt8 nTypeCount = dumpHex< sal_uInt8 >( "type-count", "OCX-FORM-SITE-TYPECOUNT" );
- if( getFlag( nTypeCount, OCX_FORM_SITECOUNTTYPE_COUNT ) )
+ sal_uInt8 nTypeCount = dumpHex< sal_uInt8 >( "type-count", "VBA-FORM-SITE-TYPECOUNT" );
+ if( getFlag( nTypeCount, AX_FORM_SITECOUNTTYPE_COUNT ) )
{
dumpDec< sal_uInt8 >( "repeated-type" );
- nSiteIdx += (nTypeCount & OCX_FORM_SITECOUNTTYPE_MASK);
+ nSiteIdx += (nTypeCount & AX_FORM_SITECOUNTTYPE_MASK);
}
else
{
@@ -1549,46 +1904,141 @@ void OcxFormObject::dumpSiteData()
}
}
-void OcxFormObject::dumpDesignExtender()
+void VbaFStreamObject::dumpDesignExtender()
{
- if( ensureValid() && getFlag( mnFlags, OCX_FORM_HASDESIGNEXTENDER ) )
+ if( ensureValid() && getFlag( mnFlags, AX_FORM_HASDESIGNEXTENDER ) )
{
- out().emptyLine();
+ mxOut->emptyLine();
writeEmptyItem( "design-extender" );
- IndentGuard aIndGuard( out() );
- OcxFormDesignExtObject( *this ).dump();
+ IndentGuard aIndGuard( mxOut );
+ VbaFormDesignExtObject( *this ).dump();
+ }
+}
+
+// ============================================================================
+
+VbaOStreamObject::VbaOStreamObject( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
+ mrFormData( rFormData )
+{
+ OleInputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+void VbaOStreamObject::implDump()
+{
+ for( VbaFormSiteInfoVector::iterator aIt = mrFormData.maSiteInfos.begin(), aEnd = mrFormData.maSiteInfos.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
+ {
+ if( (aIt->mbInStream) && (aIt->mnLength > 0) )
+ {
+ mxOut->emptyLine();
+ writeDecItem( "control-id", aIt->mnId );
+ writeInfoItem( "prog-id", aIt->maProgId );
+ IndentGuard aIndGuard( mxOut );
+ RelativeInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, aIt->mnLength ) );
+ FormControlStreamObject( *this, xRelStrm, &aIt->maProgId ).dump();
+ }
}
+ dumpRemainingStream();
+}
+
+// ============================================================================
+
+VbaPageObject::VbaPageObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "VBA-PAGE-PROPERTIES" );
+}
+
+void VbaPageObject::implDumpShortProperties()
+{
+ dumpUnknownProperty();
+ dumpDecProperty< sal_uInt32 >( 0, "VBA-PAGE-TRANSITIONEFFECT" );
+ dumpDecProperty< sal_uInt32 >( 0, "AX-CONV-MS" );
}
// ============================================================================
-OcxFormStorageObject::OcxFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
+VbaMultiPageObject::VbaMultiPageObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "VBA-MULTIPAGE-PROPERTIES" );
+}
+
+void VbaMultiPageObject::implDumpShortProperties()
+{
+ dumpUnknownProperty();
+ mnPageCount = dumpDecProperty< sal_Int32 >( 0 );
+ dumpDecProperty< sal_Int32 >( 0 );
+ dumpBoolProperty();
+}
+
+void VbaMultiPageObject::implDumpExtended()
+{
+ if( ensureValid() && (mnPageCount > 0) )
+ {
+ writeEmptyItem( "page-ids" );
+ IndentGuard aIndGuard( mxOut );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnPageCount); ++nIdx )
+ dumpDec< sal_Int32 >( "#id" );
+ }
+}
+
+// ============================================================================
+
+VbaXStreamObject::VbaXStreamObject( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
+ mrFormData( rFormData )
+{
+ InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+void VbaXStreamObject::implDump()
+{
+ for( size_t nIdx = 0, nCount = mrFormData.maSiteInfos.size(); !mxStrm->isEof() && (nIdx < nCount); ++nIdx )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "page" );
+ IndentGuard aIndGuard( mxOut );
+ VbaPageObject( *this ).dump();
+ }
+ if( !mxStrm->isEof() )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "multi-page" );
+ IndentGuard aIndGuard( mxOut );
+ VbaMultiPageObject( *this ).dump();
+ }
+ dumpRemainingStream();
+}
+
+// ============================================================================
+
+VbaContainerStorageObject::VbaContainerStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
OleStorageObject( rParent, rxStrg, rSysPath )
{
addPreferredStream( "f" );
}
-void OcxFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+void VbaContainerStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
{
if( rStrmName.equalsAscii( "f" ) )
- OcxFormObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+ VbaFStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
else if( rStrmName.equalsAscii( "o" ) )
- OcxControlsStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+ VbaOStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
else if( rStrmName.equalsAscii( "x" ) )
- OcxMultiPageStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+ VbaXStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
else
OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
}
-void OcxFormStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+void VbaContainerStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
{
if( isFormStorage( rStrgPath ) )
- OcxFormStorageObject( *this, rxStrg, rSysPath ).dump();
+ VbaContainerStorageObject( *this, rxStrg, rSysPath ).dump();
else
OleStorageObject( *this, rxStrg, rSysPath ).dump();
}
-bool OcxFormStorageObject::isFormStorage( const OUString& rStrgPath ) const
+bool VbaContainerStorageObject::isFormStorage( const OUString& rStrgPath ) const
{
if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') )
{
@@ -1597,7 +2047,7 @@ bool OcxFormStorageObject::isFormStorage( const OUString& rStrgPath ) const
aId = aId.copy( 1 );
sal_Int32 nId = aId.toInt32();
if( (nId > 0) && (OUString::valueOf( nId ) == aId) )
- for( OcxFormSiteInfoVector::const_iterator aIt = maFormData.maSiteInfos.begin(), aEnd = maFormData.maSiteInfos.end(); aIt != aEnd; ++aIt )
+ for( VbaFormSiteInfoVector::const_iterator aIt = maFormData.maSiteInfos.begin(), aEnd = maFormData.maSiteInfos.end(); aIt != aEnd; ++aIt )
if( aIt->mnId == nId )
return true;
}
@@ -1608,7 +2058,7 @@ bool OcxFormStorageObject::isFormStorage( const OUString& rStrgPath ) const
// ============================================================================
VbaSharedData::VbaSharedData() :
- meTextEnc( osl_getThreadTextEncoding() )
+ meTextEnc( RTL_TEXTENCODING_MS_1252 )
{
}
@@ -1659,7 +2109,7 @@ void VbaDirStreamObject::implDumpRecordBody()
switch( getRecId() )
{
case 0x0003:
- mrVbaData.meTextEnc = ::oox::xls::BiffHelper::calcTextEncodingFromCodePage( dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" ) );
+ mrVbaData.meTextEnc = rtl_getTextEncodingFromWindowsCodePage( dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" ) );
break;
case 0x0004:
dumpByteString( "name" );
@@ -1730,7 +2180,7 @@ void VbaDirStreamObject::implDumpRecordBody()
dumpUniString( "constants" );
break;
case 0x003D:
- dumpUniString( "helpfile-path" );
+ dumpByteString( "helpfile-path" );
break;
case 0x003E:
dumpUniString( "name" );
@@ -1759,7 +2209,7 @@ OUString VbaDirStreamObject::dumpUniString( const String& rName )
OUString VbaDirStreamObject::dumpByteStringWithLength( const String& rName )
{
- return dumpCharArray( rName, in().readInt32(), mrVbaData.meTextEnc );
+ return dumpCharArray( rName, mxStrm->readInt32(), mrVbaData.meTextEnc );
}
// ============================================================================
@@ -1776,10 +2226,10 @@ VbaModuleStreamObject::VbaModuleStreamObject(
void VbaModuleStreamObject::implDump()
{
dumpBinary( "perf-cache", mnStrmOffset );
- out().emptyLine();
+ mxOut->emptyLine();
writeEmptyItem( "source-code" );
- IndentGuard aIndGuard( out() );
- BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( in() ) );
+ IndentGuard aIndGuard( mxOut );
+ BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxStrm ) );
TextStreamObject( *this, xVbaStrm, mrVbaData.meTextEnc ).dump();
}
@@ -1805,7 +2255,7 @@ void VbaStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const
// ============================================================================
VbaFormStorageObject::VbaFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
- OcxFormStorageObject( rParent, rxStrg, rSysPath ),
+ VbaContainerStorageObject( rParent, rxStrg, rSysPath ),
mrVbaData( rVbaData )
{
}
@@ -1815,7 +2265,7 @@ void VbaFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, c
if( rStrmName.equalsAscii( "\003VBFrame" ) )
TextStreamObject( *this, rxStrm, mrVbaData.meTextEnc, rSysFileName ).dump();
else
- OcxFormStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+ VbaContainerStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
}
// ============================================================================
@@ -1845,6 +2295,19 @@ void VbaProjectStorageObject::implDumpStorage( const StorageRef& rxStrg, const O
// ============================================================================
// ============================================================================
+ActiveXStorageObject::ActiveXStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
+ VbaContainerStorageObject( rParent, rxStrg, rSysPath )
+{
+}
+
+void ActiveXStorageObject::implDumpBaseStream( const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ FormControlStreamObject( *this, rxStrm, rSysFileName ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
} // namespace dump
} // namespace oox
diff --git a/oox/source/dump/oledumper.ini b/oox/source/dump/oledumper.ini
index c398b0c01e51..7efe424b0ddc 100644
--- a/oox/source/dump/oledumper.ini
+++ b/oox/source/dump/oledumper.ini
@@ -4,7 +4,39 @@
# Path to additional configuration data, relative to this file.
include-config-file=dumperbase.ini
-# StdFont ====================================================================
+# OLE name lists =============================================================
+
+constlist=OLE-STD-CLIPBOARD-FORMAT
+ 2=bmp
+ 3=wmf
+ 8=dib
+ 14=emf
+end
+
+combilist=OLE-COLOR
+ 0x0000FFFF=uint32,dec,palette-index,,filter=0xFF000000~0x01000000
+ 0x000000FF=uint32,dec,red,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
+ 0x0000FF00=uint32,dec,green,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
+ 0x00FF0000=uint32,dec,blue,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
+ 0x0000FFFF=uint32,dec,system-color,SYSTEMCOLOR,filter=0xFF000000~0x80000000
+ 0xFF000000=uint8,dec,type,OLE-COLORTYPE
+end
+
+constlist=OLE-COLORTYPE
+ 0x00=default
+ 0x01=palette
+ 0x02=rgb
+ 0x80=system-color
+end
+
+multilist=OLE-MOUSEPTR
+ 0=default,arrow,cross,i-beam
+ 6=size-diag-down,size-vert,size-diag-up,size-hor
+ 10=up-arrow,hour-glass,no-drop,app-starting,help,size-all
+ 99=custom
+end
+
+# StdFont --------------------------------------------------------------------
{0BE35203-8F91-11CE-9DE3-00AA004BB851}=StdFont
@@ -17,11 +49,13 @@ end
unitconverter=STDFONT-HEIGHT,/10000,pt
-# StdPic =====================================================================
+# StdPic ---------------------------------------------------------------------
{0BE35204-8F91-11CE-9DE3-00AA004BB851}=StdPic
-# StdHlink ===================================================================
+shortlist=STDPIC-ID,0x0000746C,StdPic
+
+# StdHlink -------------------------------------------------------------------
{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}=StdHlink
{79EAC9E0-BAF9-11CE-8C82-00AA004BA90B}=URLMoniker
@@ -62,7 +96,7 @@ flagslist=STDHLINK-URL-FLAGS
0x00008000=no-encode-forbidden-chars
end
-# OLE name lists =============================================================
+# OLE property stream --------------------------------------------------------
{F29F85E0-4FF9-1068-AB91-08002B27B3D9}=GlobalDocProp
{D5CDD502-2E9C-101B-9397-08002B2CF9AE}=BuiltinDocProp
@@ -110,37 +144,210 @@ combilist=OLEPROP-TYPE
0x4000=byref
end
-# OCX name lists =============================================================
+# ComCtl controls ============================================================
+
+constlist=COMCTL-HEADER-IDS
+ 0x0A2BAE11=COMCTL_SLIDER_60
+ 0x12344321=COMCTL_SIZE
+ 0x6AC13CB1=COMCTL_TREEVIEW_60
+ 0x97AB8A01=COMCTL_PROGRESSBAR_60
+ 0x99470A83=COMCTL_SCROLLBAR_60
+ 0xABCDEF01=COMCTL_COMMONDATA
+ 0xBDECDE1F=COMCTL_COMPLEXDATA
+ 0xD12A7AC1=COMCTL_TABSTRIP_60
+ 0xE6E17E80=COMCTL_IMAGELIST_50_60
+ 0xE6E17E84=COMCTL_PROGRESSBAR_50
+ 0xE6E17E86=COMCTL_SLIDER_50
+ 0xE6E17E88=COMCTL_STATUSBAR_50
+ 0xE6E17E8A=COMCTL_TABSTRIP_50
+ 0xE6E17E8E=COMCTL_TREEVIEW_50
+ 0xFF3626A0=COMCTL_UPDOWN_50_60
+end
+
+combilist=COMCTL-COMMON-FLAGS
+ ignore=0xFFFF8000
+ 0x00000001=flat-border
+ 0x00000002=enabled
+ 0x00000004=3d-border
+ 0x000007F8=uint8,dec,mouse-ptr,OLE-MOUSEPTR
+ 0x00000800=ole-drag-auto
+ 0x00002000=ole-drop-manual
+end
+
+flagslist=COMCTL-COMPLEX-FLAGS
+ ignore=0xFFFFFFFC
+ 0x00000001=font
+ 0x00000002=mouse-icon
+end
+
+# flat scrollbar -------------------------------------------------------------
+
+{FE38753A-44A3-11D1-B5B7-0000C09000C4}=MSComCtl2.FlatScrollBar.2
+
+combilist=COMCTL-SCROLLBAR-FLAGS
+ 0x00000003=uint8,dec,appearance,COMCTL-SCROLLBAR-APPEARANCE
+ 0x0000000C=uint8,dec,arrows,COMCTL-SCROLLBAR-ARROWS
+ 0x00000010=!vertical!horizontal
+end
+
+shortlist=COMCTL-SCROLLBAR-APPEARANCE,0,3d,flat,track-3d
+shortlist=COMCTL-SCROLLBAR-ARROWS,0,both,left-up,right-down
+
+# progress bar ---------------------------------------------------------------
{0713E8D2-850A-101B-AFC0-4210102A8DA7}=COMCTL.ProgCtrl.1
+{35053A22-8589-11D1-B16A-00C0F0283628}=MSComctlLib.ProgCtrl.2
-combilist=OCX-COLOR
- 0x0000FFFF=uint32,dec,palette-index,,filter=0xFF000000~0x01000000
- 0x000000FF=uint32,dec,red,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
- 0x0000FF00=uint32,dec,green,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
- 0x00FF0000=uint32,dec,blue,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
- 0x0000FFFF=uint32,dec,system-color,SYSTEMCOLOR,filter=0xFF000000~0x80000000
- 0xFF000000=uint8,dec,type,OCX-COLORTYPE
+# slider ---------------------------------------------------------------------
+
+{373FF7F0-EB8B-11CD-8820-08002B2F4F5A}=COMCTL.Slider.1
+{F08DF954-8592-11D1-B16A-00C0F0283628}=MSComctlLib.Slider.2
+
+constlist=COMCTL-SLIDER-SELECTRANGE
+ 0x00000000=off
+ 0x0000FFFF=on
+ end
+
+shortlist=COMCTL-SLIDER-TICKSTYLE,0,bottom-right,top-left,both,no-ticks
+
+# updown ---------------------------------------------------------------------
+
+{026371C0-1B7C-11CF-9D53-00AA003C9CB6}=ComCtl2.UpDown.1
+{603C7E80-87C2-11D1-8BE3-0000F8754DA1}=MSComCtl2.UpDown.2
+
+flagslist=COMCTL-UPDOWN-FLAGS1
+ 0x00000001=!align-left!align-right
+ 0x00000004=!vertical!horizontal
+ end
+
+flagslist=COMCTL-UPDOWN-FLAGS2
+ 0x00000004=wrap
+ 0x00000020=ole-drop-manual
+ 0x00000080=enabled
+ end
+
+# image list -----------------------------------------------------------------
+
+{58DA8D8F-9D6A-101B-AFC0-4210102A8DA7}=COMCTL.ImageListCtrl.1
+{2C247F23-8591-11D1-B16A-00C0F0283628}=MSComctlLib.ImageListCtrl.2
+
+flagslist=COMCTL-IMAGELIST-TEXTFLAGS
+ 0x01=key
+ 0x02=tag
end
-constlist=OCX-COLORTYPE
- 0x00=default
- 0x01=palette
- 0x02=rgb
- 0x80=system-color
+# tab strip ------------------------------------------------------------------
+
+{9ED94440-E5E8-101B-B9B5-444553540000}=COMCTL.TabStrip.1
+{1EFB6596-857C-11D1-B16A-00C0F0283628}=MSComctlLib.TabStrip.2
+
+combilist=COMCTL-TABSTRIP-FLAGS1
+ ignore=0xFFFFFFE0
+ 0x00000001=multi-row
+ 0x00000002=show-tooltips
+ 0x00000018=uint8,dec,tab-width-style,COMCTL-TABSTRIP-TABWIDTHSTYLE
+end
+
+combilist=COMCTL-TABSTRIP-FLAGS2
+ ignore=0xFFFF0000
+ 0x00000003=uint8,dec,style,COMCTL-TABSTRIP-STYLE
+ 0x00000004=hot-tracking
+ 0x00000008=multi-select
+ 0x00000030=uint8,dec,placement,COMCTL-TABSTRIP-PLACEMENT
+ 0x00000040=separators
+end
+
+flagslist=COMCTL-TABSTRIP-FLAGS3
+ ignore=0xFFFF0000
+ 0x00000001=tabstyle-opposite
+end
+
+shortlist=COMCTL-TABSTRIP-TABWIDTHSTYLE,0,justified,non-justified,fixed
+shortlist=COMCTL-TABSTRIP-STYLE,0,tabs,tab-buttons,flat-buttons
+shortlist=COMCTL-TABSTRIP-PLACEMENT,0,top,bottom,left,right
+
+flagslist=COMCTL-TABSTRIP-TABFLAGS
+ 0x00000001=caption
+ 0x00000002=key
+ 0x00000004=tag
+ 0x00000008=tooltip
+end
+
+# tree view ------------------------------------------------------------------
+
+{0713E8A2-850A-101B-AFC0-4210102A8DA7}=COMCTL.TreeCtrl.1
+{C74190B6-8589-11D1-B16A-00C0F0283628}=MSComctlLib.TreeCtrl.2
+
+combilist=COMCTL-TREEVIEW-FLAGS
+ ignore=0xFFFF0000
+ 0x00000001=!tree-lines!root-lines
+ 0x0000001C=uint8,dec,style,COMCTL-TREEVIEW-STYLE
+ 0x00000020=label-edit
+ 0x00000080=hide-selection
+ 0x00000100=sorted
+end
+
+flagslist=COMCTL-TREEVIEW-STRINGFLAGS
+ ignore=0xFFFFFFF8
+ 0x00000001=separator
+ 0x00000002=image-list
+end
+
+shortlist=COMCTL-TREEVIEW-STYLE,0,text,pic-text,plusminus-text,plusminus-pic-text,treelines-text,treelines-pic-text,treelines-plusminus-text,treelines-plusminus-pic-text
+
+flagslist=COMCTL-TREEVIEW-FLAGS2
+ 0x00000001=checkboxes
+ 0x00000002=full-row-select
+ 0x00000004=hot-tracking
+ 0x00000008=scroll
+ 0x00000010=single-select
+end
+
+# status bar -----------------------------------------------------------------
+
+{6B7E638F-850A-101B-AFC0-4210102A8DA7}=COMCTL.SBarCtrl.1
+
+combilist=COMCTL-STATUSBAR-PANELFLAGS
+ ignore=0xFFFFF000
+ 0x00000007=uint8,dec,style,COMCTL-STATUSBAR-STYLE
+ 0x00000018=uint8,dec,alignment,COMCTL-STATUSBAR-ALIGN
+ 0x00000060=uint8,dec,bevel,COMCTL-STATUSBAR-BEVEL
+ 0x00000080=enabled
+ 0x00000300=uint8,dec,autosize,COMCTL-STATUSBAR-AUTOSIZE
+ 0x00000400=visible
+end
+
+shortlist=COMCTL-STATUSBAR-STYLE,0,text,caps,num,ins,scrl,time,date,kana
+shortlist=COMCTL-STATUSBAR-ALIGN,0,left,center,right
+shortlist=COMCTL-STATUSBAR-BEVEL,0,no-bevel,inset,raised
+shortlist=COMCTL-STATUSBAR-AUTOSIZE,0,no-auto,spring,content
+
+flagslist=COMCTL-STATUSBAR-TEXTFLAGS
+ 0x00000001=text
+ 0x00000002=vis-text
+ 0x00000004=key
+ 0x00000008=tag
+ 0x00000010=tooltip
end
-combilist=OCX-STRINGLEN
+# other controls =============================================================
+
+# Microsoft Web Browser
+{8856F961-340A-11D0-A96B-00C04FD705A2}=Shell.Explorer.2
+
+# ActiveX name lists =========================================================
+
+combilist=AX-STRINGLEN
0x80000000=!unicode!compressed
0x7FFFFFFF=int32,dec,buffer-size
end
-combilist=OCX-ARRAYSTRINGLEN
+combilist=AX-ARRAYSTRINGLEN
0x80000000=!unicode!compressed
0x7FFFFFFF=int32,dec,len
end
-combilist=OCX-FLAGS
+combilist=AX-FLAGS
0x00000001=reserved-1
0x00000002=enabled
0x00000004=locked
@@ -151,7 +358,7 @@ combilist=OCX-FLAGS
0x00001000=existing-entries-only
0x00002000=caption-left
0x00004000=editable
- 0x00078000=uint8,dec,ime-mode,OCX-IMEMODE
+ 0x00078000=uint8,dec,ime-mode,AX-IMEMODE
0x00080000=drag-enabled
0x00100000=enter-as-newline
0x00200000=keep-selection
@@ -166,7 +373,7 @@ combilist=OCX-FLAGS
0x80000000=multi-line
end
-multilist=OCX-IMEMODE
+multilist=AX-IMEMODE
0=no-control,on,off,disabled
4=hiragana,fillwidth-katakana,halfwidth-katakana
7=fullwidth-alpha,halfwidth-alpha
@@ -174,33 +381,26 @@ multilist=OCX-IMEMODE
11=fullwidth-hanzi,halfwidth-hanzi
end
-multilist=OCX-MOUSEPTR
- 0=default,arrow,cross,i-beam
- 6=size-diag-down,size-vert,size-diag-up,size-hor
- 10=up-arrow,hour-glass,no-drop,app-starting,help,size-all
- 99=custom
+combilist=AX-IMAGEPOS
+ 0x0000FFFF=uint16,dec,image,AX-POS
+ 0xFFFF0000=uint16,dec,label,AX-POS
end
-combilist=OCX-IMAGEPOS
- 0x0000FFFF=uint16,dec,image,OCX-POS
- 0xFFFF0000=uint16,dec,label,OCX-POS
-end
-
-unitconverter=OCX-CONV-MS,1,ms
+unitconverter=AX-CONV-MS,1,ms
-shortlist=OCX-ENABLED,0,disabled,enabled
-shortlist=OCX-BORDERSTYLE,0,none,single
-shortlist=OCX-SPECIALEFFECT,0,flat,raised,sunken,etched,,,bump
-shortlist=OCX-ORIENTATION,-1,auto,vertical,horizontal
-shortlist=OCX-POS,0,top-left,top,top-right,left,center,right,bottom-left,bottom,bottom-right
-shortlist=OCX-IMAGEALIGN,0,top-left,top-right,center,bottom-left,bottom-right
-shortlist=OCX-IMAGESIZEMODE,0,clip,stretch,,stretch-ratio
+shortlist=AX-ENABLED,0,disabled,enabled
+shortlist=AX-BORDERSTYLE,0,none,single
+shortlist=AX-SPECIALEFFECT,0,flat,raised,sunken,etched,,,bump
+shortlist=AX-ORIENTATION,-1,auto,vertical,horizontal
+shortlist=AX-POS,0,top-left,top,top-right,left,center,right,bottom-left,bottom,bottom-right
+shortlist=AX-IMAGEALIGN,0,top-left,top-right,center,bottom-left,bottom-right
+shortlist=AX-IMAGESIZEMODE,0,clip,stretch,,stretch-ratio
# CFontNew -------------------------------------------------------------------
{AFC20920-DA4E-11CE-B94300AA006887B4}=CFontNew
-flagslist=OCX-CFONTNEW-PROPERTIES
+flagslist=AX-CFONTNEW-PROPERTIES
0x0001=font-name
0x0002=flags
0x0004=font-size
@@ -211,7 +411,7 @@ flagslist=OCX-CFONTNEW-PROPERTIES
0x0080=font-weight
end
-flagslist=OCX-CFONTNEW-FLAGS
+flagslist=AX-CFONTNEW-FLAGS
0x00000001=bold
0x00000002=italic
0x00000004=underline
@@ -221,11 +421,11 @@ flagslist=OCX-CFONTNEW-FLAGS
0x40000000=auto-color
end
-shortlist=OCX-CFONTNEW-ALIGNMENT,1,left,right,center
+shortlist=AX-CFONTNEW-ALIGNMENT,1,left,right,center
# column info ----------------------------------------------------------------
-flagslist=OCX-COLUMNINFO-PROPERTIES
+flagslist=AX-COLUMNINFO-PROPERTIES
0x00000001=column-width
end
@@ -233,7 +433,7 @@ end
{D7053240-CE69-11CD-A777-00DD01143C57}=Forms.CommandButton.1
-flagslist=OCX-COMMANDBUTTON-PROPERTIES
+flagslist=AX-COMMANDBUTTON-PROPERTIES
0x00000001=text-color
0x00000002=fill-color
0x00000004=flags
@@ -257,7 +457,7 @@ end
{8BD21D60-EC42-11CE-9E0D-00AA006002F3}=Forms.ToggleButton.1
{00024512-0000-0000-C000-000000000046}=RefEdit.Ctrl
-flagslist=OCX-MORPH-PROPERTIES
+flagslist=AX-MORPH-PROPERTIES
0x0000000000000001=flags
0x0000000000000002=fill-color
0x0000000000000004=text-color
@@ -291,26 +491,26 @@ flagslist=OCX-MORPH-PROPERTIES
0x0000000100000000=groupname
end
-shortlist=OCX-MORPH-SCROLLBARS,0,none,horizontal,vertical,both
-shortlist=OCX-MORPH-CONTROLTYPE,1,edit,listbox,combobox,checkbox,optionbutton,togglebutton,dropdown-listbox
-shortlist=OCX-MORPH-MATCHENTRYTYPE,0,first-letter,complete,none
-shortlist=OCX-MORPH-LISTSTYLE,0,plain,with-buttons
-shortlist=OCX-MORPH-SHOWDROPDOWNMODE,0,never,on-focus,always
-shortlist=OCX-MORPH-DROPDOWNSTYLE,0,no-symbol,arrow,ellipsis,underline
-shortlist=OCX-MORPH-SELECTIONTYPE,0,single,multi,range
+shortlist=AX-MORPH-SCROLLBARS,0,none,horizontal,vertical,both
+shortlist=AX-MORPH-CONTROLTYPE,1,edit,listbox,combobox,checkbox,optionbutton,togglebutton,dropdown-listbox
+shortlist=AX-MORPH-MATCHENTRYTYPE,0,first-letter,complete,none
+shortlist=AX-MORPH-LISTSTYLE,0,plain,with-buttons
+shortlist=AX-MORPH-SHOWDROPDOWNMODE,0,never,on-focus,always
+shortlist=AX-MORPH-DROPDOWNSTYLE,0,no-symbol,arrow,ellipsis,underline
+shortlist=AX-MORPH-SELECTIONTYPE,0,single,multi,range
-constlist=OCX-MORPH-BOUNDCOLUMN
+constlist=AX-MORPH-BOUNDCOLUMN
default=
0=value-is-row-index
end
-constlist=OCX-MORPH-TEXTCOLUMN
+constlist=AX-MORPH-TEXTCOLUMN
default=
-1=first-column-with-width
0=row-numbers
end
-constlist=OCX-MORPH-COLUMNCOUNT
+constlist=AX-MORPH-COLUMNCOUNT
default=
-1=all-columns
end
@@ -319,7 +519,7 @@ end
{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}=Forms.Label.1
-flagslist=OCX-LABEL-PROPERTIES
+flagslist=AX-LABEL-PROPERTIES
0x00000001=text-color
0x00000002=fill-color
0x00000004=flags
@@ -339,7 +539,7 @@ end
{4C599241-6926-101B-9992-00000B65C6F9}=Forms.Image.1
-flagslist=OCX-IMAGE-PROPERTIES
+flagslist=AX-IMAGE-PROPERTIES
0x00000004=auto-size
0x00000008=border-color
0x00000010=fill-color
@@ -359,7 +559,7 @@ end
{DFD181E0-5E2F-11CE-A449-00AA004A803D}=Forms.ScrollBar.1
-flagslist=OCX-SCROLLBAR-PROPERTIES
+flagslist=AX-SCROLLBAR-PROPERTIES
0x00000001=arrow-color
0x00000002=fill-color
0x00000004=flags
@@ -379,13 +579,13 @@ flagslist=OCX-SCROLLBAR-PROPERTIES
0x00010000=mouse-icon
end
-shortlist=OCX-SCROLLBAR-PROPTHUMB,-1,proportional,fixed
+shortlist=AX-SCROLLBAR-PROPTHUMB,-1,proportional,fixed
# spin button ----------------------------------------------------------------
{79176FB0-B7F2-11CE-97EF-00AA006D2776}=Forms.SpinButton.1
-flagslist=OCX-SPINBUTTON-PROPERTIES
+flagslist=AX-SPINBUTTON-PROPERTIES
0x00000001=arrow-color
0x00000002=fill-color
0x00000004=flags
@@ -407,7 +607,7 @@ end
{EAE50EB0-4A62-11CE-BED6-00AA00611080}=Forms.TabStrip.1
-flagslist=OCX-TABSTRIP-PROPERTIES
+flagslist=AX-TABSTRIP-PROPERTIES
0x00000001=selected-tab
0x00000002=fill-color
0x00000004=text-color
@@ -431,40 +631,19 @@ flagslist=OCX-TABSTRIP-PROPERTIES
0x01000000=mouse-icon
end
-shortlist=OCX-TABSTRIP-ORIENTATION,0,top,bottom,left,right
-shortlist=OCX-TABSTRIP-TABSTYLE,0,tabs,buttons,none
+shortlist=AX-TABSTRIP-ORIENTATION,0,top,bottom,left,right
+shortlist=AX-TABSTRIP-TABSTYLE,0,tabs,buttons,none
-flagslist=OCX-TABSTRIP-FLAGS
+flagslist=AX-TABSTRIP-FLAGS
0x00000001=visible
0x00000002=enabled
end
-# frame ----------------------------------------------------------------------
-
-{6E182020-F460-11CE-9BCD-00AA00608E01}=Forms.Frame.1
-
-# page -----------------------------------------------------------------------
-
-flagslist=OCX-PAGE-PROPERTIES
- 0x00000002=transition-effect
- 0x00000004=transition-period
-end
-
-shortlist=OCX-PAGE-TRANSITIONEFFECT,0,none,cover-up,cover-right-up,cover-right,cover-right-down,cover-down,cover-left-down,cover-left,cover-left-up,push-up,push-right,push-down,push-left
-
-# multi page -----------------------------------------------------------------
-
-{46E31370-3F7A-11CE-BED6-00AA00611080}=Forms.MultiPage.1
-
-flagslist=OCX-MULTIPAGE-PROPERTIES
- 0x00000002=page-count
- 0x00000004=id
- 0x00000008=enabled
-end
+# VBA forms ==================================================================
# form class info ------------------------------------------------------------
-flagslist=OCX-CLASSINFO-PROPERTIES
+flagslist=VBA-CLASSINFO-PROPERTIES
0x00000001=class-id
0x00000002=disp-event
0x00000008=default-prog
@@ -481,18 +660,18 @@ flagslist=OCX-CLASSINFO-PROPERTIES
0x00004000=set-rowset
end
-combilist=OCX-CLASSINFO-FLAGS
- 0x0000FFFF=uint16,hex,classtable-flags,OCX-CLASSTABLE-CLASSFLAGS
- 0xFFFF0000=uint16,hex,var-flags,OCX-CLASSTABLE-VARFLAGS
+combilist=VBA-CLASSINFO-FLAGS
+ 0x0000FFFF=uint16,hex,classtable-flags,VBA-CLASSTABLE-CLASSFLAGS
+ 0xFFFF0000=uint16,hex,var-flags,VBA-CLASSTABLE-VARFLAGS
end
-flagslist=OCX-CLASSTABLE-CLASSFLAGS
+flagslist=VBA-CLASSTABLE-CLASSFLAGS
0x0001=exclusive-value
0x0002=dual-interface
0x0004=no-aggregation
end
-flagslist=OCX-CLASSTABLE-VARFLAGS
+flagslist=VBA-CLASSTABLE-VARFLAGS
0x0001=read-only
0x0002=source
0x0004=bindable
@@ -510,7 +689,7 @@ end
# form site ------------------------------------------------------------------
-flagslist=OCX-FORMSITE-PROPERTIES
+flagslist=VBA-FORMSITE-PROPERTIES
0x00000001=name
0x00000002=tag
0x00000004=id
@@ -527,7 +706,7 @@ flagslist=OCX-FORMSITE-PROPERTIES
0x00004000=row-source
end
-flagslist=OCX-FORMSITE-FLAGS
+flagslist=VBA-FORMSITE-FLAGS
0x00000001=tabstop
0x00000002=visible
0x00000004=default
@@ -540,7 +719,18 @@ flagslist=OCX-FORMSITE-FLAGS
0x00040000=container
end
-constlist=OCX-FORMSITE-CLASSNAMES
+combilist=VBA-FORMSITE-CLASSIDCACHE
+ 0x7FFF=uint16,dec,cache-idx,VBA-FORMSITE-CLASSIDCACHEINDEX,filter=0x8000~0x0000
+ 0x7FFF=uint16,dec,class-table-idx,,filter=0x8000~0x8000
+ 0x8000=!predefined-class-id!class-table-index
+end
+
+constlist=VBA-FORMSITE-CLASSIDCACHEINDEX
+ include=VBA-FORMSITE-CLASSNAMES
+ 0x7FFF=invalid
+end
+
+constlist=VBA-FORMSITE-CLASSNAMES
7=Forms.Form.1
12=Forms.Image.1
14=Forms.Frame.1
@@ -559,20 +749,9 @@ constlist=OCX-FORMSITE-CLASSNAMES
57=Forms.MultiPage.1
end
-constlist=OCX-FORMSITE-CLASSIDCACHEINDEX
- include=OCX-FORMSITE-CLASSNAMES
- 0x7FFF=invalid
-end
-
-combilist=OCX-FORMSITE-CLASSIDCACHE
- 0x7FFF=uint16,dec,cache-idx,OCX-FORMSITE-CLASSIDCACHEINDEX,filter=0x8000~0x0000
- 0x7FFF=uint16,dec,class-table-idx,,filter=0x8000~0x8000
- 0x8000=!predefined-class-id!class-table-index
-end
-
# form design extender ------------------------------------------------------
-flagslist=OCX-FORMDESIGNEXT-PROPERTIES
+flagslist=VBA-FORMDESIGNEXT-PROPERTIES
0x00000001=flags
0x00000002=grid-x
0x00000004=grid-y
@@ -580,7 +759,7 @@ flagslist=OCX-FORMDESIGNEXT-PROPERTIES
0x00000010=dblclick-control-mode
end
-flagslist=OCX-FORMDESIGNEXT-FLAGS
+flagslist=VBA-FORMDESIGNEXT-FLAGS
0x00000001=inherit-design-mode
0x00000002=design-mode
0x00000004=inherit-show-toolbox
@@ -601,14 +780,15 @@ flagslist=OCX-FORMDESIGNEXT-FLAGS
0x00020000=immediate-layout
end
-shortlist=OCX-FORMDESIGNEXT-CLICKCTRLMODE,-2,inherit,default,insertion-point,select-then-insert
-shortlist=OCX-FORMDESIGNEXT-DBLCLICKCTRLMODE,-2,inherit,,select-text,edit-code,edit-properties
+shortlist=VBA-FORMDESIGNEXT-CLICKCTRLMODE,-2,inherit,default,insertion-point,select-then-insert
+shortlist=VBA-FORMDESIGNEXT-DBLCLICKCTRLMODE,-2,inherit,,select-text,edit-code,edit-properties
# form -----------------------------------------------------------------------
{C62A69F0-16DC-11CE-9E98-00AA00574A4F}=Forms.Form.1
+{6E182020-F460-11CE-9BCD-00AA00608E01}=Forms.Frame.1
-flagslist=OCX-FORM-PROPERTIES
+flagslist=VBA-FORM-PROPERTIES
0x00000002=fill-color
0x00000004=text-color
0x00000008=next-available-id
@@ -635,13 +815,13 @@ flagslist=OCX-FORM-PROPERTIES
0x08000000=draw-buffer
end
-flagslist=OCX-FORM-FLAGS
+flagslist=VBA-FORM-FLAGS
0x00000004=enabled
0x00004000=has-design-extender
0x00008000=!has-class-table!skip-class-table
end
-flagslist=OCX-FORM-SCROLLBARS
+flagslist=VBA-FORM-SCROLLBARS
0x01=horizontal
0x02=vertical
0x04=keep-horizontal
@@ -649,24 +829,43 @@ flagslist=OCX-FORM-SCROLLBARS
0x10=vertical-left
end
-shortlist=OCX-FORM-CYCLE,0,all-forms,,current-form
+shortlist=VBA-FORM-CYCLE,0,all-forms,,current-form
-combilist=OCX-FORM-SITE-TYPECOUNT
+combilist=VBA-FORM-SITE-TYPECOUNT
0x7F=uint8,dec,type-count
0x80=!type!count
end
-# VBA name lists =============================================================
+# page -----------------------------------------------------------------------
+
+flagslist=VBA-PAGE-PROPERTIES
+ 0x00000002=transition-effect
+ 0x00000004=transition-period
+end
+
+shortlist=VBA-PAGE-TRANSITIONEFFECT,0,none,cover-up,cover-right-up,cover-right,cover-right-down,cover-down,cover-left-down,cover-left,cover-left-up,push-up,push-right,push-down,push-left
+
+# multi page -----------------------------------------------------------------
+
+{46E31370-3F7A-11CE-BED6-00AA00611080}=Forms.MultiPage.1
+
+flagslist=VBA-MULTIPAGE-PROPERTIES
+ 0x00000002=page-count
+ 0x00000004=id
+ 0x00000008=enabled
+end
+
+# VBA project name lists =====================================================
multilist=VBA-DIR-RECORD-NAMES
- 0x0000=,PROJECTSYSKIND,PROJECTLCID,PROJECTCODEPAGE,PROJECTNAME,PROJECTDOCSTRING,PROJECTHELPFILEPATH,PROJECTHELPCONTEXT
+ 0x0000=,PROJECTSYSKIND,PROJECTLCID,PROJECTCODEPAGE,PROJECTNAME,PROJECTDOCSTRING,PROJECTHELPFILEPATH1,PROJECTHELPCONTEXT
0x0008=PROJECTLIBFLAGS,PROJECTVERSION,,,PROJECTCONSTANTS,REFERENCEREGISTERED,REFERENCEPROJECT,PROJECTMODULES
0x0010=PROJECTEND,,,PROJECTCOOKIE,PROJECTLCIDINVOKE,,REFERENCENAME,
0x0018=,MODULENAME,MODULESTREAMNAME,,MODULEDOCSTRING,,MODULEHELPCONTEXT,
- 0x0020=,PROCEDURALMODULE,DOCUMENTMODULE,,,MODULEREADONLY,,
+ 0x0020=,MODULETYPEPROCEDURAL,MODULETYPEDOCUMENT,,,MODULEREADONLY,,
0x0028=MODULEPRIVATE,,,MODULEEND,MODULECOOKIE,,,REFERENCECONTROL
0x0030=REFERENCEEXTENDED,MODULEOFFSET,MODULESTREAMNAMEUNICODE,REFERENCEORIGINAL,,,,
- 0x0038=,,,,PROJECTCONSTANTSUNICODE,PROJECTHELPFILEPATHUNICODE,REFERENCENAMEUNICODE,
+ 0x0038=,,,,PROJECTCONSTANTSUNICODE,PROJECTHELPFILEPATH2,REFERENCENAMEUNICODE,
0x0040=PROJECTDOCSTRINGUNICODE,,,,,,,MODULENAMEUNICODE
0x0048=MODULEDOCSTRINGUNICODE,,,,,,,
end
diff --git a/oox/source/dump/pptxdumper.cxx b/oox/source/dump/pptxdumper.cxx
index e58991dbecc9..e01d7d349855 100644
--- a/oox/source/dump/pptxdumper.cxx
+++ b/oox/source/dump/pptxdumper.cxx
@@ -26,8 +26,8 @@
************************************************************************/
#include "oox/dump/pptxdumper.hxx"
-#include "oox/helper/olestorage.hxx"
#include "oox/helper/zipstorage.hxx"
+#include "oox/ole/olestorage.hxx"
#include "oox/dump/biffdumper.hxx"
#include "oox/dump/oledumper.hxx"
#include "oox/dump/xlsbdumper.hxx"
@@ -91,17 +91,18 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons
{
if( rStrgPath.equalsAscii( "ppt" ) && rStrmName.equalsAscii( "vbaProject.bin" ) )
{
- StorageRef xStrg( new OleStorage( getFactory(), xInStrm, false ) );
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump();
}
else if( rStrgPath.equalsAscii( "ppt/embeddings" ) )
{
- StorageRef xStrg( new OleStorage( getFactory(), xInStrm, false ) );
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
OleStorageObject( *this, xStrg, rSysFileName ).dump();
}
else if( rStrgPath.equalsAscii( "ppt/activeX" ) )
{
- OcxGuidControlObject( *this, rxStrm, rSysFileName ).dump();
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, true ) );
+ ActiveXStorageObject( *this, xStrg, rSysFileName ).dump();
}
else
{
diff --git a/oox/source/dump/xlsbdumper.cxx b/oox/source/dump/xlsbdumper.cxx
index a9674951225b..80fccddff2ea 100644
--- a/oox/source/dump/xlsbdumper.cxx
+++ b/oox/source/dump/xlsbdumper.cxx
@@ -30,9 +30,9 @@
#include "oox/dump/biffdumper.hxx"
#include "oox/dump/oledumper.hxx"
#include "oox/dump/pptxdumper.hxx"
-#include "oox/helper/olestorage.hxx"
#include "oox/helper/zipstorage.hxx"
#include "oox/core/filterbase.hxx"
+#include "oox/ole/olestorage.hxx"
#include "oox/xls/biffhelper.hxx"
#include "oox/xls/formulabase.hxx"
#include "oox/xls/richstring.hxx"
@@ -82,8 +82,8 @@ RecordObjectBase::~RecordObjectBase()
void RecordObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
{
- mxStrm.reset( new RecordInputStream( getRecordDataSequence() ) );
- SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
+ mxBiffStrm.reset( new RecordInputStream( getRecordDataSequence() ) );
+ SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxBiffStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
if( SequenceRecordObjectBase::implIsValid() )
mxErrCodes = cfg().getNameList( "ERRORCODES" );
}
@@ -111,22 +111,22 @@ OUString RecordObjectBase::getErrorName( sal_uInt8 nErrCode ) const
void RecordObjectBase::readAddress( Address& orAddress )
{
- in() >> orAddress.mnRow >> orAddress.mnCol;
+ *mxStrm >> orAddress.mnRow >> orAddress.mnCol;
}
void RecordObjectBase::readRange( Range& orRange )
{
- in() >> orRange.maFirst.mnRow >> orRange.maLast.mnRow >> orRange.maFirst.mnCol >> orRange.maLast.mnCol;
+ *mxStrm >> orRange.maFirst.mnRow >> orRange.maLast.mnRow >> orRange.maFirst.mnCol >> orRange.maLast.mnCol;
}
void RecordObjectBase::readRangeList( RangeList& orRanges )
{
sal_Int32 nCount;
- in() >> nCount;
+ *mxStrm >> nCount;
if( nCount >= 0 )
{
orRanges.resize( getLimitedValue< size_t, sal_Int32 >( nCount, 0, SAL_MAX_UINT16 ) );
- for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !in().isEof() && (aIt != aEnd); ++aIt )
+ for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
readRange( *aIt );
}
else
@@ -150,11 +150,11 @@ void RecordObjectBase::writeFontPortions( const FontPortionModelList& rPortions
if( !rPortions.empty() )
{
writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
- IndentGuard aIndGuard( out() );
- TableGuard aTabGuard( out(), 14 );
+ IndentGuard aIndGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 14 );
for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeDecItem( "char-pos", aIt->mnPos );
writeDecItem( "font-id", aIt->mnFontId, "FONTNAMES" );
}
@@ -166,11 +166,11 @@ void RecordObjectBase::writePhoneticPortions( const PhoneticPortionModelList& rP
if( !rPortions.empty() )
{
writeDecItem( "portion-count", static_cast< sal_uInt32 >( rPortions.size() ) );
- IndentGuard aIndGuard( out() );
- TableGuard aTabGuard( out(), 14, 21 );
+ IndentGuard aIndGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 14, 21 );
for( PhoneticPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeDecItem( "char-pos", aIt->mnPos );
writeDecItem( "base-text-start", aIt->mnBasePos );
writeDecItem( "base-text-length", aIt->mnBaseLen );
@@ -183,7 +183,7 @@ void RecordObjectBase::writePhoneticPortions( const PhoneticPortionModelList& rP
sal_uInt8 RecordObjectBase::dumpBoolean( const String& rName )
{
sal_uInt8 nBool;
- in() >> nBool;
+ *mxStrm >> nBool;
writeBooleanItem( rName( "boolean" ), nBool );
return nBool;
}
@@ -191,7 +191,7 @@ sal_uInt8 RecordObjectBase::dumpBoolean( const String& rName )
sal_uInt8 RecordObjectBase::dumpErrorCode( const String& rName )
{
sal_uInt8 nErrCode;
- in() >> nErrCode;
+ *mxStrm >> nErrCode;
writeErrorCodeItem( rName( "error-code" ), nErrCode );
return nErrCode;
}
@@ -200,25 +200,25 @@ OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32
{
sal_uInt8 nFlags = bRich ? dumpHex< sal_uInt8 >( "flags", "STRING-FLAGS" ) : 0;
- OUString aString = mxStrm->readString( b32BitLen );
+ OUString aString = mxBiffStrm->readString( b32BitLen );
writeStringItem( rName( "text" ), aString );
// --- formatting ---
if( getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
{
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
FontPortionModelList aPortions;
- aPortions.importPortions( *mxStrm );
+ aPortions.importPortions( *mxBiffStrm );
writeFontPortions( aPortions );
}
// --- phonetic text ---
if( getFlag( nFlags, OOBIN_STRINGFLAG_PHONETICS ) )
{
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpString( "phonetic-text" );
PhoneticPortionModelList aPortions;
- aPortions.importPortions( *mxStrm );
+ aPortions.importPortions( *mxBiffStrm );
writePhoneticPortions( aPortions );
dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
dumpHex< sal_uInt16 >( "flags", "PHONETIC-FLAGS" );
@@ -229,7 +229,7 @@ OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32
void RecordObjectBase::dumpColor( const String& rName )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( rName( "color" ) );
switch( extractValue< sal_uInt8 >( dumpDec< sal_uInt8 >( "flags", "COLOR-FLAGS" ), 1, 7 ) )
{
@@ -246,12 +246,12 @@ void RecordObjectBase::dumpColor( const String& rName )
DateTime RecordObjectBase::dumpPivotDateTime( const String& rName )
{
DateTime aDateTime;
- aDateTime.Year = in().readuInt16();
- aDateTime.Month = in().readuInt16();
- aDateTime.Day = in().readuInt8();
- aDateTime.Hours = in().readuInt8();
- aDateTime.Minutes = in().readuInt8();
- aDateTime.Seconds = in().readuInt8();
+ aDateTime.Year = mxStrm->readuInt16();
+ aDateTime.Month = mxStrm->readuInt16();
+ aDateTime.Day = mxStrm->readuInt8();
+ aDateTime.Hours = mxStrm->readuInt8();
+ aDateTime.Minutes = mxStrm->readuInt8();
+ aDateTime.Seconds = mxStrm->readuInt8();
writeDateTimeItem( rName, aDateTime );
return aDateTime;
}
@@ -259,7 +259,7 @@ DateTime RecordObjectBase::dumpPivotDateTime( const String& rName )
sal_Int32 RecordObjectBase::dumpColIndex( const String& rName )
{
sal_Int32 nCol;
- in() >> nCol;
+ *mxStrm >> nCol;
writeColIndexItem( rName( "col-idx" ), nCol );
return nCol;
}
@@ -267,7 +267,7 @@ sal_Int32 RecordObjectBase::dumpColIndex( const String& rName )
sal_Int32 RecordObjectBase::dumpRowIndex( const String& rName )
{
sal_Int32 nRow;
- in() >> nRow;
+ *mxStrm >> nRow;
writeRowIndexItem( rName( "row-idx" ), nRow );
return nRow;
}
@@ -275,7 +275,7 @@ sal_Int32 RecordObjectBase::dumpRowIndex( const String& rName )
sal_Int32 RecordObjectBase::dumpColRange( const String& rName )
{
sal_Int32 nCol1, nCol2;
- in() >> nCol1 >> nCol2;
+ *mxStrm >> nCol1 >> nCol2;
writeColRangeItem( rName( "col-range" ), nCol1, nCol2 );
return nCol2 - nCol1 + 1;
}
@@ -283,7 +283,7 @@ sal_Int32 RecordObjectBase::dumpColRange( const String& rName )
sal_Int32 RecordObjectBase::dumpRowRange( const String& rName )
{
sal_Int32 nRow1, nRow2;
- in() >> nRow1 >> nRow2;
+ *mxStrm >> nRow1 >> nRow2;
writeRowRangeItem( rName( "row-range" ), nRow1, nRow2 );
return nRow2 - nRow1 + 1;
}
@@ -363,26 +363,25 @@ void FormulaObject::dumpNameFormula( const String& rName )
void FormulaObject::implDump()
{
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( maName );
writeDecItem( "formula-size", mnSize );
}
if( mnSize < 0 ) return;
- BinaryInputStream& rStrm = in();
- sal_Int64 nStartPos = rStrm.tell();
- sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, rStrm.getLength() );
+ sal_Int64 nStartPos = mxStrm->tell();
+ sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->getLength() );
bool bValid = mxTokens.get();
mxStack.reset( new FormulaStack );
maAddData.clear();
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
{
- TableGuard aTabGuard( out(), 8, 18 );
- while( bValid && (rStrm.tell() < nEndPos) )
+ TableGuard aTabGuard( mxOut, 8, 18 );
+ while( bValid && (mxStrm->tell() < nEndPos) )
{
- MultiItemsGuard aMultiGuard( out() );
- writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( rStrm.tell() - nStartPos ) );
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( mxStrm->tell() - nStartPos ) );
sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
bValid = mxTokens->hasName( nTokenId );
if( bValid )
@@ -457,7 +456,7 @@ void FormulaObject::implDump()
}
}
- if( nEndPos == rStrm.tell() )
+ if( nEndPos == mxStrm->tell() )
{
dumpAddTokenData();
if( mnSize > 0 )
@@ -468,7 +467,7 @@ void FormulaObject::implDump()
}
else
{
- dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32 >( nEndPos - rStrm.tell() ), false );
+ dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32 >( nEndPos - mxStrm->tell() ), false );
sal_Int32 nAddDataSize = dumpDec< sal_Int32 >( "add-data-size" );
dumpBinary( "add-data", nAddDataSize, false );
}
@@ -479,7 +478,7 @@ void FormulaObject::implDump()
void FormulaObject::dumpFormula( const String& rName, bool bNameMode )
{
maName = rName( "formula" );
- in() >> mnSize;
+ *mxStrm >> mnSize;
mbNameMode = bNameMode;
dump();
}
@@ -565,7 +564,7 @@ OUString FormulaObject::createPlaceHolder() const
OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
{
- ItemGuard aItemGuard( out(), "func-id" );
+ ItemGuard aItem( mxOut, "func-id" );
writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
OUStringBuffer aBuffer;
const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromOobFuncId( nFuncId );
@@ -578,10 +577,10 @@ OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo*
StringHelper::appendIndex( aBuffer, nFuncId & BIFF_TOK_FUNCVAR_FUNCIDMASK );
}
OUString aFuncName = aBuffer.makeStringAndClear();
- aItemGuard.cont();
- out().writeChar( OOX_DUMP_STRQUOTE );
- out().writeString( aFuncName );
- out().writeChar( OOX_DUMP_STRQUOTE );
+ aItem.cont();
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+ mxOut->writeString( aFuncName );
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
return aFuncName;
}
@@ -641,13 +640,13 @@ OUString FormulaObject::dumpTokenRefId()
void FormulaObject::dumpIntToken()
{
dumpDec< sal_uInt16 >( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpDoubleToken()
{
dumpDec< double >( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpStringToken()
@@ -660,13 +659,13 @@ void FormulaObject::dumpStringToken()
void FormulaObject::dumpBoolToken()
{
dumpBoolean( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpErrorToken()
{
dumpErrorCode( "value" );
- mxStack->pushOperand( out().getLastItemValue() );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
}
void FormulaObject::dumpMissArgToken()
@@ -698,14 +697,14 @@ void FormulaObject::dumpRefToken( const OUString& rTokClass, bool bNameMode )
{
TokenAddress aPos = dumpTokenAddress( bNameMode );
writeTokenAddressItem( "addr", aPos, bNameMode );
- mxStack->pushOperand( createRef( out().getLastItemValue() ), rTokClass );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
}
void FormulaObject::dumpAreaToken( const OUString& rTokClass, bool bNameMode )
{
TokenRange aRange = dumpTokenRange( bNameMode );
writeTokenRangeItem( "range", aRange, bNameMode );
- mxStack->pushOperand( createRef( out().getLastItemValue() ), rTokClass );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
}
void FormulaObject::dumpRefErrToken( const OUString& rTokClass, bool bArea )
@@ -719,7 +718,7 @@ void FormulaObject::dumpRef3dToken( const OUString& rTokClass, bool bNameMode )
OUString aRef = dumpTokenRefId();
TokenAddress aPos = dumpTokenAddress( bNameMode );
writeTokenAddress3dItem( "addr", aRef, aPos, bNameMode );
- mxStack->pushOperand( out().getLastItemValue(), rTokClass );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
}
void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
@@ -727,7 +726,7 @@ void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
OUString aRef = dumpTokenRefId();
TokenRange aRange = dumpTokenRange( bNameMode );
writeTokenRange3dItem( "range", aRef, aRange, bNameMode );
- mxStack->pushOperand( out().getLastItemValue(), rTokClass );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
}
void FormulaObject::dumpRefErr3dToken( const OUString& rTokClass, bool bArea )
@@ -755,7 +754,7 @@ void FormulaObject::dumpExpToken( const String& rName )
Address aPos;
dumpRowIndex( "base-row" );
OUStringBuffer aOp( rName );
- StringHelper::appendIndex( aOp, createPlaceHolder() + out().getLastItemValue() );
+ StringHelper::appendIndex( aOp, createPlaceHolder() + mxOut->getLastItemValue() );
mxStack->pushOperand( aOp.makeStringAndClear() );
maAddData.push_back( ADDDATA_EXP );
}
@@ -773,7 +772,7 @@ void FormulaObject::dumpBinaryOpToken( const String& rOp )
void FormulaObject::dumpFuncToken( const OUString& rTokClass )
{
sal_uInt16 nFuncId;
- in() >> nFuncId;
+ *mxStrm >> nFuncId;
const FunctionInfo* pFuncInfo = 0;
OUString aFuncName = writeFuncIdItem( nFuncId, &pFuncInfo );
if( pFuncInfo && (pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount) )
@@ -786,7 +785,7 @@ void FormulaObject::dumpFuncVarToken( const OUString& rTokClass )
{
sal_uInt8 nParamCount;
sal_uInt16 nFuncId;
- in() >> nParamCount >> nFuncId;
+ *mxStrm >> nParamCount >> nFuncId;
bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
if( bCmd )
writeHexItem( "param-count", nParamCount, "PARAMCOUNT-CMD" );
@@ -803,24 +802,23 @@ void FormulaObject::dumpFuncVarToken( const OUString& rTokClass )
bool FormulaObject::dumpTableToken()
{
- Output& rOut = out();
dumpUnused( 3 );
sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "TABLEFLAGS" );
sal_uInt16 nTabId = dumpDec< sal_uInt16 >( "table-id" );
dumpUnused( 2 );
{
sal_uInt16 nCol1, nCol2;
- in() >> nCol1 >> nCol2;
- ItemGuard aItem( rOut, "cols" );
- rOut.writeDec( nCol1 );
+ *mxStrm >> nCol1 >> nCol2;
+ ItemGuard aItem( mxOut, "cols" );
+ mxOut->writeDec( nCol1 );
if( nCol1 != nCol2 )
{
- rOut.writeChar( OOX_DUMP_RANGESEP );
- rOut.writeDec( nCol2 );
+ mxOut->writeChar( OOX_DUMP_RANGESEP );
+ mxOut->writeDec( nCol2 );
}
}
OUStringBuffer aColRange;
- StringHelper::appendIndex( aColRange, rOut.getLastItemValue() );
+ StringHelper::appendIndex( aColRange, mxOut->getLastItemValue() );
OUStringBuffer aParams;
size_t nParams = 0;
if( getFlag( nFlags, OOBIN_TOK_TABLE_ALL ) && ++nParams )
@@ -860,7 +858,7 @@ bool FormulaObject::dumpAttrToken()
case OOBIN_TOK_ATTR_CHOOSE:
{
sal_uInt16 nCount = dumpDec< sal_uInt16 >( "choices" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
dumpDec< sal_uInt16 >( "#skip" );
dumpDec< sal_uInt16 >( "skip-err" );
@@ -892,27 +890,25 @@ bool FormulaObject::dumpAttrToken()
void FormulaObject::dumpAddTokenData()
{
- Output& rOut = out();
- rOut.resetItemIndex();
- BinaryInputStream& rStrm = in();
- sal_Int32 nAddDataSize = (in().getLength() - in().tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0;
- sal_Int64 nEndPos = ::std::min< sal_Int64 >( rStrm.tell() + nAddDataSize, rStrm.getLength() );
- for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); (aIt != aEnd) && !rStrm.isEof() && (rStrm.tell() < nEndPos); ++aIt )
+ mxOut->resetItemIndex();
+ sal_Int32 nAddDataSize = (mxStrm->getLength() - mxStrm->tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0;
+ sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nAddDataSize, mxStrm->getLength() );
+ for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); (aIt != aEnd) && !mxStrm->isEof() && (mxStrm->tell() < nEndPos); ++aIt )
{
AddDataType eType = *aIt;
{
- ItemGuard aItem( rOut, "#add-data" );
+ ItemGuard aItem( mxOut, "#add-data" );
switch( eType )
{
- case ADDDATA_EXP: rOut.writeAscii( "tExp" ); break;
- case ADDDATA_ARRAY: rOut.writeAscii( "tArray" ); break;
- case ADDDATA_MEMAREA: rOut.writeAscii( "tMemArea" ); break;
+ case ADDDATA_EXP: mxOut->writeAscii( "tExp" ); break;
+ case ADDDATA_ARRAY: mxOut->writeAscii( "tArray" ); break;
+ case ADDDATA_MEMAREA: mxOut->writeAscii( "tMemArea" ); break;
}
}
size_t nIdx = aIt - maAddData.begin();
- IndentGuard aIndGuard( rOut );
+ IndentGuard aIndGuard( mxOut );
switch( eType )
{
case ADDDATA_EXP: dumpAddDataExp( nIdx ); break;
@@ -926,7 +922,7 @@ void FormulaObject::dumpAddTokenData()
void FormulaObject::dumpAddDataExp( size_t nIdx )
{
dumpColIndex( "base-col" );
- mxStack->replaceOnTop( createPlaceHolder( nIdx ), out().getLastItemValue() );
+ mxStack->replaceOnTop( createPlaceHolder( nIdx ), mxOut->getLastItemValue() );
}
void FormulaObject::dumpAddDataArray( size_t nIdx )
@@ -935,7 +931,7 @@ void FormulaObject::dumpAddDataArray( size_t nIdx )
dumpaddDataArrayHeader( nCols, nRows );
OUStringBuffer aOp;
- TableGuard aTabGuard( out(), 17 );
+ TableGuard aTabGuard( mxOut, 17 );
for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
{
OUStringBuffer aArrayLine;
@@ -954,28 +950,26 @@ void FormulaObject::dumpAddDataMemArea( size_t /*nIdx*/ )
void FormulaObject::dumpaddDataArrayHeader( sal_Int32& rnCols, sal_Int32& rnRows )
{
- Output& rOut = out();
- MultiItemsGuard aMultiGuard( rOut );
+ MultiItemsGuard aMultiGuard( mxOut );
rnRows = dumpDec< sal_Int32 >( "height" );
rnCols = dumpDec< sal_Int32 >( "width" );
- ItemGuard aItem( rOut, "size" );
- rOut.writeDec( rnCols );
- rOut.writeChar( 'x' );
- rOut.writeDec( rnRows );
+ ItemGuard aItem( mxOut, "size" );
+ mxOut->writeDec( rnCols );
+ mxOut->writeChar( 'x' );
+ mxOut->writeDec( rnRows );
aItem.cont();
- rOut.writeDec( rnCols * rnRows );
+ mxOut->writeDec( rnCols * rnRows );
}
OUString FormulaObject::dumpaddDataArrayValue()
{
- Output& rOut = out();
- MultiItemsGuard aMultiGuard( rOut );
+ MultiItemsGuard aMultiGuard( mxOut );
OUStringBuffer aValue;
switch( dumpDec< sal_uInt8 >( "type", "ARRAYVALUE-TYPE" ) )
{
case OOBIN_TOK_ARRAY_DOUBLE:
dumpDec< double >( "value" );
- aValue.append( rOut.getLastItemValue() );
+ aValue.append( mxOut->getLastItemValue() );
break;
case OOBIN_TOK_ARRAY_STRING:
aValue.append( dumpString( "value", false, false ) );
@@ -983,11 +977,11 @@ OUString FormulaObject::dumpaddDataArrayValue()
break;
case OOBIN_TOK_ARRAY_BOOL:
dumpBoolean( "value" );
- aValue.append( rOut.getLastItemValue() );
+ aValue.append( mxOut->getLastItemValue() );
break;
case OOBIN_TOK_ARRAY_ERROR:
dumpErrorCode( "value" );
- aValue.append( rOut.getLastItemValue() );
+ aValue.append( mxOut->getLastItemValue() );
dumpUnused( 3 );
break;
}
@@ -1150,11 +1144,11 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_Int32 >( "formula2-size" );
dumpDec< sal_Int32 >( "formula3-size" );
dumpString( "text" );
- if( in().getLength() - in().tell() >= 8 )
+ if( mxStrm->getRemaining() >= 8 )
mxFmlaObj->dumpNameFormula( "formula1" );
- if( in().getLength() - in().tell() >= 8 )
+ if( mxStrm->getRemaining() >= 8 )
mxFmlaObj->dumpNameFormula( "formula2" );
- if( in().getLength() - in().tell() >= 8 )
+ if( mxStrm->getRemaining() >= 8 )
mxFmlaObj->dumpNameFormula( "formula3" );
}
break;
@@ -1272,10 +1266,10 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "name" );
mxFmlaObj->dumpNameFormula();
dumpString( "comment" );
- if( in().getLength() - in().tell() >= 4 ) dumpString( "menu-text" );
- if( in().getLength() - in().tell() >= 4 ) dumpString( "description-text" );
- if( in().getLength() - in().tell() >= 4 ) dumpString( "help-text" );
- if( in().getLength() - in().tell() >= 4 ) dumpString( "statusbar-text" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "menu-text" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "description-text" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "help-text" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "statusbar-text" );
break;
case OOBIN_ID_DIMENSION:
@@ -1288,16 +1282,16 @@ void RecordStreamObject::implDumpRecordBody()
case OOBIN_ID_DXF:
dumpHex< sal_uInt32 >( "flags", "DXF-FLAGS" );
- for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !in().isEof() && (nIndex < nCount); ++nIndex )
+ for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !mxStrm->isEof() && (nIndex < nCount); ++nIndex )
{
- out().startMultiItems();
- sal_Int64 nStartPos = in().tell();
+ mxOut->startMultiItems();
+ sal_Int64 nStartPos = mxStrm->tell();
writeEmptyItem( "SUBREC" );
sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "DXF-SUBREC" );
sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
sal_Int64 nEndPos = nStartPos + nSubRecSize;
- out().endMultiItems();
- IndentGuard aIndGuard( out() );
+ mxOut->endMultiItems();
+ IndentGuard aIndGuard( mxOut );
switch( nSubRecId )
{
case 0:
@@ -1438,11 +1432,11 @@ void RecordStreamObject::implDumpRecordBody()
case OOBIN_ID_EXTERNALSHEETS:
{
sal_Int32 nCount = dumpDec< sal_Int32 >( "ref-count" );
- TableGuard aTabGuard( out(), 13, 17, 24 );
- out().resetItemIndex();
- for( sal_Int32 nRefId = 0; !in().isEof() && (nRefId < nCount); ++nRefId )
+ TableGuard aTabGuard( mxOut, 13, 17, 24 );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nRefId = 0; !mxStrm->isEof() && (nRefId < nCount); ++nRefId )
{
- MultiItemsGuard aMultiGuard( out() );
+ MultiItemsGuard aMultiGuard( mxOut );
writeEmptyItem( "#ref" );
dumpDec< sal_Int32 >( "extref-id" );
dumpDec< sal_Int32 >( "first-sheet", "EXTERNALSHEETS-ID" );
@@ -1461,8 +1455,8 @@ void RecordStreamObject::implDumpRecordBody()
break;
case OOBIN_ID_EXTSHEETNAMES:
- out().resetItemIndex();
- for( sal_Int32 nSheet = 0, nCount = dumpDec< sal_Int32 >( "sheet-count" ); !in().isEof() && (nSheet < nCount); ++nSheet )
+ mxOut->resetItemIndex();
+ for( sal_Int32 nSheet = 0, nCount = dumpDec< sal_Int32 >( "sheet-count" ); !mxStrm->isEof() && (nSheet < nCount); ++nSheet )
dumpString( "#sheet-name" );
break;
@@ -1477,11 +1471,11 @@ void RecordStreamObject::implDumpRecordBody()
dumpColor( "fg-color" );
dumpColor( "bg-color" );
dumpGradientHead();
- out().resetItemIndex();
- for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !in().isEof(); ++nStop )
+ mxOut->resetItemIndex();
+ for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !mxStrm->isEof(); ++nStop )
{
writeEmptyItem( "#stop" );
- IndentGuard aIndGuard( out() );
+ IndentGuard aIndGuard( mxOut );
dumpColor( "stop-color" );
dumpDec< double >( "stop-position" );
}
@@ -1739,7 +1733,7 @@ void RecordStreamObject::implDumpRecordBody()
{
sal_uInt16 nType = dumpDec< sal_uInt16 >( "type", "PCITEM_ARRAY-TYPE" );
sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
- out().resetItemIndex();
+ mxOut->resetItemIndex();
for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
{
switch( nType )
@@ -1839,8 +1833,8 @@ void RecordStreamObject::implDumpRecordBody()
case OOBIN_ID_PTCOLFIELDS:
dumpDec< sal_Int32 >( "count" );
- out().resetItemIndex();
- while( in().getRemaining() >= 4 )
+ mxOut->resetItemIndex();
+ while( mxStrm->getRemaining() >= 4 )
dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
break;
@@ -1948,8 +1942,8 @@ void RecordStreamObject::implDumpRecordBody()
case OOBIN_ID_PTROWFIELDS:
dumpDec< sal_Int32 >( "count" );
- out().resetItemIndex();
- while( in().getRemaining() >= 4 )
+ mxOut->resetItemIndex();
+ while( mxStrm->getRemaining() >= 4 )
dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
break;
@@ -1959,8 +1953,8 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
dumpHex< sal_uInt16 >( "flags", "ROW-FLAGS1" );
dumpHex< sal_uInt8 >( "flags", "ROW-FLAGS2" );
- out().resetItemIndex();
- for( sal_Int32 nSpan = 0, nSpanCount = dumpDec< sal_Int32 >( "row-spans-count" ); !in().isEof() && (nSpan < nSpanCount); ++nSpan )
+ mxOut->resetItemIndex();
+ for( sal_Int32 nSpan = 0, nSpanCount = dumpDec< sal_Int32 >( "row-spans-count" ); !mxStrm->isEof() && (nSpan < nSpanCount); ++nSpan )
dumpRowRange( "#row-spans" );
break;
@@ -2205,12 +2199,12 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons
{
if( rStrgPath.equalsAscii( "xl" ) && rStrmName.equalsAscii( "vbaProject.bin" ) )
{
- StorageRef xStrg( new OleStorage( getFactory(), xInStrm, false ) );
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump();
}
else if( rStrgPath.equalsAscii( "xl/embeddings" ) )
{
- StorageRef xStrg( new OleStorage( getFactory(), xInStrm, false ) );
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
OleStorageObject( *this, xStrg, rSysFileName ).dump();
}
else if(
@@ -2228,7 +2222,8 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons
}
else if( rStrgPath.equalsAscii( "xl/activeX" ) )
{
- OcxGuidControlObject( *this, rxStrm, rSysFileName ).dump();
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, true ) );
+ ActiveXStorageObject( *this, xStrg, rSysFileName ).dump();
}
else
{
diff --git a/oox/source/helper/binaryinputstream.cxx b/oox/source/helper/binaryinputstream.cxx
index 5ba4a8b0b73b..a5a3cf9a2c30 100644
--- a/oox/source/helper/binaryinputstream.cxx
+++ b/oox/source/helper/binaryinputstream.cxx
@@ -30,6 +30,7 @@
#include <vector>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
+#include "oox/helper/binaryoutputstream.hxx"
using ::rtl::OString;
using ::rtl::OStringBuffer;
@@ -102,6 +103,25 @@ OUString BinaryInputStream::readUnicodeArray( sal_Int32 nChars, bool bAllowNulCh
return aBuffer.makeStringAndClear();
}
+void BinaryInputStream::copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes )
+{
+ if( nBytes > 0 )
+ {
+ sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, INPUTSTREAM_BUFFERSIZE );
+ StreamDataSequence aBuffer( nBufferSize );
+ while( nBytes > 0 )
+ {
+ sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, nBufferSize );
+ sal_Int32 nBytesRead = readData( aBuffer, nReadSize );
+ rOutStrm.writeData( aBuffer );
+ if( nReadSize == nBytesRead )
+ nBytes -= nReadSize;
+ else
+ nBytes = 0;
+ }
+ }
+}
+
void BinaryInputStream::readAtom( void* opMem, sal_uInt8 nSize )
{
readMemory( opMem, nSize );
@@ -214,7 +234,7 @@ sal_Int32 SequenceInputStream::readMemory( void* opMem, sal_Int32 nBytes )
sal_Int32 nReadBytes = 0;
if( !mbEof )
{
- nReadBytes = ::std::min< sal_Int32 >( nBytes, mrData.getLength() - mnPos );
+ nReadBytes = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mrData.getLength() - mnPos );
if( nReadBytes > 0 )
memcpy( opMem, mrData.getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) );
mnPos += nReadBytes;
@@ -227,7 +247,7 @@ void SequenceInputStream::skip( sal_Int32 nBytes )
{
if( !mbEof )
{
- sal_Int32 nSkipBytes = ::std::min< sal_Int32 >( nBytes, mrData.getLength() - mnPos );
+ sal_Int32 nSkipBytes = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mrData.getLength() - mnPos );
mnPos += nSkipBytes;
mbEof = nSkipBytes < nBytes;
}
@@ -235,5 +255,79 @@ void SequenceInputStream::skip( sal_Int32 nBytes )
// ============================================================================
+RelativeInputStream::RelativeInputStream( BinaryInputStream& rInStrm, sal_Int64 nLength ) :
+ mrInStrm( rInStrm ),
+ mnStartPos( rInStrm.tell() ),
+ mnRelPos( 0 )
+{
+ sal_Int64 nRemaining = rInStrm.getRemaining();
+ mnLength = (nRemaining >= 0) ? ::std::min( nLength, nRemaining ) : nLength;
+ mbEof = mnLength < 0;
+}
+
+bool RelativeInputStream::isSeekable() const
+{
+ return mrInStrm.isSeekable();
+}
+
+sal_Int64 RelativeInputStream::getLength() const
+{
+ return mnLength;
+}
+
+sal_Int64 RelativeInputStream::tell() const
+{
+ return mnRelPos;
+}
+
+void RelativeInputStream::seek( sal_Int64 nPos )
+{
+ if( mrInStrm.isSeekable() && (mnStartPos >= 0) )
+ {
+ mnRelPos = getLimitedValue< sal_Int64, sal_Int64 >( nPos, 0, mnLength );
+ mrInStrm.seek( mnStartPos + mnRelPos );
+ mbEof = (mnRelPos != nPos) || mrInStrm.isEof();
+ }
+}
+
+sal_Int32 RelativeInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes )
+{
+ sal_Int32 nReadBytes = 0;
+ if( !mbEof )
+ {
+ sal_Int32 nRealBytes = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnLength - mnRelPos );
+ nReadBytes = mrInStrm.readData( orData, nRealBytes );
+ mnRelPos += nReadBytes;
+ mbEof = (nRealBytes < nBytes) || mrInStrm.isEof();
+ }
+ return nReadBytes;
+}
+
+sal_Int32 RelativeInputStream::readMemory( void* opMem, sal_Int32 nBytes )
+{
+ sal_Int32 nReadBytes = 0;
+ if( !mbEof )
+ {
+ sal_Int32 nRealBytes = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnLength - mnRelPos );
+ nReadBytes = mrInStrm.readMemory( opMem, nRealBytes );
+ mnRelPos += nReadBytes;
+ mbEof = (nRealBytes < nBytes) || mrInStrm.isEof();
+ }
+ return nReadBytes;
+}
+
+void RelativeInputStream::skip( sal_Int32 nBytes )
+{
+ if( !mbEof )
+ {
+ sal_Int32 nSkipBytes = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnLength - mnRelPos );
+ mrInStrm.skip( nSkipBytes );
+ mnRelPos += nSkipBytes;
+ mbEof = nSkipBytes < nBytes;
+ }
+}
+
+// ============================================================================
+
} // namespace oox
diff --git a/oox/source/helper/binaryoutputstream.cxx b/oox/source/helper/binaryoutputstream.cxx
index be6bc6d67577..f39ac9d8f1b2 100644
--- a/oox/source/helper/binaryoutputstream.cxx
+++ b/oox/source/helper/binaryoutputstream.cxx
@@ -27,7 +27,6 @@
#include "oox/helper/binaryoutputstream.hxx"
#include <osl/diagnose.h>
-#include "oox/helper/binaryinputstream.hxx"
#include <string.h>
using ::com::sun::star::uno::UNO_QUERY;
@@ -42,25 +41,6 @@ const sal_Int32 OUTPUTSTREAM_BUFFERSIZE = 0x8000;
// ============================================================================
-void BinaryOutputStream::copyStream( BinaryInputStream& rInStrm, sal_Int64 nBytes )
-{
- if( nBytes > 0 )
- {
- sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, OUTPUTSTREAM_BUFFERSIZE );
- StreamDataSequence aBuffer( nBufferSize );
- while( nBytes > 0 )
- {
- sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, nBufferSize );
- sal_Int32 nBytesRead = rInStrm.readData( aBuffer, nReadSize );
- writeData( aBuffer );
- if( nReadSize == nBytesRead )
- nBytes -= nReadSize;
- else
- nBytes = 0;
- }
- }
-}
-
void BinaryOutputStream::writeAtom( const void* pMem, sal_uInt8 nSize )
{
writeMemory( pMem, nSize );
diff --git a/oox/source/helper/binarystreambase.cxx b/oox/source/helper/binarystreambase.cxx
index be6b17d3aab9..a8f9320ffc94 100644
--- a/oox/source/helper/binarystreambase.cxx
+++ b/oox/source/helper/binarystreambase.cxx
@@ -61,7 +61,24 @@ void BinaryStreamBase::seek( sal_Int64 )
sal_Int64 BinaryStreamBase::getRemaining() const
{
- return isSeekable() ? ::std::max< sal_Int64 >( getLength() - tell(), 0 ) : -1;
+ // do not use isSeekable(), implementations may provide stream position and size even if not seekable
+ sal_Int64 nPos = tell();
+ sal_Int64 nLen = getLength();
+ return ((nPos >= 0) && (nLen >= 0)) ? ::std::max< sal_Int64 >( nLen - nPos, 0 ) : -1;
+}
+
+void BinaryStreamBase::alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos )
+{
+ sal_Int64 nStrmPos = tell();
+ // nothing to do, if stream is at anchor position
+ if( isSeekable() && (0 <= nAnchorPos) && (nAnchorPos != nStrmPos) && (nBlockSize > 1) )
+ {
+ // prevent modulo with negative arguments...
+ sal_Int64 nSkipSize = (nAnchorPos < nStrmPos) ?
+ (nBlockSize - ((nStrmPos - nAnchorPos - 1) % nBlockSize) - 1) :
+ ((nAnchorPos - nStrmPos) % nBlockSize);
+ seek( nStrmPos + nSkipSize );
+ }
}
// ============================================================================
@@ -135,7 +152,7 @@ sal_Int64 SequenceSeekableStream::tell() const
void SequenceSeekableStream::seek( sal_Int64 nPos )
{
mnPos = getLimitedValue< sal_Int32, sal_Int64 >( nPos, 0, mrData.getLength() );
- mbEof = mnPos < nPos;
+ mbEof = mnPos != nPos;
}
// ============================================================================
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 3e54cd16c2bc..6b294f61abef 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -26,42 +26,248 @@
************************************************************************/
#include "oox/helper/graphichelper.hxx"
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XUnitConversion.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/graphic/GraphicObject.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
#include <comphelper/componentcontext.hxx>
#include <comphelper/seqstream.hxx>
+#include "tokens.hxx"
+#include "oox/helper/containerhelper.hxx"
using ::rtl::OUString;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::awt::DeviceInfo;
+using ::com::sun::star::awt::Point;
+using ::com::sun::star::awt::Size;
+using ::com::sun::star::awt::XDevice;
+using ::com::sun::star::awt::XUnitConversion;
using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::frame::XFrame;
+using ::com::sun::star::frame::XFramesSupplier;
using ::com::sun::star::graphic::GraphicObject;
using ::com::sun::star::graphic::XGraphic;
using ::com::sun::star::graphic::XGraphicObject;
using ::com::sun::star::graphic::XGraphicProvider;
+using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
namespace oox {
// ============================================================================
-GraphicHelper::GraphicHelper( const Reference< XMultiServiceFactory >& rxFactory ) :
- mxGraphicProvider( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY ),
+namespace {
+
+inline sal_Int32 lclConvertScreenPixelToHmm( double fPixel, double fPixelPerHmm )
+{
+ return static_cast< sal_Int32 >( (fPixelPerHmm > 0.0) ? (fPixel / fPixelPerHmm + 0.5) : 0.0 );
+}
+
+} // namespace
+
+// ============================================================================
+
+GraphicHelper::GraphicHelper( const Reference< XMultiServiceFactory >& rxGlobalFactory, const Reference< XFrame >& rxTargetFrame ) :
+ mxGraphicProvider( rxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY ),
maGraphicObjScheme( CREATE_OUSTRING( "vnd.sun.star.GraphicObject:" ) )
{
- ::comphelper::ComponentContext aContext( rxFactory );
+ ::comphelper::ComponentContext aContext( rxGlobalFactory );
mxCompContext = aContext.getUNOContext();
+
+ //! TODO: get colors from system
+ maSystemPalette[ XML_3dDkShadow ] = 0x716F64;
+ maSystemPalette[ XML_3dLight ] = 0xF1EFE2;
+ maSystemPalette[ XML_activeBorder ] = 0xD4D0C8;
+ maSystemPalette[ XML_activeCaption ] = 0x0054E3;
+ maSystemPalette[ XML_appWorkspace ] = 0x808080;
+ maSystemPalette[ XML_background ] = 0x004E98;
+ maSystemPalette[ XML_btnFace ] = 0xECE9D8;
+ maSystemPalette[ XML_btnHighlight ] = 0xFFFFFF;
+ maSystemPalette[ XML_btnShadow ] = 0xACA899;
+ maSystemPalette[ XML_btnText ] = 0x000000;
+ maSystemPalette[ XML_captionText ] = 0xFFFFFF;
+ maSystemPalette[ XML_gradientActiveCaption ] = 0x3D95FF;
+ maSystemPalette[ XML_gradientInactiveCaption ] = 0xD8E4F8;
+ maSystemPalette[ XML_grayText ] = 0xACA899;
+ maSystemPalette[ XML_highlight ] = 0x316AC5;
+ maSystemPalette[ XML_highlightText ] = 0xFFFFFF;
+ maSystemPalette[ XML_hotLight ] = 0x000080;
+ maSystemPalette[ XML_inactiveBorder ] = 0xD4D0C8;
+ maSystemPalette[ XML_inactiveCaption ] = 0x7A96DF;
+ maSystemPalette[ XML_inactiveCaptionText ] = 0xD8E4F8;
+ maSystemPalette[ XML_infoBk ] = 0xFFFFE1;
+ maSystemPalette[ XML_infoText ] = 0x000000;
+ maSystemPalette[ XML_menu ] = 0xFFFFFF;
+ maSystemPalette[ XML_menuBar ] = 0xECE9D8;
+ maSystemPalette[ XML_menuHighlight ] = 0x316AC5;
+ maSystemPalette[ XML_menuText ] = 0x000000;
+ maSystemPalette[ XML_scrollBar ] = 0xD4D0C8;
+ maSystemPalette[ XML_window ] = 0xFFFFFF;
+ maSystemPalette[ XML_windowFrame ] = 0x000000;
+ maSystemPalette[ XML_windowText ] = 0x000000;
+
+ // if no target frame has been passed (e.g. OLE objects), try to fallback to the active frame
+ // TODO: we need some mechanism to keep and pass the parent frame
+ Reference< XFrame > xFrame = rxTargetFrame;
+ if( !xFrame.is() && rxGlobalFactory.is() ) try
+ {
+ Reference< XFramesSupplier > xFramesSupp( rxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW );
+ xFrame = xFramesSupp->getActiveFrame();
+ }
+ catch( Exception& )
+ {
+ }
+
+ // get the metric of the output device
+ OSL_ENSURE( xFrame.is(), "GraphicHelper::GraphicHelper - cannot get target frame" );
+ maDeviceInfo.PixelPerMeterX = maDeviceInfo.PixelPerMeterY = 3500.0; // some default just in case
+ if( xFrame.is() ) try
+ {
+ Reference< XDevice > xDevice( xFrame->getContainerWindow(), UNO_QUERY_THROW );
+ mxUnitConversion.set( xDevice, UNO_QUERY );
+ OSL_ENSURE( mxUnitConversion.is(), "GraphicHelper::GraphicHelper - cannot get unit converter" );
+ maDeviceInfo = xDevice->getInfo();
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "GraphicHelper::GraphicHelper - cannot get output device info" );
+ }
+ mfPixelPerHmmX = maDeviceInfo.PixelPerMeterX / 100000.0;
+ mfPixelPerHmmY = maDeviceInfo.PixelPerMeterY / 100000.0;
}
GraphicHelper::~GraphicHelper()
{
}
-Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStream >& rxInStrm )
+sal_Int32 GraphicHelper::getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb ) const
+{
+ return ContainerHelper::getMapElement( maSystemPalette, nToken, nDefaultRgb );
+}
+
+sal_Int32 GraphicHelper::getSchemeColor( sal_Int32 /*nToken*/ ) const
+{
+ OSL_ENSURE( false, "GraphicHelper::getSchemeColor - scheme colors not implemented" );
+ return API_RGB_TRANSPARENT;
+}
+
+sal_Int32 GraphicHelper::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const
+{
+ OSL_ENSURE( false, "GraphicHelper::getPaletteColor - palette colors not implemented" );
+ return API_RGB_TRANSPARENT;
+}
+
+const DeviceInfo& GraphicHelper::getDeviceInfo() const
+{
+ return maDeviceInfo;
+}
+
+sal_Int32 GraphicHelper::convertScreenPixelXToHmm( double fPixelX ) const
+{
+ return lclConvertScreenPixelToHmm( fPixelX, mfPixelPerHmmX );
+}
+
+sal_Int32 GraphicHelper::convertScreenPixelYToHmm( double fPixelY ) const
+{
+ return lclConvertScreenPixelToHmm( fPixelY, mfPixelPerHmmY );
+}
+
+Point GraphicHelper::convertScreenPixelToHmm( const Point& rPixel ) const
+{
+ return Point( convertScreenPixelXToHmm( rPixel.X ), convertScreenPixelYToHmm( rPixel.Y ) );
+}
+
+Size GraphicHelper::convertScreenPixelToHmm( const Size& rPixel ) const
+{
+ return Size( convertScreenPixelXToHmm( rPixel.Width ), convertScreenPixelYToHmm( rPixel.Height ) );
+}
+
+double GraphicHelper::convertHmmToScreenPixelX( sal_Int32 nHmmX ) const
+{
+ return nHmmX * mfPixelPerHmmX;
+}
+
+double GraphicHelper::convertHmmToScreenPixelY( sal_Int32 nHmmY ) const
+{
+ return nHmmY * mfPixelPerHmmY;
+}
+
+Point GraphicHelper::convertHmmToScreenPixel( const Point& rHmm ) const
+{
+ return Point(
+ static_cast< sal_Int32 >( convertHmmToScreenPixelX( rHmm.X ) + 0.5 ),
+ static_cast< sal_Int32 >( convertHmmToScreenPixelY( rHmm.Y ) + 0.5 ) );
+}
+
+Size GraphicHelper::convertHmmToScreenPixel( const Size& rHmm ) const
+{
+ return Size(
+ static_cast< sal_Int32 >( convertHmmToScreenPixelX( rHmm.Width ) + 0.5 ),
+ static_cast< sal_Int32 >( convertHmmToScreenPixelY( rHmm.Height ) + 0.5 ) );
+}
+
+Point GraphicHelper::convertAppFontToHmm( const Point& rAppFont ) const
+{
+ if( mxUnitConversion.is() ) try
+ {
+ Point aPixel = mxUnitConversion->convertPointToPixel( rAppFont, ::com::sun::star::util::MeasureUnit::APPFONT );
+ return convertScreenPixelToHmm( aPixel );
+ }
+ catch( Exception& )
+ {
+ }
+ return Point( 0, 0 );
+}
+
+Size GraphicHelper::convertAppFontToHmm( const Size& rAppFont ) const
+{
+ if( mxUnitConversion.is() ) try
+ {
+ Size aPixel = mxUnitConversion->convertSizeToPixel( rAppFont, ::com::sun::star::util::MeasureUnit::APPFONT );
+ return convertScreenPixelToHmm( aPixel );
+ }
+ catch( Exception& )
+ {
+ }
+ return Size( 0, 0 );
+}
+
+Point GraphicHelper::convertHmmToAppFont( const Point& rHmm ) const
+{
+ if( mxUnitConversion.is() ) try
+ {
+ Point aPixel = convertHmmToScreenPixel( rHmm );
+ return mxUnitConversion->convertPointToLogic( aPixel, ::com::sun::star::util::MeasureUnit::APPFONT );
+ }
+ catch( Exception& )
+ {
+ }
+ return Point( 0, 0 );
+}
+
+Size GraphicHelper::convertHmmToAppFont( const Size& rHmm ) const
+{
+ if( mxUnitConversion.is() ) try
+ {
+ Size aPixel = convertHmmToScreenPixel( rHmm );
+ return mxUnitConversion->convertSizeToLogic( aPixel, ::com::sun::star::util::MeasureUnit::APPFONT );
+ }
+ catch( Exception& )
+ {
+ }
+ return Size( 0, 0 );
+}
+
+Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStream >& rxInStrm ) const
{
Reference< XGraphic > xGraphic;
if( rxInStrm.is() && mxGraphicProvider.is() ) try
@@ -77,7 +283,7 @@ Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStrea
return xGraphic;
}
-Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rGraphicData )
+Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rGraphicData ) const
{
Reference< XGraphic > xGraphic;
if( rGraphicData.hasElements() )
@@ -88,7 +294,7 @@ Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rG
return xGraphic;
}
-OUString GraphicHelper::createGraphicObject( const Reference< XGraphic >& rxGraphic )
+OUString GraphicHelper::createGraphicObject( const Reference< XGraphic >& rxGraphic ) const
{
OUString aGraphicObjUrl;
if( mxCompContext.is() && rxGraphic.is() ) try
@@ -104,12 +310,12 @@ OUString GraphicHelper::createGraphicObject( const Reference< XGraphic >& rxGrap
return aGraphicObjUrl;
}
-OUString GraphicHelper::importGraphicObject( const Reference< XInputStream >& rxInStrm )
+OUString GraphicHelper::importGraphicObject( const Reference< XInputStream >& rxInStrm ) const
{
return createGraphicObject( importGraphic( rxInStrm ) );
}
-OUString GraphicHelper::importGraphicObject( const StreamDataSequence& rGraphicData )
+OUString GraphicHelper::importGraphicObject( const StreamDataSequence& rGraphicData ) const
{
return createGraphicObject( importGraphic( rGraphicData ) );
}
diff --git a/oox/source/helper/makefile.mk b/oox/source/helper/makefile.mk
index 4a91a7a47764..3518db0c6d7c 100644
--- a/oox/source/helper/makefile.mk
+++ b/oox/source/helper/makefile.mk
@@ -48,12 +48,12 @@ SLOFILES = \
$(SLO)$/containerhelper.obj \
$(SLO)$/graphichelper.obj \
$(SLO)$/modelobjecthelper.obj \
- $(SLO)$/olestorage.obj \
$(SLO)$/progressbar.obj \
$(SLO)$/propertymap.obj \
$(SLO)$/propertyset.obj \
$(SLO)$/recordinputstream.obj \
$(SLO)$/storagebase.obj \
+ $(SLO)$/textinputstream.obj \
$(SLO)$/zipstorage.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx
index d1996991090a..6528fea5634d 100644
--- a/oox/source/helper/modelobjecthelper.cxx
+++ b/oox/source/helper/modelobjecthelper.cxx
@@ -44,11 +44,11 @@ namespace oox {
// ============================================================================
-ModelObjectHelper::ModelObjectHelper( const Reference< XMultiServiceFactory >& rxFactory ) :
- maMarkerContainer( rxFactory, CREATE_OUSTRING( "com.sun.star.drawing.MarkerTable" ) ),
- maDashContainer( rxFactory, CREATE_OUSTRING( "com.sun.star.drawing.DashTable" ) ),
- maGradientContainer( rxFactory, CREATE_OUSTRING( "com.sun.star.drawing.GradientTable" ) ),
- maBitmapContainer( rxFactory, CREATE_OUSTRING( "com.sun.star.drawing.BitmapTable" ) ),
+ModelObjectHelper::ModelObjectHelper( const Reference< XMultiServiceFactory >& rxModelFactory ) :
+ maMarkerContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.MarkerTable" ) ),
+ maDashContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.DashTable" ) ),
+ maGradientContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.GradientTable" ) ),
+ maBitmapContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.BitmapTable" ) ),
maDashNameBase( CREATE_OUSTRING( "msLineDash " ) ),
maGradientNameBase( CREATE_OUSTRING( "msFillGradient " ) ),
maBitmapNameBase( CREATE_OUSTRING( "msFillBitmap " ) )
diff --git a/oox/source/helper/olestorage.cxx b/oox/source/helper/olestorage.cxx
deleted file mode 100644
index fe660b27ff2b..000000000000
--- a/oox/source/helper/olestorage.cxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/helper/olestorage.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include "oox/helper/helper.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::embed::XStorage;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XStream;
-
-namespace oox {
-
-// ============================================================================
-
-OleStorage::OleStorage(
- const Reference< XMultiServiceFactory >& rxFactory,
- const Reference< XInputStream >& rxInStream,
- bool bBaseStreamAccess ) :
- StorageBase( rxInStream, bBaseStreamAccess )
-{
- OSL_ENSURE( rxFactory.is(), "OleStorage::OleStorage - missing service factory" );
- // create base storage object
- Sequence< Any > aArgs( 2 );
- aArgs[ 0 ] <<= rxInStream;
- aArgs[ 1 ] <<= true; // true = do not create a copy of the input stream
- mxStorage.set( rxFactory->createInstanceWithArguments(
- CREATE_OUSTRING( "com.sun.star.embed.OLESimpleStorage" ), aArgs ), UNO_QUERY );
- mxElements.set( mxStorage, UNO_QUERY );
-}
-
-OleStorage::OleStorage(
- const Reference< XMultiServiceFactory >& rxFactory,
- const Reference< XStream >& rxStream,
- bool bBaseStreamAccess ) :
- StorageBase( rxStream, bBaseStreamAccess )
-{
- OSL_ENSURE( rxFactory.is(), "OleStorage::OleStorage - missing service factory" );
- (void)rxFactory; // prevent compiler warning
- OSL_ENSURE( false, "OleStorage::OleStorage - not implemented" );
- mxElements.set( mxStorage, UNO_QUERY );
-}
-
-OleStorage::OleStorage( const OleStorage& rParentStorage, const Reference< XNameAccess >& rxElementsAccess, const OUString& rElementName ) :
- StorageBase( rParentStorage, rElementName ),
- mxStorage( rParentStorage.mxStorage ),
- mxElements( rxElementsAccess )
-{
- OSL_ENSURE( mxElements.is(), "OleStorage::OleStorage - missing elements access" );
-}
-
-OleStorage::~OleStorage()
-{
-}
-
-// StorageBase interface ------------------------------------------------------
-
-bool OleStorage::implIsStorage() const
-{
- if( mxStorage.is() && mxElements.is() ) try
- {
- /* If this is not a storage, hasElements() throws an exception. But we
- do not return the result of hasElements(), because an empty storage
- is a valid storage too. */
- mxElements->hasElements();
- return true;
- }
- catch( Exception& )
- {
- }
- return false;
-}
-
-Reference< XStorage > OleStorage::implGetXStorage() const
-{
- OSL_ENSURE( false, "OleStorage::getXStorage - not implemented" );
- return Reference< XStorage >();
-}
-
-void OleStorage::implGetElementNames( ::std::vector< OUString >& orElementNames ) const
-{
- Sequence< OUString > aNames;
- if( mxElements.is() ) try
- {
- aNames = mxElements->getElementNames();
- if( aNames.getLength() > 0 )
- orElementNames.insert( orElementNames.end(), aNames.getConstArray(), aNames.getConstArray() + aNames.getLength() );
- }
- catch( Exception& )
- {
- }
-}
-
-StorageRef OleStorage::implOpenSubStorage( const OUString& rElementName, bool bCreate )
-{
- OSL_ENSURE( !bCreate, "OleStorage::implOpenSubStorage - creating substorages not implemented" );
- (void)bCreate; // prevent compiler warning
- StorageRef xSubStorage;
- if( mxElements.is() ) try
- {
- Reference< XNameAccess > xSubElements( mxElements->getByName( rElementName ), UNO_QUERY_THROW );
- xSubStorage.reset( new OleStorage( *this, xSubElements, rElementName ) );
- }
- catch( Exception& )
- {
- }
- return xSubStorage;
-}
-
-Reference< XInputStream > OleStorage::implOpenInputStream( const OUString& rElementName )
-{
- Reference< XInputStream > xInStream;
- if( mxElements.is() ) try
- {
- xInStream.set( mxElements->getByName( rElementName ), UNO_QUERY );
- }
- catch( Exception& )
- {
- }
- return xInStream;
-}
-
-Reference< XOutputStream > OleStorage::implOpenOutputStream( const OUString& rElementName )
-{
- Reference< XOutputStream > xOutStream;
- if( mxElements.is() && (rElementName.getLength() > 0) ) try
- {
- (void)rElementName; // prevent compiler warning
- OSL_ENSURE( false, "OleStorage::implOpenOutputStream - not implemented" );
- }
- catch( Exception& )
- {
- }
- return xOutStream;
-}
-
-// ============================================================================
-
-} // namespace oox
-
diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx
index 5477224b9461..c52872e50f2f 100644
--- a/oox/source/helper/propertyset.cxx
+++ b/oox/source/helper/propertyset.cxx
@@ -57,6 +57,12 @@ bool PropertySet::getAnyProperty( Any& orValue, sal_Int32 nPropId ) const
return getAnyProperty( orValue, PropertyMap::getPropertyName( nPropId ) );
}
+Any PropertySet::getAnyProperty( sal_Int32 nPropId ) const
+{
+ Any aValue;
+ return getAnyProperty( aValue, nPropId ) ? aValue : Any();
+}
+
bool PropertySet::getBoolProperty( sal_Int32 nPropId ) const
{
Any aAny;
@@ -66,18 +72,17 @@ bool PropertySet::getBoolProperty( sal_Int32 nPropId ) const
void PropertySet::getProperties( Sequence< Any >& orValues, const Sequence< OUString >& rPropNames ) const
{
- if( mxMultiPropSet.is() ) // first try the XMultiPropertySet
+ if( mxMultiPropSet.is() ) try
{
- try
- {
- orValues = mxMultiPropSet->getPropertyValues( rPropNames );
- }
- catch( Exception& )
- {
- OSL_ENSURE( false, "PropertySet::getProperties - cannot get all property values" );
- }
+ orValues = mxMultiPropSet->getPropertyValues( rPropNames );
+ return;
}
- else if( mxPropSet.is() )
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "PropertySet::getProperties - cannot get all property values - fallback to single mode" );
+ }
+
+ if( mxPropSet.is() )
{
sal_Int32 nLen = rPropNames.getLength();
const OUString* pPropName = rPropNames.getConstArray();
@@ -101,18 +106,17 @@ void PropertySet::setProperties( const Sequence< OUString >& rPropNames, const S
OSL_ENSURE( rPropNames.getLength() == rValues.getLength(),
"PropertySet::setProperties - length of sequences different" );
- if( mxMultiPropSet.is() ) // first try the XMultiPropertySet
+ if( mxMultiPropSet.is() ) try
{
- try
- {
- mxMultiPropSet->setPropertyValues( rPropNames, rValues );
- }
- catch( Exception& )
- {
- OSL_ENSURE( false, "PropertySet::setProperties - cannot set all property values" );
- }
+ mxMultiPropSet->setPropertyValues( rPropNames, rValues );
+ return;
}
- else if( mxPropSet.is() )
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "PropertySet::setProperties - cannot set all property values, fallback to single mode" );
+ }
+
+ if( mxPropSet.is() )
{
const OUString* pPropName = rPropNames.getConstArray();
const OUString* pPropNameEnd = pPropName + rPropNames.getLength();
diff --git a/oox/source/helper/storagebase.cxx b/oox/source/helper/storagebase.cxx
index 6f174a74593c..4a05f66db81b 100644
--- a/oox/source/helper/storagebase.cxx
+++ b/oox/source/helper/storagebase.cxx
@@ -29,11 +29,14 @@
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <rtl/ustrbuf.hxx>
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/binaryoutputstream.hxx"
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::embed::XTransactedObject;
using ::com::sun::star::io::XInputStream;
@@ -66,24 +69,25 @@ void lclSplitFirstElement( OUString& orElement, OUString& orRemainder, const OUS
StorageBase::StorageBase( const Reference< XInputStream >& rxInStream, bool bBaseStreamAccess ) :
mxInStream( rxInStream ),
- mpParentStorage( 0 ),
- mbBaseStreamAccess( bBaseStreamAccess )
+ mbBaseStreamAccess( bBaseStreamAccess ),
+ mbReadOnly( true )
{
OSL_ENSURE( mxInStream.is(), "StorageBase::StorageBase - missing base input stream" );
}
StorageBase::StorageBase( const Reference< XStream >& rxOutStream, bool bBaseStreamAccess ) :
mxOutStream( rxOutStream ),
- mpParentStorage( 0 ),
- mbBaseStreamAccess( bBaseStreamAccess )
+ mbBaseStreamAccess( bBaseStreamAccess ),
+ mbReadOnly( false )
{
OSL_ENSURE( mxOutStream.is(), "StorageBase::StorageBase - missing base output stream" );
}
-StorageBase::StorageBase( const StorageBase& rParentStorage, const OUString& rStorageName ) :
+StorageBase::StorageBase( const StorageBase& rParentStorage, const OUString& rStorageName, bool bReadOnly ) :
+ maParentPath( rParentStorage.getPath() ),
maStorageName( rStorageName ),
- mpParentStorage( &rParentStorage ),
- mbBaseStreamAccess( false )
+ mbBaseStreamAccess( false ),
+ mbReadOnly( bReadOnly )
{
}
@@ -96,6 +100,16 @@ bool StorageBase::isStorage() const
return implIsStorage();
}
+bool StorageBase::isRootStorage() const
+{
+ return implIsStorage() && (maStorageName.getLength() == 0);
+}
+
+bool StorageBase::isReadOnly() const
+{
+ return mbReadOnly;
+}
+
Reference< XStorage > StorageBase::getXStorage() const
{
return implGetXStorage();
@@ -108,9 +122,7 @@ const OUString& StorageBase::getName() const
OUString StorageBase::getPath() const
{
- OUStringBuffer aBuffer;
- if( mpParentStorage )
- aBuffer.append( mpParentStorage->getPath() );
+ OUStringBuffer aBuffer( maParentPath );
if( aBuffer.getLength() > 0 )
aBuffer.append( sal_Unicode( '/' ) );
aBuffer.append( maStorageName );
@@ -123,15 +135,19 @@ void StorageBase::getElementNames( ::std::vector< OUString >& orElementNames ) c
implGetElementNames( orElementNames );
}
-StorageRef StorageBase::openSubStorage( const OUString& rStorageName, bool bCreate )
+StorageRef StorageBase::openSubStorage( const OUString& rStorageName, bool bCreateMissing )
{
StorageRef xSubStorage;
- OUString aElement, aRemainder;
- lclSplitFirstElement( aElement, aRemainder, rStorageName );
- if( aElement.getLength() > 0 )
- xSubStorage = getSubStorage( aElement, bCreate );
- if( xSubStorage.get() && (aRemainder.getLength() > 0) )
- xSubStorage = xSubStorage->openSubStorage( aRemainder, bCreate );
+ OSL_ENSURE( !bCreateMissing || !mbReadOnly, "StorageBase::openSubStorage - cannot create substorage in read-only mode" );
+ if( !bCreateMissing || !mbReadOnly )
+ {
+ OUString aElement, aRemainder;
+ lclSplitFirstElement( aElement, aRemainder, rStorageName );
+ if( aElement.getLength() > 0 )
+ xSubStorage = getSubStorage( aElement, bCreateMissing );
+ if( xSubStorage.get() && (aRemainder.getLength() > 0) )
+ xSubStorage = xSubStorage->openSubStorage( aRemainder, bCreateMissing );
+ }
return xSubStorage;
}
@@ -163,47 +179,96 @@ Reference< XInputStream > StorageBase::openInputStream( const OUString& rStreamN
Reference< XOutputStream > StorageBase::openOutputStream( const OUString& rStreamName )
{
Reference< XOutputStream > xOutStream;
- OUString aElement, aRemainder;
- lclSplitFirstElement( aElement, aRemainder, rStreamName );
- if( aElement.getLength() > 0 )
+ OSL_ENSURE( !mbReadOnly, "StorageBase::openOutputStream - cannot create output stream in read-only mode" );
+ if( !mbReadOnly )
{
- if( aRemainder.getLength() > 0 )
+ OUString aElement, aRemainder;
+ lclSplitFirstElement( aElement, aRemainder, rStreamName );
+ if( aElement.getLength() > 0 )
{
- StorageRef xSubStorage = getSubStorage( aElement, true );
- if( xSubStorage.get() )
- xOutStream = xSubStorage->openOutputStream( aRemainder );
+ if( aRemainder.getLength() > 0 )
+ {
+ StorageRef xSubStorage = getSubStorage( aElement, true );
+ if( xSubStorage.get() )
+ xOutStream = xSubStorage->openOutputStream( aRemainder );
+ }
+ else
+ {
+ xOutStream = implOpenOutputStream( aElement );
+ }
}
- else
+ else if( mbBaseStreamAccess )
{
- xOutStream = implOpenOutputStream( aElement );
+ xOutStream = mxOutStream->getOutputStream();
}
}
- else if( mbBaseStreamAccess )
+ return xOutStream;
+}
+
+void StorageBase::copyToStorage( StorageBase& rDestStrg, const OUString& rElementName )
+{
+ OSL_ENSURE( rDestStrg.isStorage() && !rDestStrg.isReadOnly(), "StorageBase::copyToStorage - invalid destination" );
+ OSL_ENSURE( rElementName.getLength() > 0, "StorageBase::copyToStorage - invalid element name" );
+ if( rDestStrg.isStorage() && !rDestStrg.isReadOnly() && (rElementName.getLength() > 0) )
{
- xOutStream = mxOutStream->getOutputStream();
+ StorageRef xSubStrg = openSubStorage( rElementName, false );
+ if( xSubStrg.get() )
+ {
+ StorageRef xDestSubStrg = rDestStrg.openSubStorage( rElementName, true );
+ if( xDestSubStrg.get() )
+ xSubStrg->copyStorageToStorage( *xDestSubStrg );
+ }
+ else
+ {
+ Reference< XInputStream > xInStrm = openInputStream( rElementName );
+ if( xInStrm.is() )
+ {
+ Reference< XOutputStream > xOutStrm = rDestStrg.openOutputStream( rElementName );
+ if( xOutStrm.is() )
+ {
+ BinaryXInputStream aInStrm( xInStrm, true );
+ BinaryXOutputStream aOutStrm( xOutStrm, true );
+ aInStrm.copyToStream( aOutStrm );
+ }
+ }
+ }
}
- return xOutStream;
}
-StorageRef StorageBase::getSubStorage( const OUString& rElementName, bool bCreate )
+void StorageBase::copyStorageToStorage( StorageBase& rDestStrg )
{
- SubStorageMap::iterator aIt = maSubStorages.find( rElementName );
- return (aIt == maSubStorages.end()) ?
- (maSubStorages[ rElementName ] = implOpenSubStorage( rElementName, bCreate )) : aIt->second;
+ OSL_ENSURE( rDestStrg.isStorage() && !rDestStrg.isReadOnly(), "StorageBase::copyToStorage - invalid destination" );
+ if( rDestStrg.isStorage() && !rDestStrg.isReadOnly() )
+ {
+ ::std::vector< OUString > aElements;
+ getElementNames( aElements );
+ for( ::std::vector< OUString >::iterator aIt = aElements.begin(), aEnd = aElements.end(); aIt != aEnd; ++aIt )
+ copyToStorage( rDestStrg, *aIt );
+ }
}
void StorageBase::commit()
{
- for( SubStorageMap::iterator aIt = maSubStorages.begin(); aIt != maSubStorages.end(); aIt ++ )
- aIt->second->commit();
+ OSL_ENSURE( !mbReadOnly, "StorageBase::commit - cannot commit in read-only mode" );
+ if( !mbReadOnly )
+ {
+ // commit all open substorages
+ maSubStorages.forEachMem( &StorageBase::commit );
+ // commit this storage
+ implCommit();
+ }
+}
- Reference< XTransactedObject > xTransactedObj( getXStorage(), UNO_QUERY );
+// private --------------------------------------------------------------------
- if( xTransactedObj.is() )
- xTransactedObj->commit();
+StorageRef StorageBase::getSubStorage( const OUString& rElementName, bool bCreateMissing )
+{
+ StorageRef& rxSubStrg = maSubStorages[ rElementName ];
+ if( !rxSubStrg )
+ rxSubStrg = implOpenSubStorage( rElementName, bCreateMissing );
+ return rxSubStrg;
}
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/textinputstream.cxx b/oox/source/helper/textinputstream.cxx
new file mode 100755
index 000000000000..d6d4736f3ca2
--- /dev/null
+++ b/oox/source/helper/textinputstream.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/helper/textinputstream.hxx"
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "oox/helper/binaryinputstream.hxx"
+
+using ::rtl::OStringBuffer;
+using ::rtl::OStringToOUString;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace oox {
+
+// ============================================================================
+
+namespace {
+
+/** Reads a text line from stream. First, tries to skip the second character of
+ a two-character line end sequence. Returns the new line-end character. */
+template< typename BufferType, typename CharType, typename StreamDataType >
+sal_Unicode lclReadLine( BufferType& orBuffer, BinaryInputStream& rInStrm, sal_Unicode cLastEolChar )
+{
+ // try to skip LF following CR, or CR following LF
+ if( !rInStrm.isEof() && (cLastEolChar != 0) )
+ {
+ CharType cChar = static_cast< CharType >( rInStrm.readValue< StreamDataType >() );
+ // return on EOF after line-end
+ if( rInStrm.isEof() )
+ return 0;
+ // return on sequence of equal line-end characters
+ bool bIsEolChar = (cChar == 10) || (cChar == 13);
+ if( bIsEolChar && (cChar == cLastEolChar) )
+ return cChar;
+ // append the character, if it is not the other line-end charcter
+ if( !bIsEolChar )
+ orBuffer.append( cChar );
+ }
+
+ // read chars until EOF or line end character (LF or CR)
+ while( true )
+ {
+ CharType cChar = static_cast< CharType >( rInStrm.readValue< StreamDataType >() );
+ if( rInStrm.isEof() )
+ return 0;
+ if( (cChar == 10) || (cChar == 13) )
+ return cChar;
+ orBuffer.append( cChar );
+ }
+}
+
+} // namespace
+
+// ============================================================================
+
+TextInputStream::TextInputStream( BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc ) :
+ mrInStrm( rInStrm ),
+ meTextEnc( eTextEnc ),
+ mcLastEolChar( 0 )
+{
+}
+
+bool TextInputStream::isEof() const
+{
+ // do not return EOF, if last text line missed line-end character (see below)
+ return mrInStrm.isEof() && (mcLastEolChar == 0);
+}
+
+OUString TextInputStream::readLine()
+{
+ if( mrInStrm.isEof() )
+ {
+ mcLastEolChar = 0;
+ return OUString();
+ }
+
+ OUString aLine;
+ if( meTextEnc == RTL_TEXTENCODING_UCS2 )
+ {
+ // read 16-bit characters for UCS2 encoding
+ OUStringBuffer aBuffer;
+ mcLastEolChar = lclReadLine< OUStringBuffer, sal_Unicode, sal_uInt16 >( aBuffer, mrInStrm, mcLastEolChar );
+ aLine = aBuffer.makeStringAndClear();
+ }
+ else
+ {
+ // otherwise, read 8-bit characters and convert according to text encoding
+ OStringBuffer aBuffer;
+ mcLastEolChar = lclReadLine< OStringBuffer, sal_Char, sal_uInt8 >( aBuffer, mrInStrm, mcLastEolChar );
+ aLine = OStringToOUString( aBuffer.makeStringAndClear(), meTextEnc );
+ }
+
+ // if last line is not empty but line-end character is missing, do not return EOF
+ if( mrInStrm.isEof() && (aLine.getLength() > 0) )
+ mcLastEolChar = 10;
+
+ return aLine;
+}
+
+// ============================================================================
+
+} // namespace oox
+
diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index c90b2071b133..72b6fcd1bff0 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -26,26 +26,29 @@
************************************************************************/
#include "oox/helper/zipstorage.hxx"
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/storagehelper.hxx>
#include "oox/helper/helper.hxx"
using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::container::NoSuchElementException;
using ::com::sun::star::embed::XStorage;
+using ::com::sun::star::embed::XTransactedObject;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
using ::com::sun::star::io::XStream;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
namespace oox {
@@ -93,7 +96,7 @@ ZipStorage::ZipStorage(
}
ZipStorage::ZipStorage( const ZipStorage& rParentStorage, const Reference< XStorage >& rxStorage, const OUString& rElementName ) :
- StorageBase( rParentStorage, rElementName ),
+ StorageBase( rParentStorage, rElementName, rParentStorage.isReadOnly() ),
mxStorage( rxStorage )
{
OSL_ENSURE( mxStorage.is(), "ZipStorage::ZipStorage - missing storage" );
@@ -127,7 +130,7 @@ void ZipStorage::implGetElementNames( ::std::vector< OUString >& orElementNames
}
}
-StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bCreate )
+StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bCreateMissing )
{
Reference< XStorage > xSubXStorage;
bool bMissing = false;
@@ -138,7 +141,7 @@ StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bC
xSubXStorage = mxStorage->openStorageElement(
rElementName, ::com::sun::star::embed::ElementModes::READ );
}
- catch( ::com::sun::star::container::NoSuchElementException& )
+ catch( NoSuchElementException& )
{
bMissing = true;
}
@@ -146,15 +149,14 @@ StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bC
{
}
- if( bMissing && bCreate )
- try
- {
- xSubXStorage = mxStorage->openStorageElement(
- rElementName, ::com::sun::star::embed::ElementModes::READWRITE );
- }
- catch( Exception& )
- {
- }
+ if( bMissing && bCreateMissing ) try
+ {
+ xSubXStorage = mxStorage->openStorageElement(
+ rElementName, ::com::sun::star::embed::ElementModes::READWRITE );
+ }
+ catch( Exception& )
+ {
+ }
StorageRef xSubStorage;
if( xSubXStorage.is() )
@@ -188,7 +190,17 @@ Reference< XOutputStream > ZipStorage::implOpenOutputStream( const OUString& rEl
return xOutStream;
}
+void ZipStorage::implCommit() const
+{
+ try
+ {
+ Reference< XTransactedObject >( mxStorage, UNO_QUERY_THROW )->commit();
+ }
+ catch( Exception& )
+ {
+ }
+}
+
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx
index f49776ef70e5..cb7e292b8cf4 100644..100755
--- a/oox/source/ole/axbinaryreader.cxx
+++ b/oox/source/ole/axbinaryreader.cxx
@@ -89,13 +89,80 @@ void AxAlignedInputStream::align( size_t nSize )
// ============================================================================
+AxFontData::AxFontData() :
+ mnFontEffects( 0 ),
+ mnFontHeight( 160 ),
+ mnFontCharSet( WINDOWS_CHARSET_DEFAULT ),
+ mnHorAlign( AX_FONTDATA_LEFT )
+{
+}
+
+sal_Int16 AxFontData::getHeightPoints() const
+{
+ /* MSO uses weird font sizes:
+ 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135,
+ 8pt->165, 9pt->180, 10pt->195, 11pt->225, ... */
+ return getLimitedValue< sal_Int16, sal_Int32 >( (mnFontHeight + 10) / 20, 1, SAL_MAX_INT16 );
+}
+
+void AxFontData::setHeightPoints( sal_Int16 nPoints )
+{
+ mnFontHeight = getLimitedValue< sal_Int32, sal_Int32 >( ((nPoints * 4 + 1) / 3) * 15, 30, 4294967 );
+}
+
+bool AxFontData::importBinaryModel( BinaryInputStream& rInStrm )
+{
+ AxBinaryPropertyReader aReader( rInStrm );
+ aReader.readStringProperty( maFontName );
+ aReader.readIntProperty< sal_uInt32 >( mnFontEffects );
+ aReader.readIntProperty< sal_Int32 >( mnFontHeight );
+ aReader.skipIntProperty< sal_Int32 >(); // font offset
+ aReader.readIntProperty< sal_uInt8 >( mnFontCharSet );
+ aReader.skipIntProperty< sal_uInt8 >(); // font pitch/family
+ aReader.readIntProperty< sal_uInt8 >( mnHorAlign );
+ aReader.skipIntProperty< sal_uInt16 >(); // font weight
+ return aReader.finalizeImport();
+}
+
+bool AxFontData::importStdFont( BinaryInputStream& rInStrm )
+{
+ StdFontInfo aFontInfo;
+ if( OleHelper::importStdFont( aFontInfo, rInStrm, false ) )
+ {
+ maFontName = aFontInfo.maName;
+ mnFontEffects = 0;
+ setFlag( mnFontEffects, AX_FONTDATA_BOLD, aFontInfo.mnWeight >= OLE_STDFONT_BOLD );
+ setFlag( mnFontEffects, AX_FONTDATA_ITALIC, getFlag( aFontInfo.mnFlags, OLE_STDFONT_ITALIC ) );
+ setFlag( mnFontEffects, AX_FONTDATA_UNDERLINE, getFlag( aFontInfo.mnFlags, OLE_STDFONT_UNDERLINE ) );
+ setFlag( mnFontEffects, AX_FONTDATA_STRIKEOUT, getFlag( aFontInfo.mnFlags,OLE_STDFONT_STRIKE ) );
+ // StdFont stores font height in 1/10,000 of points
+ setHeightPoints( getLimitedValue< sal_Int16, sal_Int32 >( aFontInfo.mnHeight / 10000, 0, SAL_MAX_INT16 ) );
+ mnFontCharSet = aFontInfo.mnCharSet;
+ mnHorAlign = AX_FONTDATA_LEFT;
+ return true;
+ }
+ return false;
+}
+
+bool AxFontData::importGuidAndFont( BinaryInputStream& rInStrm )
+{
+ OUString aGuid = OleHelper::importGuid( rInStrm );
+ if( aGuid.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{AFC20920-DA4E-11CE-B943-00AA006887B4}" ) ) )
+ return importBinaryModel( rInStrm );
+ if( aGuid.equalsAscii( OLE_GUID_STDFONT ) )
+ return importStdFont( rInStrm );
+ return false;
+}
+
+// ============================================================================
+
AxBinaryPropertyReader::ComplexProperty::~ComplexProperty()
{
}
bool AxBinaryPropertyReader::PairProperty::readProperty( AxAlignedInputStream& rInStrm )
{
- rInStrm >> mrnValue1 >> mrnValue2;
+ rInStrm >> mrPairData.first >> mrPairData.second;
return true;
}
@@ -116,6 +183,17 @@ bool AxBinaryPropertyReader::StringProperty::readProperty( AxAlignedInputStream&
return bValidChars;
}
+bool AxBinaryPropertyReader::GuidProperty::readProperty( AxAlignedInputStream& rInStrm )
+{
+ mrGuid = OleHelper::importGuid( rInStrm );
+ return true;
+}
+
+bool AxBinaryPropertyReader::FontProperty::readProperty( AxAlignedInputStream& rInStrm )
+{
+ return mrFontData.importGuidAndFont( rInStrm );
+}
+
bool AxBinaryPropertyReader::PictureProperty::readProperty( AxAlignedInputStream& rInStrm )
{
return OleHelper::importStdPic( mrPicData, rInStrm, true );
@@ -145,10 +223,10 @@ void AxBinaryPropertyReader::readBoolProperty( bool& orbValue, bool bReverse )
orbValue = startNextProperty() != bReverse;
}
-void AxBinaryPropertyReader::readPairProperty( sal_Int32& ornValue1, sal_Int32& ornValue2 )
+void AxBinaryPropertyReader::readPairProperty( AxPairData& orPairData )
{
if( startNextProperty() )
- maLargeProps.push_back( ComplexPropVector::value_type( new PairProperty( ornValue1, ornValue2 ) ) );
+ maLargeProps.push_back( ComplexPropVector::value_type( new PairProperty( orPairData ) ) );
}
void AxBinaryPropertyReader::readStringProperty( OUString& orValue )
@@ -160,6 +238,22 @@ void AxBinaryPropertyReader::readStringProperty( OUString& orValue )
}
}
+void AxBinaryPropertyReader::readGuidProperty( ::rtl::OUString& orGuid )
+{
+ if( startNextProperty() )
+ maLargeProps.push_back( ComplexPropVector::value_type( new GuidProperty( orGuid ) ) );
+}
+
+void AxBinaryPropertyReader::readFontProperty( AxFontData& orFontData )
+{
+ if( startNextProperty() )
+ {
+ sal_Int16 nData = maInStrm.readAligned< sal_Int16 >();
+ if( ensureValid( nData == -1 ) )
+ maStreamProps.push_back( ComplexPropVector::value_type( new FontProperty( orFontData ) ) );
+ }
+}
+
void AxBinaryPropertyReader::readPictureProperty( StreamDataSequence& orPicData )
{
if( startNextProperty() )
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 96baaab4bb36..95d5c7dc67b7 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -27,20 +27,24 @@
#include "oox/ole/axcontrol.hxx"
#include <rtl/tencinfo.h>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XIndexContainer.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/awt/FontWeight.hpp>
#include <com/sun/star/awt/ImagePosition.hpp>
#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/TextAlign.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
#include "properties.hxx"
#include "tokens.hxx"
#include "oox/helper/attributelist.hxx"
@@ -48,20 +52,23 @@
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/filterbase.hxx"
-#include "oox/ole/axbinaryreader.hxx"
-#include "oox/ole/axcontrolhelper.hxx"
-#include "oox/ole/olehelper.hxx"
using ::rtl::OUString;
+using ::com::sun::star::awt::Point;
+using ::com::sun::star::awt::Size;
+using ::com::sun::star::awt::XControlModel;
+using ::com::sun::star::container::XIndexContainer;
+using ::com::sun::star::container::XNameContainer;
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::form::XForm;
+using ::com::sun::star::form::XFormComponent;
+using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XIndexContainer;
-using ::com::sun::star::awt::XControlModel;
-using ::com::sun::star::form::XFormComponent;
-using ::oox::core::FilterBase;
+using ::com::sun::star::uno::UNO_SET_THROW;
namespace oox {
namespace ole {
@@ -70,6 +77,29 @@ namespace ole {
namespace {
+const sal_uInt32 COMCTL_ID_SIZE = 0x12344321;
+
+const sal_uInt32 COMCTL_ID_COMMONDATA = 0xABCDEF01;
+const sal_uInt32 COMCTL_COMMON_FLATBORDER = 0x00000001;
+const sal_uInt32 COMCTL_COMMON_ENABLED = 0x00000002;
+const sal_uInt32 COMCTL_COMMON_3DBORDER = 0x00000004;
+const sal_uInt32 COMCTL_COMMON_OLEDROPMAN = 0x00002000;
+
+const sal_uInt32 COMCTL_ID_COMPLEXDATA = 0xBDECDE1F;
+const sal_uInt32 COMCTL_COMPLEX_FONT = 0x00000001;
+const sal_uInt32 COMCTL_COMPLEX_MOUSEICON = 0x00000002;
+
+const sal_uInt32 COMCTL_ID_SCROLLBAR_60 = 0x99470A83;
+const sal_uInt32 COMCTL_SCROLLBAR_HOR = 0x00000010;
+const sal_Int32 COMCTL_SCROLLBAR_3D = 0;
+const sal_Int32 COMCTL_SCROLLBAR_FLAT = 1;
+const sal_Int32 COMCTL_SCROLLBAR_TRACK3D = 2;
+
+const sal_uInt32 COMCTL_ID_PROGRESSBAR_50 = 0xE6E17E84;
+const sal_uInt32 COMCTL_ID_PROGRESSBAR_60 = 0x97AB8A01;
+
+// ----------------------------------------------------------------------------
+
const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002;
const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004;
const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008;
@@ -99,26 +129,6 @@ const sal_uInt32 AX_MORPHDATA_DEFFLAGS = 0x2C80081B;
const sal_uInt32 AX_SPINBUTTON_DEFFLAGS = 0x0000001B;
const sal_uInt32 AX_SCROLLBAR_DEFFLAGS = 0x0000001B;
-const sal_uInt32 AX_FONT_BOLD = 0x00000001;
-const sal_uInt32 AX_FONT_ITALIC = 0x00000002;
-const sal_uInt32 AX_FONT_UNDERLINE = 0x00000004;
-const sal_uInt32 AX_FONT_STRIKEOUT = 0x00000008;
-const sal_uInt32 AX_FONT_DISABLED = 0x00002000;
-const sal_uInt32 AX_FONT_AUTOCOLOR = 0x40000000;
-
-const sal_Int32 AX_FONTALIGN_LEFT = 1;
-const sal_Int32 AX_FONTALIGN_RIGHT = 2;
-const sal_Int32 AX_FONTALIGN_CENTER = 3;
-
-const sal_Int32 AX_BORDERSTYLE_NONE = 0;
-const sal_Int32 AX_BORDERSTYLE_SINGLE = 1;
-
-const sal_Int32 AX_SPECIALEFFECT_FLAT = 0;
-const sal_Int32 AX_SPECIALEFFECT_RAISED = 1;
-const sal_Int32 AX_SPECIALEFFECT_SUNKEN = 2;
-const sal_Int32 AX_SPECIALEFFECT_ETCHED = 3;
-const sal_Int32 AX_SPECIALEFFECT_BUMPED = 6;
-
const sal_uInt16 AX_POS_TOPLEFT = 0;
const sal_uInt16 AX_POS_TOP = 1;
const sal_uInt16 AX_POS_TOPRIGHT = 2;
@@ -129,31 +139,21 @@ const sal_uInt16 AX_POS_BOTTOMLEFT = 6;
const sal_uInt16 AX_POS_BOTTOM = 7;
const sal_uInt16 AX_POS_BOTTOMRIGHT = 8;
-#define AX_PICPOS( label, image ) ((AX_POS_##label << 16) | AX_POS_##image)
-const sal_uInt32 AX_PICPOS_LEFTTOP = AX_PICPOS( TOPRIGHT, TOPLEFT );
-const sal_uInt32 AX_PICPOS_LEFTCENTER = AX_PICPOS( RIGHT, LEFT );
-const sal_uInt32 AX_PICPOS_LEFTBOTTOM = AX_PICPOS( BOTTOMRIGHT, BOTTOMLEFT );
-const sal_uInt32 AX_PICPOS_RIGHTTOP = AX_PICPOS( TOPLEFT, TOPRIGHT );
-const sal_uInt32 AX_PICPOS_RIGHTCENTER = AX_PICPOS( LEFT, RIGHT );
-const sal_uInt32 AX_PICPOS_RIGHTBOTTOM = AX_PICPOS( BOTTOMLEFT, BOTTOMRIGHT );
-const sal_uInt32 AX_PICPOS_ABOVELEFT = AX_PICPOS( BOTTOMLEFT, TOPLEFT );
-const sal_uInt32 AX_PICPOS_ABOVECENTER = AX_PICPOS( BOTTOM, TOP );
-const sal_uInt32 AX_PICPOS_ABOVERIGHT = AX_PICPOS( BOTTOMRIGHT, TOPRIGHT );
-const sal_uInt32 AX_PICPOS_BELOWLEFT = AX_PICPOS( TOPLEFT, BOTTOMLEFT );
-const sal_uInt32 AX_PICPOS_BELOWCENTER = AX_PICPOS( TOP, BOTTOM );
-const sal_uInt32 AX_PICPOS_BELOWRIGHT = AX_PICPOS( TOPRIGHT, BOTTOMRIGHT );
-const sal_uInt32 AX_PICPOS_CENTER = AX_PICPOS( CENTER, CENTER );
-#undef AX_PICPOS
-
-const sal_Int32 AX_PICSIZE_CLIP = 0;
-const sal_Int32 AX_PICSIZE_STRETCH = 1;
-const sal_Int32 AX_PICSIZE_ZOOM = 3;
-
-const sal_Int32 AX_PICALIGN_TOPLEFT = 0;
-const sal_Int32 AX_PICALIGN_TOPRIGHT = 1;
-const sal_Int32 AX_PICALIGN_CENTER = 2;
-const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3;
-const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4;
+#define AX_PICPOS_IMPL( label, image ) ((AX_POS_##label << 16) | AX_POS_##image)
+const sal_uInt32 AX_PICPOS_LEFTTOP = AX_PICPOS_IMPL( TOPRIGHT, TOPLEFT );
+const sal_uInt32 AX_PICPOS_LEFTCENTER = AX_PICPOS_IMPL( RIGHT, LEFT );
+const sal_uInt32 AX_PICPOS_LEFTBOTTOM = AX_PICPOS_IMPL( BOTTOMRIGHT, BOTTOMLEFT );
+const sal_uInt32 AX_PICPOS_RIGHTTOP = AX_PICPOS_IMPL( TOPLEFT, TOPRIGHT );
+const sal_uInt32 AX_PICPOS_RIGHTCENTER = AX_PICPOS_IMPL( LEFT, RIGHT );
+const sal_uInt32 AX_PICPOS_RIGHTBOTTOM = AX_PICPOS_IMPL( BOTTOMLEFT, BOTTOMRIGHT );
+const sal_uInt32 AX_PICPOS_ABOVELEFT = AX_PICPOS_IMPL( BOTTOMLEFT, TOPLEFT );
+const sal_uInt32 AX_PICPOS_ABOVECENTER = AX_PICPOS_IMPL( BOTTOM, TOP );
+const sal_uInt32 AX_PICPOS_ABOVERIGHT = AX_PICPOS_IMPL( BOTTOMRIGHT, TOPRIGHT );
+const sal_uInt32 AX_PICPOS_BELOWLEFT = AX_PICPOS_IMPL( TOPLEFT, BOTTOMLEFT );
+const sal_uInt32 AX_PICPOS_BELOWCENTER = AX_PICPOS_IMPL( TOP, BOTTOM );
+const sal_uInt32 AX_PICPOS_BELOWRIGHT = AX_PICPOS_IMPL( TOPRIGHT, BOTTOMRIGHT );
+const sal_uInt32 AX_PICPOS_CENTER = AX_PICPOS_IMPL( CENTER, CENTER );
+#undef AX_PICPOS_IMPL
const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1;
const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2;
@@ -186,6 +186,25 @@ const sal_Int32 AX_ORIENTATION_HORIZONTAL = 1;
const sal_Int32 AX_PROPTHUMB_ON = -1;
const sal_Int32 AX_PROPTHUMB_OFF = 0;
+const sal_uInt32 AX_CONTAINER_ENABLED = 0x00000004;
+const sal_uInt32 AX_CONTAINER_HASDESIGNEXT = 0x00004000;
+const sal_uInt32 AX_CONTAINER_NOCLASSTABLE = 0x00008000;
+
+const sal_uInt32 AX_CONTAINER_DEFFLAGS = 0x00000004;
+
+const sal_Int32 AX_CONTAINER_DEFWIDTH = 4000;
+const sal_Int32 AX_CONTAINER_DEFHEIGHT = 3000;
+
+const sal_Int32 AX_CONTAINER_CYCLEALL = 0;
+const sal_Int32 AX_CONTAINER_CYCLECURRENT = 2;
+
+const sal_Int32 AX_CONTAINER_SCR_NONE = 0x00;
+const sal_Int32 AX_CONTAINER_SCR_HOR = 0x01;
+const sal_Int32 AX_CONTAINER_SCR_VER = 0x02;
+const sal_Int32 AX_CONTAINER_SCR_KEEP_HOR = 0x04;
+const sal_Int32 AX_CONTAINER_SCR_KEEP_VER = 0x08;
+const sal_Int32 AX_CONTAINER_SCR_SHOW_LEFT = 0x10;
+
// ----------------------------------------------------------------------------
const sal_Int16 API_BORDER_NONE = 0;
@@ -196,37 +215,82 @@ const sal_Int16 API_STATE_UNCHECKED = 0;
const sal_Int16 API_STATE_CHECKED = 1;
const sal_Int16 API_STATE_DONTKNOW = 2;
-// ----------------------------------------------------------------------------
+} // namespace
+
+// ============================================================================
-/** Specifies how a form control supports transparent background. */
-enum ApiTransparencyMode
+ControlConverter::ControlConverter( const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
+ mrGraphicHelper( rGraphicHelper ),
+ mbDefaultColorBgr( bDefaultColorBgr )
{
- API_TRANSPARENCY_NOTSUPPORTED, /// Control does not support transparency.
- API_TRANSPARENCY_VOID, /// Transparency is enabled by missing fill color.
- API_TRANSPARENCY_PAINTTRANSPARENT /// Transparency is enabled by the 'PaintTransparent' property.
-};
+}
-// ----------------------------------------------------------------------------
+ControlConverter::~ControlConverter()
+{
+}
-/** Specifies how a form control supports the DefaultState property. */
-enum ApiDefaultStateMode
+// Generic conversion ---------------------------------------------------------
+
+void ControlConverter::convertSize( PropertyMap& rPropMap, const AxPairData& rSize ) const
{
- API_DEFAULTSTATE_BOOLEAN, /// Control does not support tri-state, state is given as boolean.
- API_DEFAULTSTATE_SHORT, /// Control does not support tri-state, state is given as short.
- API_DEFAULTSTATE_TRISTATE /// Control supports tri-state, state is given as short.
-};
+ // size is given in 1/100 mm, UNO needs AppFont units
+ Size aAppFontSize = mrGraphicHelper.convertHmmToAppFont( Size( rSize.first, rSize.second ) );
+ rPropMap.setProperty( PROP_Width, aAppFontSize.Width );
+ rPropMap.setProperty( PROP_Height, aAppFontSize.Height );
+}
-// ----------------------------------------------------------------------------
+void ControlConverter::convertPosition( PropertyMap& rPropMap, const AxPairData& rPos ) const
+{
+ // position is given in 1/100 mm, UNO needs AppFont units
+ Point aAppFontPos = mrGraphicHelper.convertHmmToAppFont( Point( rPos.first, rPos.second ) );
+ rPropMap.setProperty( PROP_PositionX, aAppFontPos.X );
+ rPropMap.setProperty( PROP_PositionY, aAppFontPos.Y );
+}
+
+void ControlConverter::convertColor( PropertyMap& rPropMap, sal_Int32 nPropId, sal_uInt32 nOleColor ) const
+{
+ rPropMap.setProperty( nPropId, OleHelper::decodeOleColor( mrGraphicHelper, nOleColor, mbDefaultColorBgr ) );
+}
+
+void ControlConverter::convertPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData ) const
+{
+ if( rPicData.hasElements() )
+ {
+ OUString aGraphicUrl = mrGraphicHelper.importGraphicObject( rPicData );
+ if( aGraphicUrl.getLength() > 0 )
+ rPropMap.setProperty( PROP_ImageURL, aGraphicUrl );
+ }
+}
+
+void ControlConverter::convertOrientation( PropertyMap& rPropMap, bool bHorizontal ) const
+{
+ namespace AwtScrollBarOrient = ::com::sun::star::awt::ScrollBarOrientation;
+ sal_Int32 nScrollOrient = bHorizontal ? AwtScrollBarOrient::HORIZONTAL : AwtScrollBarOrient::VERTICAL;
+ rPropMap.setProperty( PROP_Orientation, nScrollOrient );
+}
-/** Converts the AX background formatting to UNO properties. */
-void lclConvertBackground( AxControlHelper& rHelper, PropertyMap& rPropMap, sal_uInt32 nBackColor, sal_uInt32 nFlags, ApiTransparencyMode eTranspMode )
+void ControlConverter::convertScrollBar( PropertyMap& rPropMap,
+ sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
+ sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const
+{
+ rPropMap.setProperty( PROP_ScrollValueMin, ::std::min( nMin, nMax ) );
+ rPropMap.setProperty( PROP_ScrollValueMax, ::std::max( nMin, nMax ) );
+ rPropMap.setProperty( PROP_LineIncrement, nSmallChange );
+ rPropMap.setProperty( PROP_BlockIncrement, nLargeChange );
+ rPropMap.setProperty( bAwtModel ? PROP_ScrollValue : PROP_DefaultScrollValue, nPosition );
+}
+
+// ActiveX (Forms 2.0) specific conversion ------------------------------------
+
+void ControlConverter::convertAxBackground( PropertyMap& rPropMap,
+ sal_uInt32 nBackColor, sal_uInt32 nFlags, ApiTransparencyMode eTranspMode ) const
{
bool bOpaque = getFlag( nFlags, AX_FLAGS_OPAQUE );
switch( eTranspMode )
{
case API_TRANSPARENCY_NOTSUPPORTED:
// fake transparency by using system window background if needed
- rPropMap.setProperty( PROP_BackgroundColor, rHelper.convertColor( bOpaque ? nBackColor : AX_SYSCOLOR_WINDOWBACK ) );
+ convertColor( rPropMap, PROP_BackgroundColor, bOpaque ? nBackColor : AX_SYSCOLOR_WINDOWBACK );
break;
case API_TRANSPARENCY_PAINTTRANSPARENT:
rPropMap.setProperty( PROP_PaintTransparent, !bOpaque );
@@ -234,52 +298,31 @@ void lclConvertBackground( AxControlHelper& rHelper, PropertyMap& rPropMap, sal_
case API_TRANSPARENCY_VOID:
// keep transparency by leaving the (void) default property value
if( bOpaque )
- rPropMap.setProperty( PROP_BackgroundColor, rHelper.convertColor( nBackColor ) );
+ convertColor( rPropMap, PROP_BackgroundColor, nBackColor );
break;
}
}
-// ----------------------------------------------------------------------------
-
-/** Converts the AX border formatting to UNO properties. */
-void lclConvertBorder( AxControlHelper& rHelper, PropertyMap& rPropMap, sal_uInt32 nBorderColor, sal_Int32 nBorderStyle, sal_Int32 nSpecialEffect )
+void ControlConverter::convertAxBorder( PropertyMap& rPropMap,
+ sal_uInt32 nBorderColor, sal_Int32 nBorderStyle, sal_Int32 nSpecialEffect ) const
{
sal_Int16 nBorder = (nBorderStyle == AX_BORDERSTYLE_SINGLE) ? API_BORDER_FLAT :
((nSpecialEffect == AX_SPECIALEFFECT_FLAT) ? API_BORDER_NONE : API_BORDER_SUNKEN);
rPropMap.setProperty( PROP_Border, nBorder );
- rPropMap.setProperty( PROP_BorderColor, rHelper.convertColor( nBorderColor ) );
+ convertColor( rPropMap, PROP_BorderColor, nBorderColor );
}
-// ----------------------------------------------------------------------------
-
-/** Converts the AX special effect to UNO properties. */
-void lclConvertVisualEffect( AxControlHelper& /*rHelper*/, PropertyMap& rPropMap, sal_Int32 nSpecialEffect )
+void ControlConverter::convertAxVisualEffect( PropertyMap& rPropMap, sal_Int32 nSpecialEffect ) const
{
namespace AwtVisualEffect = ::com::sun::star::awt::VisualEffect;
sal_Int16 nVisualEffect = (nSpecialEffect == AX_SPECIALEFFECT_FLAT) ? AwtVisualEffect::FLAT : AwtVisualEffect::LOOK3D;
rPropMap.setProperty( PROP_VisualEffect, nVisualEffect );
}
-// ----------------------------------------------------------------------------
-
-/** Converts the passed picture stream to UNO properties. */
-void lclConvertPicture( AxControlHelper& rHelper, PropertyMap& rPropMap, const StreamDataSequence& rPicData )
-{
- if( rPicData.hasElements() )
- {
- OUString aGraphicUrl = rHelper.getFilter().getGraphicHelper().importGraphicObject( rPicData );
- if( aGraphicUrl.getLength() > 0 )
- rPropMap.setProperty( PROP_ImageURL, aGraphicUrl );
- }
-}
-
-// ----------------------------------------------------------------------------
-
-/** Converts the passed picture stream and position to UNO properties. */
-void lclConvertPicture( AxControlHelper& rHelper, PropertyMap& rPropMap, const StreamDataSequence& rPicData, sal_uInt32 nPicPos )
+void ControlConverter::convertAxPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData, sal_uInt32 nPicPos ) const
{
// the picture
- lclConvertPicture( rHelper, rPropMap, rPicData );
+ convertPicture( rPropMap, rPicData );
// picture position
namespace AwtImagePos = ::com::sun::star::awt::ImagePosition;
@@ -299,18 +342,16 @@ void lclConvertPicture( AxControlHelper& rHelper, PropertyMap& rPropMap, const S
case AX_PICPOS_BELOWCENTER: nImagePos = AwtImagePos::BelowCenter; break;
case AX_PICPOS_BELOWRIGHT: nImagePos = AwtImagePos::BelowRight; break;
case AX_PICPOS_CENTER: nImagePos = AwtImagePos::Centered; break;
- default: OSL_ENSURE( false, "lclConvertPicture - unknown picture position" );
+ default: OSL_ENSURE( false, "ControlConverter::convertAxPicture - unknown picture position" );
}
rPropMap.setProperty( PROP_ImagePosition, nImagePos );
}
-// ----------------------------------------------------------------------------
-
-/** Converts the passed picture stream and position to UNO properties. */
-void lclConvertPicture( AxControlHelper& rHelper, PropertyMap& rPropMap, const StreamDataSequence& rPicData, sal_Int32 nPicSizeMode, sal_Int32 /*nPicAlign*/, bool /*bPicTiling*/ )
+void ControlConverter::convertAxPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData,
+ sal_Int32 nPicSizeMode, sal_Int32 /*nPicAlign*/, bool /*bPicTiling*/ ) const
{
// the picture
- lclConvertPicture( rHelper, rPropMap, rPicData );
+ convertPicture( rPropMap, rPicData );
// picture scale mode
namespace AwtScaleMode = ::com::sun::star::awt::ImageScaleMode;
@@ -320,15 +361,13 @@ void lclConvertPicture( AxControlHelper& rHelper, PropertyMap& rPropMap, const S
case AX_PICSIZE_CLIP: nScaleMode = AwtScaleMode::None; break;
case AX_PICSIZE_STRETCH: nScaleMode = AwtScaleMode::Anisotropic; break;
case AX_PICSIZE_ZOOM: nScaleMode = AwtScaleMode::Isotropic; break;
- default: OSL_ENSURE( false, "lclConvertPicture - unknown picture size mode" );
+ default: OSL_ENSURE( false, "ControlConverter::convertAxPicture - unknown picture size mode" );
}
rPropMap.setProperty( PROP_ScaleMode, nScaleMode );
}
-// ----------------------------------------------------------------------------
-
-/** Converts the AX value for checked/unchecked/dontknow to UNO properties. */
-void lclConvertState( AxControlHelper& /*rHelper*/, PropertyMap& rPropMap, const OUString& rValue, sal_Int32 nMultiSelect, ApiDefaultStateMode eDefStateMode )
+void ControlConverter::convertAxState( PropertyMap& rPropMap,
+ const OUString& rValue, sal_Int32 nMultiSelect, ApiDefaultStateMode eDefStateMode, bool bAwtModel ) const
{
bool bBooleanState = eDefStateMode == API_DEFAULTSTATE_BOOLEAN;
bool bSupportsTriState = eDefStateMode == API_DEFAULTSTATE_TRISTATE;
@@ -341,44 +380,280 @@ void lclConvertState( AxControlHelper& /*rHelper*/, PropertyMap& rPropMap, const
case '1': nState = API_STATE_CHECKED; break;
// any other string (also empty) means 'dontknow'
}
+ sal_Int32 nPropId = bAwtModel ? PROP_State : PROP_DefaultState;
if( bBooleanState )
- rPropMap.setProperty( PROP_DefaultState, nState != API_STATE_UNCHECKED );
+ rPropMap.setProperty( nPropId, nState != API_STATE_UNCHECKED );
else
- rPropMap.setProperty( PROP_DefaultState, nState );
+ rPropMap.setProperty( nPropId, nState );
// tristate
if( bSupportsTriState )
rPropMap.setProperty( PROP_TriState, nMultiSelect == AX_SELCTION_MULTI );
}
-// ----------------------------------------------------------------------------
-
-/** Converts the AX control orientation to UNO properties. */
-void lclConvertOrientation( AxControlHelper& /*rHelper*/, PropertyMap& rPropMap, sal_Int32 nOrientation, sal_Int32 nWidth, sal_Int32 nHeight )
+void ControlConverter::convertAxOrientation( PropertyMap& rPropMap,
+ const AxPairData& rSize, sal_Int32 nOrientation ) const
{
- namespace AwtScrollBarOrient = ::com::sun::star::awt::ScrollBarOrientation;
- sal_Int32 nScrollOrient = AwtScrollBarOrient::HORIZONTAL;
+ bool bHorizontal = true;
switch( nOrientation )
{
- case AX_ORIENTATION_AUTO: if( nWidth <= nHeight) nScrollOrient = AwtScrollBarOrient::VERTICAL; break;
- case AX_ORIENTATION_VERTICAL: nScrollOrient = AwtScrollBarOrient::VERTICAL; break;
- case AX_ORIENTATION_HORIZONTAL: nScrollOrient = AwtScrollBarOrient::HORIZONTAL; break;
- default: OSL_ENSURE( false, "lclConvertOrientation - unknown orientation" );
+ case AX_ORIENTATION_AUTO: bHorizontal = rSize.first > rSize.second; break;
+ case AX_ORIENTATION_VERTICAL: bHorizontal = false; break;
+ case AX_ORIENTATION_HORIZONTAL: bHorizontal = true; break;
+ default: OSL_ENSURE( false, "ControlConverter::convertAxOrientation - unknown orientation" );
}
- rPropMap.setProperty( PROP_Orientation, nScrollOrient );
+ convertOrientation( rPropMap, bHorizontal );
}
-} // namespace
+// ============================================================================
+
+ControlModelBase::ControlModelBase() :
+ maSize( 0, 0 ),
+ mbAwtModel( false )
+{
+}
+
+ControlModelBase::~ControlModelBase()
+{
+}
+
+OUString ControlModelBase::getServiceName() const
+{
+ ApiControlType eCtrlType = getControlType();
+ if( mbAwtModel ) switch( eCtrlType )
+ {
+ case API_CONTROL_BUTTON: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlButtonModel" );
+ case API_CONTROL_FIXEDTEXT: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlFixedTextModel" );
+ case API_CONTROL_IMAGE: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlImageControlModel" );
+ case API_CONTROL_CHECKBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlCheckBoxModel" );
+ case API_CONTROL_RADIOBUTTON: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlRadioButtonModel" );
+ case API_CONTROL_EDIT: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlEditModel" );
+ case API_CONTROL_LISTBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlListBoxModel" );
+ case API_CONTROL_COMBOBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlComboBoxModel" );
+ case API_CONTROL_SPINBUTTON: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlSpinButtonModel" );
+ case API_CONTROL_SCROLLBAR: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlScrollBarModel" );
+ case API_CONTROL_PROGRESSBAR: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlProgressBarModel" );
+ case API_CONTROL_GROUPBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlGroupBoxModel" );
+ case API_CONTROL_DIALOG: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlDialogModel" );
+ default: OSL_ENSURE( false, "ControlModelBase::getServiceName - no AWT model service supported" );
+ }
+ else switch( eCtrlType )
+ {
+ case API_CONTROL_BUTTON: return CREATE_OUSTRING( "com.sun.star.form.component.CommandButton" );
+ case API_CONTROL_FIXEDTEXT: return CREATE_OUSTRING( "com.sun.star.form.component.FixedText" );
+ case API_CONTROL_IMAGE: return CREATE_OUSTRING( "com.sun.star.form.component.DatabaseImageControl" );
+ case API_CONTROL_CHECKBOX: return CREATE_OUSTRING( "com.sun.star.form.component.CheckBox" );
+ case API_CONTROL_RADIOBUTTON: return CREATE_OUSTRING( "com.sun.star.form.component.RadioButton" );
+ case API_CONTROL_EDIT: return CREATE_OUSTRING( "com.sun.star.form.component.TextField" );
+ case API_CONTROL_LISTBOX: return CREATE_OUSTRING( "com.sun.star.form.component.ListBox" );
+ case API_CONTROL_COMBOBOX: return CREATE_OUSTRING( "com.sun.star.form.component.ComboBox" );
+ case API_CONTROL_SPINBUTTON: return CREATE_OUSTRING( "com.sun.star.form.component.SpinButton" );
+ case API_CONTROL_SCROLLBAR: return CREATE_OUSTRING( "com.sun.star.form.component.ScrollBar" );
+ case API_CONTROL_GROUPBOX: return CREATE_OUSTRING( "com.sun.star.form.component.GroupBox" );
+ default: OSL_ENSURE( false, "ControlModelBase::getServiceName - no form component service supported" );
+ }
+ return OUString();
+}
+
+void ControlModelBase::importProperty( sal_Int32 /*nPropId*/, const OUString& /*rValue*/ )
+{
+}
+
+void ControlModelBase::importPictureData( sal_Int32 /*nPropId*/, BinaryInputStream& /*rInStrm*/ )
+{
+}
+
+void ControlModelBase::convertProperties( PropertyMap& /*rPropMap*/, const ControlConverter& /*rConv*/ ) const
+{
+}
+
+void ControlModelBase::convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const
+{
+ rConv.convertSize( rPropMap, maSize );
+}
+
+// ============================================================================
+
+ComCtlModelBase::ComCtlModelBase( sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6,
+ sal_uInt16 nVersion, bool bCommonPart, bool bComplexPart ) :
+ maFontData( CREATE_OUSTRING( "Tahoma" ), 82500 ),
+ mnFlags( 0 ),
+ mnVersion( nVersion ),
+ mnDataPartId5( nDataPartId5 ),
+ mnDataPartId6( nDataPartId6 ),
+ mbCommonPart( bCommonPart ),
+ mbComplexPart( bComplexPart )
+{
+}
+
+bool ComCtlModelBase::importBinaryModel( BinaryInputStream& rInStrm )
+{
+ // read initial size part and header of the control data part
+ if( importSizePart( rInStrm ) && readPartHeader( rInStrm, getDataPartId(), mnVersion ) )
+ {
+ // if flags part exists, the first int32 of the data part contains its size
+ sal_uInt32 nCommonPartSize = mbCommonPart ? rInStrm.readuInt32() : 0;
+ // implementations must read the exact amount of data, stream must point to its end afterwards
+ importControlData( rInStrm );
+ // read following parts
+ if( !rInStrm.isEof() &&
+ (!mbCommonPart || importCommonPart( rInStrm, nCommonPartSize )) &&
+ (!mbComplexPart || importComplexPart( rInStrm )) )
+ {
+ return !rInStrm.isEof();
+ }
+ }
+ return false;
+}
+
+void ComCtlModelBase::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
+{
+ if( mbCommonPart )
+ rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, COMCTL_COMMON_ENABLED ) );
+ ControlModelBase::convertProperties( rPropMap, rConv );
+}
+
+void ComCtlModelBase::importCommonExtraData( BinaryInputStream& /*rInStrm*/ )
+{
+}
+
+void ComCtlModelBase::importCommonTrailingData( BinaryInputStream& /*rInStrm*/ )
+{
+}
+
+sal_uInt32 ComCtlModelBase::getDataPartId() const
+{
+ switch( mnVersion )
+ {
+ case 5: return mnDataPartId5;
+ case 6: return mnDataPartId6;
+ }
+ OSL_ENSURE( false, "ComCtlObjectBase::getDataPartId - unxpected version" );
+ return SAL_MAX_UINT32;
+}
+
+bool ComCtlModelBase::readPartHeader( BinaryInputStream& rInStrm, sal_uInt32 nExpPartId, sal_uInt16 nExpMajor, sal_uInt16 nExpMinor )
+{
+ // no idea if all this is correct...
+ sal_uInt32 nPartId;
+ sal_uInt16 nMajor, nMinor;
+ rInStrm >> nPartId >> nMinor >> nMajor;
+ bool bPartId = nPartId == nExpPartId;
+ OSL_ENSURE( bPartId, "ComCtlObjectBase::readPartHeader - unexpected part identifier" );
+ bool bVersion = ((nExpMajor == SAL_MAX_UINT16) || (nExpMajor == nMajor)) && ((nExpMinor == SAL_MAX_UINT16) || (nExpMinor == nMinor));
+ OSL_ENSURE( bVersion, "ComCtlObjectBase::readPartHeader - unexpected part version" );
+ return !rInStrm.isEof() && bPartId && bVersion;
+}
+
+bool ComCtlModelBase::importSizePart( BinaryInputStream& rInStrm )
+{
+ if( readPartHeader( rInStrm, COMCTL_ID_SIZE, 0, 8 ) )
+ {
+ rInStrm >> maSize.first >> maSize.second;
+ return !rInStrm.isEof();
+ }
+ return false;
+}
+
+bool ComCtlModelBase::importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize )
+{
+ sal_Int64 nEndPos = rInStrm.tell() + nPartSize;
+ if( (nPartSize >= 16) && readPartHeader( rInStrm, COMCTL_ID_COMMONDATA, 5, 0 ) )
+ {
+ rInStrm.skip( 4 );
+ rInStrm >> mnFlags;
+ // implementations may read less than the exact amount of data
+ importCommonExtraData( rInStrm );
+ rInStrm.seek( nEndPos );
+ // implementations must read the exact amount of data, stream must point to its end afterwards
+ importCommonTrailingData( rInStrm );
+ return !rInStrm.isEof();
+ }
+ return false;
+}
+
+bool ComCtlModelBase::importComplexPart( BinaryInputStream& rInStrm )
+{
+ if( readPartHeader( rInStrm, COMCTL_ID_COMPLEXDATA, 5, 1 ) )
+ {
+ sal_uInt32 nContFlags;
+ rInStrm >> nContFlags;
+ bool bReadOk =
+ (!getFlag( nContFlags, COMCTL_COMPLEX_FONT ) || OleHelper::importStdFont( maFontData, rInStrm, true )) &&
+ (!getFlag( nContFlags, COMCTL_COMPLEX_MOUSEICON ) || OleHelper::importStdPic( maMouseIcon, rInStrm, true ));
+ return bReadOk && !rInStrm.isEof();
+ }
+ return false;
+}
+
+// ============================================================================
+
+ComCtlScrollBarModel::ComCtlScrollBarModel( sal_uInt16 nVersion ) :
+ ComCtlModelBase( SAL_MAX_UINT32, COMCTL_ID_SCROLLBAR_60, nVersion, true, true ),
+ mnScrollBarFlags( 0x00000011 ),
+ mnLargeChange( 1 ),
+ mnSmallChange( 1 ),
+ mnMin( 0 ),
+ mnMax( 32767 ),
+ mnPosition( 0 )
+{
+}
+
+ApiControlType ComCtlScrollBarModel::getControlType() const
+{
+ return API_CONTROL_SCROLLBAR;
+}
+
+void ComCtlScrollBarModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
+{
+ rPropMap.setProperty( PROP_Border, API_BORDER_NONE );
+ rConv.convertOrientation( rPropMap, getFlag( mnScrollBarFlags, COMCTL_SCROLLBAR_HOR ) );
+ rConv.convertScrollBar( rPropMap, mnMin, mnMax, mnPosition, mnSmallChange, mnLargeChange, mbAwtModel );
+ ComCtlModelBase::convertProperties( rPropMap, rConv );
+}
+
+void ComCtlScrollBarModel::importControlData( BinaryInputStream& rInStrm )
+{
+ rInStrm >> mnScrollBarFlags >> mnLargeChange >> mnSmallChange >> mnMin >> mnMax >> mnPosition;
+}
// ============================================================================
-AxControlModelBase::AxControlModelBase() :
- mnWidth( 0 ),
- mnHeight( 0 )
+ComCtlProgressBarModel::ComCtlProgressBarModel( sal_uInt16 nVersion ) :
+ ComCtlModelBase( COMCTL_ID_PROGRESSBAR_50, COMCTL_ID_PROGRESSBAR_60, nVersion, true, true ),
+ mfMin( 0.0 ),
+ mfMax( 100.0 ),
+ mnVertical( 0 ),
+ mnSmooth( 0 )
{
}
-AxControlModelBase::~AxControlModelBase()
+ApiControlType ComCtlProgressBarModel::getControlType() const
+{
+ return API_CONTROL_PROGRESSBAR;
+}
+
+void ComCtlProgressBarModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
+{
+ sal_uInt16 nBorder = getFlag( mnFlags, COMCTL_COMMON_3DBORDER ) ? API_BORDER_SUNKEN :
+ (getFlag( mnFlags, COMCTL_COMMON_FLATBORDER ) ? API_BORDER_FLAT : API_BORDER_NONE);
+ rPropMap.setProperty( PROP_Border, nBorder );
+ rPropMap.setProperty( PROP_ProgressValueMin, getLimitedValue< sal_Int32, double >( ::std::min( mfMin, mfMax ), 0.0, SAL_MAX_INT32 ) );
+ rPropMap.setProperty( PROP_ProgressValueMax, getLimitedValue< sal_Int32, double >( ::std::max( mfMin, mfMax ), 0.0, SAL_MAX_INT32 ) );
+ // ComCtl model does not provide current value?
+ ComCtlModelBase::convertProperties( rPropMap, rConv );
+}
+
+void ComCtlProgressBarModel::importControlData( BinaryInputStream& rInStrm )
+{
+ rInStrm >> mfMin >> mfMax;
+ if( mnVersion == 6 )
+ rInStrm >> mnVertical >> mnSmooth;
+}
+
+// ============================================================================
+
+AxControlModelBase::AxControlModelBase()
{
}
@@ -393,33 +668,18 @@ void AxControlModelBase::importProperty( sal_Int32 nPropId, const OUString& rVal
OSL_ENSURE( nSepPos >= 0, "AxControlModelBase::importProperty - missing separator in 'Size' property" );
if( nSepPos >= 0 )
{
- mnWidth = rValue.copy( 0, nSepPos ).toInt32();
- mnHeight = rValue.copy( nSepPos + 1 ).toInt32();
+ maSize.first = rValue.copy( 0, nSepPos ).toInt32();
+ maSize.second = rValue.copy( nSepPos + 1 ).toInt32();
}
}
break;
}
}
-void AxControlModelBase::importBinaryModel( BinaryInputStream& /*rInStrm*/ )
-{
-}
-
-void AxControlModelBase::importPictureData( sal_Int32 /*nPropId*/, BinaryInputStream& /*rInStrm*/ )
-{
-}
-
-void AxControlModelBase::convertProperties( AxControlHelper& /*rHelper*/, PropertyMap& /*rPropMap*/ ) const
-{
-}
-
// ============================================================================
-AxFontDataModel::AxFontDataModel() :
- mnFontEffects( 0 ),
- mnFontHeight( 160 ),
- mnFontCharSet( 1 ),
- mnHorAlign( AX_FONTALIGN_LEFT )
+AxFontDataModel::AxFontDataModel( bool bSupportsAlign ) :
+ mbSupportsAlign( bSupportsAlign )
{
}
@@ -427,70 +687,59 @@ void AxFontDataModel::importProperty( sal_Int32 nPropId, const OUString& rValue
{
switch( nPropId )
{
- case XML_FontName: maFontName = rValue; break;
- case XML_FontEffects: mnFontEffects = AttributeList::decodeUnsigned( rValue ); break;
- case XML_FontHeight: mnFontHeight = AttributeList::decodeInteger( rValue ); break;
- case XML_FontCharSet: mnFontCharSet = AttributeList::decodeInteger( rValue ); break;
- case XML_ParagraphAlign: mnHorAlign = AttributeList::decodeInteger( rValue ); break;
+ case XML_FontName: maFontData.maFontName = rValue; break;
+ case XML_FontEffects: maFontData.mnFontEffects = AttributeList::decodeUnsigned( rValue ); break;
+ case XML_FontHeight: maFontData.mnFontHeight = AttributeList::decodeInteger( rValue ); break;
+ case XML_FontCharSet: maFontData.mnFontCharSet = AttributeList::decodeInteger( rValue ); break;
+ case XML_ParagraphAlign: maFontData.mnHorAlign = AttributeList::decodeInteger( rValue ); break;
default: AxControlModelBase::importProperty( nPropId, rValue );
}
}
-void AxFontDataModel::importBinaryModel( BinaryInputStream& rInStrm )
+bool AxFontDataModel::importBinaryModel( BinaryInputStream& rInStrm )
{
- AxBinaryPropertyReader aReader( rInStrm );
- aReader.readStringProperty( maFontName );
- aReader.readIntProperty< sal_uInt32 >( mnFontEffects );
- aReader.readIntProperty< sal_Int32 >( mnFontHeight );
- aReader.skipIntProperty< sal_Int32 >(); // font offset
- aReader.readIntProperty< sal_uInt8 >( mnFontCharSet );
- aReader.skipIntProperty< sal_uInt8 >(); // font pitch/family
- aReader.readIntProperty< sal_uInt8 >( mnHorAlign );
- aReader.skipIntProperty< sal_uInt16 >(); // font weight
- aReader.finalizeImport();
+ return maFontData.importBinaryModel( rInStrm );
}
-void AxFontDataModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
namespace cssa = ::com::sun::star::awt;
// font name
- if( maFontName.getLength() > 0 )
- rPropMap.setProperty( PROP_FontName, maFontName );
+ if( maFontData.maFontName.getLength() > 0 )
+ rPropMap.setProperty( PROP_FontName, maFontData.maFontName );
// font effects
- rPropMap.setProperty( PROP_FontWeight, getFlagValue( mnFontEffects, AX_FONT_BOLD, cssa::FontWeight::BOLD, cssa::FontWeight::NORMAL ) );
- rPropMap.setProperty( PROP_FontSlant, getFlagValue< sal_Int16 >( mnFontEffects, AX_FONT_ITALIC, cssa::FontSlant_ITALIC, cssa::FontSlant_NONE ) );
- rPropMap.setProperty( PROP_FontUnderline, getFlagValue( mnFontEffects, AX_FONT_UNDERLINE, cssa::FontUnderline::SINGLE, cssa::FontUnderline::NONE ) );
- rPropMap.setProperty( PROP_FontStrikeout, getFlagValue( mnFontEffects, AX_FONT_STRIKEOUT, cssa::FontStrikeout::SINGLE, cssa::FontStrikeout::NONE ) );
-
- /* font height in points. MSO uses weird font sizes:
- 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135,
- 8pt->165, 9pt->180, 10pt->195, 11pt->225, ... */
- sal_Int16 nHeight = getLimitedValue< sal_Int16, sal_Int32 >( (mnFontHeight + 10) / 20, 1, SAL_MAX_INT16 );
- rPropMap.setProperty( PROP_FontHeight, nHeight );
+ rPropMap.setProperty( PROP_FontWeight, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_BOLD, cssa::FontWeight::BOLD, cssa::FontWeight::NORMAL ) );
+ rPropMap.setProperty( PROP_FontSlant, getFlagValue< sal_Int16 >( maFontData.mnFontEffects, AX_FONTDATA_ITALIC, cssa::FontSlant_ITALIC, cssa::FontSlant_NONE ) );
+ rPropMap.setProperty( PROP_FontUnderline, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_UNDERLINE, cssa::FontUnderline::SINGLE, cssa::FontUnderline::NONE ) );
+ rPropMap.setProperty( PROP_FontStrikeout, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_STRIKEOUT, cssa::FontStrikeout::SINGLE, cssa::FontStrikeout::NONE ) );
+ rPropMap.setProperty( PROP_FontHeight, maFontData.getHeightPoints() );
// font character set
rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
- if( (0 <= mnFontCharSet) && (mnFontCharSet <= SAL_MAX_UINT8) )
- eFontEnc = rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( mnFontCharSet ) );
+ if( (0 <= maFontData.mnFontCharSet) && (maFontData.mnFontCharSet <= SAL_MAX_UINT8) )
+ eFontEnc = rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maFontData.mnFontCharSet ) );
if( eFontEnc != RTL_TEXTENCODING_DONTKNOW )
rPropMap.setProperty( PROP_FontCharset, static_cast< sal_Int16 >( eFontEnc ) );
// text alignment
- sal_Int32 nAlign = cssa::TextAlign::LEFT;
- switch( mnHorAlign )
+ if( mbSupportsAlign )
{
- case AX_FONTALIGN_LEFT: nAlign = cssa::TextAlign::LEFT; break;
- case AX_FONTALIGN_RIGHT: nAlign = cssa::TextAlign::RIGHT; break;
- case AX_FONTALIGN_CENTER: nAlign = cssa::TextAlign::CENTER; break;
- default: OSL_ENSURE( false, "AxFontDataModel::convertProperties - unknown text alignment" );
+ sal_Int32 nAlign = cssa::TextAlign::LEFT;
+ switch( maFontData.mnHorAlign )
+ {
+ case AX_FONTDATA_LEFT: nAlign = cssa::TextAlign::LEFT; break;
+ case AX_FONTDATA_RIGHT: nAlign = cssa::TextAlign::RIGHT; break;
+ case AX_FONTDATA_CENTER: nAlign = cssa::TextAlign::CENTER; break;
+ default: OSL_ENSURE( false, "AxFontDataModel::convertProperties - unknown text alignment" );
+ }
+ // form controls expect short value
+ rPropMap.setProperty( PROP_Align, static_cast< sal_Int16 >( nAlign ) );
}
- // form controls expect short value
- rPropMap.setProperty( PROP_Align, static_cast< sal_Int16 >( nAlign ) );
// process base class properties
- AxControlModelBase::convertProperties( rHelper, rPropMap );
+ AxControlModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -527,7 +776,7 @@ void AxCommandButtonModel::importPictureData( sal_Int32 nPropId, BinaryInputStre
}
}
-void AxCommandButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
+bool AxCommandButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
{
AxBinaryPropertyReader aReader( rInStrm );
aReader.readIntProperty< sal_uInt32 >( mnTextColor );
@@ -535,32 +784,31 @@ void AxCommandButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.readIntProperty< sal_uInt32 >( mnFlags );
aReader.readStringProperty( maCaption );
aReader.readIntProperty< sal_uInt32 >( mnPicturePos );
- aReader.readPairProperty( mnWidth, mnHeight );
+ aReader.readPairProperty( maSize );
aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
aReader.readPictureProperty( maPictureData );
aReader.skipIntProperty< sal_uInt16 >(); // accelerator
aReader.readBoolProperty( mbFocusOnClick, true ); // binary flag means "do not take focus"
aReader.skipPictureProperty(); // mouse icon
- if( aReader.finalizeImport() )
- AxFontDataModel::importBinaryModel( rInStrm );
+ return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
}
-OUString AxCommandButtonModel::getServiceName() const
+ApiControlType AxCommandButtonModel::getControlType() const
{
- return CREATE_OUSTRING( "com.sun.star.form.component.CommandButton" );
+ return API_CONTROL_BUTTON;
}
-void AxCommandButtonModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxCommandButtonModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Label, maCaption );
- rPropMap.setProperty( PROP_TextColor, rHelper.convertColor( mnTextColor ) );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
rPropMap.setProperty( PROP_FocusOnClick, mbFocusOnClick );
rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
- lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicturePos );
- AxFontDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
+ rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
+ AxFontDataModel::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -590,7 +838,7 @@ void AxLabelModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
}
}
-void AxLabelModel::importBinaryModel( BinaryInputStream& rInStrm )
+bool AxLabelModel::importBinaryModel( BinaryInputStream& rInStrm )
{
AxBinaryPropertyReader aReader( rInStrm );
aReader.readIntProperty< sal_uInt32 >( mnTextColor );
@@ -598,7 +846,7 @@ void AxLabelModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.readIntProperty< sal_uInt32 >( mnFlags );
aReader.readStringProperty( maCaption );
aReader.skipIntProperty< sal_uInt32 >(); // picture position
- aReader.readPairProperty( mnWidth, mnHeight );
+ aReader.readPairProperty( maSize );
aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
aReader.readIntProperty< sal_uInt32 >( mnBorderColor );
aReader.readIntProperty< sal_uInt16 >( mnBorderStyle );
@@ -606,25 +854,24 @@ void AxLabelModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.skipPictureProperty(); // picture
aReader.skipIntProperty< sal_uInt16 >(); // accelerator
aReader.skipPictureProperty(); // mouse icon
- if( aReader.finalizeImport() )
- AxFontDataModel::importBinaryModel( rInStrm );
+ return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
}
-OUString AxLabelModel::getServiceName() const
+ApiControlType AxLabelModel::getControlType() const
{
- return CREATE_OUSTRING( "com.sun.star.form.component.FixedText" );
+ return API_CONTROL_FIXEDTEXT;
}
-void AxLabelModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxLabelModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Label, maCaption );
- rPropMap.setProperty( PROP_TextColor, rHelper.convertColor( mnTextColor ) );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_TOP );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
- lclConvertBorder( rHelper, rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
- AxFontDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxBorder( rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxFontDataModel::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -666,7 +913,7 @@ void AxImageModel::importPictureData( sal_Int32 nPropId, BinaryInputStream& rInS
}
}
-void AxImageModel::importBinaryModel( BinaryInputStream& rInStrm )
+bool AxImageModel::importBinaryModel( BinaryInputStream& rInStrm )
{
AxBinaryPropertyReader aReader( rInStrm );
aReader.skipUndefinedProperty();
@@ -678,32 +925,32 @@ void AxImageModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
aReader.readIntProperty< sal_uInt8 >( mnPicSizeMode );
aReader.readIntProperty< sal_uInt8 >( mnSpecialEffect );
- aReader.readPairProperty( mnWidth, mnHeight );
+ aReader.readPairProperty( maSize );
aReader.readPictureProperty( maPictureData );
aReader.readIntProperty< sal_uInt8 >( mnPicAlign );
aReader.readBoolProperty( mbPicTiling );
aReader.readIntProperty< sal_uInt32 >( mnFlags );
aReader.skipPictureProperty(); // mouse icon
- aReader.finalizeImport();
+ return aReader.finalizeImport();
}
-OUString AxImageModel::getServiceName() const
+ApiControlType AxImageModel::getControlType() const
{
- return CREATE_OUSTRING( "com.sun.star.form.component.DatabaseImageControl" );
+ return API_CONTROL_IMAGE;
}
-void AxImageModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxImageModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
- lclConvertBorder( rHelper, rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
- lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicSizeMode, mnPicAlign, mbPicTiling );
- AxControlModelBase::convertProperties( rHelper, rPropMap );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxBorder( rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ rConv.convertAxPicture( rPropMap, maPictureData, mnPicSizeMode, mnPicAlign, mbPicTiling );
+ AxControlModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
-AxMorphDataModel::AxMorphDataModel() :
+AxMorphDataModelBase::AxMorphDataModelBase() :
mnTextColor( AX_SYSCOLOR_WINDOWTEXT ),
mnBackColor( AX_SYSCOLOR_WINDOWBACK ),
mnFlags( AX_MORPHDATA_DEFFLAGS ),
@@ -722,7 +969,7 @@ AxMorphDataModel::AxMorphDataModel() :
{
}
-void AxMorphDataModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
+void AxMorphDataModelBase::importProperty( sal_Int32 nPropId, const OUString& rValue )
{
switch( nPropId )
{
@@ -748,7 +995,7 @@ void AxMorphDataModel::importProperty( sal_Int32 nPropId, const OUString& rValue
}
}
-void AxMorphDataModel::importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm )
+void AxMorphDataModelBase::importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm )
{
switch( nPropId )
{
@@ -757,7 +1004,7 @@ void AxMorphDataModel::importPictureData( sal_Int32 nPropId, BinaryInputStream&
}
}
-void AxMorphDataModel::importBinaryModel( BinaryInputStream& rInStrm )
+bool AxMorphDataModelBase::importBinaryModel( BinaryInputStream& rInStrm )
{
AxBinaryPropertyReader aReader( rInStrm, true );
aReader.readIntProperty< sal_uInt32 >( mnFlags );
@@ -768,7 +1015,7 @@ void AxMorphDataModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.readIntProperty< sal_uInt8 >( mnScrollBars );
aReader.readIntProperty< sal_uInt8 >( mnDisplayStyle );
aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
- aReader.readPairProperty( mnWidth, mnHeight );
+ aReader.readPairProperty( maSize );
aReader.readIntProperty< sal_uInt16 >( mnPasswordChar );
aReader.skipIntProperty< sal_uInt32 >(); // list width
aReader.skipIntProperty< sal_uInt16 >(); // bound column
@@ -793,15 +1040,14 @@ void AxMorphDataModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.skipUndefinedProperty();
aReader.skipBoolProperty();
aReader.readStringProperty( maGroupName );
- if( aReader.finalizeImport() )
- AxFontDataModel::importBinaryModel( rInStrm );
+ return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
}
-void AxMorphDataModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxMorphDataModelBase::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
- rPropMap.setProperty( PROP_TextColor, rHelper.convertColor( mnTextColor ) );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
- AxFontDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
+ AxFontDataModel::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -810,22 +1056,22 @@ AxToggleButtonModel::AxToggleButtonModel()
{
}
-OUString AxToggleButtonModel::getServiceName() const
+ApiControlType AxToggleButtonModel::getControlType() const
{
- OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TOGGLE, "AxToggleButtonModel::getServiceName - invalid control type" );
- return CREATE_OUSTRING( "com.sun.star.form.component.CommandButton" );
+ OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TOGGLE, "AxToggleButtonModel::getControlType - invalid control type" );
+ return API_CONTROL_BUTTON;
}
-void AxToggleButtonModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxToggleButtonModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
rPropMap.setProperty( PROP_Toggle, true );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
- lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicturePos );
- lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_BOOLEAN );
- AxMorphDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
+ rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
+ rConv.convertAxState( rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_BOOLEAN, mbAwtModel );
+ AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -834,22 +1080,22 @@ AxCheckBoxModel::AxCheckBoxModel()
{
}
-OUString AxCheckBoxModel::getServiceName() const
+ApiControlType AxCheckBoxModel::getControlType() const
{
- OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_CHECKBOX, "AxCheckBoxModel::getServiceName - invalid control type" );
- return CREATE_OUSTRING( "com.sun.star.form.component.CheckBox" );
+ OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_CHECKBOX, "AxCheckBoxModel::getControlType - invalid control type" );
+ return API_CONTROL_CHECKBOX;
}
-void AxCheckBoxModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxCheckBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
- lclConvertVisualEffect( rHelper, rPropMap, mnSpecialEffect );
- lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicturePos );
- lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_TRISTATE );
- AxMorphDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxVisualEffect( rPropMap, mnSpecialEffect );
+ rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
+ rConv.convertAxState( rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_TRISTATE, mbAwtModel );
+ AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -858,22 +1104,22 @@ AxOptionButtonModel::AxOptionButtonModel()
{
}
-OUString AxOptionButtonModel::getServiceName() const
+ApiControlType AxOptionButtonModel::getControlType() const
{
- OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON, "AxOptionButtonModel::getServiceName - invalid control type" );
- return CREATE_OUSTRING( "com.sun.star.form.component.RadioButton" );
+ OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON, "AxOptionButtonModel::getControlType - invalid control type" );
+ return API_CONTROL_RADIOBUTTON;
}
-void AxOptionButtonModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxOptionButtonModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
- lclConvertVisualEffect( rHelper, rPropMap, mnSpecialEffect );
- lclConvertPicture( rHelper, rPropMap, maPictureData, mnPicturePos );
- lclConvertState( rHelper, rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_SHORT );
- AxMorphDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxVisualEffect( rPropMap, mnSpecialEffect );
+ rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
+ rConv.convertAxState( rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_SHORT, mbAwtModel );
+ AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -882,25 +1128,25 @@ AxTextBoxModel::AxTextBoxModel()
{
}
-OUString AxTextBoxModel::getServiceName() const
+ApiControlType AxTextBoxModel::getControlType() const
{
- OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT, "AxTextBoxModel::getServiceName - invalid control type" );
- return CREATE_OUSTRING( "com.sun.star.form.component.TextField" );
+ OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT, "AxTextBoxModel::getControlType - invalid control type" );
+ return API_CONTROL_EDIT;
}
-void AxTextBoxModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxTextBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_MULTILINE ) );
rPropMap.setProperty( PROP_HideInactiveSelection, getFlag( mnFlags, AX_FLAGS_HIDESELECTION ) );
- rPropMap.setProperty( PROP_DefaultText, maValue );
+ rPropMap.setProperty( mbAwtModel ? PROP_Text : PROP_DefaultText, maValue );
rPropMap.setProperty( PROP_MaxTextLen, getLimitedValue< sal_Int16, sal_Int32 >( mnMaxLength, 0, SAL_MAX_INT16 ) );
if( (0 < mnPasswordChar) && (mnPasswordChar <= SAL_MAX_INT16) )
rPropMap.setProperty( PROP_EchoChar, static_cast< sal_Int16 >( mnPasswordChar ) );
rPropMap.setProperty( PROP_HScroll, getFlag( mnScrollBars, AX_SCROLLBAR_HORIZONTAL ) );
rPropMap.setProperty( PROP_VScroll, getFlag( mnScrollBars, AX_SCROLLBAR_VERTICAL ) );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
- lclConvertBorder( rHelper, rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
- AxMorphDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxBorder( rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -909,20 +1155,20 @@ AxListBoxModel::AxListBoxModel()
{
}
-OUString AxListBoxModel::getServiceName() const
+ApiControlType AxListBoxModel::getControlType() const
{
- OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX, "AxListBoxModel::getServiceName - invalid control type" );
- return CREATE_OUSTRING( "com.sun.star.form.component.ListBox" );
+ OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX, "AxListBoxModel::getControlType - invalid control type" );
+ return API_CONTROL_LISTBOX;
}
-void AxListBoxModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxListBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
bool bMultiSelect = (mnMultiSelect == AX_SELCTION_MULTI) || (mnMultiSelect == AX_SELCTION_EXTENDED);
rPropMap.setProperty( PROP_MultiSelection, bMultiSelect );
rPropMap.setProperty( PROP_Dropdown, false );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
- lclConvertBorder( rHelper, rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
- AxMorphDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxBorder( rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -931,18 +1177,18 @@ AxComboBoxModel::AxComboBoxModel()
{
}
-OUString AxComboBoxModel::getServiceName() const
+ApiControlType AxComboBoxModel::getControlType() const
{
- OSL_ENSURE( (mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX) || (mnDisplayStyle == AX_DISPLAYSTYLE_DROPDOWN), "AxComboBoxModel::getServiceName - invalid control type" );
- return (mnDisplayStyle == AX_DISPLAYSTYLE_DROPDOWN) ? CREATE_OUSTRING( "com.sun.star.form.component.ListBox" ) : CREATE_OUSTRING( "com.sun.star.form.component.ComboBox" );
+ OSL_ENSURE( (mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX) || (mnDisplayStyle == AX_DISPLAYSTYLE_DROPDOWN), "AxComboBoxModel::getControlType - invalid control type" );
+ return (mnDisplayStyle == AX_DISPLAYSTYLE_DROPDOWN) ? API_CONTROL_LISTBOX : API_CONTROL_COMBOBOX;
}
-void AxComboBoxModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxComboBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
if( mnDisplayStyle != AX_DISPLAYSTYLE_DROPDOWN )
{
rPropMap.setProperty( PROP_HideInactiveSelection, getFlag( mnFlags, AX_FLAGS_HIDESELECTION ) );
- rPropMap.setProperty( PROP_DefaultText, maValue );
+ rPropMap.setProperty( mbAwtModel ? PROP_Text : PROP_DefaultText, maValue );
rPropMap.setProperty( PROP_MaxTextLen, getLimitedValue< sal_Int16, sal_Int32 >( mnMaxLength, 0, SAL_MAX_INT16 ) );
bool bAutoComplete = (mnMatchEntry == AX_MATCHENTRY_FIRSTLETTER) || (mnMatchEntry == AX_MATCHENTRY_COMPLETE);
rPropMap.setProperty( PROP_Autocomplete, bAutoComplete );
@@ -950,9 +1196,9 @@ void AxComboBoxModel::convertProperties( AxControlHelper& rHelper, PropertyMap&
bool bShowDropdown = (mnShowDropButton == AX_SHOWDROPBUTTON_FOCUS) || (mnShowDropButton == AX_SHOWDROPBUTTON_ALWAYS);
rPropMap.setProperty( PROP_Dropdown, bShowDropdown );
rPropMap.setProperty( PROP_LineCount, getLimitedValue< sal_Int16, sal_Int32 >( mnListRows, 1, SAL_MAX_INT16 ) );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
- lclConvertBorder( rHelper, rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
- AxMorphDataModel::convertProperties( rHelper, rPropMap );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxBorder( rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -970,9 +1216,9 @@ AxSpinButtonModel::AxSpinButtonModel() :
{
}
-OUString AxSpinButtonModel::getServiceName() const
+ApiControlType AxSpinButtonModel::getControlType() const
{
- return CREATE_OUSTRING( "com.sun.star.form.component.SpinButton" );
+ return API_CONTROL_SPINBUTTON;
}
void AxSpinButtonModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
@@ -992,13 +1238,13 @@ void AxSpinButtonModel::importProperty( sal_Int32 nPropId, const OUString& rValu
}
}
-void AxSpinButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
+bool AxSpinButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
{
AxBinaryPropertyReader aReader( rInStrm );
aReader.readIntProperty< sal_uInt32 >( mnArrowColor );
aReader.readIntProperty< sal_uInt32 >( mnBackColor );
aReader.readIntProperty< sal_uInt32 >( mnFlags );
- aReader.readPairProperty( mnWidth, mnHeight );
+ aReader.readPairProperty( maSize );
aReader.skipIntProperty< sal_uInt32 >(); // unused
aReader.readIntProperty< sal_Int32 >( mnMin );
aReader.readIntProperty< sal_Int32 >( mnMax );
@@ -1010,25 +1256,25 @@ void AxSpinButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.readIntProperty< sal_Int32 >( mnDelay );
aReader.skipPictureProperty(); // mouse icon
aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
- aReader.finalizeImport();
+ return aReader.finalizeImport();
}
-void AxSpinButtonModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxSpinButtonModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
sal_Int32 nMin = ::std::min( mnMin, mnMax );
sal_Int32 nMax = ::std::max( mnMin, mnMax );
- rPropMap.setProperty( PROP_SymbolColor, rHelper.convertColor( mnArrowColor ) );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
rPropMap.setProperty( PROP_SpinValueMin, nMin );
rPropMap.setProperty( PROP_SpinValueMax, nMax );
rPropMap.setProperty( PROP_SpinIncrement, mnSmallChange );
- rPropMap.setProperty( PROP_DefaultSpinValue, mnPosition );
+ rPropMap.setProperty( mbAwtModel ? PROP_SpinValue : PROP_DefaultSpinValue, mnPosition );
rPropMap.setProperty( PROP_Repeat, true );
rPropMap.setProperty( PROP_RepeatDelay, mnDelay );
rPropMap.setProperty( PROP_Border, API_BORDER_NONE );
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
- lclConvertOrientation( rHelper, rPropMap, mnOrientation, mnWidth, mnHeight );
- AxControlModelBase::convertProperties( rHelper, rPropMap );
+ rConv.convertColor( rPropMap, PROP_SymbolColor, mnArrowColor );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
+ rConv.convertAxOrientation( rPropMap, maSize, mnOrientation );
+ AxControlModelBase::convertProperties( rPropMap, rConv );
}
// ============================================================================
@@ -1048,9 +1294,9 @@ AxScrollBarModel::AxScrollBarModel() :
{
}
-OUString AxScrollBarModel::getServiceName() const
+ApiControlType AxScrollBarModel::getControlType() const
{
- return CREATE_OUSTRING( "com.sun.star.form.component.ScrollBar" );
+ return API_CONTROL_SCROLLBAR;
}
void AxScrollBarModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
@@ -1072,13 +1318,13 @@ void AxScrollBarModel::importProperty( sal_Int32 nPropId, const OUString& rValue
}
}
-void AxScrollBarModel::importBinaryModel( BinaryInputStream& rInStrm )
+bool AxScrollBarModel::importBinaryModel( BinaryInputStream& rInStrm )
{
AxBinaryPropertyReader aReader( rInStrm );
aReader.readIntProperty< sal_uInt32 >( mnArrowColor );
aReader.readIntProperty< sal_uInt32 >( mnBackColor );
aReader.readIntProperty< sal_uInt32 >( mnFlags );
- aReader.readPairProperty( mnWidth, mnHeight );
+ aReader.readPairProperty( maSize );
aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
aReader.readIntProperty< sal_Int32 >( mnMin );
aReader.readIntProperty< sal_Int32 >( mnMax );
@@ -1092,114 +1338,292 @@ void AxScrollBarModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.readIntProperty< sal_Int16 >( mnPropThumb );
aReader.readIntProperty< sal_Int32 >( mnDelay );
aReader.skipPictureProperty(); // mouse icon
- aReader.finalizeImport();
+ return aReader.finalizeImport();
}
-void AxScrollBarModel::convertProperties( AxControlHelper& rHelper, PropertyMap& rPropMap ) const
+void AxScrollBarModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
- sal_Int32 nMin = ::std::min( mnMin, mnMax );
- sal_Int32 nMax = ::std::max( mnMin, mnMax );
- rPropMap.setProperty( PROP_SymbolColor, rHelper.convertColor( mnArrowColor ) );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
- rPropMap.setProperty( PROP_ScrollValueMin, nMin );
- rPropMap.setProperty( PROP_ScrollValueMax, nMax );
- rPropMap.setProperty( PROP_LineIncrement, mnSmallChange );
- rPropMap.setProperty( PROP_BlockIncrement, mnLargeChange );
- rPropMap.setProperty( PROP_DefaultScrollValue, mnPosition );
rPropMap.setProperty( PROP_RepeatDelay, mnDelay );
rPropMap.setProperty( PROP_Border, API_BORDER_NONE );
- if( (mnPropThumb == AX_PROPTHUMB_ON) && (nMin < nMax) && (mnLargeChange > 0) )
+ if( (mnPropThumb == AX_PROPTHUMB_ON) && (mnMin != mnMax) && (mnLargeChange > 0) )
{
- double fInterval = nMax - nMin; // prevent integer overflow (fInterval+mnLargeChange may become 0 when int is used)
+ // use double to prevent integer overflow in division (fInterval+mnLargeChange may become 0 when performed as int)
+ double fInterval = fabs( static_cast< double >( mnMax - mnMin ) );
sal_Int32 nThumbLen = getLimitedValue< sal_Int32, double >( (fInterval * mnLargeChange) / (fInterval + mnLargeChange), 1, SAL_MAX_INT32 );
rPropMap.setProperty( PROP_VisibleSize, nThumbLen );
}
- lclConvertBackground( rHelper, rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
- lclConvertOrientation( rHelper, rPropMap, mnOrientation, mnWidth, mnHeight );
- AxControlModelBase::convertProperties( rHelper, rPropMap );
+ rConv.convertColor( rPropMap, PROP_SymbolColor, mnArrowColor );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
+ rConv.convertAxOrientation( rPropMap, maSize, mnOrientation );
+ rConv.convertScrollBar( rPropMap, mnMin, mnMax, mnPosition, mnSmallChange, mnLargeChange, mbAwtModel );
+ AxControlModelBase::convertProperties( rPropMap, rConv );
+}
+
+// ============================================================================
+
+AxContainerModelBase::AxContainerModelBase() :
+ AxFontDataModel( false ), // no support for Align property
+ maLogicalSize( AX_CONTAINER_DEFWIDTH, AX_CONTAINER_DEFHEIGHT ),
+ maScrollPos( 0, 0 ),
+ mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
+ mnTextColor( AX_SYSCOLOR_BUTTONTEXT ),
+ mnFlags( AX_CONTAINER_DEFFLAGS ),
+ mnBorderColor( AX_SYSCOLOR_BUTTONTEXT ),
+ mnBorderStyle( AX_BORDERSTYLE_NONE ),
+ mnScrollBars( AX_CONTAINER_SCR_NONE ),
+ mnCycleType( AX_CONTAINER_CYCLEALL ),
+ mnSpecialEffect( AX_SPECIALEFFECT_FLAT ),
+ mnPicAlign( AX_PICALIGN_CENTER ),
+ mnPicSizeMode( AX_PICSIZE_CLIP ),
+ mbPicTiling( false )
+{
+ setAwtModelMode();
+ // different default size for frame
+ maSize = AxPairData( AX_CONTAINER_DEFWIDTH, AX_CONTAINER_DEFHEIGHT );
+}
+
+void AxContainerModelBase::importProperty( sal_Int32 nPropId, const OUString& rValue )
+{
+ if( nPropId == XML_Caption )
+ maCaption = rValue;
+}
+
+bool AxContainerModelBase::importBinaryModel( BinaryInputStream& rInStrm )
+{
+ AxBinaryPropertyReader aReader( rInStrm );
+ aReader.skipUndefinedProperty();
+ aReader.readIntProperty< sal_uInt32 >( mnBackColor );
+ aReader.readIntProperty< sal_uInt32 >( mnTextColor );
+ aReader.skipIntProperty< sal_uInt32 >(); // next availbale control ID
+ aReader.skipUndefinedProperty();
+ aReader.skipUndefinedProperty();
+ aReader.readIntProperty< sal_uInt32 >( mnFlags );
+ aReader.readIntProperty< sal_uInt8 >( mnBorderStyle );
+ aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
+ aReader.readIntProperty< sal_uInt8 >( mnScrollBars );
+ aReader.readPairProperty( maSize );
+ aReader.readPairProperty( maLogicalSize );
+ aReader.readPairProperty( maScrollPos );
+ aReader.skipIntProperty< sal_uInt32 >(); // number of control groups
+ aReader.skipUndefinedProperty();
+ aReader.skipPictureProperty(); // mouse icon
+ aReader.readIntProperty< sal_uInt8 >( mnCycleType );
+ aReader.readIntProperty< sal_uInt8 >( mnSpecialEffect );
+ aReader.readIntProperty< sal_uInt32 >( mnBorderColor );
+ aReader.readStringProperty( maCaption );
+ aReader.readFontProperty( maFontData );
+ aReader.readPictureProperty( maPictureData );
+ aReader.skipIntProperty< sal_Int32 >(); // zoom
+ aReader.readIntProperty< sal_uInt8 >( mnPicAlign );
+ aReader.readBoolProperty( mbPicTiling );
+ aReader.readIntProperty< sal_uInt8 >( mnPicSizeMode );
+ aReader.skipIntProperty< sal_uInt32 >(); // shape cookie
+ aReader.skipIntProperty< sal_uInt32 >(); // draw buffer size
+ return aReader.finalizeImport();
+}
+
+bool AxContainerModelBase::importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable )
+{
+ bool bValid = true;
+ orClassTable.clear();
+ if( !getFlag( mnFlags, AX_CONTAINER_NOCLASSTABLE ) )
+ {
+ sal_uInt16 nCount = rInStrm.readuInt16();
+ for( sal_uInt16 nIndex = 0; bValid && (nIndex < nCount); ++nIndex )
+ {
+ orClassTable.push_back( OUString() );
+ AxBinaryPropertyReader aReader( rInStrm );
+ aReader.readGuidProperty( orClassTable.back() );
+ aReader.skipGuidProperty(); // source interface GUID
+ aReader.skipUndefinedProperty();
+ aReader.skipGuidProperty(); // default interface GUID
+ aReader.skipIntProperty< sal_uInt32 >(); // class table and var flags
+ aReader.skipIntProperty< sal_uInt32 >(); // method count
+ aReader.skipIntProperty< sal_Int32 >(); // IDispatch identifier for linked cell access
+ aReader.skipIntProperty< sal_uInt16 >(); // get function index for linked cell access
+ aReader.skipIntProperty< sal_uInt16 >(); // put function index for linked cell access
+ aReader.skipIntProperty< sal_uInt16 >(); // linked cell access property type
+ aReader.skipIntProperty< sal_uInt16 >(); // get function index of value
+ aReader.skipIntProperty< sal_uInt16 >(); // put function index of value
+ aReader.skipIntProperty< sal_uInt16 >(); // value type
+ aReader.skipIntProperty< sal_Int32 >(); // IDispatch identifier for source range access
+ aReader.skipIntProperty< sal_uInt16 >(); // get function index for source range access
+ bValid = aReader.finalizeImport();
+ }
+ }
+ return bValid;
}
// ============================================================================
-AxControl::AxControl( const OUString& rName ) :
+AxFrameModel::AxFrameModel()
+{
+}
+
+ApiControlType AxFrameModel::getControlType() const
+{
+ return API_CONTROL_GROUPBOX;
+}
+
+void AxFrameModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
+{
+ rPropMap.setProperty( PROP_Label, maCaption );
+ rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) );
+ AxContainerModelBase::convertProperties( rPropMap, rConv );
+}
+
+// ============================================================================
+
+AxUserFormModel::AxUserFormModel()
+{
+}
+
+ApiControlType AxUserFormModel::getControlType() const
+{
+ return API_CONTROL_DIALOG;
+}
+
+void AxUserFormModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
+{
+ rPropMap.setProperty( PROP_Title, maCaption );
+ rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
+ AxContainerModelBase::convertProperties( rPropMap, rConv );
+}
+
+// ============================================================================
+
+EmbeddedControl::EmbeddedControl( const OUString& rName ) :
maName( rName )
{
}
-AxControl::~AxControl()
+EmbeddedControl::~EmbeddedControl()
{
}
-AxControlModelBase* AxControl::createModel( const OUString& rClassId )
+ControlModelRef EmbeddedControl::createModel( const OUString& rClassId )
{
- // TODO: move into a factory
- maClassId = rClassId.toAsciiUpperCase();
- if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{D7053240-CE69-11CD-A777-00DD01143C57}" ) ) ) // Forms.CommandButton.1
+ OUString aClassId = rClassId.toAsciiUpperCase();
+ if( aClassId.equalsAscii( AX_GUID_COMMANDBUTTON ) )
mxModel.reset( new AxCommandButtonModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}" ) ) ) // Forms.Label.1
+ else if( aClassId.equalsAscii( AX_GUID_LABEL ) )
mxModel.reset( new AxLabelModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{4C599241-6926-101B-9992-00000B65C6F9}" ) ) ) // Forms.Image.1
+ else if( aClassId.equalsAscii( AX_GUID_IMAGE ) )
mxModel.reset( new AxImageModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{8BD21D60-EC42-11CE-9E0D-00AA006002F3}" ) ) ) // Forms.ToggleButton.1
+ else if( aClassId.equalsAscii( AX_GUID_TOGGLEBUTTON ) )
mxModel.reset( new AxToggleButtonModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{8BD21D40-EC42-11CE-9E0D-00AA006002F3}" ) ) ) // Forms.CheckBox.1
+ else if( aClassId.equalsAscii( AX_GUID_CHECKBOX ) )
mxModel.reset( new AxCheckBoxModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{8BD21D50-EC42-11CE-9E0D-00AA006002F3}" ) ) ) // Forms.OptionButton.1
+ else if( aClassId.equalsAscii( AX_GUID_OPTIONBUTTON ) )
mxModel.reset( new AxOptionButtonModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{8BD21D10-EC42-11CE-9E0D-00AA006002F3}" ) ) ) // Forms.TextBox.1
+ else if( aClassId.equalsAscii( AX_GUID_TEXTBOX ) )
mxModel.reset( new AxTextBoxModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{8BD21D20-EC42-11CE-9E0D-00AA006002F3}" ) ) ) // Forms.ListBox.1
+ else if( aClassId.equalsAscii( AX_GUID_LISTBOX ) )
mxModel.reset( new AxListBoxModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{8BD21D30-EC42-11CE-9E0D-00AA006002F3}" ) ) ) // Forms.ComboBox.1
+ else if( aClassId.equalsAscii( AX_GUID_COMBOBOX ) )
mxModel.reset( new AxComboBoxModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{79176FB0-B7F2-11CE-97EF-00AA006D2776}" ) ) ) // Forms.SpinButton.1
+ else if( aClassId.equalsAscii( AX_GUID_SPINBUTTON ) )
mxModel.reset( new AxSpinButtonModel );
- else if( maClassId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{DFD181E0-5E2F-11CE-A449-00AA004A803D}" ) ) ) // Forms.ScrollBar.1
+ else if( aClassId.equalsAscii( AX_GUID_SCROLLBAR ) )
mxModel.reset( new AxScrollBarModel );
+ else if( aClassId.equalsAscii( AX_GUID_FRAME ) )
+ mxModel.reset( new AxFrameModel );
+ else if( aClassId.equalsAscii( COMCTL_GUID_SCROLLBAR_60 ) )
+ mxModel.reset( new ComCtlScrollBarModel( 6 ) );
else
mxModel.reset();
- return mxModel.get();
+ // embedded controls are form component instances
+ if( mxModel.get() )
+ mxModel->setFormComponentMode();
+
+ return mxModel;
}
-void AxControl::importBinaryModel( BinaryInputStream& rInStrm )
+OUString EmbeddedControl::getServiceName() const
{
- if( AxControlModelBase* pModel = createModel( OleHelper::importGuid( rInStrm ) ) )
- pModel->importBinaryModel( rInStrm );
+ return mxModel.get() ? mxModel->getServiceName() : OUString();
}
-Reference< XControlModel > AxControl::convertAndInsert( AxControlHelper& rHelper ) const
+bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv ) const
{
- Reference< XControlModel > xCtrlModel;
- if( mxModel.get() ) try
+ if( mxModel.get() && rxCtrlModel.is() && (maName.getLength() > 0) )
{
- Reference< XIndexContainer > xFormIC( rHelper.getControlForm(), UNO_QUERY_THROW );
+ PropertyMap aPropMap;
+ aPropMap.setProperty( PROP_Name, maName );
+ mxModel->convertProperties( aPropMap, rConv );
+ PropertySet aPropSet( rxCtrlModel );
+ aPropSet.setProperties( aPropMap );
+ return true;
+ }
+ return false;
+}
- // document model creates the form control model
- xCtrlModel.set( rHelper.getFilter().getModelFactory()->createInstance( mxModel->getServiceName() ), UNO_QUERY_THROW );
- Reference< XFormComponent > xFormComp( xCtrlModel, UNO_QUERY_THROW );
+// ============================================================================
+
+EmbeddedForm::EmbeddedForm( const Reference< XMultiServiceFactory >& rxModelFactory,
+ const Reference< XDrawPage >& rxDrawPage, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
+ ControlConverter( rGraphicHelper, bDefaultColorBgr ),
+ mxModelFactory( rxModelFactory ),
+ mxFormsSupp( rxDrawPage, UNO_QUERY )
+{
+ OSL_ENSURE( mxModelFactory.is(), "EmbeddedForm::EmbeddedForm - missing service factory" );
+}
+
+Reference< XControlModel > EmbeddedForm::convertAndInsert( const EmbeddedControl& rControl )
+{
+ if( mxModelFactory.is() && rControl.hasModel() ) try
+ {
+ // create the UNO control model
+ OUString aServiceName = rControl.getServiceName();
+ Reference< XFormComponent > xFormComp( mxModelFactory->createInstance( aServiceName ), UNO_QUERY_THROW );
+ Reference< XControlModel > xCtrlModel( xFormComp, UNO_QUERY_THROW );
- // insert control model into the passed form
+ // insert the control into the form
+ Reference< XIndexContainer > xFormIC( createForm(), UNO_SET_THROW );
sal_Int32 nNewIndex = xFormIC->getCount();
xFormIC->insertByIndex( nNewIndex, Any( xFormComp ) );
- // convert all control properties
- PropertyMap aPropMap;
- aPropMap.setProperty( PROP_Name, maName );
- mxModel->convertProperties( rHelper, aPropMap );
-
- PropertySet aPropSet( xCtrlModel );
- aPropSet.setProperties( aPropMap );
+ // convert the control properties
+ if( rControl.convertProperties( xCtrlModel, *this ) )
+ return xCtrlModel;
}
catch( Exception& )
{
- xCtrlModel.clear(); // on error: forget the created form control model
}
- return xCtrlModel;
+ return Reference< XControlModel >();
+}
+
+Reference< XIndexContainer > EmbeddedForm::createForm()
+{
+ if( mxFormsSupp.is() )
+ {
+ try
+ {
+ Reference< XNameContainer > xFormsNC( mxFormsSupp->getForms(), UNO_SET_THROW );
+ OUString aFormName = CREATE_OUSTRING( "Standard" );
+ if( xFormsNC->hasByName( aFormName ) )
+ {
+ mxFormIC.set( xFormsNC->getByName( aFormName ), UNO_QUERY_THROW );
+ }
+ else if( mxModelFactory.is() )
+ {
+ Reference< XForm > xForm( mxModelFactory->createInstance( CREATE_OUSTRING( "com.sun.star.form.component.Form" ) ), UNO_QUERY_THROW );
+ xFormsNC->insertByName( aFormName, Any( xForm ) );
+ mxFormIC.set( xForm, UNO_QUERY_THROW );
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ // always clear the forms supplier to not try to create the form again
+ mxFormsSupp.clear();
+ }
+ return mxFormIC;
}
// ============================================================================
} // namespace ole
} // namespace oox
-
diff --git a/oox/source/ole/axcontrolfragment.cxx b/oox/source/ole/axcontrolfragment.cxx
index e641ec40d71b..ecd782da2cb0 100644
--- a/oox/source/ole/axcontrolfragment.cxx
+++ b/oox/source/ole/axcontrolfragment.cxx
@@ -30,8 +30,12 @@
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/ole/axcontrol.hxx"
+#include "oox/ole/olehelper.hxx"
+#include "oox/ole/olestorage.hxx"
using ::rtl::OUString;
+using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::uno::Reference;
using ::oox::core::ContextHandler2;
using ::oox::core::ContextHandlerRef;
using ::oox::core::FragmentHandler2;
@@ -42,7 +46,7 @@ namespace ole {
// ============================================================================
-AxControlPropertyContext::AxControlPropertyContext( FragmentHandler2& rFragment, AxControlModelBase& rModel ) :
+AxControlPropertyContext::AxControlPropertyContext( FragmentHandler2& rFragment, ControlModelBase& rModel ) :
ContextHandler2( rFragment ),
mrModel( rModel ),
mnPropId( XML_TOKEN_INVALID )
@@ -87,7 +91,7 @@ ContextHandlerRef AxControlPropertyContext::onCreateContext( sal_Int32 nElement,
// ============================================================================
-AxControlFragment::AxControlFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, AxControl& rControl ) :
+AxControlFragment::AxControlFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, EmbeddedControl& rControl ) :
FragmentHandler2( rFilter, rFragmentPath, true ),
mrControl( rControl )
{
@@ -101,7 +105,7 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
switch( rAttribs.getToken( AX_TOKEN( persistence ), XML_TOKEN_INVALID ) )
{
case XML_persistPropertyBag:
- if( AxControlModelBase* pModel = mrControl.createModel( aClassId ) )
+ if( ControlModelBase* pModel = mrControl.createModel( aClassId ).get() )
return new AxControlPropertyContext( *this, *pModel );
break;
@@ -113,10 +117,30 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
BinaryXInputStream aInStrm( getFilter().openInputStream( aFragmentPath ), true );
if( !aInStrm.isEof() )
{
- mrControl.importBinaryModel( aInStrm );
// binary stream contains a copy of the class ID, must be equal to attribute value
- OSL_ENSURE( !mrControl.getModel() || aClassId.equalsIgnoreAsciiCase( mrControl.getClassId() ),
+ OUString aStrmClassId = OleHelper::importGuid( aInStrm );
+ OSL_ENSURE( aClassId.equalsIgnoreAsciiCase( aStrmClassId ),
"AxControlFragment::importBinaryControl - form control class ID mismatch" );
+ if( ControlModelBase* pModel = mrControl.createModel( aStrmClassId ).get() )
+ pModel->importBinaryModel( aInStrm );
+ }
+ }
+ }
+ break;
+
+ case XML_persistStorage:
+ {
+ OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ if( aFragmentPath.getLength() > 0 )
+ {
+ Reference< XInputStream > xStrgStrm = getFilter().openInputStream( aFragmentPath );
+ if( xStrgStrm.is() )
+ {
+ OleStorage aStorage( getFilter().getGlobalFactory(), xStrgStrm, false );
+ BinaryXInputStream aInStrm( aStorage.openInputStream( CREATE_OUSTRING( "f" ) ), true );
+ if( !aInStrm.isEof() )
+ if( AxContainerModelBase* pModel = dynamic_cast< AxContainerModelBase* >( mrControl.createModel( aClassId ).get() ) )
+ pModel->importBinaryModel( aInStrm );
}
}
}
@@ -130,4 +154,3 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
} // namespace ole
} // namespace oox
-
diff --git a/oox/source/ole/axcontrolhelper.cxx b/oox/source/ole/axcontrolhelper.cxx
deleted file mode 100644
index 1ffb4343aaf5..000000000000
--- a/oox/source/ole/axcontrolhelper.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/ole/axcontrolhelper.hxx"
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/form/XForm.hpp>
-#include <com/sun/star/form/XFormsSupplier.hpp>
-#include "tokens.hxx"
-#include "oox/helper/containerhelper.hxx"
-#include "oox/core/filterbase.hxx"
-#include "oox/drawingml/color.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::drawing::XDrawPage;
-using ::com::sun::star::form::XForm;
-using ::com::sun::star::form::XFormsSupplier;
-using ::oox::core::FilterBase;
-
-namespace oox {
-namespace ole {
-
-// ============================================================================
-
-namespace {
-
-const sal_uInt32 AX_COLORTYPE_MASK = 0xFF000000;
-const sal_uInt32 AX_COLORTYPE_CLIENT = 0x00000000;
-const sal_uInt32 AX_COLORTYPE_PALETTE = 0x01000000;
-const sal_uInt32 AX_COLORTYPE_BGR = 0x02000000;
-const sal_uInt32 AX_COLORTYPE_SYSCOLOR = 0x80000000;
-
-const sal_uInt32 AX_PALETTECOLOR_MASK = 0x0000FFFF;
-const sal_uInt32 AX_BGRCOLOR_MASK = 0x00FFFFFF;
-const sal_uInt32 AX_SYSTEMCOLOR_MASK = 0x0000FFFF;
-
-// ----------------------------------------------------------------------------
-
-/** Returns the UNO RGB color from the passed encoded OLE BGR color. */
-inline sal_Int32 lclDecodeBgrColor( sal_uInt32 nAxColor )
-{
- return static_cast< sal_Int32 >( ((nAxColor & 0x0000FF) << 16) | (nAxColor & 0x00FF00) | ((nAxColor & 0xFF0000) >> 16) );
-}
-
-} // namespace
-
-// ============================================================================
-
-AxControlHelper::AxControlHelper( const FilterBase& rFilter, AxDefaultColorMode eColorMode ) :
- mrFilter( rFilter ),
- meColorMode( eColorMode ),
- mbHasFormQuerried( false )
-{
-}
-
-AxControlHelper::~AxControlHelper()
-{
-}
-
-Reference< XForm > AxControlHelper::getControlForm() const
-{
- if( !mbHasFormQuerried )
- {
- mbHasFormQuerried = true;
- mxForm = createControlForm(); // virtual call
- }
- return mxForm;
-}
-
-sal_Int32 AxControlHelper::convertColor( sal_uInt32 nAxColor ) const
-{
- static const sal_Int32 spnSystemColors[] =
- {
- XML_scrollBar, XML_background, XML_activeCaption, XML_inactiveCaption,
- XML_menu, XML_window, XML_windowFrame, XML_menuText,
- XML_windowText, XML_captionText, XML_activeBorder, XML_inactiveBorder,
- XML_appWorkspace, XML_highlight, XML_highlightText, XML_btnFace,
- XML_btnShadow, XML_grayText, XML_btnText, XML_inactiveCaptionText,
- XML_btnHighlight, XML_3dDkShadow, XML_3dLight, XML_infoText,
- XML_infoBk
- };
-
- switch( nAxColor & AX_COLORTYPE_MASK )
- {
- case AX_COLORTYPE_CLIENT:
- switch( meColorMode )
- {
- case AX_DEFAULTCOLORMODE_BGR: return lclDecodeBgrColor( nAxColor );
- case AX_DEFAULTCOLORMODE_PALETTE: return mrFilter.getPaletteColor( nAxColor & AX_PALETTECOLOR_MASK );
- }
- break;
-
- case AX_COLORTYPE_PALETTE:
- return mrFilter.getPaletteColor( nAxColor & AX_PALETTECOLOR_MASK );
-
- case AX_COLORTYPE_BGR:
- return lclDecodeBgrColor( nAxColor );
-
- case AX_COLORTYPE_SYSCOLOR:
- return mrFilter.getSystemColor( STATIC_ARRAY_SELECT( spnSystemColors, nAxColor & AX_SYSTEMCOLOR_MASK, XML_TOKEN_INVALID ), API_RGB_WHITE );
- }
- OSL_ENSURE( false, "AxControlHelper::convertColor - unknown color type" );
- return 0;
-}
-
-// ============================================================================
-
-AxEmbeddedControlHelper::AxEmbeddedControlHelper( const FilterBase& rFilter,
- const Reference< XDrawPage >& rxDrawPage, AxDefaultColorMode eColorMode ) :
- AxControlHelper( rFilter, eColorMode ),
- mxDrawPage( rxDrawPage )
-{
-}
-
-Reference< XForm > AxEmbeddedControlHelper::createControlForm() const
-{
- Reference< XForm > xForm;
- try
- {
- Reference< XFormsSupplier > xFormsSupplier( mxDrawPage, UNO_QUERY_THROW );
- Reference< XNameContainer > xFormsNC( xFormsSupplier->getForms(), UNO_SET_THROW );
- OUString aFormName = CREATE_OUSTRING( "Standard" );
- if( xFormsNC->hasByName( aFormName ) )
- {
- xFormsNC->getByName( aFormName ) >>= xForm;
- }
- else
- {
- Reference< XForm > xNewForm( getFilter().getModelFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.form.component.Form" ) ), UNO_QUERY_THROW );
- xFormsNC->insertByName( aFormName, Any( xNewForm ) );
- // return the form if insertion did not fail
- xForm = xNewForm;
- }
- }
- catch( Exception& )
- {
- }
- return xForm;
-}
-
-// ============================================================================
-
-} // namespace ole
-} // namespace oox
-
diff --git a/oox/source/ole/makefile.mk b/oox/source/ole/makefile.mk
index 5fe0c08dbd6f..4e01392d4a57 100644
--- a/oox/source/ole/makefile.mk
+++ b/oox/source/ole/makefile.mk
@@ -44,10 +44,14 @@ SLOFILES = \
$(SLO)$/axbinaryreader.obj \
$(SLO)$/axcontrol.obj \
$(SLO)$/axcontrolfragment.obj \
- $(SLO)$/axcontrolhelper.obj \
$(SLO)$/olehelper.obj \
$(SLO)$/oleobjecthelper.obj \
- $(SLO)$/vbainputstream.obj
+ $(SLO)$/olestorage.obj \
+ $(SLO)$/vbacontrol.obj \
+ $(SLO)$/vbahelper.obj \
+ $(SLO)$/vbainputstream.obj \
+ $(SLO)$/vbamodule.obj \
+ $(SLO)$/vbaproject.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index f26fb9d0cec3..0a0796e15a7e 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -27,7 +27,9 @@
#include "oox/ole/olehelper.hxx"
#include <rtl/ustrbuf.hxx>
+#include "tokens.hxx"
#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/graphichelper.hxx"
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -39,9 +41,24 @@ namespace ole {
namespace {
-const sal_Char* const OLE_GUID_STDFONT = "{0BE35203-8F91-11CE-9DE3-00AA004BB851}";
-const sal_Char* const OLE_GUID_STDPIC = "{0BE35204-8F91-11CE-9DE3-00AA004BB851}";
-const sal_Char* const OLE_GUID_STDHLINK = "{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}";
+const sal_uInt32 OLE_COLORTYPE_MASK = 0xFF000000;
+const sal_uInt32 OLE_COLORTYPE_CLIENT = 0x00000000;
+const sal_uInt32 OLE_COLORTYPE_PALETTE = 0x01000000;
+const sal_uInt32 OLE_COLORTYPE_BGR = 0x02000000;
+const sal_uInt32 OLE_COLORTYPE_SYSCOLOR = 0x80000000;
+
+const sal_uInt32 OLE_PALETTECOLOR_MASK = 0x0000FFFF;
+const sal_uInt32 OLE_BGRCOLOR_MASK = 0x00FFFFFF;
+const sal_uInt32 OLE_SYSTEMCOLOR_MASK = 0x0000FFFF;
+
+/** Returns the UNO RGB color from the passed encoded OLE BGR color. */
+inline sal_Int32 lclDecodeBgrColor( sal_uInt32 nOleColor )
+{
+ return static_cast< sal_Int32 >( ((nOleColor & 0x0000FF) << 16) | (nOleColor & 0x00FF00) | ((nOleColor & 0xFF0000) >> 16) );
+}
+
+// ----------------------------------------------------------------------------
+
const sal_Char* const OLE_GUID_URLMONIKER = "{79EAC9E0-BAF9-11CE-8C82-00AA004BA90B}";
const sal_Char* const OLE_GUID_FILEMONIKER = "{00000303-0000-0000-C000-000000000046}";
@@ -69,14 +86,15 @@ void lclAppendHex( OUStringBuffer& orBuffer, Type nValue )
orBuffer.setCharAt( nCharIdx, spcHexChars[ nValue & 0xF ] );
}
-OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc, bool bUnicode )
+OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, bool bUnicode )
{
OUString aRet;
sal_Int32 nChars = rInStrm.readInt32();
if( nChars > 0 )
{
sal_Int32 nReadChars = getLimitedValue< sal_Int32, sal_Int32 >( nChars, 0, SAL_MAX_UINT16 );
- aRet = bUnicode ? rInStrm.readUnicodeArray( nReadChars, true ) : rInStrm.readCharArrayUC( nReadChars, eTextEnc, true );
+ // byte strings are always in ANSI (Windows 1252) encoding
+ aRet = bUnicode ? rInStrm.readUnicodeArray( nReadChars, true ) : rInStrm.readCharArrayUC( nReadChars, RTL_TEXTENCODING_MS_1252, true );
// strings are NUL terminated, remove trailing NUL and possible other garbage
sal_Int32 nNulPos = aRet.indexOf( '\0' );
if( nNulPos >= 0 )
@@ -91,6 +109,58 @@ OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTe
// ============================================================================
+StdFontInfo::StdFontInfo() :
+ mnHeight( 0 ),
+ mnWeight( OLE_STDFONT_NORMAL ),
+ mnCharSet( WINDOWS_CHARSET_ANSI ),
+ mnFlags( 0 )
+{
+}
+
+StdFontInfo::StdFontInfo( const ::rtl::OUString& rName, sal_uInt32 nHeight,
+ sal_uInt16 nWeight, sal_uInt16 nCharSet, sal_uInt8 nFlags ) :
+ maName( rName ),
+ mnHeight( nHeight ),
+ mnWeight( nWeight ),
+ mnCharSet( nCharSet ),
+ mnFlags( nFlags )
+{
+}
+
+// ============================================================================
+
+/*static*/ sal_Int32 OleHelper::decodeOleColor(
+ const GraphicHelper& rGraphicHelper, sal_uInt32 nOleColor, bool bDefaultColorBgr )
+{
+ static const sal_Int32 spnSystemColors[] =
+ {
+ XML_scrollBar, XML_background, XML_activeCaption, XML_inactiveCaption,
+ XML_menu, XML_window, XML_windowFrame, XML_menuText,
+ XML_windowText, XML_captionText, XML_activeBorder, XML_inactiveBorder,
+ XML_appWorkspace, XML_highlight, XML_highlightText, XML_btnFace,
+ XML_btnShadow, XML_grayText, XML_btnText, XML_inactiveCaptionText,
+ XML_btnHighlight, XML_3dDkShadow, XML_3dLight, XML_infoText,
+ XML_infoBk
+ };
+
+ switch( nOleColor & OLE_COLORTYPE_MASK )
+ {
+ case OLE_COLORTYPE_CLIENT:
+ return bDefaultColorBgr ? lclDecodeBgrColor( nOleColor ) : rGraphicHelper.getPaletteColor( nOleColor & OLE_PALETTECOLOR_MASK );
+
+ case OLE_COLORTYPE_PALETTE:
+ return rGraphicHelper.getPaletteColor( nOleColor & OLE_PALETTECOLOR_MASK );
+
+ case OLE_COLORTYPE_BGR:
+ return lclDecodeBgrColor( nOleColor );
+
+ case OLE_COLORTYPE_SYSCOLOR:
+ return rGraphicHelper.getSystemColor( STATIC_ARRAY_SELECT( spnSystemColors, nOleColor & OLE_SYSTEMCOLOR_MASK, XML_TOKEN_INVALID ), API_RGB_WHITE );
+ }
+ OSL_ENSURE( false, "OleHelper::decodeOleColor - unknown color type" );
+ return API_RGB_BLACK;
+}
+
/*static*/ OUString OleHelper::importGuid( BinaryInputStream& rInStrm )
{
OUStringBuffer aBuffer;
@@ -110,6 +180,24 @@ OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTe
return aBuffer.makeStringAndClear();
}
+/*static*/ bool OleHelper::importStdFont( StdFontInfo& orFontInfo, BinaryInputStream& rInStrm, bool bWithGuid )
+{
+ if( bWithGuid )
+ {
+ bool bIsStdFont = importGuid( rInStrm ).equalsAscii( OLE_GUID_STDFONT );
+ OSL_ENSURE( bIsStdFont, "OleHelper::importStdFont - unexpected header GUID, expected StdFont" );
+ if( !bIsStdFont )
+ return false;
+ }
+
+ sal_uInt8 nVersion, nNameLen;
+ rInStrm >> nVersion >> orFontInfo.mnCharSet >> orFontInfo.mnFlags >> orFontInfo.mnWeight >> orFontInfo.mnHeight >> nNameLen;
+ // according to spec the name is ASCII
+ orFontInfo.maName = rInStrm.readCharArrayUC( nNameLen, RTL_TEXTENCODING_ASCII_US );
+ OSL_ENSURE( nVersion <= 1, "OleHelper::importStdFont - wrong version" );
+ return !rInStrm.isEof() && (nVersion <= 1);
+}
+
/*static*/ bool OleHelper::importStdPic( StreamDataSequence& orGraphicData, BinaryInputStream& rInStrm, bool bWithGuid )
{
if( bWithGuid )
@@ -127,7 +215,7 @@ OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTe
return !rInStrm.isEof() && (nStdPicId == OLE_STDPIC_ID) && (nBytes > 0) && (rInStrm.readData( orGraphicData, nBytes ) == nBytes);
}
-/*static*/ bool OleHelper::importStdHlink( StdHlinkInfo& orHlinkInfo, BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc, bool bWithGuid )
+/*static*/ bool OleHelper::importStdHlink( StdHlinkInfo& orHlinkInfo, BinaryInputStream& rInStrm, bool bWithGuid )
{
if( bWithGuid )
{
@@ -145,10 +233,10 @@ OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTe
// display string
if( getFlag( nFlags, OLE_STDHLINK_HASDISPLAY ) )
- orHlinkInfo.maDisplay = lclReadStdHlinkString( rInStrm, eTextEnc, true );
+ orHlinkInfo.maDisplay = lclReadStdHlinkString( rInStrm, true );
// frame string
if( getFlag( nFlags, OLE_STDHLINK_HASFRAME ) )
- orHlinkInfo.maFrame = lclReadStdHlinkString( rInStrm, eTextEnc, true );
+ orHlinkInfo.maFrame = lclReadStdHlinkString( rInStrm, true );
// target
if( getFlag( nFlags, OLE_STDHLINK_HASTARGET ) )
@@ -156,7 +244,7 @@ OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTe
if( getFlag( nFlags, OLE_STDHLINK_ASSTRING ) )
{
OSL_ENSURE( getFlag( nFlags, OLE_STDHLINK_ABSOLUTE ), "OleHelper::importStdHlink - link not absolute" );
- orHlinkInfo.maTarget = lclReadStdHlinkString( rInStrm, eTextEnc, true );
+ orHlinkInfo.maTarget = lclReadStdHlinkString( rInStrm, true );
}
else // hyperlink moniker
{
@@ -167,7 +255,7 @@ OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTe
sal_Int16 nUpLevels;
rInStrm >> nUpLevels;
OSL_ENSURE( (nUpLevels == 0) || !getFlag( nFlags, OLE_STDHLINK_ABSOLUTE ), "OleHelper::importStdHlink - absolute filename with upcount" );
- orHlinkInfo.maTarget = lclReadStdHlinkString( rInStrm, eTextEnc, false );
+ orHlinkInfo.maTarget = lclReadStdHlinkString( rInStrm, false );
rInStrm.skip( 24 );
sal_Int32 nBytes = rInStrm.readInt32();
if( nBytes > 0 )
@@ -200,9 +288,9 @@ OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, rtl_TextEncoding eTe
// target location
if( getFlag( nFlags, OLE_STDHLINK_HASLOCATION ) )
- orHlinkInfo.maLocation = lclReadStdHlinkString( rInStrm, eTextEnc, true );
+ orHlinkInfo.maLocation = lclReadStdHlinkString( rInStrm, true );
- return true;
+ return !rInStrm.isEof();
}
// ============================================================================
diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx
new file mode 100755
index 000000000000..0ca2992d47ad
--- /dev/null
+++ b/oox/source/ole/olestorage.cxx
@@ -0,0 +1,423 @@
+/*************************************************************************
+ *
+ * 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 "oox/ole/olestorage.hxx"
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include "oox/helper/helper.hxx"
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/binaryoutputstream.hxx"
+
+using ::rtl::OUString;
+using ::com::sun::star::container::XNameContainer;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::embed::XStorage;
+using ::com::sun::star::embed::XTransactedObject;
+using ::com::sun::star::io::BufferSizeExceededException;
+using ::com::sun::star::io::IOException;
+using ::com::sun::star::io::NotConnectedException;
+using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XSeekable;
+using ::com::sun::star::io::XStream;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+namespace {
+
+typedef ::cppu::WeakImplHelper2< XSeekable, XOutputStream > OleOutputStreamBase;
+
+/** Implementation of an OLE storage output stream that inserts itself into the
+ storage when it is closed.
+ */
+class OleOutputStream : public OleOutputStreamBase
+{
+public:
+ explicit OleOutputStream(
+ const Reference< XMultiServiceFactory >& rxFactory,
+ const Reference< XNameContainer >& rxStorage,
+ const OUString& rElementName );
+ virtual ~OleOutputStream();
+
+ virtual void SAL_CALL seek( sal_Int64 nPos ) throw( IllegalArgumentException, IOException, RuntimeException );
+ virtual sal_Int64 SAL_CALL getPosition() throw( IOException, RuntimeException );
+ virtual sal_Int64 SAL_CALL getLength() throw( IOException, RuntimeException );
+
+ virtual void SAL_CALL writeBytes( const Sequence< sal_Int8 >& rData ) throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException );
+ virtual void SAL_CALL flush() throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException );
+ virtual void SAL_CALL closeOutput() throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException );
+
+private:
+ void ensureSeekable() const throw( IOException );
+ void ensureConnected() const throw( NotConnectedException );
+
+private:
+ Reference< XNameContainer > mxStorage;
+ Reference< XStream > mxTempFile;
+ Reference< XOutputStream > mxOutStrm;
+ Reference< XSeekable > mxSeekable;
+ OUString maElementName;
+};
+
+// ----------------------------------------------------------------------------
+
+OleOutputStream::OleOutputStream( const Reference< XMultiServiceFactory >& rxFactory,
+ const Reference< XNameContainer >& rxStorage, const OUString& rElementName ) :
+ mxStorage( rxStorage ),
+ maElementName( rElementName )
+{
+ try
+ {
+ mxTempFile.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ mxOutStrm = mxTempFile->getOutputStream();
+ mxSeekable.set( mxOutStrm, UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+OleOutputStream::~OleOutputStream()
+{
+}
+
+void SAL_CALL OleOutputStream::seek( sal_Int64 nPos ) throw( IllegalArgumentException, IOException, RuntimeException )
+{
+ ensureSeekable();
+ mxSeekable->seek( nPos );
+}
+
+sal_Int64 SAL_CALL OleOutputStream::getPosition() throw( IOException, RuntimeException )
+{
+ ensureSeekable();
+ return mxSeekable->getPosition();
+}
+
+sal_Int64 SAL_CALL OleOutputStream::getLength() throw( IOException, RuntimeException )
+{
+ ensureSeekable();
+ return mxSeekable->getLength();
+}
+
+void SAL_CALL OleOutputStream::writeBytes( const Sequence< sal_Int8 >& rData ) throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
+{
+ ensureConnected();
+ mxOutStrm->writeBytes( rData );
+}
+
+void SAL_CALL OleOutputStream::flush() throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
+{
+ ensureConnected();
+ mxOutStrm->flush();
+}
+
+void SAL_CALL OleOutputStream::closeOutput() throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
+{
+ ensureConnected();
+ ensureSeekable();
+ // remember the class members
+ Reference< XOutputStream > xOutStrm = mxOutStrm;
+ Reference< XSeekable > xSeekable = mxSeekable;
+ // reset all class members
+ mxOutStrm.clear();
+ mxSeekable.clear();
+ // close stream (and let it throw something if needed)
+ xOutStrm->closeOutput();
+ // on success, insert the stream into the OLE storage (must be seeked back before)
+ xSeekable->seek( 0 );
+ if( !ContainerHelper::insertByName( mxStorage, maElementName, Any( mxTempFile ) ) )
+ throw IOException();
+}
+
+void OleOutputStream::ensureSeekable() const throw( IOException )
+{
+ if( !mxSeekable.is() )
+ throw IOException();
+}
+
+void OleOutputStream::ensureConnected() const throw( NotConnectedException )
+{
+ if( !mxOutStrm.is() )
+ throw NotConnectedException();
+}
+
+} // namespace
+
+// ============================================================================
+
+OleStorage::OleStorage(
+ const Reference< XMultiServiceFactory >& rxFactory,
+ const Reference< XInputStream >& rxInStream,
+ bool bBaseStreamAccess ) :
+ StorageBase( rxInStream, bBaseStreamAccess ),
+ mxFactory( rxFactory ),
+ mpParentStorage( 0 )
+{
+ OSL_ENSURE( mxFactory.is(), "OleStorage::OleStorage - missing service factory" );
+ initStorage( rxInStream );
+}
+
+OleStorage::OleStorage(
+ const Reference< XMultiServiceFactory >& rxFactory,
+ const Reference< XStream >& rxOutStream,
+ bool bBaseStreamAccess ) :
+ StorageBase( rxOutStream, bBaseStreamAccess ),
+ mxFactory( rxFactory ),
+ mpParentStorage( 0 )
+{
+ OSL_ENSURE( mxFactory.is(), "OleStorage::OleStorage - missing service factory" );
+ initStorage( rxOutStream );
+}
+
+OleStorage::OleStorage(
+ const OleStorage& rParentStorage,
+ const Reference< XNameContainer >& rxStorage,
+ const OUString& rElementName,
+ bool bReadOnly ) :
+ StorageBase( rParentStorage, rElementName, bReadOnly ),
+ mxFactory( rParentStorage.mxFactory ),
+ mxStorage( rxStorage ),
+ mpParentStorage( &rParentStorage )
+{
+ OSL_ENSURE( mxStorage.is(), "OleStorage::OleStorage - missing substorage elements" );
+}
+
+OleStorage::OleStorage(
+ const OleStorage& rParentStorage,
+ const Reference< XStream >& rxOutStream,
+ const OUString& rElementName ) :
+ StorageBase( rParentStorage, rElementName, false ),
+ mxFactory( rParentStorage.mxFactory ),
+ mpParentStorage( &rParentStorage )
+{
+ initStorage( rxOutStream );
+}
+
+OleStorage::~OleStorage()
+{
+}
+
+// ----------------------------------------------------------------------------
+
+void OleStorage::initStorage( const Reference< XInputStream >& rxInStream )
+{
+ // if stream is not seekable, create temporary copy
+ Reference< XInputStream > xInStrm = rxInStream;
+ if( !Reference< XSeekable >( xInStrm, UNO_QUERY ).is() ) try
+ {
+ Reference< XStream > xTempFile( mxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ {
+ Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW );
+ /* Pass false to both binary stream objects to keep the UNO
+ streams alive. Life time of these streams is controlled by the
+ tempfile implementation. */
+ BinaryXOutputStream aOutStrm( xOutStrm, false );
+ BinaryXInputStream aInStrm( xInStrm, false );
+ aInStrm.copyToStream( aOutStrm );
+ } // scope closes output stream of tempfile
+ xInStrm = xTempFile->getInputStream();
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "OleStorage::initStorage - cannot create temporary copy of input stream" );
+ }
+
+ // create base storage object
+ if( xInStrm.is() ) try
+ {
+ Sequence< Any > aArgs( 2 );
+ aArgs[ 0 ] <<= xInStrm;
+ aArgs[ 1 ] <<= true; // true = do not create a copy of the input stream
+ mxStorage.set( mxFactory->createInstanceWithArguments(
+ CREATE_OUSTRING( "com.sun.star.embed.OLESimpleStorage" ), aArgs ), UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+void OleStorage::initStorage( const Reference< XStream >& rxOutStream )
+{
+ // create base storage object
+ if( rxOutStream.is() ) try
+ {
+ Sequence< Any > aArgs( 2 );
+ aArgs[ 0 ] <<= rxOutStream;
+ aArgs[ 1 ] <<= true; // true = do not create a copy of the stream
+ mxStorage.set( mxFactory->createInstanceWithArguments(
+ CREATE_OUSTRING( "com.sun.star.embed.OLESimpleStorage" ), aArgs ), UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// StorageBase interface ------------------------------------------------------
+
+bool OleStorage::implIsStorage() const
+{
+ if( mxStorage.is() ) try
+ {
+ /* If this is not an OLE storage, hasElements() of the OLESimpleStorage
+ implementation throws an exception. But we do not return the result
+ of hasElements(), because an empty storage is a valid storage too. */
+ mxStorage->hasElements();
+ return true;
+ }
+ catch( Exception& )
+ {
+ }
+ return false;
+}
+
+Reference< XStorage > OleStorage::implGetXStorage() const
+{
+ OSL_ENSURE( false, "OleStorage::getXStorage - not implemented" );
+ return Reference< XStorage >();
+}
+
+void OleStorage::implGetElementNames( ::std::vector< OUString >& orElementNames ) const
+{
+ Sequence< OUString > aNames;
+ if( mxStorage.is() ) try
+ {
+ aNames = mxStorage->getElementNames();
+ if( aNames.getLength() > 0 )
+ orElementNames.insert( orElementNames.end(), aNames.getConstArray(), aNames.getConstArray() + aNames.getLength() );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+StorageRef OleStorage::implOpenSubStorage( const OUString& rElementName, bool bCreateMissing )
+{
+ StorageRef xSubStorage;
+ if( mxStorage.is() && (rElementName.getLength() > 0) )
+ {
+ try
+ {
+ Reference< XNameContainer > xSubElements( mxStorage->getByName( rElementName ), UNO_QUERY_THROW );
+ xSubStorage.reset( new OleStorage( *this, xSubElements, rElementName, true ) );
+ }
+ catch( Exception& )
+ {
+ }
+
+ /* The OLESimpleStorage API implementation seems to be buggy in the
+ area of writable inplace substorage (sometimes it overwrites other
+ unrelated streams with zero bytes). We go the save way and create a
+ new OLE storage based on a temporary file. All operations are
+ performed on this clean storage. On committing, the storage will be
+ completely re-inserted into the parent storage. */
+ if( !isReadOnly() && (bCreateMissing || xSubStorage.get()) ) try
+ {
+ // create new storage based on a temp file
+ Reference< XStream > xTempFile( mxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ StorageRef xTempStorage( new OleStorage( *this, xTempFile, rElementName ) );
+ // copy existing substorage into temp storage
+ if( xSubStorage.get() )
+ xSubStorage->copyStorageToStorage( *xTempStorage );
+ // return the temp storage to caller
+ xSubStorage = xTempStorage;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ return xSubStorage;
+}
+
+Reference< XInputStream > OleStorage::implOpenInputStream( const OUString& rElementName )
+{
+ Reference< XInputStream > xInStream;
+ if( mxStorage.is() ) try
+ {
+ xInStream.set( mxStorage->getByName( rElementName ), UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ }
+ return xInStream;
+}
+
+Reference< XOutputStream > OleStorage::implOpenOutputStream( const OUString& rElementName )
+{
+ Reference< XOutputStream > xOutStream;
+ if( mxStorage.is() && (rElementName.getLength() > 0) )
+ xOutStream.set( new OleOutputStream( mxFactory, mxStorage, rElementName ) );
+ return xOutStream;
+}
+
+void OleStorage::implCommit() const
+{
+ try
+ {
+ // commit this storage (finalizes the file this storage is based on)
+ Reference< XTransactedObject >( mxStorage, UNO_QUERY_THROW )->commit();
+ // re-insert this storage into the parent storage
+ if( mpParentStorage )
+ {
+ if( mpParentStorage->mxStorage->hasByName( getName() ) )
+ {
+ // replaceByName() does not work (#i109539#)
+ mpParentStorage->mxStorage->removeByName( getName() );
+ Reference< XTransactedObject >( mpParentStorage->mxStorage, UNO_QUERY_THROW )->commit();
+ }
+ mpParentStorage->mxStorage->insertByName( getName(), Any( mxStorage ) );
+ // this requires another commit(), which will be performed by the parent storage
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
new file mode 100755
index 000000000000..b43e8289a592
--- /dev/null
+++ b/oox/source/ole/vbacontrol.cxx
@@ -0,0 +1,811 @@
+/*************************************************************************
+ *
+ * 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 "oox/ole/vbacontrol.hxx"
+#include <algorithm>
+#include <set>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/io/XInputStreamProvider.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <xmlscript/xmldlg_imexp.hxx>
+#include "properties.hxx"
+#include "tokens.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/helper/textinputstream.hxx"
+#include "oox/ole/vbahelper.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::awt::XControlModel;
+using ::com::sun::star::container::XNameContainer;
+using ::com::sun::star::io::XInputStreamProvider;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::uno::XComponentContext;
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt16 VBA_SITE_CLASSIDINDEX = 0x8000;
+const sal_uInt16 VBA_SITE_INDEXMASK = 0x7FFF;
+const sal_uInt16 VBA_SITE_FORM = 7;
+const sal_uInt16 VBA_SITE_IMAGE = 12;
+const sal_uInt16 VBA_SITE_FRAME = 14;
+const sal_uInt16 VBA_SITE_SPINBUTTON = 16;
+const sal_uInt16 VBA_SITE_COMMANDBUTTON = 17;
+const sal_uInt16 VBA_SITE_TABSTRIP = 18;
+const sal_uInt16 VBA_SITE_LABEL = 21;
+const sal_uInt16 VBA_SITE_TEXTBOX = 23;
+const sal_uInt16 VBA_SITE_LISTBOX = 24;
+const sal_uInt16 VBA_SITE_COMBOBOX = 25;
+const sal_uInt16 VBA_SITE_CHECKBOX = 26;
+const sal_uInt16 VBA_SITE_OPTIONBUTTON = 27;
+const sal_uInt16 VBA_SITE_TOGGLEBUTTON = 28;
+const sal_uInt16 VBA_SITE_SCROLLBAR = 47;
+const sal_uInt16 VBA_SITE_MULTIPAGE = 57;
+const sal_uInt16 VBA_SITE_UNKNOWN = 0x7FFF;
+
+const sal_uInt32 VBA_SITE_TABSTOP = 0x00000001;
+const sal_uInt32 VBA_SITE_VISIBLE = 0x00000002;
+const sal_uInt32 VBA_SITE_DEFAULTBUTTON = 0x00000004;
+const sal_uInt32 VBA_SITE_CANCELBUTTON = 0x00000008;
+const sal_uInt32 VBA_SITE_OSTREAM = 0x00000010;
+const sal_uInt32 VBA_SITE_DEFFLAGS = 0x00000033;
+
+const sal_uInt8 VBA_SITEINFO_COUNT = 0x80;
+const sal_uInt8 VBA_SITEINFO_MASK = 0x7F;
+
+// ----------------------------------------------------------------------------
+
+/** Collects names of all controls in a user form or container control. Allows
+ to generate unused names for dummy controls separating option groups.
+ */
+class VbaControlNamesSet
+{
+public:
+ explicit VbaControlNamesSet();
+
+ /** Inserts the name of the passed control. */
+ void insertName( const VbaFormControl& rControl );
+ /** Returns a name that is not contained in this set. */
+ OUString generateDummyName();
+
+private:
+ typedef ::std::set< OUString > OUStringSet;
+ OUStringSet maCtrlNames;
+ const OUString maDummyBaseName;
+ sal_Int32 mnIndex;
+};
+
+VbaControlNamesSet::VbaControlNamesSet() :
+ maDummyBaseName( CREATE_OUSTRING( "DummyGroupSep" ) ),
+ mnIndex( 0 )
+{
+}
+
+void VbaControlNamesSet::insertName( const VbaFormControl& rControl )
+{
+ OUString aName = rControl.getControlName();
+ if( aName.getLength() > 0 )
+ maCtrlNames.insert( aName );
+}
+
+OUString VbaControlNamesSet::generateDummyName()
+{
+ OUString aCtrlName;
+ do
+ {
+ aCtrlName = OUStringBuffer( maDummyBaseName ).append( ++mnIndex ).makeStringAndClear();
+ }
+ while( maCtrlNames.count( aCtrlName ) > 0 );
+ maCtrlNames.insert( aCtrlName );
+ return aCtrlName;
+}
+
+// ----------------------------------------------------------------------------
+
+/** Functor that inserts the name of a control into a VbaControlNamesSet. */
+struct VbaControlNameInserter
+{
+public:
+ VbaControlNamesSet& mrCtrlNames;
+ inline explicit VbaControlNameInserter( VbaControlNamesSet& rCtrlNames ) : mrCtrlNames( rCtrlNames ) {}
+ inline void operator()( const VbaFormControl& rControl ) { mrCtrlNames.insertName( rControl ); }
+};
+
+// ----------------------------------------------------------------------------
+
+/** A dummy invisible form control (fixed label without text) that is used to
+ separate two groups of option buttons.
+ */
+class VbaDummyFormControl : public VbaFormControl
+{
+public:
+ explicit VbaDummyFormControl( const OUString& rName );
+};
+
+VbaDummyFormControl::VbaDummyFormControl( const OUString& rName )
+{
+ mxSiteModel.reset( new VbaSiteModel );
+ mxSiteModel->importProperty( XML_Name, rName );
+ mxSiteModel->importProperty( XML_VariousPropertyBits, OUString( sal_Unicode( '0' ) ) );
+
+ mxCtrlModel.reset( new AxLabelModel );
+ mxCtrlModel->setAwtModelMode();
+ mxCtrlModel->importProperty( XML_Size, CREATE_OUSTRING( "10;10" ) );
+}
+
+} // namespace
+
+// ============================================================================
+
+VbaSiteModel::VbaSiteModel() :
+ maPos( 0, 0 ),
+ mnId( 0 ),
+ mnHelpContextId( 0 ),
+ mnFlags( VBA_SITE_DEFFLAGS ),
+ mnStreamLen( 0 ),
+ mnTabIndex( -1 ),
+ mnClassIdOrCache( VBA_SITE_UNKNOWN ),
+ mnGroupId( 0 )
+{
+}
+
+VbaSiteModel::~VbaSiteModel()
+{
+}
+
+void VbaSiteModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
+{
+ switch( nPropId )
+ {
+ case XML_Name: maName = rValue; break;
+ case XML_Tag: maTag = rValue; break;
+ case XML_VariousPropertyBits: mnFlags = AttributeList::decodeUnsigned( rValue ); break;
+ }
+}
+
+bool VbaSiteModel::importBinaryModel( BinaryInputStream& rInStrm )
+{
+ AxBinaryPropertyReader aReader( rInStrm );
+ aReader.readStringProperty( maName );
+ aReader.readStringProperty( maTag );
+ aReader.readIntProperty< sal_Int32 >( mnId );
+ aReader.readIntProperty< sal_Int32 >( mnHelpContextId );
+ aReader.readIntProperty< sal_uInt32 >( mnFlags );
+ aReader.readIntProperty< sal_uInt32 >( mnStreamLen );
+ aReader.readIntProperty< sal_Int16 >( mnTabIndex );
+ aReader.readIntProperty< sal_uInt16 >( mnClassIdOrCache );
+ aReader.readPairProperty( maPos );
+ aReader.readIntProperty< sal_uInt16 >( mnGroupId );
+ aReader.skipUndefinedProperty();
+ aReader.readStringProperty( maToolTip );
+ aReader.skipStringProperty(); // license key
+ aReader.readStringProperty( maLinkedCell );
+ aReader.readStringProperty( maSourceRange );
+ return aReader.finalizeImport();
+}
+
+void VbaSiteModel::moveRelative( const AxPairData& rDistance )
+{
+ maPos.first += rDistance.first;
+ maPos.second += rDistance.second;
+}
+
+bool VbaSiteModel::isContainer() const
+{
+ return !getFlag( mnFlags, VBA_SITE_OSTREAM );
+}
+
+sal_uInt32 VbaSiteModel::getStreamLength() const
+{
+ return isContainer() ? 0 : mnStreamLen;
+}
+
+OUString VbaSiteModel::getSubStorageName() const
+{
+ if( mnId >= 0 )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( sal_Unicode( 'i' ) );
+ if( mnId < 10 )
+ aBuffer.append( sal_Unicode( '0' ) );
+ aBuffer.append( mnId );
+ return aBuffer.makeStringAndClear();
+ }
+ return OUString();
+}
+
+ControlModelRef VbaSiteModel::createControlModel( const AxClassTable& rClassTable ) const
+{
+ ControlModelRef xCtrlModel;
+
+ sal_Int32 nTypeIndex = static_cast< sal_Int32 >( mnClassIdOrCache & VBA_SITE_INDEXMASK );
+ if( !getFlag( mnClassIdOrCache, VBA_SITE_CLASSIDINDEX ) )
+ {
+ switch( nTypeIndex )
+ {
+ case VBA_SITE_COMMANDBUTTON: xCtrlModel.reset( new AxCommandButtonModel ); break;
+ case VBA_SITE_LABEL: xCtrlModel.reset( new AxLabelModel ); break;
+ case VBA_SITE_IMAGE: xCtrlModel.reset( new AxImageModel ); break;
+ case VBA_SITE_TOGGLEBUTTON: xCtrlModel.reset( new AxToggleButtonModel ); break;
+ case VBA_SITE_CHECKBOX: xCtrlModel.reset( new AxCheckBoxModel ); break;
+ case VBA_SITE_OPTIONBUTTON: xCtrlModel.reset( new AxOptionButtonModel ); break;
+ case VBA_SITE_TEXTBOX: xCtrlModel.reset( new AxTextBoxModel ); break;
+ case VBA_SITE_LISTBOX: xCtrlModel.reset( new AxListBoxModel ); break;
+ case VBA_SITE_COMBOBOX: xCtrlModel.reset( new AxComboBoxModel ); break;
+ case VBA_SITE_SPINBUTTON: /*xCtrlModel.reset( new AxSpinButtonModel );*/ break; // not supported (?)
+ case VBA_SITE_SCROLLBAR: xCtrlModel.reset( new AxScrollBarModel ); break;
+ case VBA_SITE_TABSTRIP: break; // not supported
+ case VBA_SITE_FRAME: xCtrlModel.reset( new AxFrameModel ); break;
+ case VBA_SITE_MULTIPAGE: break; // not supported
+ case VBA_SITE_FORM: break; // not supported
+ default: OSL_ENSURE( false, "VbaSiteModel::createControlModel - unknown type index" );
+ }
+ }
+ else
+ {
+ const OUString* pGuid = ContainerHelper::getVectorElement( rClassTable, nTypeIndex );
+ OSL_ENSURE( pGuid, "VbaSiteModel::createControlModel - invalid class table index" );
+ if( pGuid )
+ {
+ if( pGuid->equalsAscii( COMCTL_GUID_SCROLLBAR_60 ) )
+ xCtrlModel.reset( new ComCtlScrollBarModel( 6 ) );
+ else if( pGuid->equalsAscii( COMCTL_GUID_PROGRESSBAR_50 ) )
+ xCtrlModel.reset( new ComCtlProgressBarModel( 5 ) );
+ else if( pGuid->equalsAscii( COMCTL_GUID_PROGRESSBAR_60 ) )
+ xCtrlModel.reset( new ComCtlProgressBarModel( 6 ) );
+ }
+ }
+
+ if( xCtrlModel.get() )
+ {
+ // user form controls are AWT models
+ xCtrlModel->setAwtModelMode();
+
+ // check that container model matches container flag in site data
+ bool bModelIsContainer = dynamic_cast< const AxContainerModelBase* >( xCtrlModel.get() ) != 0;
+ bool bTypeMatch = bModelIsContainer == isContainer();
+ OSL_ENSURE( bTypeMatch, "VbaSiteModel::createControlModel - container type does not match container flag" );
+ if( !bTypeMatch )
+ xCtrlModel.reset();
+ }
+ return xCtrlModel;
+}
+
+void VbaSiteModel::convertProperties( PropertyMap& rPropMap,
+ const ControlConverter& rConv, ApiControlType eCtrlType, sal_Int32 nCtrlIndex ) const
+{
+ rPropMap.setProperty( PROP_Name, maName );
+ rPropMap.setProperty( PROP_Tag, maTag );
+
+ if( eCtrlType != API_CONTROL_DIALOG )
+ {
+ rPropMap.setProperty( PROP_HelpText, maToolTip );
+ rPropMap.setProperty( PROP_EnableVisible, getFlag( mnFlags, VBA_SITE_VISIBLE ) );
+ // we need to set the passed control index to make option button groups work
+ if( (0 <= nCtrlIndex) && (nCtrlIndex <= SAL_MAX_INT16) )
+ rPropMap.setProperty( PROP_TabIndex, static_cast< sal_Int16 >( nCtrlIndex ) );
+ // progress bar and group box support TabIndex, but not Tabstop...
+ if( (eCtrlType != API_CONTROL_PROGRESSBAR) && (eCtrlType != API_CONTROL_GROUPBOX) )
+ rPropMap.setProperty( PROP_Tabstop, getFlag( mnFlags, VBA_SITE_TABSTOP ) );
+ rConv.convertPosition( rPropMap, maPos );
+ }
+}
+
+// ============================================================================
+
+VbaFormControl::VbaFormControl()
+{
+}
+
+VbaFormControl::~VbaFormControl()
+{
+}
+
+void VbaFormControl::importModelOrStorage( BinaryInputStream& rInStrm, StorageBase& rStrg, const AxClassTable& rClassTable )
+{
+ if( mxSiteModel.get() )
+ {
+ if( mxSiteModel->isContainer() )
+ {
+ StorageRef xSubStrg = rStrg.openSubStorage( mxSiteModel->getSubStorageName(), false );
+ OSL_ENSURE( xSubStrg.get(), "VbaFormControl::importModelOrStorage - cannot find storage for embedded control" );
+ if( xSubStrg.get() )
+ importStorage( *xSubStrg, rClassTable );
+ }
+ else if( !rInStrm.isEof() )
+ {
+ sal_Int64 nNextStrmPos = rInStrm.tell() + mxSiteModel->getStreamLength();
+ importControlModel( rInStrm, rClassTable );
+ rInStrm.seek( nNextStrmPos );
+ }
+ }
+}
+
+OUString VbaFormControl::getControlName() const
+{
+ return mxSiteModel.get() ? mxSiteModel->getName() : OUString();
+}
+
+void VbaFormControl::createAndConvert( sal_Int32 nCtrlIndex,
+ const Reference< XNameContainer >& rxParentNC, const ControlConverter& rConv ) const
+{
+ if( rxParentNC.is() && mxSiteModel.get() && mxCtrlModel.get() ) try
+ {
+ // create the control model
+ OUString aServiceName = mxCtrlModel->getServiceName();
+ Reference< XMultiServiceFactory > xModelFactory( rxParentNC, UNO_QUERY_THROW );
+ Reference< XControlModel > xCtrlModel( xModelFactory->createInstance( aServiceName ), UNO_QUERY_THROW );
+
+ // convert all properties and embedded controls
+ if( convertProperties( xCtrlModel, rConv, nCtrlIndex ) )
+ {
+ // insert into parent container
+ const OUString& rCtrlName = mxSiteModel->getName();
+ OSL_ENSURE( !rxParentNC->hasByName( rCtrlName ), "VbaFormControl::createAndConvert - multiple controls with equal name" );
+ ContainerHelper::insertByName( rxParentNC, rCtrlName, Any( xCtrlModel ) );
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// protected ------------------------------------------------------------------
+
+void VbaFormControl::importControlModel( BinaryInputStream& rInStrm, const AxClassTable& rClassTable )
+{
+ createControlModel( rClassTable );
+ if( mxCtrlModel.get() )
+ mxCtrlModel->importBinaryModel( rInStrm );
+}
+
+void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rClassTable )
+{
+ createControlModel( rClassTable );
+ AxContainerModelBase* pContainerModel = dynamic_cast< AxContainerModelBase* >( mxCtrlModel.get() );
+ OSL_ENSURE( pContainerModel, "VbaFormControl::importStorage - missing container control model" );
+ if( pContainerModel )
+ {
+ /* Open the 'f' stream containing the model of this control and a list
+ of site models for all child controls. */
+ BinaryXInputStream aFStrm( rStrg.openInputStream( CREATE_OUSTRING( "f" ) ), true );
+ OSL_ENSURE( !aFStrm.isEof(), "VbaFormControl::importStorage - missing 'f' stream" );
+
+ /* Read the properties of this container control and the class table
+ (into the maClassTable vector) containing a list of GUIDs for
+ exotic embedded controls. */
+ if( !aFStrm.isEof() && pContainerModel->importBinaryModel( aFStrm ) && pContainerModel->importClassTable( aFStrm, maClassTable ) )
+ {
+ /* Read the site models of all embedded controls (this fills the
+ maControls vector). Ignore failure of importSiteModels() but
+ try to import as much controls as possible. */
+ importEmbeddedSiteModels( aFStrm );
+
+ /* Open the 'o' stream containing models of embedded simple
+ controls. Stream may be empty or missing, if this control
+ contains no controls or only container controls. */
+ BinaryXInputStream aOStrm( rStrg.openInputStream( CREATE_OUSTRING( "o" ) ), true );
+
+ /* Iterate over all embedded controls, import model from 'o'
+ stream (for embedded simple controls) or from the substorage
+ (for embedded container controls). */
+ maControls.forEachMem( &VbaFormControl::importModelOrStorage,
+ ::boost::ref( aOStrm ), ::boost::ref( rStrg ), ::boost::cref( maClassTable ) );
+
+ /* Reorder the controls (sorts all option buttons of an option
+ group together), and move all children of all embedded frames
+ (group boxes) to this control (UNO group boxes cannot contain
+ other controls). */
+ finalizeEmbeddedControls();
+ }
+ }
+}
+
+bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv, sal_Int32 nCtrlIndex ) const
+{
+ if( rxCtrlModel.is() && mxSiteModel.get() && mxCtrlModel.get() )
+ {
+ const OUString& rCtrlName = mxSiteModel->getName();
+ OSL_ENSURE( rCtrlName.getLength() > 0, "VbaFormControl::convertProperties - control without name" );
+ if( rCtrlName.getLength() > 0 )
+ {
+ // convert all properties
+ PropertyMap aPropMap;
+ mxSiteModel->convertProperties( aPropMap, rConv, mxCtrlModel->getControlType(), nCtrlIndex );
+ mxCtrlModel->convertProperties( aPropMap, rConv );
+ mxCtrlModel->convertSize( aPropMap, rConv );
+ PropertySet aPropSet( rxCtrlModel );
+ aPropSet.setProperties( aPropMap );
+
+ // create and convert all embedded controls
+ if( !maControls.empty() ) try
+ {
+ Reference< XNameContainer > xCtrlModelNC( rxCtrlModel, UNO_QUERY_THROW );
+ /* Call conversion for all controls. Pass vector index as new
+ tab order to make option button groups work correctly. */
+ maControls.forEachMemWithIndex( &VbaFormControl::createAndConvert,
+ ::boost::cref( xCtrlModelNC ), ::boost::cref( rConv ) );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "VbaFormControl::convertProperties - cannot get control container interface" );
+ }
+
+ return true;
+ }
+ }
+ return false;
+}
+
+// private --------------------------------------------------------------------
+
+void VbaFormControl::createControlModel( const AxClassTable& rClassTable )
+{
+ // derived classes may have created their own control model
+ if( !mxCtrlModel && mxSiteModel.get() )
+ mxCtrlModel = mxSiteModel->createControlModel( rClassTable );
+}
+
+bool VbaFormControl::importSiteModel( BinaryInputStream& rInStrm )
+{
+ mxSiteModel.reset( new VbaSiteModel );
+ return mxSiteModel->importBinaryModel( rInStrm );
+}
+
+bool VbaFormControl::importEmbeddedSiteModels( BinaryInputStream& rInStrm )
+{
+ sal_uInt64 nAnchorPos = rInStrm.tell();
+ sal_uInt32 nSiteCount, nSiteDataSize;
+ rInStrm >> nSiteCount >> nSiteDataSize;
+ sal_Int64 nSiteEndPos = rInStrm.tell() + nSiteDataSize;
+
+ // skip the site info structure
+ sal_uInt32 nSiteIndex = 0;
+ while( !rInStrm.isEof() && (nSiteIndex < nSiteCount) )
+ {
+ rInStrm.skip( 1 ); // site depth
+ sal_uInt8 nTypeCount = rInStrm.readuInt8(); // 'type-or-count' byte
+ if( getFlag( nTypeCount, VBA_SITEINFO_COUNT ) )
+ {
+ /* Count flag is set: the 'type-or-count' byte contains the number
+ of controls in the lower bits, the type specifier follows in
+ the next byte. The type specifier should always be 1 according
+ to the specification. */
+ rInStrm.skip( 1 );
+ nSiteIndex += (nTypeCount & VBA_SITEINFO_MASK);
+ }
+ else
+ {
+ /* Count flag is not set: the 'type-or-count' byte contains the
+ type specifier of *one* control in the lower bits (this type
+ should be 1, see above). */
+ ++nSiteIndex;
+ }
+ }
+ // align the stream to 32bit, relative to start of entire site info
+ rInStrm.alignToBlock( 4, nAnchorPos );
+
+ // import the site models for all embedded controls
+ maControls.clear();
+ bool bValid = !rInStrm.isEof();
+ for( nSiteIndex = 0; bValid && (nSiteIndex < nSiteCount); ++nSiteIndex )
+ {
+ VbaFormControlRef xControl( new VbaFormControl );
+ maControls.push_back( xControl );
+ bValid = xControl->importSiteModel( rInStrm );
+ }
+
+ rInStrm.seek( nSiteEndPos );
+ return bValid;
+}
+
+void VbaFormControl::finalizeEmbeddedControls()
+{
+ /* This function performs two tasks:
+
+ 1) Reorder the controls appropriately (sort all option buttons of an
+ option group together to make grouping work).
+ 2) Move all children of all embedded frames (group boxes) to this
+ control (UNO group boxes cannot contain other controls).
+ */
+
+ // first, sort all controls by original tab index
+ ::std::sort( maControls.begin(), maControls.end(), &compareByTabIndex );
+
+ /* Collect the programmatical names of all embedded controls (needed to be
+ able to set unused names to new dummy controls created below). Also
+ collect the names of all children of embedded frames (group boxes).
+ Luckily, names of controls must be unique in the entire form, not just
+ in the current container. */
+ VbaControlNamesSet aControlNames;
+ VbaControlNameInserter aInserter( aControlNames );
+ maControls.forEach( aInserter );
+ for( VbaFormControlVector::iterator aIt = maControls.begin(), aEnd = maControls.end(); aIt != aEnd; ++aIt )
+ if( (*aIt)->mxCtrlModel.get() && ((*aIt)->mxCtrlModel->getControlType() == API_CONTROL_GROUPBOX) )
+ (*aIt)->maControls.forEach( aInserter );
+
+ /* Reprocess the sorted list and collect all option button controls that
+ are part of the same option group (determined by group name). All
+ controls will be stored in a vector of vectors, that collects every
+ option button group in one vector element, and other controls between
+ these option groups (or leading or trailing controls) in other vector
+ elements. If an option button group follows another group, a dummy
+ separator control has to be inserted. */
+ typedef RefVector< VbaFormControlVector > VbaFormControlVectorVector;
+ VbaFormControlVectorVector aControlGroups;
+
+ typedef RefMap< OUString, VbaFormControlVector > VbaFormControlVectorMap;
+ VbaFormControlVectorMap aOptionGroups;
+
+ typedef VbaFormControlVectorMap::mapped_type VbaFormControlVectorRef;
+ bool bLastWasOptionButton = false;
+ for( VbaFormControlVector::iterator aIt = maControls.begin(), aEnd = maControls.end(); aIt != aEnd; ++aIt )
+ {
+ VbaFormControlRef xControl = *aIt;
+ const ControlModelBase* pCtrlModel = xControl->mxCtrlModel.get();
+
+ if( const AxOptionButtonModel* pOptButtonModel = dynamic_cast< const AxOptionButtonModel* >( pCtrlModel ) )
+ {
+ // check if a new option group needs to be created
+ const OUString& rGroupName = pOptButtonModel->getGroupName();
+ VbaFormControlVectorRef& rxOptionGroup = aOptionGroups[ rGroupName ];
+ if( !rxOptionGroup )
+ {
+ /* If last control was an option button too, we have two
+ option groups following each other, so a dummy separator
+ control is needed. */
+ if( bLastWasOptionButton )
+ {
+ VbaFormControlVectorRef xDummyGroup( new VbaFormControlVector );
+ aControlGroups.push_back( xDummyGroup );
+ OUString aName = aControlNames.generateDummyName();
+ VbaFormControlRef xDummyControl( new VbaDummyFormControl( aName ) );
+ xDummyGroup->push_back( xDummyControl );
+ }
+ rxOptionGroup.reset( new VbaFormControlVector );
+ aControlGroups.push_back( rxOptionGroup );
+ }
+ /* Append the option button to the control group (which is now
+ referred by the vector aControlGroups and by the map
+ aOptionGroups). */
+ rxOptionGroup->push_back( xControl );
+ bLastWasOptionButton = true;
+ }
+ else
+ {
+ // open a new control group, if the last group is an option group
+ if( bLastWasOptionButton || aControlGroups.empty() )
+ {
+ VbaFormControlVectorRef xControlGroup( new VbaFormControlVector );
+ aControlGroups.push_back( xControlGroup );
+ }
+ // append the control to the last control group
+ VbaFormControlVector& rLastGroup = *aControlGroups.back();
+ rLastGroup.push_back( xControl );
+ bLastWasOptionButton = false;
+
+ // if control is a group box, move all its children to this control
+ if( pCtrlModel && (pCtrlModel->getControlType() == API_CONTROL_GROUPBOX) )
+ {
+ /* Move all embedded controls of the group box relative to the
+ position of the group box. */
+ xControl->moveEmbeddedToAbsoluteParent();
+ /* Insert all children of the group box into the last control
+ group (following the group box). */
+ rLastGroup.insert( rLastGroup.end(), xControl->maControls.begin(), xControl->maControls.end() );
+ xControl->maControls.clear();
+ // check if last control of the group box is an option button
+ bLastWasOptionButton = dynamic_cast< const AxOptionButtonModel* >( rLastGroup.back()->mxCtrlModel.get() ) != 0;
+ }
+ }
+ }
+
+ // flatten the vector of vectors of form controls to a single vector
+ maControls.clear();
+ for( VbaFormControlVectorVector::iterator aIt = aControlGroups.begin(), aEnd = aControlGroups.end(); aIt != aEnd; ++aIt )
+ maControls.insert( maControls.end(), (*aIt)->begin(), (*aIt)->end() );
+}
+
+void VbaFormControl::moveRelative( const AxPairData& rDistance )
+{
+ if( mxSiteModel.get() )
+ mxSiteModel->moveRelative( rDistance );
+}
+
+void VbaFormControl::moveEmbeddedToAbsoluteParent()
+{
+ if( mxSiteModel.get() && !maControls.empty() )
+ {
+ // distance to move is equal to position of this control in its parent
+ AxPairData aDistance = mxSiteModel->getPosition();
+
+ /* For group boxes: add half of the font height to Y position (VBA
+ positions relative to frame border line, not to 'top' of frame). */
+ const AxFontDataModel* pFontModel = dynamic_cast< const AxFontDataModel* >( mxCtrlModel.get() );
+ if( pFontModel && (pFontModel->getControlType() == API_CONTROL_GROUPBOX) )
+ {
+ // convert points to 1/100 mm (1 pt = 1/72 inch = 2.54/72 cm = 2540/72 1/100 mm)
+ sal_Int32 nFontHeight = static_cast< sal_Int32 >( pFontModel->getFontHeight() * 2540 / 72 );
+ aDistance.second += nFontHeight / 2;
+ }
+
+ // move the embedded controls
+ maControls.forEachMem( &VbaFormControl::moveRelative, ::boost::cref( aDistance ) );
+ }
+}
+
+/*static*/ bool VbaFormControl::compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight )
+{
+ // sort controls without model to the end
+ sal_Int32 nLeftTabIndex = rxLeft->mxSiteModel.get() ? rxLeft->mxSiteModel->getTabIndex() : SAL_MAX_INT32;
+ sal_Int32 nRightTabIndex = rxRight->mxSiteModel.get() ? rxRight->mxSiteModel->getTabIndex() : SAL_MAX_INT32;
+ return nLeftTabIndex < nRightTabIndex;
+}
+
+// ============================================================================
+
+namespace {
+
+OUString lclGetQuotedString( const OUString& rCodeLine )
+{
+ OUStringBuffer aBuffer;
+ sal_Int32 nLen = rCodeLine.getLength();
+ if( (nLen > 0) && (rCodeLine[ 0 ] == '"') )
+ {
+ bool bExitLoop = false;
+ for( sal_Int32 nIndex = 1; !bExitLoop && (nIndex < nLen); ++nIndex )
+ {
+ sal_Unicode cChar = rCodeLine[ nIndex ];
+ // exit on closing quote char (but check on double quote chars)
+ bExitLoop = (cChar == '"') && ((nIndex + 1 == nLen) || (rCodeLine[ nIndex + 1 ] != '"'));
+ if( !bExitLoop )
+ {
+ aBuffer.append( cChar );
+ // skip second quote char
+ if( cChar == '"' )
+ ++nIndex;
+ }
+ }
+ }
+ return aBuffer.makeStringAndClear();
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+VbaUserForm::VbaUserForm( const Reference< XMultiServiceFactory >& rxGlobalFactory,
+ const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
+ ControlConverter( rGraphicHelper, bDefaultColorBgr ),
+ mxGlobalFactory( rxGlobalFactory )
+{
+ OSL_ENSURE( mxGlobalFactory.is(), "VbaUserForm::VbaUserForm - missing service factory" );
+}
+
+void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
+ StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc )
+{
+ OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" );
+ if( !mxGlobalFactory.is() || !rxDialogLib.is() )
+ return;
+
+ // check that the '03VBFrame' stream exists, this is required for forms
+ BinaryXInputStream aInStrm( rVbaFormStrg.openInputStream( CREATE_OUSTRING( "\003VBFrame" ) ), true );
+ OSL_ENSURE( !aInStrm.isEof(), "VbaUserForm::importForm - missing \\003VBFrame stream" );
+ if( aInStrm.isEof() )
+ return;
+
+ // scan for the line 'Begin {GUID} <FormName>'
+ TextInputStream aFrameTextStrm( aInStrm, eTextEnc );
+ const OUString aBegin = CREATE_OUSTRING( "Begin" );
+ OUString aLine;
+ bool bBeginFound = false;
+ while( !bBeginFound && !aFrameTextStrm.isEof() )
+ {
+ aLine = aFrameTextStrm.readLine().trim();
+ bBeginFound = VbaHelper::eatKeyword( aLine, aBegin );
+ }
+ // check for the specific GUID that represents VBA forms
+ if( !bBeginFound || !VbaHelper::eatKeyword( aLine, CREATE_OUSTRING( "{C62A69F0-16DC-11CE-9E98-00AA00574A4F}" ) ) )
+ return;
+
+ // remaining line is the form name
+ OUString aFormName = aLine.trim();
+ OSL_ENSURE( aFormName.getLength() > 0, "VbaUserForm::importForm - missing form name" );
+ OSL_ENSURE( rModuleName.equalsIgnoreAsciiCase( aFormName ), "VbaUserForm::importFrameStream - form and module name mismatch" );
+ if( aFormName.getLength() == 0 )
+ aFormName = rModuleName;
+ if( aFormName.getLength() == 0 )
+ return;
+ mxSiteModel.reset( new VbaSiteModel );
+ mxSiteModel->importProperty( XML_Name, aFormName );
+
+ // read the form properties (caption is contained in this '03VBFrame' stream, not in the 'f' stream)
+ mxCtrlModel.reset( new AxUserFormModel );
+ OUString aKey, aValue;
+ bool bExitLoop = false;
+ while( !bExitLoop && !aFrameTextStrm.isEof() )
+ {
+ aLine = aFrameTextStrm.readLine().trim();
+ bExitLoop = aLine.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "End" ) );
+ if( !bExitLoop && VbaHelper::extractKeyValue( aKey, aValue, aLine ) )
+ {
+ if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Caption" ) ) )
+ mxCtrlModel->importProperty( XML_Caption, lclGetQuotedString( aValue ) );
+ else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Tag" ) ) )
+ mxSiteModel->importProperty( XML_Tag, lclGetQuotedString( aValue ) );
+ }
+ }
+
+ // use generic container control functionality to import the embedded controls
+ importStorage( rVbaFormStrg, AxClassTable() );
+
+ try
+ {
+ // create the dialog model
+ OUString aServiceName = mxCtrlModel->getServiceName();
+ Reference< XControlModel > xDialogModel( mxGlobalFactory->createInstance( aServiceName ), UNO_QUERY_THROW );
+ Reference< XNameContainer > xDialogNC( xDialogModel, UNO_QUERY_THROW );
+
+ // convert properties and embedded controls
+ if( convertProperties( xDialogModel, *this, 0 ) )
+ {
+ // export the dialog to XML and insert it into the dialog library
+ PropertySet aFactoryProps( mxGlobalFactory );
+ Reference< XComponentContext > xCompContext( aFactoryProps.getAnyProperty( PROP_DefaultContext ), UNO_QUERY_THROW );
+ Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext ), UNO_SET_THROW );
+ OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" );
+ ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) );
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
diff --git a/oox/source/ole/vbahelper.cxx b/oox/source/ole/vbahelper.cxx
new file mode 100755
index 000000000000..7293e357e746
--- /dev/null
+++ b/oox/source/ole/vbahelper.cxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * 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 "oox/ole/vbahelper.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <comphelper/string.hxx>
+#include "oox/helper/binaryinputstream.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::container::XNameContainer;
+using ::com::sun::star::container::XNameReplace;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_SET_THROW;
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/*static*/ OUString VbaHelper::getBasicScriptUrl(
+ const OUString& rLibraryName, const OUString& rModuleName, const OUString& rMacroName )
+{
+ OSL_ENSURE( rLibraryName.getLength() > 0, "VbaHelper::getBasicScriptUrl - library name is empty" );
+ OSL_ENSURE( rModuleName.getLength() > 0, "VbaHelper::getBasicScriptUrl - module name is empty" );
+ OSL_ENSURE( rMacroName.getLength() > 0, "VbaHelper::getBasicScriptUrl - macro name is empty" );
+ const sal_Unicode cDot = '.';
+ return OUStringBuffer().
+ appendAscii( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.script:" ) ).
+ append( rLibraryName ).append( cDot ).append( rModuleName ).append( cDot ).append( rMacroName ).
+ appendAscii( RTL_CONSTASCII_STRINGPARAM( "?language=Basic&location=document" ) ).
+ makeStringAndClear();
+}
+
+/*static*/ bool VbaHelper::readDirRecord( sal_uInt16& rnRecId, StreamDataSequence& rRecData, BinaryInputStream& rInStrm )
+{
+ // read the record header
+ sal_Int32 nRecSize;
+ rInStrm >> rnRecId >> nRecSize;
+ // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long
+ if( rnRecId == VBA_ID_PROJECTVERSION )
+ {
+ OSL_ENSURE( nRecSize == 4, "VbaHelper::readDirRecord - unexpected record size for PROJECTVERSION" );
+ nRecSize = 6;
+ }
+ // read the record contents into the passed sequence
+ return !rInStrm.isEof() && (rInStrm.readData( rRecData, nRecSize ) == nRecSize);
+}
+
+/*static*/ bool VbaHelper::extractKeyValue( OUString& rKey, OUString& rValue, const OUString& rKeyValue )
+{
+ sal_Int32 nEqSignPos = rKeyValue.indexOf( '=' );
+ if( nEqSignPos > 0 )
+ {
+ rKey = rKeyValue.copy( 0, nEqSignPos ).trim();
+ rValue = rKeyValue.copy( nEqSignPos + 1 ).trim();
+ return (rKey.getLength() > 0) && (rValue.getLength() > 0);
+ }
+ return false;
+}
+
+/*static*/ bool VbaHelper::eatWhitespace( OUString& rCodeLine )
+{
+ sal_Int32 nIndex = 0;
+ while( (nIndex < rCodeLine.getLength()) && ((rCodeLine[ nIndex ] == ' ') || (rCodeLine[ nIndex ] == '\t')) )
+ ++nIndex;
+ if( nIndex > 0 )
+ {
+ rCodeLine = rCodeLine.copy( nIndex );
+ return true;
+ }
+ return false;
+}
+
+/*static*/ bool VbaHelper::eatKeyword( OUString& rCodeLine, const OUString& rKeyword )
+{
+ if( rCodeLine.matchIgnoreAsciiCase( rKeyword ) )
+ {
+ rCodeLine = rCodeLine.copy( rKeyword.getLength() );
+ // success, if code line ends after keyword, or if whitespace follows
+ return (rCodeLine.getLength() == 0) || eatWhitespace( rCodeLine );
+ }
+ return false;
+}
+
+/*static*/ OUString VbaHelper::getSourceCode( const Reference< XNameContainer >& rxBasicLib, const OUString& rModuleName )
+{
+ OUString aSourceCode;
+ if( rxBasicLib.is() ) try
+ {
+ rxBasicLib->getByName( rModuleName ) >>= aSourceCode;
+ }
+ catch( Exception& )
+ {
+ }
+ return aSourceCode;
+}
+
+namespace {
+
+bool lclGetLine( OUString& rCodeLine, sal_Int32& rnIndex, const OUString& rSourceCode )
+{
+ if( rnIndex < rSourceCode.getLength() )
+ {
+ sal_Int32 nPosLF = rSourceCode.indexOf( '\n', rnIndex );
+ if( nPosLF >= rnIndex )
+ {
+ rCodeLine = rSourceCode.copy( rnIndex, nPosLF - rnIndex ).trim();
+ rnIndex = nPosLF + 1;
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+/*static*/ bool VbaHelper::hasMacro( const OUString& rSourceCode, const OUString& rMacroName )
+{
+ // scan all text lines for '[Public|Private] [Static] Sub <macroname> (...)'
+ const OUString aPublic = CREATE_OUSTRING( "Public" );
+ const OUString aPrivate = CREATE_OUSTRING( "Private" );
+ const OUString aStatic = CREATE_OUSTRING( "Static" );
+ const OUString aSub = CREATE_OUSTRING( "Sub" );
+
+ OUString aCodeLine;
+ sal_Int32 nIndex = 0;
+ while( lclGetLine( aCodeLine, nIndex, rSourceCode ) )
+ {
+ // eat optional 'Private' or 'Public', but do not accept both keywords in a row (therefore the ||)
+ eatKeyword( aCodeLine, aPublic ) || eatKeyword( aCodeLine, aPrivate );
+ // eat optional 'Static'
+ eatKeyword( aCodeLine, aStatic );
+ // eat 'Sub' keyword, check if macro name follows
+ if( eatKeyword( aCodeLine, aSub ) && aCodeLine.matchIgnoreAsciiCase( rMacroName ) )
+ {
+ // eat macro name and following whitespace
+ aCodeLine = aCodeLine.copy( rMacroName.getLength() );
+ eatWhitespace( aCodeLine );
+ // opening bracket must follow the macro name
+ if( (aCodeLine.getLength() >= 2) && (aCodeLine[ 0 ] == '(') )
+ return true;
+ }
+ }
+ return false;
+}
+
+/*static*/ bool VbaHelper::hasMacro( const Reference< XNameContainer >& rxBasicLib,
+ const OUString& rModuleName, const OUString& rMacroName )
+{
+ return hasMacro( getSourceCode( rxBasicLib, rModuleName ), rMacroName );
+}
+
+/*static*/ bool VbaHelper::insertMacro( const Reference< XNameContainer >& rxBasicLib, const OUString& rModuleName,
+ const OUString& rMacroName, const OUString& rMacroArgs, const OUString& rMacroType, const OUString& rMacroCode )
+{
+ if( rxBasicLib.is() ) try
+ {
+ // receive module source code and check that the specified macro does not exist
+ OUString aSourceCode = getSourceCode( rxBasicLib, rModuleName );
+ if( !hasMacro( aSourceCode, rMacroName ) )
+ {
+ bool bFunction = rMacroType.getLength() > 0;
+ const sal_Char* pcSubFunc = bFunction ? "Function" : "Sub";
+ OUStringBuffer aBuffer( aSourceCode );
+ // generate the source code for the new macro
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\nPrivate " ) ).
+ appendAscii( pcSubFunc ).append( sal_Unicode( ' ' ) ).
+ append( rMacroName ).append( sal_Unicode( '(' ) );
+ if( rMacroArgs.getLength() > 0 )
+ aBuffer.append( sal_Unicode( ' ' ) ).append( rMacroArgs ).append( sal_Unicode( ' ' ) );
+ aBuffer.append( sal_Unicode( ')' ) );
+ if( bFunction )
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " As " ) ).append( rMacroType );
+ aBuffer.append( sal_Unicode( '\n' ) );
+ // replace all $MACRO placeholders with macro name
+ if( rMacroCode.getLength() > 0 )
+ {
+ OUString aMacroCode = ::comphelper::string::searchAndReplaceAsciiL( rMacroCode, RTL_CONSTASCII_STRINGPARAM( "$MACRO" ), rMacroName );
+ aBuffer.append( aMacroCode ).append( sal_Unicode( '\n' ) );
+ }
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "End " ) ).appendAscii( pcSubFunc ).append( sal_Unicode( '\n' ) );
+ rxBasicLib->replaceByName( rModuleName, Any( aBuffer.makeStringAndClear() ) );
+ return true;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return false;
+}
+
+/*static*/ bool VbaHelper::attachMacroToEvent( const Reference< XEventsSupplier >& rxEventsSupp,
+ const OUString& rEventName, const OUString& rLibraryName, const OUString& rModuleName, const OUString& rMacroName )
+{
+ if( rxEventsSupp.is() ) try
+ {
+ Reference< XNameReplace > xEvents( rxEventsSupp->getEvents(), UNO_SET_THROW );
+ Sequence< PropertyValue > aEvent( 2 );
+ aEvent[ 0 ].Name = CREATE_OUSTRING( "EventType" );
+ aEvent[ 0 ].Value <<= CREATE_OUSTRING( "Script" );
+ aEvent[ 1 ].Name = CREATE_OUSTRING( "Script" );
+ aEvent[ 1 ].Value <<= getBasicScriptUrl( rLibraryName, rModuleName, rMacroName );
+ xEvents->replaceByName( rEventName, Any( aEvent ) );
+ return true;
+ }
+ catch( Exception& )
+ {
+ }
+ return false;
+}
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx
new file mode 100755
index 000000000000..e9388e54215a
--- /dev/null
+++ b/oox/source/ole/vbamodule.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * 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 "oox/ole/vbamodule.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/helper/textinputstream.hxx"
+#include "oox/ole/vbahelper.hxx"
+#include "oox/ole/vbainputstream.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNameContainer;
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::script::ModuleInfo;
+using ::com::sun::star::script::XVBAModuleInfo;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+
+namespace ApiModuleType = ::com::sun::star::script::ModuleType;
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+VbaModule::VbaModule( const Reference< XModel >& rxDocModel, const OUString& rName, rtl_TextEncoding eTextEnc, bool bExecutable ) :
+ mxDocModel( rxDocModel ),
+ maName( rName ),
+ meTextEnc( eTextEnc ),
+ mnType( ApiModuleType::UNKNOWN ),
+ mnOffset( SAL_MAX_UINT32 ),
+ mbReadOnly( false ),
+ mbPrivate( false ),
+ mbExecutable( bExecutable )
+{
+}
+
+void VbaModule::importDirRecords( BinaryInputStream& rDirStrm )
+{
+ sal_uInt16 nRecId = 0;
+ StreamDataSequence aRecData;
+ while( VbaHelper::readDirRecord( nRecId, aRecData, rDirStrm ) && (nRecId != VBA_ID_MODULEEND) )
+ {
+ SequenceInputStream aRecStrm( aRecData );
+ sal_Int32 nRecSize = aRecData.getLength();
+ switch( nRecId )
+ {
+#define OOX_ENSURE_RECORDSIZE( cond ) OSL_ENSURE( cond, "VbaModule::importDirRecords - invalid record size" )
+ case VBA_ID_MODULENAME:
+ OSL_ENSURE( false, "VbaModule::importDirRecords - unexpected MODULENAME record" );
+ maName = aRecStrm.readCharArrayUC( nRecSize, meTextEnc );
+ break;
+ case VBA_ID_MODULENAMEUNICODE:
+ break;
+ case VBA_ID_MODULESTREAMNAME:
+ maStreamName = aRecStrm.readCharArrayUC( nRecSize, meTextEnc );
+ break;
+ case VBA_ID_MODULESTREAMNAMEUNICODE:
+ break;
+ case VBA_ID_MODULEDOCSTRING:
+ maDocString = aRecStrm.readCharArrayUC( nRecSize, meTextEnc );
+ break;
+ case VBA_ID_MODULEDOCSTRINGUNICODE:
+ break;
+ case VBA_ID_MODULEOFFSET:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 4 );
+ aRecStrm >> mnOffset;
+ break;
+ case VBA_ID_MODULEHELPCONTEXT:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 4 );
+ break;
+ case VBA_ID_MODULECOOKIE:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 2 );
+ break;
+ case VBA_ID_MODULETYPEPROCEDURAL:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
+ OSL_ENSURE( mnType == ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
+ mnType = ApiModuleType::NORMAL;
+ break;
+ case VBA_ID_MODULETYPEDOCUMENT:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
+ OSL_ENSURE( mnType == ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - multiple module type records" );
+ mnType = ApiModuleType::DOCUMENT;
+ break;
+ case VBA_ID_MODULEREADONLY:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
+ mbReadOnly = true;
+ break;
+ case VBA_ID_MODULEPRIVATE:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 0 );
+ mbPrivate = true;
+ break;
+ default:
+ OSL_ENSURE( false, "VbaModule::importDirRecords - unknown module record" );
+#undef OOX_ENSURE_RECORDSIZE
+ }
+ }
+ OSL_ENSURE( maName.getLength() > 0, "VbaModule::importDirRecords - missing module name" );
+ OSL_ENSURE( maStreamName.getLength() > 0, "VbaModule::importDirRecords - missing module stream name" );
+ OSL_ENSURE( mnType != ApiModuleType::UNKNOWN, "VbaModule::importDirRecords - missing module type" );
+ OSL_ENSURE( mnOffset < SAL_MAX_UINT32, "VbaModule::importDirRecords - missing module stream offset" );
+}
+
+void VbaModule::importSourceCode( StorageBase& rVbaStrg,
+ const Reference< XNameContainer >& rxBasicLib, const Reference< XNameAccess >& rxDocObjectNA ) const
+{
+ if( (maName.getLength() == 0) || (maStreamName.getLength() == 0) || (mnOffset == SAL_MAX_UINT32) )
+ return;
+
+ BinaryXInputStream aInStrm( rVbaStrg.openInputStream( maStreamName ), true );
+ OSL_ENSURE( !aInStrm.isEof(), "VbaModule::importSourceCode - cannot open module stream" );
+ // skip the 'performance cache' stored before the actual source code
+ aInStrm.seek( mnOffset );
+ // if stream is still valid, load the source code
+ if( aInStrm.isEof() )
+ return;
+
+ // prepare the Basic module
+ ModuleInfo aModuleInfo;
+ aModuleInfo.ModuleType = mnType;
+ OUStringBuffer aSourceCode;
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
+ switch( mnType )
+ {
+ case ApiModuleType::NORMAL:
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAModule" ) );
+ break;
+ case ApiModuleType::CLASS:
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAClassModule" ) );
+ break;
+ case ApiModuleType::FORM:
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAFormModule" ) );
+ // hack from old filter, document Basic should know the XModel, but it doesn't
+ aModuleInfo.ModuleObject.set( mxDocModel, UNO_QUERY );
+ break;
+ case ApiModuleType::DOCUMENT:
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBADocumentModule" ) );
+ // get the VBA object associated to the document module
+ if( rxDocObjectNA.is() ) try
+ {
+ aModuleInfo.ModuleObject.set( rxDocObjectNA->getByName( maName ), UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ }
+ break;
+ default:
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VBAUnknown" ) );
+ }
+ aSourceCode.append( sal_Unicode( '\n' ) );
+ if( mbExecutable )
+ {
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Option VBASupport 1\n" ) );
+ if( mnType == ApiModuleType::CLASS )
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Option ClassModule\n" ) );
+ }
+ else
+ {
+ // add a subroutine named after the module itself
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Sub " ) ).
+ append( maName.replace( ' ', '_' ) ).append( sal_Unicode( '\n' ) );
+ }
+
+ // decompression starts at current stream position of aInStrm
+ VbaInputStream aVbaStrm( aInStrm );
+ // load the source code line-by-line, with some more processing
+ TextInputStream aVbaTextStrm( aVbaStrm, meTextEnc );
+ while( !aVbaTextStrm.isEof() )
+ {
+ OUString aCodeLine = aVbaTextStrm.readLine();
+ // skip all 'Attribute' statements
+ if( !aCodeLine.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "Attribute " ) ) )
+ {
+ if( !mbExecutable )
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Rem " ) );
+ aSourceCode.append( aCodeLine ).append( sal_Unicode( '\n' ) );
+ }
+ }
+
+ // close the subroutine named after the module
+ if( !mbExecutable )
+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "End Sub\n" ) );
+
+ // insert extended module info
+ try
+ {
+ Reference< XVBAModuleInfo > xVBAModuleInfo( rxBasicLib, UNO_QUERY_THROW );
+ xVBAModuleInfo->insertModuleInfo( maName, aModuleInfo );
+ }
+ catch( Exception& )
+ {
+ }
+
+ // insert the module into the passed Basic library
+ try
+ {
+ rxBasicLib->insertByName( maName, Any( aSourceCode.makeStringAndClear() ) );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "VbaModule::importSourceCode - cannot insert module into library" );
+ }
+}
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx
new file mode 100755
index 000000000000..a370fb3d168e
--- /dev/null
+++ b/oox/source/ole/vbaproject.cxx
@@ -0,0 +1,519 @@
+/*************************************************************************
+ *
+ * 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 "oox/ole/vbaproject.hxx"
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
+#include <rtl/tencinfo.h>
+#include <rtl/ustrbuf.h>
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/string.hxx>
+#include "properties.hxx"
+#include "tokens.hxx"
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/helper/textinputstream.hxx"
+#include "oox/ole/olestorage.hxx"
+#include "oox/ole/vbacontrol.hxx"
+#include "oox/ole/vbahelper.hxx"
+#include "oox/ole/vbainputstream.hxx"
+#include "oox/ole/vbamodule.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNameContainer;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::document::XStorageBasedDocument;
+using ::com::sun::star::embed::XStorage;
+using ::com::sun::star::embed::XTransactedObject;
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::io::XStream;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::script::XLibraryContainer;
+using ::com::sun::star::script::XVBACompat;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::uno::XInterface;
+using ::comphelper::ConfigurationHelper;
+
+namespace ApiModuleType = ::com::sun::star::script::ModuleType;
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+namespace {
+
+bool lclReadConfigItem( const Reference< XInterface >& rxConfigAccess, const OUString& rItemName )
+{
+ // some applications do not support all configuration items, assume 'false' in this case
+ try
+ {
+ Any aItem = ConfigurationHelper::readRelativeKey( rxConfigAccess, CREATE_OUSTRING( "Filter/Import/VBA" ), rItemName );
+ return aItem.has< bool >() && aItem.get< bool >();
+ }
+ catch( Exception& )
+ {
+ }
+ return false;
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+VbaFilterConfig::VbaFilterConfig( const Reference< XMultiServiceFactory >& rxGlobalFactory, const OUString& rConfigCompName )
+{
+ OSL_ENSURE( rxGlobalFactory.is(), "VbaFilterConfig::VbaFilterConfig - missing service factory" );
+ try
+ {
+ OSL_ENSURE( rConfigCompName.getLength() > 0, "VbaFilterConfig::VbaFilterConfig - invalid configuration component name" );
+ OUString aConfigPackage = CREATE_OUSTRING( "org.openoffice.Office." ) + rConfigCompName;
+ mxConfigAccess = ConfigurationHelper::openConfig( rxGlobalFactory, aConfigPackage, ConfigurationHelper::E_READONLY );
+ }
+ catch( Exception& )
+ {
+ }
+ OSL_ENSURE( mxConfigAccess.is(), "VbaFilterConfig::VbaFilterConfig - cannot open configuration" );
+}
+
+VbaFilterConfig::~VbaFilterConfig()
+{
+}
+
+bool VbaFilterConfig::isImportVba() const
+{
+ return lclReadConfigItem( mxConfigAccess, CREATE_OUSTRING( "Load" ) );
+}
+
+bool VbaFilterConfig::isImportVbaExecutable() const
+{
+ return lclReadConfigItem( mxConfigAccess, CREATE_OUSTRING( "Executable" ) );
+}
+
+bool VbaFilterConfig::isExportVba() const
+{
+ return lclReadConfigItem( mxConfigAccess, CREATE_OUSTRING( "Save" ) );
+}
+
+// ============================================================================
+
+VbaProject::VbaProject( const Reference< XMultiServiceFactory >& rxGlobalFactory,
+ const Reference< XModel >& rxDocModel, const OUString& rConfigCompName ) :
+ VbaFilterConfig( rxGlobalFactory, rConfigCompName ),
+ mxGlobalFactory( rxGlobalFactory ),
+ mxDocModel( rxDocModel ),
+ maLibName( CREATE_OUSTRING( "Standard" ) )
+{
+ OSL_ENSURE( mxDocModel.is(), "VbaProject::VbaProject - missing document model" );
+ mxBasicLib = openLibrary( PROP_BasicLibraries, false );
+ mxDialogLib = openLibrary( PROP_DialogLibraries, false );
+}
+
+VbaProject::~VbaProject()
+{
+}
+
+void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr )
+{
+ if( rVbaPrjStrg.isStorage() )
+ {
+ // load the code modules and forms
+ if( isImportVba() )
+ importVba( rVbaPrjStrg, rGraphicHelper, bDefaultColorBgr );
+ // copy entire storage into model
+ if( isExportVba() )
+ copyStorage( rVbaPrjStrg );
+ }
+}
+
+bool VbaProject::hasModules() const
+{
+ return mxBasicLib.is() && mxBasicLib->hasElements();
+}
+
+bool VbaProject::hasModule( const OUString& rModuleName ) const
+{
+ return mxBasicLib.is() && mxBasicLib->hasByName( rModuleName );
+}
+
+bool VbaProject::hasDialogs() const
+{
+ return mxDialogLib.is() && mxDialogLib->hasElements();
+}
+
+bool VbaProject::hasDialog( const OUString& rDialogName ) const
+{
+ return mxDialogLib.is() && mxDialogLib->hasByName( rDialogName );
+}
+
+// Insert VBA code modules and VBA macros into modules ------------------------
+
+bool VbaProject::insertMacro( const OUString& rModuleName,
+ const OUString& rMacroName, const OUString& rMacroArgs,
+ const OUString& rMacroType, const OUString& rMacroCode )
+{
+ return
+ // do nothing if macros are imported as comments
+ isImportVbaExecutable() &&
+ // try to insert the macro (will check that the macro does not exist yet)
+ VbaHelper::insertMacro( mxBasicLib, rModuleName, rMacroName, rMacroArgs, rMacroType, rMacroCode );
+}
+
+// Attach VBA macros to generic or document events ----------------------------
+
+bool VbaProject::attachMacroToEvent( const Reference< XEventsSupplier >& rxEventsSupp,
+ const OUString& rEventName, const OUString& rModuleName, const OUString& rMacroName )
+{
+ return
+ // do not attach if macros are imported as comments
+ isImportVbaExecutable() &&
+ // check that the specified macro exists in the module
+ VbaHelper::hasMacro( mxBasicLib, rModuleName, rMacroName ) &&
+ // attach the macro to the events supplier
+ VbaHelper::attachMacroToEvent( rxEventsSupp, rEventName, maLibName, rModuleName, rMacroName );
+}
+
+bool VbaProject::attachMacroToDocumentEvent( const OUString& rEventName,
+ const OUString& rModuleName, const OUString& rMacroName )
+{
+ Reference< XEventsSupplier > xEventsSupp( mxDocModel, UNO_QUERY );
+ return attachMacroToEvent( xEventsSupp, rEventName, rModuleName, rMacroName );
+}
+
+bool VbaProject::attachMacroToEvent( const Reference< XEventsSupplier >& rxEventsSupp,
+ const OUString& rEventName, const OUString& rModuleName, const OUString& rMacroName,
+ const OUString& rProxyArgs, const OUString& rProxyType, const OUString& rProxyCode )
+{
+ // receive module source code, and check that the specified macro exists in the module
+ OUString aSourceCode = VbaHelper::getSourceCode( mxBasicLib, rModuleName );
+ if( isImportVbaExecutable() && VbaHelper::hasMacro( aSourceCode, rMacroName ) )
+ {
+ // create the name of the proxy macro, and the macro source code
+ OUString aProxyName = OUStringBuffer( rMacroName ).append( sal_Unicode( '_' ) ).
+ append( rEventName ).appendAscii( "_Proxy" ).makeStringAndClear();
+ // replace $MACRO and $PROXY placeholders in proxy source code
+ OUString aProxyCode = ::comphelper::string::searchAndReplaceAsciiL( rProxyCode, RTL_CONSTASCII_STRINGPARAM( "$MACRO" ), rMacroName );
+ aProxyCode = ::comphelper::string::searchAndReplaceAsciiL( aProxyCode, RTL_CONSTASCII_STRINGPARAM( "$PROXY" ), aProxyName );
+ // insert the new macro into the code module and attach it to the event
+ return
+ VbaHelper::insertMacro( mxBasicLib, rModuleName, aProxyName, rProxyArgs, rProxyType, aProxyCode ) &&
+ VbaHelper::attachMacroToEvent( rxEventsSupp, rEventName, maLibName, rModuleName, aProxyName );
+ }
+ return false;
+}
+
+bool VbaProject::attachMacroToDocumentEvent(
+ const OUString& rEventName, const OUString& rModuleName, const OUString& rMacroName,
+ const OUString& rProxyArgs, const OUString& rProxyType, const OUString& rProxyCode )
+{
+ Reference< XEventsSupplier > xEventsSupp( mxDocModel, UNO_QUERY );
+ return attachMacroToEvent( xEventsSupp, rEventName, rModuleName, rMacroName, rProxyArgs, rProxyType, rProxyCode );
+}
+
+// private --------------------------------------------------------------------
+
+Reference< XLibraryContainer > VbaProject::getLibraryContainer( sal_Int32 nPropId )
+{
+ PropertySet aDocProp( mxDocModel );
+ Reference< XLibraryContainer > xLibContainer( aDocProp.getAnyProperty( nPropId ), UNO_QUERY );
+ return xLibContainer;
+}
+
+Reference< XNameContainer > VbaProject::openLibrary( sal_Int32 nPropId, bool bCreateMissing )
+{
+ Reference< XNameContainer > xLibrary;
+ try
+ {
+ Reference< XLibraryContainer > xLibContainer( getLibraryContainer( nPropId ), UNO_SET_THROW );
+ if( bCreateMissing && !xLibContainer->hasByName( maLibName ) )
+ xLibContainer->createLibrary( maLibName );
+ xLibrary.set( xLibContainer->getByName( maLibName ), UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ }
+ OSL_ENSURE( !bCreateMissing || xLibrary.is(), "VbaProject::openLibrary - cannot create library" );
+ return xLibrary;
+}
+
+Reference< XNameContainer > VbaProject::createBasicLibrary()
+{
+ if( !mxBasicLib.is() )
+ mxBasicLib = openLibrary( PROP_BasicLibraries, true );
+ return mxBasicLib;
+}
+
+Reference< XNameContainer > VbaProject::createDialogLibrary()
+{
+ if( !mxDialogLib.is() )
+ mxDialogLib = openLibrary( PROP_DialogLibraries, true );
+ return mxDialogLib;
+}
+
+void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr )
+{
+ StorageRef xVbaStrg = rVbaPrjStrg.openSubStorage( CREATE_OUSTRING( "VBA" ), false );
+ OSL_ENSURE( xVbaStrg.get(), "VbaProject::importVba - cannot open 'VBA' substorage" );
+ if( !xVbaStrg )
+ return;
+
+ /* Read the 'VBA/dir' stream which contains general settings of the VBA
+ project such as the text encoding used throughout several streams, and
+ a list of all code modules.
+ */
+ BinaryXInputStream aInStrm( xVbaStrg->openInputStream( CREATE_OUSTRING( "dir" ) ), true );
+ // VbaInputStream implements decompression
+ VbaInputStream aDirStrm( aInStrm );
+ OSL_ENSURE( !aDirStrm.isEof(), "VbaProject::importVba - cannot open 'dir' stream" );
+ if( aDirStrm.isEof() )
+ return;
+
+ // read all records of the directory
+ rtl_TextEncoding eTextEnc = RTL_TEXTENCODING_MS_1252;
+ sal_uInt16 nModuleCount = 0;
+ bool bExecutable = isImportVbaExecutable();
+
+ typedef RefMap< OUString, VbaModule > VbaModuleMap;
+ VbaModuleMap aModules, aModulesByStrm;
+
+ sal_uInt16 nRecId = 0;
+ StreamDataSequence aRecData;
+ while( VbaHelper::readDirRecord( nRecId, aRecData, aDirStrm ) && (nRecId != VBA_ID_PROJECTEND) )
+ {
+ // create record stream object from imported record data
+ SequenceInputStream aRecStrm( aRecData );
+ sal_Int32 nRecSize = aRecData.getLength();
+ switch( nRecId )
+ {
+#define OOX_ENSURE_RECORDSIZE( cond ) OSL_ENSURE( cond, "VbaProject::importVba - invalid record size" )
+ case VBA_ID_PROJECTCODEPAGE:
+ {
+ OOX_ENSURE_RECORDSIZE( nRecSize == 2 );
+ OSL_ENSURE( aModules.empty(), "VbaProject::importVba - unexpected PROJECTCODEPAGE record" );
+ rtl_TextEncoding eNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( aRecStrm.readuInt16() );
+ OSL_ENSURE( eNewTextEnc != RTL_TEXTENCODING_DONTKNOW, "VbaProject::importVba - unknown text encoding" );
+ if( eNewTextEnc != RTL_TEXTENCODING_DONTKNOW )
+ eTextEnc = eNewTextEnc;
+ }
+ break;
+ case VBA_ID_PROJECTMODULES:
+ OOX_ENSURE_RECORDSIZE( nRecSize == 2 );
+ OSL_ENSURE( aModules.empty(), "VbaProject::importVba - unexpected PROJECTMODULES record" );
+ aRecStrm >> nModuleCount;
+ break;
+ case VBA_ID_MODULENAME:
+ {
+ OUString aName = aRecStrm.readCharArrayUC( nRecSize, eTextEnc );
+ OSL_ENSURE( aName.getLength() > 0, "VbaProject::importVba - invalid module name" );
+ OSL_ENSURE( !aModules.has( aName ), "VbaProject::importVba - multiple modules with the same name" );
+ VbaModuleMap::mapped_type& rxModule = aModules[ aName ];
+ rxModule.reset( new VbaModule( mxDocModel, aName, eTextEnc, bExecutable ) );
+ // read all remaining records until the MODULEEND record
+ rxModule->importDirRecords( aDirStrm );
+ OSL_ENSURE( !aModulesByStrm.has( rxModule->getStreamName() ), "VbaProject::importVba - multiple modules with the same stream name" );
+ aModulesByStrm[ rxModule->getStreamName() ] = rxModule;
+ }
+ break;
+#undef OOX_ENSURE_RECORDSIZE
+ }
+ }
+ OSL_ENSURE( nModuleCount == aModules.size(), "VbaProject::importVba - invalid module count" );
+
+ /* The directory does not contain the real type of the modules, it
+ distinguishes only between 'procedural' and 'document' (the latter
+ includes class and form modules). Now, the exact type of all modules
+ will be read from the 'PROJECT' stream. It consists of text lines in
+ 'key=value' format which list the code modules by type.
+
+ - The line 'document=<modulename>/&HXXXXXXXX' declares document
+ modules. These are attached to the Word document (usually called
+ 'ThisDocument'), the Excel workbook (usually called
+ 'ThisWorkbook'), or single Excel worksheets or chartsheets (usually
+ called 'SheetX' or 'ChartX', X being a decimal number). Of course,
+ users may rename all these modules. The slash character separates
+ an automation server version number (hexadecimal 'XXXXXXXX') from
+ the module name.
+ - The line 'Module=<modulename>' declares common procedural code
+ modules.
+ - The line 'Class=<modulename>' declares a class module.
+ - The line 'BaseClass=<modulename>' declares a code module attached
+ to a user form with the same name.
+ */
+ BinaryXInputStream aPrjStrm( rVbaPrjStrg.openInputStream( CREATE_OUSTRING( "PROJECT" ) ), true );
+ OSL_ENSURE( !aPrjStrm.isEof(), "VbaProject::importVba - cannot open 'PROJECT' stream" );
+ // do not exit if this stream does not exist, but proceed to load the modules below
+ if( !aPrjStrm.isEof() )
+ {
+ TextInputStream aPrjTextStrm( aPrjStrm, eTextEnc );
+ OUString aKey, aValue;
+ bool bExitLoop = false;
+ while( !bExitLoop && !aPrjTextStrm.isEof() )
+ {
+ // read a text line from the stream
+ OUString aLine = aPrjTextStrm.readLine().trim();
+ sal_Int32 nLineLen = aLine.getLength();
+ // exit if a subsection starts (section name is given in brackets)
+ bExitLoop = (nLineLen >= 2) && (aLine[ 0 ] == '[') && (aLine[ nLineLen - 1 ] == ']');
+ if( !bExitLoop && VbaHelper::extractKeyValue( aKey, aValue, aLine ) )
+ {
+ sal_Int32 nType = ApiModuleType::UNKNOWN;
+ if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Document" ) ) )
+ {
+ nType = ApiModuleType::DOCUMENT;
+ // strip automation server version from module names
+ sal_Int32 nSlashPos = aValue.indexOf( '/' );
+ if( nSlashPos >= 0 )
+ aValue = aValue.copy( 0, nSlashPos );
+ }
+ else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Module" ) ) )
+ nType = ApiModuleType::NORMAL;
+ else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Class" ) ) )
+ nType = ApiModuleType::CLASS;
+ else if( aKey.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "BaseClass" ) ) )
+ nType = ApiModuleType::FORM;
+
+ if( (nType != ApiModuleType::UNKNOWN) && (aValue.getLength() > 0) )
+ {
+ OSL_ENSURE( aModules.has( aValue ), "VbaProject::importVba - module not found" );
+ if( VbaModule* pModule = aModules.get( aValue ).get() )
+ pModule->setType( nType );
+ }
+ }
+ }
+ }
+
+ /* Now it is time to load the source code. All modules will be inserted
+ into the Basic library of the document specified by the 'maLibName'
+ member. Do not create the Basic library, if there are no modules
+ specified. */
+ if( !aModules.empty() ) try
+ {
+ // get the basic library
+ Reference< XNameContainer > xBasicLib( createBasicLibrary(), UNO_SET_THROW );
+
+ // set library container to VBA compatibility mode
+ try
+ {
+ Reference< XVBACompat >( getLibraryContainer( PROP_BasicLibraries ), UNO_QUERY_THROW )->setVBACompatModeOn( sal_True );
+ }
+ catch( Exception& )
+ {
+ }
+
+ // try to get access to document objects related to code modules
+ Reference< XNameAccess > xDocObjectNA;
+ try
+ {
+ Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW );
+ xDocObjectNA.set( xModelFactory->createInstance( CREATE_OUSTRING( "ooo.vba.VBAObjectModuleObjectProvider" ) ), UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ // not all documents support this
+ }
+
+ // call Basic source code import for each module, boost::[c]ref enforces pass-by-ref
+ if( xBasicLib.is() )
+ aModules.forEachMem( &VbaModule::importSourceCode,
+ ::boost::ref( *xVbaStrg ), ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
+ }
+ catch( Exception& )
+ {
+ }
+
+ /* Load the forms. The file format specification requires that a module
+ must exist for every form. We are a bit more tolerant and scan the
+ project storage for all form substorages. This may 'repair' broken VBA
+ storages that misses to mention a module for an existing form. */
+ ::std::vector< OUString > aElements;
+ rVbaPrjStrg.getElementNames( aElements );
+ for( ::std::vector< OUString >::iterator aIt = aElements.begin(), aEnd = aElements.end(); aIt != aEnd; ++aIt )
+ {
+ // try to open the element as storage
+ if( !aIt->equals( CREATE_OUSTRING( "VBA" ) ) )
+ {
+ StorageRef xSubStrg = rVbaPrjStrg.openSubStorage( *aIt, false );
+ if( xSubStrg.get() ) try
+ {
+ // resolve module name from storage name (which equals the module stream name)
+ VbaModule* pModule = aModulesByStrm.get( *aIt ).get();
+ OSL_ENSURE( pModule && (pModule->getType() == ApiModuleType::FORM),
+ "VbaProject::importVba - form substorage without form module" );
+ OUString aModuleName;
+ if( pModule )
+ aModuleName = pModule->getName();
+
+ // create and import the form
+ Reference< XNameContainer > xDialogLib( createDialogLibrary(), UNO_SET_THROW );
+ VbaUserForm aForm( mxGlobalFactory, rGraphicHelper, bDefaultColorBgr );
+ aForm.importForm( xDialogLib, *xSubStrg, aModuleName, eTextEnc );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+}
+
+void VbaProject::copyStorage( StorageBase& rVbaPrjStrg )
+{
+ try
+ {
+ Reference< XStorageBasedDocument > xStorageBasedDoc( mxDocModel, UNO_QUERY_THROW );
+ Reference< XStorage > xDocStorage( xStorageBasedDoc->getDocumentStorage(), UNO_QUERY_THROW );
+ {
+ using namespace ::com::sun::star::embed::ElementModes;
+ Reference< XStream > xDocStream( xDocStorage->openStreamElement( CREATE_OUSTRING( "_MS_VBA_Macros" ), SEEKABLE | WRITE | TRUNCATE ), UNO_SET_THROW );
+ OleStorage aDestStorage( mxGlobalFactory, xDocStream, false );
+ rVbaPrjStrg.copyStorageToStorage( aDestStorage );
+ aDestStorage.commit();
+ }
+ Reference< XTransactedObject >( xDocStorage, UNO_QUERY_THROW )->commit();
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
diff --git a/oox/source/ppt/animvariantcontext.cxx b/oox/source/ppt/animvariantcontext.cxx
index ea639c8c6f5c..e2eca9a36dca 100644
--- a/oox/source/ppt/animvariantcontext.cxx
+++ b/oox/source/ppt/animvariantcontext.cxx
@@ -65,7 +65,7 @@ namespace oox { namespace ppt {
{
if( ( aElement == mnElement ) && maColor.isUsed() )
{
- maValue = makeAny( maColor.getColor( getFilter() ) );
+ maValue = makeAny( maColor.getColor( getFilter().getGraphicHelper() ) );
}
}
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index 79341081f1d0..39ad52316a92 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -29,6 +29,7 @@
#include "oox/drawingml/chart/chartconverter.hxx"
#include "oox/dump/pptxdumper.hxx"
#include "oox/drawingml/table/tablestylelistfragmenthandler.hxx"
+#include "oox/helper/graphichelper.hxx"
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -150,6 +151,35 @@ const oox::drawingml::table::TableStyleListPtr PowerPointImport::getTableStyles(
return *mxChartConv;
}
+namespace {
+
+class PptGraphicHelper : public GraphicHelper
+{
+public:
+ explicit PptGraphicHelper( const PowerPointImport& rFilter );
+ virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+private:
+ const PowerPointImport& mrFilter;
+};
+
+PptGraphicHelper::PptGraphicHelper( const PowerPointImport& rFilter ) :
+ GraphicHelper( rFilter.getGlobalFactory(), rFilter.getTargetFrame() ),
+ mrFilter( rFilter )
+{
+}
+
+sal_Int32 PptGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
+{
+ return mrFilter.getSchemeColor( nToken );
+}
+
+} // namespace
+
+GraphicHelper* PowerPointImport::implCreateGraphicHelper() const
+{
+ return new PptGraphicHelper( *this );
+}
+
OUString PowerPointImport::implGetImplementationName() const
{
return PowerPointImport_getImplementationName();
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index d5b3b13c762a..39540335cf13 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -179,7 +179,7 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xPropertySet( aPropMap.makePropertySet() );
PropertySet aPropSet( xPropertySet );
- mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper() );
+ mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), rFilterBase.getGraphicHelper() );
xPagePropSet->setPropertyValue( sBackground, Any( xPropertySet ) );
}
catch( Exception )
diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx
index 3edca28aecac..7e40e3be4db4 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -504,19 +504,13 @@ namespace oox { namespace ppt {
NodePropertyMap & pProps(mpNode->getNodeProperties());
pProps[ NP_DIRECTION ] = makeAny( mnDir == XML_cw );
pProps[ NP_COLORINTERPOLATION ] = makeAny( mnColorSpace == XML_hsl ? AnimationColorSpace::HSL : AnimationColorSpace::RGB );
+ const GraphicHelper& rGraphicHelper = getFilter().getGraphicHelper();
if( maToClr.isUsed() )
- {
- mpNode->setTo( Any( maToClr.getColor( getFilter() ) ) );
- }
+ mpNode->setTo( Any( maToClr.getColor( rGraphicHelper ) ) );
if( maFromClr.isUsed() )
- {
- mpNode->setFrom( Any( maFromClr.getColor( getFilter() ) ) );
- }
+ mpNode->setFrom( Any( maFromClr.getColor( rGraphicHelper ) ) );
if( mbHasByColor )
- {
mpNode->setBy( Any ( m_byColor.get() ) );
- }
-
}
}
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 4d20b8f1c255..609eeda60cde 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -15,6 +15,7 @@ Autocomplete
BackGraphicLocation
BackGraphicURL
BackgroundColor
+BasicLibraries
BlackDay
BlockIncrement
Border
@@ -72,6 +73,7 @@ CharUnderlineHasColor
CharWeight
CharWeightAsian
CharWeightComplex
+CodeName
Color
ColumnGrand
ColumnLabelRanges
@@ -97,16 +99,19 @@ D3DScenePerspective
D3DSceneShadeMode
DDELinks
DatabaseRanges
+DefaultContext
DefaultScrollValue
DefaultSpinValue
DefaultState
DefaultText
DiagonalBLTR
DiagonalTLBR
+DialogLibraries
DisplayLabels
DrillDownOnDoubleClick
Dropdown
EchoChar
+EnableVisible
Enabled
EndPosition
ErrorAlertStyle
@@ -173,6 +178,7 @@ HeaderIsDynamicHeight
HeaderIsOn
HeaderIsShared
Height
+HelpText
HideInactiveSelection
HoriJustify
HorizontalSplitMode
@@ -279,6 +285,8 @@ PositionBottom
PositionLeft
PositionRight
PositionTop
+PositionX
+PositionY
PositiveError
Prefix
PrintAnnotations
@@ -287,6 +295,8 @@ PrintDownFirst
PrintGrid
PrintHeaders
Printable
+ProgressValueMax
+ProgressValueMin
Protected
Reference
ReferenceDevice
@@ -312,6 +322,7 @@ ScaleMode
ScaleToPages
ScaleToPagesX
ScaleToPagesY
+ScrollValue
ScrollValueMax
ScrollValueMin
SelectedPage
@@ -343,6 +354,7 @@ Sound
SoundOn
Speed
SpinIncrement
+SpinValue
SpinValueMax
SpinValueMin
StackCharacters
@@ -350,16 +362,21 @@ StackingDirection
StartPosition
StartWith
StartingAngle
+State
Subtotals
Suffix
SwapXAndYAxis
Symbol
SymbolColor
+TabIndex
TableBorder
TableLayout
TableSelected
Tables
+Tabstop
+Tag
TargetFrame
+Text
TextAutoGrowHeight
TextBreak
TextColor
@@ -372,6 +389,7 @@ TextUpperDistance
TextVerticalAdjust
TextWordWrap
TextWritingMode
+Title
Toggle
TokenIndex
TopBorder
diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index 9c1bb761532a..9a5f4451ec04 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -29,7 +29,7 @@
#include <com/sun/star/drawing/XShapes.hpp>
#include "tokens.hxx"
#include "oox/core/xmlfilterbase.hxx"
-#include "oox/ole/axcontrolhelper.hxx"
+#include "oox/ole/axcontrol.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
@@ -97,15 +97,12 @@ Drawing::~Drawing()
{
}
-::oox::ole::AxControlHelper& Drawing::getControlHelper() const
+::oox::ole::EmbeddedForm& Drawing::getControlForm() const
{
- // create the helper object on demand
- if( !mxCtrlHelper.get() )
- {
- mxCtrlHelper.reset( createControlHelper() );
- OSL_ENSURE( mxCtrlHelper.get(), "Drawing::getControlHelper - cannot create form controls helper" );
- }
- return *mxCtrlHelper;
+ if( !mxCtrlForm.get() )
+ mxCtrlForm.reset( new ::oox::ole::EmbeddedForm(
+ mrFilter.getModelFactory(), mxDrawPage, mrFilter.getGraphicHelper() ) );
+ return *mxCtrlForm;
}
void Drawing::registerOleObject( const OleObjectInfo& rOleObject )
@@ -158,11 +155,6 @@ void Drawing::convertControlClientData( const Reference< XControlModel >& /*rxCt
{
}
-::oox::ole::AxControlHelper* Drawing::createControlHelper() const
-{
- return new ::oox::ole::AxEmbeddedControlHelper( mrFilter, mxDrawPage );
-}
-
// ============================================================================
} // namespace vml
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index be3f3dd19e8c..6baea708c8a2 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -29,8 +29,8 @@
#include <rtl/strbuf.hxx>
#include "tokens.hxx"
#include "oox/token/tokenmap.hxx"
+#include "oox/helper/graphichelper.hxx"
#include "oox/helper/propertymap.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/drawingml/color.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/fillproperties.hxx"
@@ -39,7 +39,6 @@
using ::rtl::OStringBuffer;
using ::rtl::OUString;
using ::com::sun::star::geometry::IntegerRectangle2D;
-using ::oox::core::FilterBase;
using ::oox::drawingml::Color;
using ::oox::drawingml::FillProperties;
using ::oox::drawingml::LineArrowProperties;
@@ -106,7 +105,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
return fDefValue;
}
-/*static*/ sal_Int32 ConversionHelper::decodeMeasureToEmu( const FilterBase& rFilter,
+/*static*/ sal_Int32 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper,
const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel )
{
// default for missing values is 0
@@ -150,7 +149,9 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
else if( (cChar1 == 'p') && (cChar2 == 'c') ) // 1 pica = 1/6 inch = 152,400 EMU
fValue *= 152400.0;
else if( (cChar1 == 'p') && (cChar2 == 'x') ) // 1 pixel, dependent on output device, factor 360 to convert 1/100mm to EMU
- fValue = bPixelX ? rFilter.convertScreenPixelX( 360.0 * fValue ) : rFilter.convertScreenPixelY( 360.0 * fValue );
+ fValue = bPixelX ?
+ rGraphicHelper.convertScreenPixelXToHmm( 360.0 * fValue ) :
+ rGraphicHelper.convertScreenPixelYToHmm( 360.0 * fValue );
}
else if( (aUnit.getLength() == 1) && (aUnit[ 0 ] == '%') )
{
@@ -164,10 +165,10 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
return static_cast< sal_Int32 >( fValue + 0.5 );
}
-/*static*/ sal_Int32 ConversionHelper::decodeMeasureToHmm( const FilterBase& rFilter,
+/*static*/ sal_Int32 ConversionHelper::decodeMeasureToHmm( const GraphicHelper& rGraphicHelper,
const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel )
{
- return (decodeMeasureToEmu( rFilter, rValue, nRefValue, bPixelX, bDefaultAsPixel ) + 180) / 360;
+ return (decodeMeasureToEmu( rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel ) + 180) / 360;
}
// ============================================================================
@@ -195,7 +196,7 @@ namespace {
specifies the color to be used to resolve the color modifiers used in
one-color gradients.
*/
-void lclGetColor( Color& orDmlColor, const FilterBase& rFilter,
+void lclGetColor( Color& orDmlColor, const GraphicHelper& rGraphicHelper,
const OptValue< OUString >& roVmlColor, const OptValue< double >& roVmlOpacity,
sal_Int32 nDefaultRgb, sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT )
{
@@ -239,7 +240,7 @@ void lclGetColor( Color& orDmlColor, const FilterBase& rFilter,
sal_Int32 nColorToken = StaticTokenMap::get().getTokenFromUnicode( aColorName );
sal_Int32 nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
if( nRgbValue == API_RGB_TRANSPARENT )
- nRgbValue = rFilter.getSystemColor( nColorToken, API_RGB_TRANSPARENT );
+ nRgbValue = rGraphicHelper.getSystemColor( nColorToken, API_RGB_TRANSPARENT );
if( nRgbValue != API_RGB_TRANSPARENT )
{
orDmlColor.setSrgbClr( nRgbValue );
@@ -284,9 +285,9 @@ void lclGetColor( Color& orDmlColor, const FilterBase& rFilter,
orDmlColor.setSrgbClr( nDefaultRgb );
}
-sal_Int32 lclGetEmu( const FilterBase& rFilter, const OptValue< OUString >& roValue, sal_Int32 nDefValue )
+sal_Int32 lclGetEmu( const GraphicHelper& rGraphicHelper, const OptValue< OUString >& roValue, sal_Int32 nDefValue )
{
- return roValue.has() ? ConversionHelper::decodeMeasureToEmu( rFilter, roValue.get(), 0, false, false ) : nDefValue;
+ return roValue.has() ? ConversionHelper::decodeMeasureToEmu( rGraphicHelper, roValue.get(), 0, false, false ) : nDefValue;
}
void lclGetDmlLineDash( OptValue< sal_Int32 >& oroPresetDash, LineProperties::DashStopVector& orCustomDash, const OptValue< OUString >& roDashStyle )
@@ -428,7 +429,8 @@ void StrokeModel::assignUsed( const StrokeModel& rSource )
moJoinStyle.assignIfUsed( rSource.moJoinStyle );
}
-void StrokeModel::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter ) const
+void StrokeModel::pushToPropMap( PropertyMap& rPropMap,
+ ModelObjectHelper& rModelObjectHelper, const GraphicHelper& rGraphicHelper ) const
{
/* Convert VML line formatting to DrawingML line formatting and let the
DrawingML code do the hard work. */
@@ -439,8 +441,8 @@ void StrokeModel::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilte
aLineProps.maLineFill.moFillType = XML_solidFill;
lclConvertArrow( aLineProps.maStartArrow, maStartArrow );
lclConvertArrow( aLineProps.maEndArrow, maEndArrow );
- lclGetColor( aLineProps.maLineFill.maFillColor, rFilter, moColor, moOpacity, API_RGB_BLACK );
- aLineProps.moLineWidth = lclGetEmu( rFilter, moWeight, 1 );
+ lclGetColor( aLineProps.maLineFill.maFillColor, rGraphicHelper, moColor, moOpacity, API_RGB_BLACK );
+ aLineProps.moLineWidth = lclGetEmu( rGraphicHelper, moWeight, 1 );
lclGetDmlLineDash( aLineProps.moPresetDash, aLineProps.maCustomDash, moDashStyle );
aLineProps.moLineCompound = lclGetDmlLineCompound( moLineStyle );
aLineProps.moLineCap = lclGetDmlLineCap( moEndCap );
@@ -451,7 +453,7 @@ void StrokeModel::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilte
aLineProps.maLineFill.moFillType = XML_noFill;
}
- aLineProps.pushToPropMap( rPropMap, rFilter, rFilter.getModelObjectHelper() );
+ aLineProps.pushToPropMap( rPropMap, rModelObjectHelper, rGraphicHelper );
}
// ============================================================================
@@ -471,7 +473,8 @@ void FillModel::assignUsed( const FillModel& rSource )
moRotate.assignIfUsed( rSource.moRotate );
}
-void FillModel::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter ) const
+void FillModel::pushToPropMap( PropertyMap& rPropMap,
+ ModelObjectHelper& rModelObjectHelper, const GraphicHelper& rGraphicHelper ) const
{
/* Convert VML fill formatting to DrawingML fill formatting and let the
DrawingML code do the hard work. */
@@ -491,8 +494,8 @@ void FillModel::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter
// prepare colors
Color aColor1, aColor2;
- lclGetColor( aColor1, rFilter, moColor, moOpacity, API_RGB_WHITE );
- lclGetColor( aColor2, rFilter, moColor2, moOpacity2, API_RGB_WHITE, aColor1.getColor( rFilter ) );
+ lclGetColor( aColor1, rGraphicHelper, moColor, moOpacity, API_RGB_WHITE );
+ lclGetColor( aColor2, rGraphicHelper, moColor2, moOpacity2, API_RGB_WHITE, aColor1.getColor( rGraphicHelper ) );
// type XML_gradient is linear or axial gradient
if( nFillType == XML_gradient )
@@ -563,7 +566,7 @@ void FillModel::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter
{
aFillProps.moFillType = XML_solidFill;
// fill color (default is white)
- lclGetColor( aFillProps.maFillColor, rFilter, moColor, moOpacity, API_RGB_WHITE );
+ lclGetColor( aFillProps.maFillColor, rGraphicHelper, moColor, moOpacity, API_RGB_WHITE );
}
}
}
@@ -572,7 +575,7 @@ void FillModel::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter
aFillProps.moFillType = XML_noFill;
}
- aFillProps.pushToPropMap( rPropMap, rFilter, rFilter.getModelObjectHelper() );
+ aFillProps.pushToPropMap( rPropMap, rModelObjectHelper, rGraphicHelper );
}
// ============================================================================
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 014f1edf4c45..40b3e9952b43 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -195,12 +195,12 @@ Rectangle ShapeType::getRectangle( const ShapeParentAnchor* pParentAnchor ) cons
Rectangle ShapeType::getAbsRectangle() const
{
- const XmlFilterBase& rFilter = mrDrawing.getFilter();
+ const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
return Rectangle(
- ConversionHelper::decodeMeasureToHmm( rFilter, maTypeModel.maLeft, 0, true, true ) + ConversionHelper::decodeMeasureToHmm( rFilter, maTypeModel.maMarginLeft, 0, true, true ),
- ConversionHelper::decodeMeasureToHmm( rFilter, maTypeModel.maTop, 0, false, true ) + ConversionHelper::decodeMeasureToHmm( rFilter, maTypeModel.maMarginTop, 0, false, true ),
- ConversionHelper::decodeMeasureToHmm( rFilter, maTypeModel.maWidth, 0, true, true ),
- ConversionHelper::decodeMeasureToHmm( rFilter, maTypeModel.maHeight, 0, false, true ) );
+ ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maLeft, 0, true, true ) + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true ),
+ ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maTop, 0, false, true ) + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginTop, 0, false, true ),
+ ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maWidth, 0, true, true ),
+ ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maHeight, 0, false, true ) );
}
Rectangle ShapeType::getRelRectangle() const
@@ -305,10 +305,12 @@ Rectangle ShapeBase::calcShapeRectangle( const ShapeParentAnchor* pParentAnchor
void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) const
{
- PropertyMap aPropMap;
+ ModelObjectHelper& rModelObjectHelper = mrDrawing.getFilter().getModelObjectHelper();
+ const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
- maTypeModel.maStrokeModel.pushToPropMap( aPropMap, mrDrawing.getFilter() );
- maTypeModel.maFillModel.pushToPropMap( aPropMap, mrDrawing.getFilter() );
+ PropertyMap aPropMap;
+ maTypeModel.maStrokeModel.pushToPropMap( aPropMap, rModelObjectHelper, rGraphicHelper );
+ maTypeModel.maFillModel.pushToPropMap( aPropMap, rModelObjectHelper, rGraphicHelper );
PropertySet aPropSet( rxShape );
aPropSet.setProperties( aPropMap );
@@ -440,12 +442,12 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
if( pControlInfo && (pControlInfo->maFragmentPath.getLength() > 0) && (maTypeModel.maName.getLength() > 0) )
{
OSL_ENSURE( maTypeModel.maName == pControlInfo->maName, "ComplexShape::implConvertAndInsert - control name mismatch" );
- ::oox::ole::AxControl aControl( maTypeModel.maName );
+ ::oox::ole::EmbeddedControl aControl( maTypeModel.maName );
// load the control properties from fragment
if( rFilter.importFragment( new ::oox::ole::AxControlFragment( rFilter, pControlInfo->maFragmentPath, aControl ) ) ) try
{
// create control model and insert it into the form of the draw page
- Reference< XControlModel > xCtrlModel( aControl.convertAndInsert( mrDrawing.getControlHelper() ), UNO_SET_THROW );
+ Reference< XControlModel > xCtrlModel( mrDrawing.getControlForm().convertAndInsert( aControl ), UNO_SET_THROW );
if( maShapeModel.mxClientData.get() )
mrDrawing.convertControlClientData( xCtrlModel, *maShapeModel.mxClientData );
diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx
index 6b1711f3c0f9..8e36e4b0054e 100644
--- a/oox/source/vml/vmlshapecontainer.cxx
+++ b/oox/source/vml/vmlshapecontainer.cxx
@@ -33,7 +33,6 @@ using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::awt::Rectangle;
using ::com::sun::star::drawing::XShapes;
-using ::oox::core::XmlFilterBase;
namespace oox {
namespace vml {
diff --git a/oox/source/xls/biffdetector.cxx b/oox/source/xls/biffdetector.cxx
index 82c7cb822d83..fc3e1e710bcb 100644
--- a/oox/source/xls/biffdetector.cxx
+++ b/oox/source/xls/biffdetector.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <comphelper/mediadescriptor.hxx>
#include "oox/helper/binaryinputstream.hxx"
-#include "oox/helper/olestorage.hxx"
+#include "oox/ole/olestorage.hxx"
using ::rtl::OUString;
using ::rtl::OStringBuffer;
@@ -85,7 +85,7 @@ BiffType BiffDetector::detectStreamBiffVersion( BinaryInputStream& rInStream )
if( !rInStream.isEof() && rInStream.isSeekable() && (rInStream.getLength() > 4) )
{
sal_Int64 nOldPos = rInStream.tell();
- rInStream.seek( 0 );
+ rInStream.seekToStart();
sal_uInt16 nBofId, nBofSize;
rInStream >> nBofId >> nBofSize;
@@ -211,7 +211,7 @@ OUString SAL_CALL BiffDetector::detect( Sequence< PropertyValue >& rDescriptor )
if( xInStrm.is() )
{
OUString aWorkbookName;
- StorageRef xStorage( new OleStorage( mxFactory, xInStrm, true ) );
+ StorageRef xStorage( new ::oox::ole::OleStorage( mxFactory, xInStrm, true ) );
switch( detectStorageBiffVersion( aWorkbookName, xStorage ) )
{
case BIFF2:
diff --git a/oox/source/xls/biffhelper.cxx b/oox/source/xls/biffhelper.cxx
index 8ecea303183e..afd7e04e6a08 100644
--- a/oox/source/xls/biffhelper.cxx
+++ b/oox/source/xls/biffhelper.cxx
@@ -26,8 +26,8 @@
************************************************************************/
#include "oox/xls/biffhelper.hxx"
-#include <algorithm>
#include <rtl/math.hxx>
+#include <rtl/tencinfo.h>
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/biffoutputstream.hxx"
#include "oox/xls/worksheethelper.hxx"
@@ -56,69 +56,6 @@ const sal_uInt16 BIFF_IMGDATA_NATIVE = 14;
// ----------------------------------------------------------------------------
-static const struct CodePageEntry
-{
- sal_uInt16 mnCodePage;
- rtl_TextEncoding meTextEnc;
-}
-spCodePages[] =
-{
- { 437, RTL_TEXTENCODING_IBM_437 }, // OEM US
-// { 720, RTL_TEXTENCODING_IBM_720 }, // OEM Arabic
- { 737, RTL_TEXTENCODING_IBM_737 }, // OEM Greek
- { 775, RTL_TEXTENCODING_IBM_775 }, // OEM Baltic
- { 850, RTL_TEXTENCODING_IBM_850 }, // OEM Latin I
- { 852, RTL_TEXTENCODING_IBM_852 }, // OEM Latin II (Central European)
- { 855, RTL_TEXTENCODING_IBM_855 }, // OEM Cyrillic
- { 857, RTL_TEXTENCODING_IBM_857 }, // OEM Turkish
-// { 858, RTL_TEXTENCODING_IBM_858 }, // OEM Multilingual Latin I with Euro
- { 860, RTL_TEXTENCODING_IBM_860 }, // OEM Portugese
- { 861, RTL_TEXTENCODING_IBM_861 }, // OEM Icelandic
- { 862, RTL_TEXTENCODING_IBM_862 }, // OEM Hebrew
- { 863, RTL_TEXTENCODING_IBM_863 }, // OEM Canadian (French)
- { 864, RTL_TEXTENCODING_IBM_864 }, // OEM Arabic
- { 865, RTL_TEXTENCODING_IBM_865 }, // OEM Nordic
- { 866, RTL_TEXTENCODING_IBM_866 }, // OEM Cyrillic (Russian)
- { 869, RTL_TEXTENCODING_IBM_869 }, // OEM Greek (Modern)
- { 874, RTL_TEXTENCODING_MS_874 }, // MS Windows Thai
- { 932, RTL_TEXTENCODING_MS_932 }, // MS Windows Japanese Shift-JIS
- { 936, RTL_TEXTENCODING_MS_936 }, // MS Windows Chinese Simplified GBK
- { 949, RTL_TEXTENCODING_MS_949 }, // MS Windows Korean (Wansung)
- { 950, RTL_TEXTENCODING_MS_950 }, // MS Windows Chinese Traditional BIG5
- { 1200, RTL_TEXTENCODING_DONTKNOW }, // Unicode (BIFF8) - return *_DONTKNOW to preserve old code page
- { 1250, RTL_TEXTENCODING_MS_1250 }, // MS Windows Latin II (Central European)
- { 1251, RTL_TEXTENCODING_MS_1251 }, // MS Windows Cyrillic
- { 1252, RTL_TEXTENCODING_MS_1252 }, // MS Windows Latin I (BIFF4-BIFF8)
- { 1253, RTL_TEXTENCODING_MS_1253 }, // MS Windows Greek
- { 1254, RTL_TEXTENCODING_MS_1254 }, // MS Windows Turkish
- { 1255, RTL_TEXTENCODING_MS_1255 }, // MS Windows Hebrew
- { 1256, RTL_TEXTENCODING_MS_1256 }, // MS Windows Arabic
- { 1257, RTL_TEXTENCODING_MS_1257 }, // MS Windows Baltic
- { 1258, RTL_TEXTENCODING_MS_1258 }, // MS Windows Vietnamese
- { 1361, RTL_TEXTENCODING_MS_1361 }, // MS Windows Korean (Johab)
- { 10000, RTL_TEXTENCODING_APPLE_ROMAN }, // Apple Roman
- { 32768, RTL_TEXTENCODING_APPLE_ROMAN }, // Apple Roman
- { 32769, RTL_TEXTENCODING_MS_1252 } // MS Windows Latin I (BIFF2-BIFF3)
-};
-
-/** Predicate to search by given code page. */
-struct CodePageEntry_CPPred
-{
- inline explicit CodePageEntry_CPPred( sal_uInt16 nCodePage ) : mnCodePage( nCodePage ) {}
- inline bool operator()( const CodePageEntry& rEntry ) const { return rEntry.mnCodePage == mnCodePage; }
- sal_uInt16 mnCodePage;
-};
-
-/** Predicate to search by given text encoding. */
-struct CodePageEntry_TEPred
-{
- inline explicit CodePageEntry_TEPred( rtl_TextEncoding eTextEnc ) : meTextEnc( eTextEnc ) {}
- inline bool operator()( const CodePageEntry& rEntry ) const { return rEntry.meTextEnc == meTextEnc; }
- rtl_TextEncoding meTextEnc;
-};
-
-// ----------------------------------------------------------------------------
-
union DecodedDouble
{
double mfValue;
@@ -217,7 +154,7 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm,
aOutStrm << sal_uInt16( 0x4D42 ) << nBmpSize << sal_Int32( 0 ) << nOffset;
// copy the DIB header
- aOutStrm.copyStream( rStrm, nDibHdrSize );
+ rStrm.copyToStream( aOutStrm, nDibHdrSize );
nBytes -= nDibHdrSize;
/* Excel 3.x and Excel 4.x seem to write broken or out-dated DIB data.
@@ -239,8 +176,8 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm,
aOutStrm.seek( nOutStrmPos );
}
- // copy remaining pixel data top output stream
- aOutStrm.copyStream( rStrm, nBytes );
+ // copy remaining pixel data to output stream
+ rStrm.copyToStream( aOutStrm, nBytes );
}
rStrm.seek( nInStrmPos + nBytes );
}
@@ -249,8 +186,6 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm,
// ============================================================================
-// conversion -----------------------------------------------------------------
-
/*static*/ double BiffHelper::calcDoubleFromRk( sal_Int32 nRkValue )
{
DecodedDouble aDecDbl( 0.0 );
@@ -307,24 +242,24 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm,
/*static*/ rtl_TextEncoding BiffHelper::calcTextEncodingFromCodePage( sal_uInt16 nCodePage )
{
- const CodePageEntry* pEntry = ::std::find_if( spCodePages, STATIC_ARRAY_END( spCodePages ), CodePageEntry_CPPred( nCodePage ) );
- if( pEntry == STATIC_ARRAY_END( spCodePages ) )
+ // some specials for BIFF
+ switch( nCodePage )
{
- OSL_ENSURE( false, "UnitConverter::calcTextEncodingFromCodePage - unknown code page" );
- return RTL_TEXTENCODING_DONTKNOW;
+ case 1200: return RTL_TEXTENCODING_DONTKNOW; // BIFF8 Unicode
+ case 32768: return RTL_TEXTENCODING_APPLE_ROMAN;
+ case 32769: return RTL_TEXTENCODING_MS_1252; // BIFF2-BIFF3
}
- return pEntry->meTextEnc;
+
+ rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage );
+ OSL_ENSURE( eTextEnc != RTL_TEXTENCODING_DONTKNOW, "BiffHelper::calcTextEncodingFromCodePage - unknown code page" );
+ return eTextEnc;
}
/*static*/ sal_uInt16 BiffHelper::calcCodePageFromTextEncoding( rtl_TextEncoding eTextEnc )
{
- const CodePageEntry* pEntry = ::std::find_if( spCodePages, STATIC_ARRAY_END( spCodePages ), CodePageEntry_TEPred( eTextEnc ) );
- if( pEntry == STATIC_ARRAY_END( spCodePages ) )
- {
- OSL_ENSURE( false, "UnitConverter::calcCodePageFromTextEncoding - unsupported text encoding" );
- return 1252;
- }
- return pEntry->mnCodePage;
+ sal_uInt32 nCodePage = rtl_getWindowsCodePageFromTextEncoding( eTextEnc );
+ OSL_ENSURE( (0 < nCodePage) && (nCodePage <= SAL_MAX_UINT16), "BiffHelper::calcCodePageFromTextEncoding - unknown text encoding" );
+ return static_cast< sal_uInt16 >( (nCodePage == 0) ? 1252 : nCodePage );
}
/*static*/ void BiffHelper::importImgData( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, BiffType eBiff )
diff --git a/oox/source/xls/excelfilter.cxx b/oox/source/xls/excelfilter.cxx
index d5627c56b4a3..71475790851f 100644
--- a/oox/source/xls/excelfilter.cxx
+++ b/oox/source/xls/excelfilter.cxx
@@ -30,6 +30,7 @@
#include "oox/xls/biffdetector.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/excelchartconverter.hxx"
+#include "oox/xls/stylesbuffer.hxx"
#include "oox/xls/themebuffer.hxx"
#include "oox/xls/workbookfragment.hxx"
#include "oox/dump/biffdumper.hxx"
@@ -56,29 +57,29 @@ namespace xls {
// ============================================================================
ExcelFilterBase::ExcelFilterBase() :
- mpHelper( 0 )
+ mpData( 0 )
{
}
ExcelFilterBase::~ExcelFilterBase()
{
- OSL_ENSURE( !mpHelper, "ExcelFilterBase::~ExcelFilterBase - workbook helper not cleared" );
+ OSL_ENSURE( !mpData, "ExcelFilterBase::~ExcelFilterBase - workbook data not cleared" );
}
-void ExcelFilterBase::setWorkbookHelper( WorkbookHelper& rHelper )
+void ExcelFilterBase::registerWorkbookData( WorkbookData& rData )
{
- mpHelper = &rHelper;
+ mpData = &rData;
}
-WorkbookHelper& ExcelFilterBase::getWorkbookHelper() const
+WorkbookData& ExcelFilterBase::getWorkbookData() const
{
- OSL_ENSURE( mpHelper, "ExcelFilterBase::getWorkbookHelper - missing workbook helper" );
- return *mpHelper;
+ OSL_ENSURE( mpData, "ExcelFilterBase::getWorkbookData - missing workbook data" );
+ return *mpData;
}
-void ExcelFilterBase::clearWorkbookHelper()
+void ExcelFilterBase::unregisterWorkbookData()
{
- mpHelper = 0;
+ mpData = 0;
}
// ============================================================================
@@ -124,12 +125,7 @@ bool ExcelFilter::importDocument() throw()
if( aWorkbookPath.getLength() > 0 )
{
WorkbookHelperRoot aHelper( *this );
- if( aHelper.isValid() )
- {
- setWorkbookHelper( aHelper ); // needed for callbacks
- bRet = importFragment( new OoxWorkbookFragment( aHelper, aWorkbookPath ) );
- clearWorkbookHelper();
- }
+ bRet = aHelper.isValid() && importFragment( new OoxWorkbookFragment( aHelper, aWorkbookPath ) );
}
return bRet;
}
@@ -139,19 +135,9 @@ bool ExcelFilter::exportDocument() throw()
return false;
}
-sal_Int32 ExcelFilter::getSchemeColor( sal_Int32 nToken ) const
-{
- return getWorkbookHelper().getTheme().getColorByToken( nToken );
-}
-
-sal_Int32 ExcelFilter::getPaletteColor( sal_Int32 nPaletteIdx ) const
-{
- return getWorkbookHelper().getStyles().getPaletteColor( nPaletteIdx );
-}
-
const ::oox::drawingml::Theme* ExcelFilter::getCurrentTheme() const
{
- return &getWorkbookHelper().getTheme();
+ return &WorkbookHelper( getWorkbookData() ).getTheme();
}
::oox::vml::Drawing* ExcelFilter::getVmlDrawing()
@@ -166,7 +152,12 @@ const TableStyleListPtr ExcelFilter::getTableStyles()
::oox::drawingml::chart::ChartConverter& ExcelFilter::getChartConverter()
{
- return getWorkbookHelper().getChartConverter();
+ return WorkbookHelper( getWorkbookData() ).getChartConverter();
+}
+
+GraphicHelper* ExcelFilter::implCreateGraphicHelper() const
+{
+ return new ExcelGraphicHelper( getWorkbookData() );
}
OUString ExcelFilter::implGetImplementationName() const
@@ -229,12 +220,7 @@ bool ExcelBiffFilter::importDocument() throw()
if( eBiff != BIFF_UNKNOWN )
{
WorkbookHelperRoot aHelper( *this, eBiff );
- if( aHelper.isValid() )
- {
- setWorkbookHelper( aHelper ); // needed for callbacks
- bRet = BiffWorkbookFragment( aHelper, aWorkbookName ).importFragment();
- clearWorkbookHelper();
- }
+ bRet = aHelper.isValid() && BiffWorkbookFragment( aHelper, aWorkbookName ).importFragment();
}
return bRet;
}
@@ -244,9 +230,9 @@ bool ExcelBiffFilter::exportDocument() throw()
return false;
}
-sal_Int32 ExcelBiffFilter::getPaletteColor( sal_Int32 nPaletteIdx ) const
+GraphicHelper* ExcelBiffFilter::implCreateGraphicHelper() const
{
- return getWorkbookHelper().getStyles().getPaletteColor( nPaletteIdx );
+ return new ExcelGraphicHelper( getWorkbookData() );
}
OUString ExcelBiffFilter::implGetImplementationName() const
diff --git a/oox/source/xls/excelvbaproject.cxx b/oox/source/xls/excelvbaproject.cxx
new file mode 100755
index 000000000000..fc3caf7e59aa
--- /dev/null
+++ b/oox/source/xls/excelvbaproject.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * 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 "oox/xls/excelvbaproject.hxx"
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include "properties.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertyset.hxx"
+
+using ::rtl::OUString;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::document::XEventsSupplier;
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::sheet::XSpreadsheetDocument;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+VbaProject::VbaProject( const Reference< XMultiServiceFactory >& rxGlobalFactory, const Reference< XSpreadsheetDocument >& rxDocument ) :
+ ::oox::ole::VbaProject( rxGlobalFactory, Reference< XModel >( rxDocument, UNO_QUERY ), CREATE_OUSTRING( "Calc" ) ),
+ mxDocument( rxDocument )
+{
+}
+
+void VbaProject::attachToEvents()
+{
+ // do nothing is code is not executable
+ if( !isImportVbaExecutable() )
+ return;
+
+ // document events
+ PropertySet aDocProp( mxDocument );
+ OUString aCodeName;
+ aDocProp.getProperty( aCodeName, PROP_CodeName );
+ attachToDocumentEvents( aCodeName );
+
+ // sheet events
+ if( mxDocument.is() ) try
+ {
+ Reference< XEnumerationAccess > xSheetsEA( mxDocument->getSheets(), UNO_QUERY_THROW );
+ Reference< XEnumeration > xSheetsEnum( xSheetsEA->createEnumeration(), UNO_SET_THROW );
+ // own try/catch for every sheet
+ while( xSheetsEnum->hasMoreElements() ) try
+ {
+ // TODO: once we have chart sheets we need a switch/case on sheet type
+ Reference< XEventsSupplier > xEventsSupp( xSheetsEnum->nextElement(), UNO_QUERY_THROW );
+ PropertySet aSheetProp( xEventsSupp );
+ aSheetProp.getProperty( aCodeName, PROP_CodeName );
+ attachToSheetEvents( xEventsSupp, aCodeName );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// private --------------------------------------------------------------------
+
+void VbaProject::attachToDocumentEvents( const OUString& rCodeName )
+{
+ if( (rCodeName.getLength() == 0) || !hasModule( rCodeName ) )
+ return;
+
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnLoad" ), rCodeName, CREATE_OUSTRING( "Workbook_Open" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnFocus" ), rCodeName, CREATE_OUSTRING( "Workbook_Activate" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnUnfocus" ), rCodeName, CREATE_OUSTRING( "Workbook_Deactivate" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSave" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforeSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False, False" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveAs" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforeSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO True, False" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveDone" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO True" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveAsDone" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO True" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveFailed" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnSaveAsFailed" ), rCodeName, CREATE_OUSTRING( "Workbook_AfterSave" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnPrint" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforePrint" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
+ attachMacroToDocumentEvent( CREATE_OUSTRING( "OnPrepareUnload" ), rCodeName, CREATE_OUSTRING( "Workbook_BeforeClose" ), OUString(), OUString(), CREATE_OUSTRING( "\t$MACRO False" ) );
+}
+
+void VbaProject::attachToSheetEvents( const Reference< XEventsSupplier >& rxEventsSupp, const OUString& rCodeName )
+{
+ if( !rxEventsSupp.is() || (rCodeName.getLength() == 0) || !hasModule( rCodeName ) )
+ return;
+
+ // attach macros to simple sheet events directly
+ attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnFocus" ), rCodeName, CREATE_OUSTRING( "Worksheet_Activate" ) );
+ attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnUnfocus" ), rCodeName, CREATE_OUSTRING( "Worksheet_Deactivate" ) );
+ attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnCalculate" ), rCodeName, CREATE_OUSTRING( "Worksheet_Calculate" ) );
+
+ /* Attach macros to complex sheet events. The events pass a cell range or
+ a collection of cell ranges depending on the event type and sheet
+ selection. The generated proxy macros need to convert these UNO renges
+ to VBA compatible ranges.
+ */
+
+#define VBA_MACRONAME_RANGECONV "Local_GetVbaRangeFromUnoRange"
+#define VBA_MACRONAME_TARGETCONV "Local_GetVbaTargetFromUnoTarget"
+
+ /* If this variable turns to true, the macros that convert UNO cell ranges
+ to VBA Range objects have to be inserted.
+ */
+ bool bNeedsTargetHelper = false;
+
+ /* Insert the proxy macros attached to sheet events that notify something
+ has changed (changed selection and changed cell contents). These events
+ cannot be cancelled. The proxy macro converts the passed UNO cell range
+ or collection of cell ranges to a VBA Range object, and calls the VBA
+ event handler.
+ */
+ OUString aChangeProxyArgs = CREATE_OUSTRING( "ByVal unoTarget As Object" );
+ OUString aChangeProxyCode = CREATE_OUSTRING(
+ "\tDim vbaTarget As Range : Set vbaTarget = " VBA_MACRONAME_TARGETCONV "( unoTarget )\n"
+ "\tIf Not vbaTarget Is Nothing Then $MACRO vbaTarget" );
+ bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnChange" ), rCodeName, CREATE_OUSTRING( "Worksheet_Change" ), aChangeProxyArgs, OUString(), aChangeProxyCode );
+ bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnSelect" ), rCodeName, CREATE_OUSTRING( "Worksheet_SelectionChange" ), aChangeProxyArgs, OUString(), aChangeProxyCode );
+
+ /* Insert the proxy macros attached to sheet events that notify an ongoing
+ mouse click event (double click and right click). These events can be
+ cancelled by returning false (in VBA: as a Boolean output parameter, in
+ UNO: as return value of the Basic function). The proxy macro converts
+ the passed UNO cell range or collection of cell ranges to a VBA Range
+ object, calls the VBA event handler, and returns the Boolean value
+ provided by the VBA event handler.
+ */
+ OUString aClickProxyArgs = CREATE_OUSTRING( "ByVal unoTarget As Object" );
+ OUString aClickProxyRetT = CREATE_OUSTRING( "Boolean" );
+ OUString aClickProxyCode = CREATE_OUSTRING(
+ "\tDim Cancel As Boolean : Cancel = False\n"
+ "\tDim vbaTarget As Range : Set vbaTarget = " VBA_MACRONAME_TARGETCONV "( unoTarget )\n"
+ "\tIf Not vbaTarget Is Nothing Then $MACRO vbaTarget, Cancel\n"
+ "\t$PROXY = Cancel" );
+ bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnDoubleClick" ), rCodeName, CREATE_OUSTRING( "Worksheet_BeforeDoubleClick" ), aClickProxyArgs, aClickProxyRetT, aClickProxyCode );
+ bNeedsTargetHelper |= attachMacroToEvent( rxEventsSupp, CREATE_OUSTRING( "OnRightClick" ), rCodeName, CREATE_OUSTRING( "Worksheet_BeforeRightClick" ), aClickProxyArgs, aClickProxyRetT, aClickProxyCode );
+
+ if( bNeedsTargetHelper )
+ {
+ /* Generate a helper function that converts a
+ com.sun.star.sheet.SheetCellRange object to a VBA Range object.
+ */
+ OUString aRangeConvName = CREATE_OUSTRING( VBA_MACRONAME_RANGECONV );
+ OUString aRangeConvArgs = CREATE_OUSTRING( "ByVal unoRange As com.sun.star.sheet.SheetCellRange" );
+ OUString aRangeConvRetT = CREATE_OUSTRING( "Range" );
+ OUString aRangeConvCode = CREATE_OUSTRING(
+ "\tDim unoAddress As com.sun.star.table.CellRangeAddress : Set unoAddress = unoRange.RangeAddress\n"
+ "\tDim vbaSheet As Worksheet : Set vbaSheet = Application.ThisWorkbook.Sheets( unoAddress.Sheet + 1 )\n"
+ "\tSet $MACRO = vbaSheet.Range( vbaSheet.Cells( unoAddress.StartRow + 1, unoAddress.StartColumn + 1 ), vbaSheet.Cells( unoAddress.EndRow + 1, unoAddress.EndColumn + 1 ) )" );
+ insertMacro( rCodeName, aRangeConvName, aRangeConvArgs, aRangeConvRetT, aRangeConvCode );
+
+ /* Generate a helper function that converts a generic range selection
+ object (com.sun.star.sheet.SheetCellRange or
+ com.sun.star.sheet.SheetCellRanges) to a VBA Range object.
+ */
+ OUString aTargetConvName = CREATE_OUSTRING( VBA_MACRONAME_TARGETCONV );
+ OUString aTargetConvArgs = CREATE_OUSTRING( "ByVal unoTarget As Object" );
+ OUString aTargetConvRetT = CREATE_OUSTRING( "Range" );
+ OUString aTargetConvCode = CREATE_OUSTRING(
+ "\tDim vbaTarget As Range\n"
+ "\tIf unoTarget.supportsService( \"com.sun.star.sheet.SheetCellRange\" ) Then\n"
+ "\t\tSet vbaTarget = " VBA_MACRONAME_RANGECONV "( unoTarget )\n"
+ "\tElseIf unoTarget.supportsService( \"com.sun.star.sheet.SheetCellRanges\" ) Then\n"
+ "\t\tDim unoRangeEnum As Object : Set unoRangeEnum = unoTarget.createEnumeration\n"
+ "\t\tIf unoRangeEnum.hasMoreElements Then Set vbaTarget = " VBA_MACRONAME_RANGECONV "( unoRangeEnum.nextElement )\n"
+ "\t\tWhile unoRangeEnum.hasMoreElements\n"
+ "\t\t\tSet vbaTarget = Application.Union( vbaTarget, " VBA_MACRONAME_RANGECONV "( unoRangeEnum.nextElement ) )\n"
+ "\t\tWend\n"
+ "\tEnd If\n"
+ "\tSet $MACRO = vbaTarget" );
+ insertMacro( rCodeName, aTargetConvName, aTargetConvArgs, aTargetConvRetT, aTargetConvCode );
+ }
+#undef VBA_MACRONAME_RANGECONV
+#undef VBA_MACRONAME_TARGETCONV
+}
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx
index c0337444f59d..12deadecd695 100644
--- a/oox/source/xls/formulaparser.cxx
+++ b/oox/source/xls/formulaparser.cxx
@@ -2751,19 +2751,16 @@ FormulaParser::~FormulaParser()
void FormulaParser::importFormula( FormulaContext& rContext, const OUString& rFormulaString ) const
{
- OOX_LOADSAVE_TIMER( IMPORTFORMULA );
mxImpl->importOoxFormula( rContext, rFormulaString );
}
void FormulaParser::importFormula( FormulaContext& rContext, RecordInputStream& rStrm ) const
{
- OOX_LOADSAVE_TIMER( IMPORTFORMULA );
mxImpl->importOobFormula( rContext, rStrm );
}
void FormulaParser::importFormula( FormulaContext& rContext, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) const
{
- OOX_LOADSAVE_TIMER( IMPORTFORMULA );
mxImpl->importBiffFormula( rContext, rStrm, pnFmlaSize );
}
diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk
index cdb2e18c262d..b5ede953bbfe 100644
--- a/oox/source/xls/makefile.mk
+++ b/oox/source/xls/makefile.mk
@@ -59,6 +59,7 @@ SLOFILES = \
$(SLO)$/excelchartconverter.obj \
$(SLO)$/excelfilter.obj \
$(SLO)$/excelhandlers.obj \
+ $(SLO)$/excelvbaproject.obj \
$(SLO)$/externallinkbuffer.obj \
$(SLO)$/externallinkfragment.obj \
$(SLO)$/formulabase.obj \
diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx
index be5644554d6d..43c2f1b0b654 100644
--- a/oox/source/xls/sheetdatacontext.cxx
+++ b/oox/source/xls/sheetdatacontext.cxx
@@ -171,7 +171,6 @@ OoxSheetDataContext::OoxSheetDataContext( OoxWorksheetFragmentBase& rFragment )
ContextHandlerRef OoxSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- OOX_LOADSAVE_TIMER( ONCREATESHEETCONTEXT );
switch( getCurrentElement() )
{
case XLS_TOKEN( sheetData ):
@@ -201,7 +200,6 @@ ContextHandlerRef OoxSheetDataContext::onCreateContext( sal_Int32 nElement, cons
void OoxSheetDataContext::onEndElement( const OUString& rChars )
{
- OOX_LOADSAVE_TIMER( ONENDSHEETELEMENT );
switch( getCurrentElement() )
{
case XLS_TOKEN( v ):
@@ -342,7 +340,6 @@ ContextHandlerRef OoxSheetDataContext::onCreateRecordContext( sal_Int32 nRecId,
void OoxSheetDataContext::importRow( const AttributeList& rAttribs )
{
- OOX_LOADSAVE_TIMER( IMPORTROW );
RowModel aModel;
aModel.mnFirstRow = aModel.mnLastRow = rAttribs.getInteger( XML_r, -1 );
aModel.mfHeight = rAttribs.getDouble( XML_ht, -1.0 );
@@ -361,7 +358,6 @@ void OoxSheetDataContext::importRow( const AttributeList& rAttribs )
void OoxSheetDataContext::importCell( const AttributeList& rAttribs )
{
- OOX_LOADSAVE_TIMER( IMPORTCELL );
maCurrCell.reset();
maCurrCell.mxCell = getCell( rAttribs.getString( XML_r, OUString() ), &maCurrCell.maAddress );
maCurrCell.mnCellType = rAttribs.getToken( XML_t, XML_n );
diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx
index cd914ceae196..b9a11b5104ea 100644
--- a/oox/source/xls/stylesbuffer.cxx
+++ b/oox/source/xls/stylesbuffer.cxx
@@ -95,10 +95,6 @@ const sal_Int32 OOX_FONTFAMILY_MODERN = 3;
const sal_Int32 OOX_FONTFAMILY_SCRIPT = 4;
const sal_Int32 OOX_FONTFAMILY_DECORATIVE = 5;
-// OOX font charset (also used in BIFF)
-const sal_Int32 OOX_FONTCHARSET_UNUSED = -1;
-const sal_Int32 OOX_FONTCHARSET_ANSI = 0;
-
// OOX cell text direction (also used in BIFF)
const sal_Int32 OOX_XF_TEXTDIR_CONTEXT = 0;
const sal_Int32 OOX_XF_TEXTDIR_LTR = 1;
@@ -307,7 +303,27 @@ sal_Int32 lclReadRgbColor( BinaryInputStream& rStrm )
} // namespace
-// ----------------------------------------------------------------------------
+// ============================================================================
+
+ExcelGraphicHelper::ExcelGraphicHelper( const WorkbookHelper& rHelper ) :
+ GraphicHelper( rHelper.getGlobalFactory(), rHelper.getBaseFilter().getTargetFrame() ),
+ WorkbookHelper( rHelper )
+{
+}
+
+sal_Int32 ExcelGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
+{
+ if( getFilterType() == FILTER_OOX )
+ return getTheme().getColorByToken( nToken );
+ return GraphicHelper::getSchemeColor( nToken );
+}
+
+sal_Int32 ExcelGraphicHelper::getPaletteColor( sal_Int32 nPaletteIdx ) const
+{
+ return getStyles().getPaletteColor( nPaletteIdx );
+}
+
+// ============================================================================
void Color::setAuto()
{
@@ -540,15 +556,15 @@ sal_Int32 ColorPalette::getColor( sal_Int32 nPaletteIdx ) const
{
case OOX_COLOR_WINDOWTEXT3:
case OOX_COLOR_WINDOWTEXT:
- case OOX_COLOR_CHWINDOWTEXT: nColor = getBaseFilter().getSystemColor( XML_windowText ); break;
+ case OOX_COLOR_CHWINDOWTEXT: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_windowText ); break;
case OOX_COLOR_WINDOWBACK3:
case OOX_COLOR_WINDOWBACK:
- case OOX_COLOR_CHWINDOWBACK: nColor = getBaseFilter().getSystemColor( XML_window ); break;
- case OOX_COLOR_BUTTONBACK: nColor = getBaseFilter().getSystemColor( XML_btnFace ); break;
- case OOX_COLOR_CHBORDERAUTO: nColor = API_RGB_BLACK; /* really always black? */ break;
- case OOX_COLOR_NOTEBACK: nColor = getBaseFilter().getSystemColor( XML_infoBk ); break;
- case OOX_COLOR_NOTETEXT: nColor = getBaseFilter().getSystemColor( XML_infoText ); break;
- case OOX_COLOR_FONTAUTO: nColor = API_RGB_TRANSPARENT; break;
+ case OOX_COLOR_CHWINDOWBACK: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_window ); break;
+ case OOX_COLOR_BUTTONBACK: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_btnFace ); break;
+ case OOX_COLOR_CHBORDERAUTO: nColor = API_RGB_BLACK; /* really always black? */ break;
+ case OOX_COLOR_NOTEBACK: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_infoBk ); break;
+ case OOX_COLOR_NOTETEXT: nColor = getBaseFilter().getGraphicHelper().getSystemColor( XML_infoText ); break;
+ case OOX_COLOR_FONTAUTO: nColor = API_RGB_TRANSPARENT; break;
default: OSL_ENSURE( false, "ColorPalette::getColor - unknown color index" );
}
return nColor;
@@ -573,7 +589,8 @@ void lclSetFontName( ApiScriptFontName& rFontName, const FontDescriptor& rFontDe
{
rFontName.maName = rFontDesc.Name;
rFontName.mnFamily = rFontDesc.Family;
- rFontName.mnCharSet = rFontDesc.CharSet;
+ // API font descriptor contains rtl_TextEncoding constants
+ rFontName.mnTextEnc = rFontDesc.CharSet;
}
else
{
@@ -588,7 +605,7 @@ void lclSetFontName( ApiScriptFontName& rFontName, const FontDescriptor& rFontDe
FontModel::FontModel() :
mnScheme( XML_none ),
mnFamily( OOX_FONTFAMILY_NONE ),
- mnCharSet( OOX_FONTCHARSET_ANSI ),
+ mnCharSet( WINDOWS_CHARSET_DEFAULT ),
mfHeight( 0.0 ),
mnUnderline( XML_none ),
mnEscapement( XML_baseline ),
@@ -656,7 +673,7 @@ ApiFontUsedFlags::ApiFontUsedFlags( bool bAllUsed ) :
ApiScriptFontName::ApiScriptFontName() :
mnFamily( ::com::sun::star::awt::FontFamily::DONTKNOW ),
- mnCharSet( RTL_TEXTENCODING_DONTKNOW )
+ mnTextEnc( RTL_TEXTENCODING_DONTKNOW )
{
}
@@ -978,13 +995,13 @@ void Font::finalizeImport()
case OOX_FONTFAMILY_DECORATIVE: maApiData.maDesc.Family = cssawt::FontFamily::DECORATIVE; break;
}
- // character set
- if( (0 <= maModel.mnCharSet) && (maModel.mnCharSet <= 255) )
+ // character set (API font descriptor uses rtl_TextEncoding in member CharSet!)
+ if( (0 <= maModel.mnCharSet) && (maModel.mnCharSet <= SAL_MAX_UINT8) )
maApiData.maDesc.CharSet = static_cast< sal_Int16 >(
rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maModel.mnCharSet ) ) );
// color, height, weight, slant, strikeout, outline, shadow
- maApiData.mnColor = maModel.maColor.getColor( getBaseFilter() );
+ maApiData.mnColor = maModel.maColor.getColor( getBaseFilter().getGraphicHelper() );
maApiData.maDesc.Height = static_cast< sal_Int16 >( maModel.mfHeight * 20.0 );
maApiData.maDesc.Weight = maModel.mbBold ? cssawt::FontWeight::BOLD : cssawt::FontWeight::NORMAL;
maApiData.maDesc.Slant = maModel.mbItalic ? cssawt::FontSlant_ITALIC : cssawt::FontSlant_NONE;
@@ -1085,19 +1102,19 @@ void Font::writeToPropertyMap( PropertyMap& rPropMap, FontPropertyType ePropType
{
rPropMap[ PROP_CharFontName ] <<= maApiData.maLatinFont.maName;
rPropMap[ PROP_CharFontFamily ] <<= maApiData.maLatinFont.mnFamily;
- rPropMap[ PROP_CharFontCharSet ] <<= maApiData.maLatinFont.mnCharSet;
+ rPropMap[ PROP_CharFontCharSet ] <<= maApiData.maLatinFont.mnTextEnc;
}
if( maApiData.maAsianFont.maName.getLength() > 0 )
{
rPropMap[ PROP_CharFontNameAsian ] <<= maApiData.maAsianFont.maName;
rPropMap[ PROP_CharFontFamilyAsian ] <<= maApiData.maAsianFont.mnFamily;
- rPropMap[ PROP_CharFontCharSetAsian ] <<= maApiData.maAsianFont.mnCharSet;
+ rPropMap[ PROP_CharFontCharSetAsian ] <<= maApiData.maAsianFont.mnTextEnc;
}
if( maApiData.maCmplxFont.maName.getLength() > 0 )
{
rPropMap[ PROP_CharFontNameComplex ] <<= maApiData.maCmplxFont.maName;
rPropMap[ PROP_CharFontFamilyComplex ] <<= maApiData.maCmplxFont.mnFamily;
- rPropMap[ PROP_CharFontCharSetComplex ] <<= maApiData.maCmplxFont.mnCharSet;
+ rPropMap[ PROP_CharFontCharSetComplex ] <<= maApiData.maCmplxFont.mnTextEnc;
}
}
// font height
@@ -1160,7 +1177,7 @@ void Font::importFontData2( BiffInputStream& rStrm )
maModel.setBiffHeight( nHeight );
maModel.mnFamily = OOX_FONTFAMILY_NONE;
- maModel.mnCharSet = OOX_FONTCHARSET_UNUSED; // ensure to not use font charset in byte string import
+ maModel.mnCharSet = -1; // ensure to not use font charset in byte string import
maModel.mnUnderline = getFlagValue( nFlags, BIFF_FONTFLAG_UNDERLINE, XML_single, XML_none );
maModel.mnEscapement = XML_none;
maModel.mbBold = getFlag( nFlags, BIFF_FONTFLAG_BOLD );
@@ -1771,7 +1788,7 @@ BorderLineModel* Border::getBorderLine( sal_Int32 nElement )
bool Border::convertBorderLine( BorderLine& rBorderLine, const BorderLineModel& rModel )
{
- rBorderLine.Color = rModel.maColor.getColor( getBaseFilter(), API_RGB_BLACK );
+ rBorderLine.Color = rModel.maColor.getColor( getBaseFilter().getGraphicHelper(), API_RGB_BLACK );
switch( rModel.mnStyle )
{
case XML_dashDot: lclSetBorderLineWidth( rBorderLine, API_LINE_THIN ); break;
@@ -2075,7 +2092,7 @@ void Fill::importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags )
void Fill::finalizeImport()
{
- const FilterBase& rFilter = getBaseFilter();
+ const GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper();
if( mxPatternModel.get() )
{
@@ -2127,16 +2144,16 @@ void Fill::finalizeImport()
case XML_solid: nAlpha = 0x80; break;
}
- sal_Int32 nWinTextColor = rFilter.getSystemColor( XML_windowText );
- sal_Int32 nWinColor = rFilter.getSystemColor( XML_window );
+ sal_Int32 nWinTextColor = rGraphicHelper.getSystemColor( XML_windowText );
+ sal_Int32 nWinColor = rGraphicHelper.getSystemColor( XML_window );
if( !rModel.mbPattColorUsed )
rModel.maPatternColor.setAuto();
- sal_Int32 nPattColor = rModel.maPatternColor.getColor( rFilter, nWinTextColor );
+ sal_Int32 nPattColor = rModel.maPatternColor.getColor( rGraphicHelper, nWinTextColor );
if( !rModel.mbFillColorUsed )
rModel.maFillColor.setAuto();
- sal_Int32 nFillColor = rModel.maFillColor.getColor( rFilter, nWinColor );
+ sal_Int32 nFillColor = rModel.maFillColor.getColor( rGraphicHelper, nWinColor );
maApiData.mnColor = lclGetMixedColor( nPattColor, nFillColor, nAlpha );
maApiData.mbTransparent = false;
@@ -2148,11 +2165,11 @@ void Fill::finalizeImport()
maApiData.mbUsed = true; // no support for differential attributes
GradientFillModel::ColorMap::const_iterator aIt = rModel.maColors.begin();
OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
- maApiData.mnColor = aIt->second.getColor( rFilter, API_RGB_WHITE );
+ maApiData.mnColor = aIt->second.getColor( rGraphicHelper, API_RGB_WHITE );
if( ++aIt != rModel.maColors.end() )
{
OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
- sal_Int32 nEndColor = aIt->second.getColor( rFilter, API_RGB_WHITE );
+ sal_Int32 nEndColor = aIt->second.getColor( rGraphicHelper, API_RGB_WHITE );
maApiData.mnColor = lclGetMixedColor( maApiData.mnColor, nEndColor, 0x40 );
maApiData.mbTransparent = false;
}
diff --git a/oox/source/xls/unitconverter.cxx b/oox/source/xls/unitconverter.cxx
index 6f287581c854..170a1f66f2e2 100644
--- a/oox/source/xls/unitconverter.cxx
+++ b/oox/source/xls/unitconverter.cxx
@@ -108,7 +108,7 @@ UnitConverter::UnitConverter( const WorkbookHelper& rHelper ) :
mnNullDate( lclGetDays( Date( 30, 12, 1899 ) ) )
{
// initialize constant and default coefficients
- const DeviceInfo& rDeviceInfo = getBaseFilter().getDeviceInfo();
+ const DeviceInfo& rDeviceInfo = getBaseFilter().getGraphicHelper().getDeviceInfo();
maCoeffs[ UNIT_INCH ] = MM100_PER_INCH;
maCoeffs[ UNIT_POINT ] = MM100_PER_POINT;
maCoeffs[ UNIT_TWIP ] = MM100_PER_TWIP;
diff --git a/oox/source/xls/viewsettings.cxx b/oox/source/xls/viewsettings.cxx
index 69af326c2471..3d88e64dbb12 100644
--- a/oox/source/xls/viewsettings.cxx
+++ b/oox/source/xls/viewsettings.cxx
@@ -199,7 +199,7 @@ sal_Int32 SheetViewModel::getPageBreakZoom() const
sal_Int32 SheetViewModel::getGridColor( const FilterBase& rFilter ) const
{
- return mbDefGridColor ? API_RGB_TRANSPARENT : maGridColor.getColor( rFilter );
+ return mbDefGridColor ? API_RGB_TRANSPARENT : maGridColor.getColor( rFilter.getGraphicHelper() );
}
const PaneSelectionModel* SheetViewModel::getPaneSelection( sal_Int32 nPaneId ) const
diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx
index e61820a2e620..d64abf268008 100644
--- a/oox/source/xls/workbookfragment.cxx
+++ b/oox/source/xls/workbookfragment.cxx
@@ -31,6 +31,8 @@
#include "oox/helper/progressbar.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
+#include "oox/ole/olestorage.hxx"
+#include "oox/core/filterbase.hxx"
#include "oox/drawingml/themefragmenthandler.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/chartsheetfragment.hxx"
@@ -53,6 +55,8 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::io::XInputStream;
using ::com::sun::star::table::CellAddress;
using ::oox::core::ContextHandlerRef;
using ::oox::core::FragmentHandlerRef;
@@ -284,13 +288,21 @@ void OoxWorkbookFragment::finalizeImport()
// load all worksheets
for( SheetFragmentVector::iterator aIt = aSheetFragments.begin(), aEnd = aSheetFragments.end(); aIt != aEnd; ++aIt )
{
- OOX_LOADSAVE_TIMER( IMPORTSHEETFRAGMENT );
// import the sheet fragment
importOoxFragment( *aIt );
// delete fragment object, will free all allocated sheet buffers
aIt->clear();
}
+ // open the VBA project storage
+ OUString aVbaFragmentPath = getFragmentPathFromFirstType( CREATE_MSOFFICE_RELATIONSTYPE( "vbaProject" ) );
+ if( aVbaFragmentPath.getLength() > 0 )
+ {
+ Reference< XInputStream > xInStrm = getBaseFilter().openInputStream( aVbaFragmentPath );
+ if( xInStrm.is() )
+ setVbaProjectStorage( StorageRef( new ::oox::ole::OleStorage( getGlobalFactory(), xInStrm, false ) ) );
+ }
+
// final conversions, e.g. calculation settings and view settings
finalizeWorkbookImport();
}
@@ -462,6 +474,8 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
StylesBuffer& rStyles = getStyles();
WorksheetBuffer& rWorksheets = getWorksheets();
PivotCacheBuffer& rPivotCaches = getPivotCaches();
+ bool bHasVbaProject = false;
+ bool bEmptyVbaProject = false;
// collect records that need to be loaded in a second pass
typedef ::std::vector< sal_Int64 > RecordHandleVec;
@@ -562,25 +576,27 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
case BIFF8: switch( nRecId )
{
- case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
- case BIFF_ID_CODENAME: rWorkbookSett.importCodeName( mrStrm ); break;
- case BIFF_ID_CRN: bExtLinkRec = true; break;
- case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
- case BIFF_ID_EXTERNALBOOK: bExtLinkRec = true; break;
- case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
- case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( mrStrm ); break;
- case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
- case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
- case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( mrStrm ); break;
- case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
- case BIFF_ID_SST: rSharedStrings.importSst( mrStrm ); break;
- case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
- case BIFF_ID_USESELFS: rWorkbookSett.importUsesElfs( mrStrm ); break;
- case BIFF_ID_XCT: bExtLinkRec = true; break;
- case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
+ case BIFF_ID_CODENAME: rWorkbookSett.importCodeName( mrStrm ); break;
+ case BIFF_ID_CRN: bExtLinkRec = true; break;
+ case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
+ case BIFF_ID_EXTERNALBOOK: bExtLinkRec = true; break;
+ case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
+ case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
+ case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( mrStrm ); break;
+ case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
+ case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
+ case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
+ case BIFF_ID_VBAPROJECT: bHasVbaProject = true; break;
+ case BIFF_ID_VBAPROJECTEMPTY: bEmptyVbaProject = true; break;
+ case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
+ case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( mrStrm ); break;
+ case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
+ case BIFF_ID_SST: rSharedStrings.importSst( mrStrm ); break;
+ case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
+ case BIFF_ID_USESELFS: rWorkbookSett.importUsesElfs( mrStrm ); break;
+ case BIFF_ID_XCT: bExtLinkRec = true; break;
+ case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
}
break;
@@ -618,6 +634,10 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
bRet = mrStrm.startRecordByHandle( nEofHandle );
}
+ // open the VBA project storage
+ if( bHasVbaProject && !bEmptyVbaProject )
+ setVbaProjectStorage( getBaseFilter().openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false ) );
+
// #i56376# missing EOF - rewind before worksheet BOF record (see above)
if( bRet && isBofRecord() )
mrStrm.rewindRecord();
diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx
index 93ad0a65422f..afeed95accca 100644
--- a/oox/source/xls/workbookhelper.cxx
+++ b/oox/source/xls/workbookhelper.cxx
@@ -27,7 +27,6 @@
#include "oox/xls/workbookhelper.hxx"
#include <osl/thread.h>
-#include <rtl/strbuf.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/awt/XDevice.hpp>
@@ -44,14 +43,14 @@
#include "properties.hxx"
#include "oox/helper/progressbar.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/binaryfilterbase.hxx"
-#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/theme.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/biffcodec.hxx"
#include "oox/xls/defnamesbuffer.hxx"
#include "oox/xls/excelchartconverter.hxx"
+#include "oox/xls/excelfilter.hxx"
+#include "oox/xls/excelvbaproject.hxx"
#include "oox/xls/externallinkbuffer.hxx"
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/pagesettings.hxx"
@@ -68,7 +67,6 @@
#include "oox/xls/workbooksettings.hxx"
#include "oox/xls/worksheetbuffer.hxx"
-using ::rtl::OStringBuffer;
using ::rtl::OUString;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
@@ -103,148 +101,6 @@ using ::oox::drawingml::Theme;
namespace oox {
namespace xls {
-// DEBUG ======================================================================
-
-#if OSL_DEBUG_LEVEL > 0
-namespace dbg {
-
-// ----------------------------------------------------------------------------
-
-#if OOX_SHOW_LOADSAVE_TIME > 0
-
-struct TimeCount
-{
- sal_Int64 mnTime;
- sal_Int32 mnCount;
- inline explicit TimeCount() : mnTime( 0 ), mnCount( 0 ) {}
-};
-
-Timer::Timer( TimeCount& rTimeCount ) :
- mrTimeCount( rTimeCount )
-{
- ++mrTimeCount.mnCount;
- osl_getSystemTime( &maStartTime );
-}
-
-Timer::~Timer()
-{
- TimeValue aEndTime;
- osl_getSystemTime( &aEndTime );
- mrTimeCount.mnTime += (SAL_CONST_INT64( 1000000000 ) * (aEndTime.Seconds - maStartTime.Seconds) + aEndTime.Nanosec - maStartTime.Nanosec);
-}
-
-#endif
-
-// ----------------------------------------------------------------------------
-
-struct WorkbookData
-{
-#if OOX_SHOW_LOADSAVE_TIME > 0
- typedef ::std::vector< TimeCount > TimeCountVector;
- typedef ::boost::shared_ptr< Timer > TimerRef;
- TimeCountVector maTimeCounts;
- TimerRef mxTotal;
-#endif
- sal_Int32 mnObjCount;
-
- explicit WorkbookData();
- ~WorkbookData();
-#if OOX_SHOW_LOADSAVE_TIME > 0
- TimeCount& getTimeCount( TimerType eType );
-#endif
-};
-
-WorkbookData::WorkbookData() :
-#if OOX_SHOW_LOADSAVE_TIME > 0
- maTimeCounts( static_cast< size_t >( TIMER_TOTAL + 1 ) ),
- mxTotal( new Timer( getTimeCount( TIMER_TOTAL ) ) ),
-#endif
- mnObjCount( 0 )
-{
-}
-
-WorkbookData::~WorkbookData()
-{
-#if OOX_SHOW_LOADSAVE_TIME > 0
- mxTotal.reset();
- static const sal_Char* sppcNames[] =
- {
- "importFormula\t",
- "importSheetFragment",
- " onCreateSheetContext",
- " importRow\t",
- " convertRowFormat",
- " convertColumnFormat",
- " importCell\t",
- " onEndSheetElement",
- " setCell\t\t",
- " setCellFormat\t",
- " mergeCellFormats",
- " writeCellProperties",
- " finalizeSheetData",
- " finalizeDrawing",
- "finalizeBookData",
- "total\t\t"
- };
- OStringBuffer aBuffer( "Call counts and load/save times:\n" );
- sal_Int32 nIdx = 0;
- for( TimeCountVector::iterator aIt = maTimeCounts.begin(), aEnd = maTimeCounts.end(); aIt != aEnd; ++aIt, ++nIdx )
- {
- if( aIt->mnCount > 0 )
- {
- aBuffer.append( nIdx ).append( ":\t" ).append( sppcNames[ nIdx ] ).
- append( "\tn=" ).append( aIt->mnCount ).append( ',' ).
- append( "\tt=" ).append( (aIt->mnTime / 100000000) / 10.0 ).append( 's' ).
- append( "\t(" ).append( static_cast< sal_Int32 >( ((aIt->mnTime * 1000) / maTimeCounts.back().mnTime) / 10 ) ).append( "%)" );
- if( aIt->mnCount > 1 )
- aBuffer.append( "\tt/n=" ).append( static_cast< sal_Int32 >( aIt->mnTime / aIt->mnCount / 1000 ) ).append( "mys" );
- aBuffer.append( '\n' );
- }
- }
- OSL_ENSURE( false, aBuffer.getStr() );
-#endif
- OSL_ENSURE( mnObjCount == 0,
- OStringBuffer( "WorkbookData::~WorkbookData - failed to delete " ).append( mnObjCount ).append( " objects" ).getStr() );
-}
-
-#if OOX_SHOW_LOADSAVE_TIME > 0
-TimeCount& WorkbookData::getTimeCount( TimerType eType )
-{
- return maTimeCounts[ static_cast< size_t >( eType ) ];
-}
-#endif
-
-// ----------------------------------------------------------------------------
-
-WorkbookHelper::WorkbookHelper( WorkbookData& rBookData ) :
- mrDbgBookData( rBookData )
-{
- ++mrDbgBookData.mnObjCount;
-}
-
-WorkbookHelper::WorkbookHelper( const WorkbookHelper& rCopy ) :
- mrDbgBookData( rCopy.mrDbgBookData )
-{
- ++mrDbgBookData.mnObjCount;
-}
-
-WorkbookHelper::~WorkbookHelper()
-{
- --mrDbgBookData.mnObjCount;
-}
-
-#if OOX_SHOW_LOADSAVE_TIME > 0
-TimeCount& WorkbookHelper::getTimeCount( TimerType eType ) const
-{
- return mrDbgBookData.getTimeCount( eType );
-}
-#endif
-
-// ----------------------------------------------------------------------------
-
-} // namespace dbg
-#endif
-
// ============================================================================
bool IgnoreCaseCompare::operator()( const OUString& rName1, const OUString& rName2 ) const
@@ -257,13 +113,10 @@ bool IgnoreCaseCompare::operator()( const OUString& rName1, const OUString& rNam
// ============================================================================
class WorkbookData
-#if OSL_DEBUG_LEVEL > 0
- : public dbg::WorkbookData
-#endif
{
public:
- explicit WorkbookData( XmlFilterBase& rFilter );
- explicit WorkbookData( BinaryFilterBase& rFilter, BiffType eBiff );
+ explicit WorkbookData( ExcelFilter& rFilter );
+ explicit WorkbookData( ExcelBiffFilter& rFilter, BiffType eBiff );
~WorkbookData();
/** Returns true, if this helper refers to a valid document. */
@@ -283,6 +136,10 @@ public:
inline sal_Int16 getCurrentSheetIndex() const { return mnCurrSheet; }
/** Sets the index of the current sheet in the Calc document. */
inline void setCurrentSheetIndex( sal_Int16 nSheet ) { mnCurrSheet = nSheet; }
+ /** Returns the VBA project storage. */
+ inline StorageRef getVbaProjectStorage() const { return mxVbaPrjStrg; }
+ /** Sets the VBA project storage. */
+ inline void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) { mxVbaPrjStrg = rxVbaPrjStrg; }
// document model ---------------------------------------------------------
@@ -396,11 +253,11 @@ private:
typedef ::std::auto_ptr< WebQueryBuffer > WebQueryBfrPtr;
typedef ::std::auto_ptr< PivotCacheBuffer > PivotCacheBfrPtr;
typedef ::std::auto_ptr< PivotTableBuffer > PivotTableBfrPtr;
+ typedef ::std::auto_ptr< FormulaParser > FormulaParserPtr;
typedef ::std::auto_ptr< UnitConverter > UnitConvPtr;
typedef ::std::auto_ptr< AddressConverter > AddressConvPtr;
typedef ::std::auto_ptr< ExcelChartConverter > ExcelChartConvPtr;
typedef ::std::auto_ptr< PageSettingsConverter > PageSettConvPtr;
- typedef ::std::auto_ptr< FormulaParser > FormulaParserPtr;
typedef ::std::auto_ptr< BiffCodecHelper > BiffCodecHelperPtr;
OUString maCellStyles; /// Style family name for cell styles.
@@ -409,8 +266,10 @@ private:
OUString maPageStyleServ; /// Service name for a page style.
Reference< XSpreadsheetDocument > mxDoc; /// Document model.
FilterBase& mrBaseFilter; /// Base filter object.
+ ExcelFilterBase& mrExcelBase; /// Base object for registration of this structure.
FilterType meFilterType; /// File type of the filter.
ProgressBarPtr mxProgressBar; /// The progress bar.
+ StorageRef mxVbaPrjStrg; /// Storage containing the VBA project.
sal_Int16 mnCurrSheet; /// Current sheet index in Calc dcument.
bool mbWorkbook; /// True = multi-sheet file.
@@ -449,27 +308,36 @@ private:
// ----------------------------------------------------------------------------
-WorkbookData::WorkbookData( XmlFilterBase& rFilter ) :
+WorkbookData::WorkbookData( ExcelFilter& rFilter ) :
mrBaseFilter( rFilter ),
+ mrExcelBase( rFilter ),
meFilterType( FILTER_OOX ),
mpOoxFilter( &rFilter ),
+ mpBiffFilter( 0 ),
meBiff( BIFF_UNKNOWN )
{
+ // register at the filter, needed for virtual callbacks (even during construction)
+ mrExcelBase.registerWorkbookData( *this );
initialize( true );
}
-WorkbookData::WorkbookData( BinaryFilterBase& rFilter, BiffType eBiff ) :
+WorkbookData::WorkbookData( ExcelBiffFilter& rFilter, BiffType eBiff ) :
mrBaseFilter( rFilter ),
+ mrExcelBase( rFilter ),
meFilterType( FILTER_BIFF ),
+ mpOoxFilter( 0 ),
mpBiffFilter( &rFilter ),
meBiff( eBiff )
{
+ // register at the filter, needed for virtual callbacks (even during construction)
+ mrExcelBase.registerWorkbookData( *this );
initialize( eBiff >= BIFF5 );
}
WorkbookData::~WorkbookData()
{
finalize();
+ mrExcelBase.unregisterWorkbookData();
}
// document model -------------------------------------------------------------
@@ -681,7 +549,6 @@ void WorkbookData::initialize( bool bWorkbookFile )
mxUnitConverter.reset( new UnitConverter( *this ) );
mxAddrConverter.reset( new AddressConverter( *this ) );
mxChartConverter.reset( new ExcelChartConverter( *this ) );
-
mxPageSettConverter.reset( new PageSettingsConverter( *this ) );
// set some document properties needed during import
@@ -715,7 +582,7 @@ void WorkbookData::initialize( bool bWorkbookFile )
switch( getFilterType() )
{
case FILTER_BIFF:
- mxCodecHelper.reset( new BiffCodecHelper( * this ) );
+ mxCodecHelper.reset( new BiffCodecHelper( *this ) );
break;
case FILTER_OOX:
@@ -728,7 +595,6 @@ void WorkbookData::initialize( bool bWorkbookFile )
void WorkbookData::finalize()
{
- OOX_LOADSAVE_TIMER( FINALIZEBOOKDATA );
// set some document properties needed after import
if( mrBaseFilter.isImportFilter() )
{
@@ -752,14 +618,6 @@ void WorkbookData::finalize()
// ============================================================================
-WorkbookHelper::WorkbookHelper( WorkbookData& rBookData ) :
-#if OSL_DEBUG_LEVEL > 0
- dbg::WorkbookHelper( rBookData ),
-#endif
- mrBookData( rBookData )
-{
-}
-
WorkbookHelper::~WorkbookHelper()
{
}
@@ -801,6 +659,11 @@ void WorkbookHelper::setCurrentSheetIndex( sal_Int16 nSheet )
mrBookData.setCurrentSheetIndex( nSheet );
}
+void WorkbookHelper::setVbaProjectStorage( const StorageRef& rxVbaPrjStrg )
+{
+ mrBookData.setVbaProjectStorage( rxVbaPrjStrg );
+}
+
void WorkbookHelper::finalizeWorkbookImport()
{
// workbook settings, document and sheet view settings
@@ -822,6 +685,17 @@ void WorkbookHelper::finalizeWorkbookImport()
sheets. Automatic numbering is set by passing the value 0. */
PropertySet aDefPageStyle( getStyleObject( CREATE_OUSTRING( "Default" ), true ) );
aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 );
+
+ /* Import the VBA project (after finalizing workbook settings which
+ contains the workbook code name), and attach VBA macros to document and
+ sheet events. */
+ StorageRef xVbaPrjStrg = mrBookData.getVbaProjectStorage();
+ if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
+ {
+ VbaProject aVbaProject( getGlobalFactory(), getDocument() );
+ aVbaProject.importVbaProject( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
+ aVbaProject.attachToEvents();
+ }
}
// document model -------------------------------------------------------------
@@ -1026,8 +900,6 @@ ExcelChartConverter& WorkbookHelper::getChartConverter() const
return mrBookData.getChartConverter();
}
-// property helpers -----------------------------------------------------------
-
PageSettingsConverter& WorkbookHelper::getPageSettingsConverter() const
{
return mrBookData.getPageSettingsConverter();
@@ -1111,13 +983,13 @@ WorkbookDataOwner::~WorkbookDataOwner()
// ----------------------------------------------------------------------------
-WorkbookHelperRoot::WorkbookHelperRoot( ::oox::core::XmlFilterBase& rFilter ) :
+WorkbookHelperRoot::WorkbookHelperRoot( ExcelFilter& rFilter ) :
prv::WorkbookDataOwner( prv::WorkbookDataRef( new WorkbookData( rFilter ) ) ),
WorkbookHelper( *mxBookData )
{
}
-WorkbookHelperRoot::WorkbookHelperRoot( ::oox::core::BinaryFilterBase& rFilter, BiffType eBiff ) :
+WorkbookHelperRoot::WorkbookHelperRoot( ExcelBiffFilter& rFilter, BiffType eBiff ) :
prv::WorkbookDataOwner( prv::WorkbookDataRef( new WorkbookData( rFilter, eBiff ) ) ),
WorkbookHelper( *mxBookData )
{
diff --git a/oox/source/xls/workbooksettings.cxx b/oox/source/xls/workbooksettings.cxx
index 1277b0879e7a..40d400da7757 100644
--- a/oox/source/xls/workbooksettings.cxx
+++ b/oox/source/xls/workbooksettings.cxx
@@ -130,7 +130,7 @@ void WorkbookSettings::importFileSharing( const AttributeList& rAttribs )
void WorkbookSettings::importWorkbookPr( const AttributeList& rAttribs )
{
- maBookSettings.maCodeName = rAttribs.getString( XML_codePage, OUString() );
+ maBookSettings.maCodeName = rAttribs.getString( XML_codeName, OUString() );
maBookSettings.mnShowObjectMode = rAttribs.getToken( XML_showObjects, XML_all );
maBookSettings.mnUpdateLinksMode = rAttribs.getToken( XML_updateLinks, XML_userSet );
maBookSettings.mnDefaultThemeVer = rAttribs.getInteger( XML_defaultThemeVersion, -1 );
@@ -318,6 +318,9 @@ void WorkbookSettings::finalizeImport()
Reference< XCalculatable > xCalculatable( getDocument(), UNO_QUERY );
if( xCalculatable.is() )
xCalculatable->enableAutomaticCalculation( (maCalcSettings.mnCalcMode == XML_auto) || (maCalcSettings.mnCalcMode == XML_autoNoTable) );
+
+ // VBA code name
+ aPropSet.setProperty( PROP_CodeName, maBookSettings.maCodeName );
}
sal_Int16 WorkbookSettings::getApiShowObjectMode() const
diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx
index ff42c6afb704..14cf80a91d52 100644
--- a/oox/source/xls/worksheetfragment.cxx
+++ b/oox/source/xls/worksheetfragment.cxx
@@ -870,6 +870,7 @@ bool BiffWorksheetFragment::importFragment()
case BIFF8: switch( nRecId )
{
case BIFF_ID_CFHEADER: rCondFormats.importCfHeader( mrStrm ); break;
+ case BIFF_ID_CODENAME: rWorksheetSett.importCodeName( mrStrm ); break;
case BIFF_ID_COLINFO: importColInfo(); break;
case BIFF_ID_DATAVALIDATION: importDataValidation(); break;
case BIFF_ID_DATAVALIDATIONS: importDataValidations(); break;
@@ -1080,7 +1081,7 @@ void BiffWorksheetFragment::importHyperlink()
return;
// try to read the StdHlink data
- if( !::oox::ole::OleHelper::importStdHlink( aModel, mrStrm, getTextEncoding(), true ) )
+ if( !::oox::ole::OleHelper::importStdHlink( aModel, mrStrm, true ) )
return;
// try to read the optional following SCREENTIP record
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index e28df89cd7b3..381def644ce5 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -30,15 +30,10 @@
#include <utility>
#include <list>
#include <rtl/ustrbuf.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/util/NumberFormat.hpp>
-#include <com/sun/star/util/XMergeable.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sheet/TableValidationVisibility.hpp>
#include <com/sun/star/sheet/ValidationType.hpp>
#include <com/sun/star/sheet/ValidationAlertStyle.hpp>
@@ -52,7 +47,12 @@
#include <com/sun/star/sheet/XSheetOutline.hpp>
#include <com/sun/star/sheet/XMultipleOperation.hpp>
#include <com/sun/star/sheet/XLabelRanges.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XMergeable.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include "properties.hxx"
#include "tokens.hxx"
#include "oox/helper/containerhelper.hxx"
@@ -75,30 +75,13 @@
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::lang::Locale;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::util::DateTime;
-using ::com::sun::star::util::XMergeable;
-using ::com::sun::star::util::XNumberFormatsSupplier;
-using ::com::sun::star::util::XNumberFormatTypes;
using ::com::sun::star::awt::Point;
using ::com::sun::star::awt::Size;
+using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::drawing::XDrawPage;
using ::com::sun::star::drawing::XDrawPageSupplier;
-using ::com::sun::star::table::BorderLine;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::XCell;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::table::XColumnRowRange;
-using ::com::sun::star::table::XTableColumns;
-using ::com::sun::star::table::XTableRows;
+using ::com::sun::star::lang::Locale;
+using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::sheet::ConditionOperator;
using ::com::sun::star::sheet::ValidationType;
using ::com::sun::star::sheet::ValidationAlertStyle;
@@ -113,9 +96,26 @@ using ::com::sun::star::sheet::XSheetCellRanges;
using ::com::sun::star::sheet::XSheetCondition;
using ::com::sun::star::sheet::XSheetOutline;
using ::com::sun::star::sheet::XSpreadsheet;
+using ::com::sun::star::table::BorderLine;
+using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::table::CellRangeAddress;
+using ::com::sun::star::table::XCell;
+using ::com::sun::star::table::XCellRange;
+using ::com::sun::star::table::XColumnRowRange;
+using ::com::sun::star::table::XTableColumns;
+using ::com::sun::star::table::XTableRows;
using ::com::sun::star::text::XText;
using ::com::sun::star::text::XTextContent;
using ::com::sun::star::text::XTextRange;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::util::DateTime;
+using ::com::sun::star::util::XMergeable;
+using ::com::sun::star::util::XNumberFormatsSupplier;
+using ::com::sun::star::util::XNumberFormatTypes;
namespace oox {
namespace xls {
@@ -792,7 +792,6 @@ void WorksheetData::setDimension( const CellRangeAddress& rRange )
void WorksheetData::setCellFormat( const CellModel& rModel )
{
- OOX_LOADSAVE_TIMER( SETCELLFORMAT );
if( rModel.mxCell.is() && ((rModel.mnXfId >= 0) || (rModel.mnNumFmtId >= 0)) )
{
// try to merge existing ranges and to write some formatting properties
@@ -954,7 +953,6 @@ void WorksheetData::setRowModel( const RowModel& rModel )
void WorksheetData::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) const
{
- OOX_LOADSAVE_TIMER( CONVERTCOLUMNFORMAT );
CellRangeAddress aRange( mnSheet, nFirstCol, 0, nLastCol, mrMaxApiPos.Row );
if( getAddressConverter().validateCellRange( aRange, true, false ) )
{
@@ -965,7 +963,6 @@ void WorksheetData::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol
void WorksheetData::convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) const
{
- OOX_LOADSAVE_TIMER( CONVERTROWFORMAT );
CellRangeAddress aRange( mnSheet, 0, nFirstRow, mrMaxApiPos.Column, nLastRow );
if( getAddressConverter().validateCellRange( aRange, true, false ) )
{
@@ -987,13 +984,13 @@ void WorksheetData::initializeWorksheetImport()
void WorksheetData::finalizeWorksheetImport()
{
- OOX_LOADSAVE_TIMER( FINALIZESHEETDATA );
lclUpdateProgressBar( mxRowProgress, 1.0 );
finalizeXfIdRanges();
lclUpdateProgressBar( mxFinalProgress, 0.25 );
finalizeHyperlinkRanges();
finalizeValidationRanges();
finalizeMergedRanges();
+ maSheetSett.finalizeImport();
maCondFormats.finalizeImport();
maPageSett.finalizeImport();
maSheetViewSett.finalizeImport();
@@ -1117,7 +1114,6 @@ void WorksheetData::writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRan
void WorksheetData::writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const
{
- OOX_LOADSAVE_TIMER( WRITECELLPROPERTIES );
StylesBuffer& rStyles = getStyles();
PropertyMap aPropMap;
if( rXfIdRange.mnXfId >= 0 )
@@ -1132,7 +1128,6 @@ void WorksheetData::mergeXfIdRanges()
{
if( !maXfIdRanges.empty() )
{
- OOX_LOADSAVE_TIMER( MERGECELLFORMAT );
// get row index of last range
sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow;
// process all ranges located in the same row of the last range
@@ -1397,10 +1392,7 @@ void WorksheetData::finalizeDrawing()
OSL_ENSURE( (getFilterType() == FILTER_OOX) || (maDrawingPath.getLength() == 0),
"WorksheetData::finalizeDrawing - unexpected DrawingML path" );
if( (getFilterType() == FILTER_OOX) && (maDrawingPath.getLength() > 0) )
- {
- OOX_LOADSAVE_TIMER( FINALIZEDRAWING );
importOoxFragment( new OoxDrawingFragment( *this, maDrawingPath ) );
- }
}
void WorksheetData::finalizeVmlDrawing()
@@ -1822,7 +1814,6 @@ void WorksheetHelper::setErrorCell( const Reference< XCell >& rxCell, sal_uInt8
void WorksheetHelper::setCell( CellModel& orModel ) const
{
OSL_ENSURE( orModel.mxCell.is(), "WorksheetHelper::setCell - missing cell interface" );
- OOX_LOADSAVE_TIMER( SETCELL );
if( orModel.mbHasValueStr ) switch( orModel.mnCellType )
{
case XML_b:
diff --git a/oox/source/xls/worksheetsettings.cxx b/oox/source/xls/worksheetsettings.cxx
index b9e4f4b8babc..6a42c38e1647 100644
--- a/oox/source/xls/worksheetsettings.cxx
+++ b/oox/source/xls/worksheetsettings.cxx
@@ -27,6 +27,7 @@
#include "oox/xls/worksheetsettings.hxx"
#include <com/sun/star/util/XProtectable.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/biffinputstream.hxx"
@@ -293,6 +294,11 @@ void WorksheetSettings::importSheetProtection( BiffInputStream& rStrm )
maSheetProt.mbSelectUnlocked = !getFlag( nFlags, BIFF_SHEETPROT_SELECT_UNLOCKED );
}
+void WorksheetSettings::importCodeName( BiffInputStream& rStrm )
+{
+ maSheetSettings.maCodeName = rStrm.readUniString();
+}
+
void WorksheetSettings::importPhoneticPr( BiffInputStream& rStrm )
{
maPhoneticSett.importPhoneticPr( rStrm );
@@ -300,6 +306,7 @@ void WorksheetSettings::importPhoneticPr( BiffInputStream& rStrm )
void WorksheetSettings::finalizeImport()
{
+ // sheet protection
if( maSheetProt.mbSheet ) try
{
Reference< XProtectable > xProtectable( getSheet(), UNO_QUERY_THROW );
@@ -308,6 +315,10 @@ void WorksheetSettings::finalizeImport()
catch( Exception& )
{
}
+
+ // VBA code name
+ PropertySet aPropSet( getSheet() );
+ aPropSet.setProperty( PROP_CodeName, maSheetSettings.maCodeName );
}
// ============================================================================
diff --git a/oox/util/makefile.mk b/oox/util/makefile.mk
index 3d3aba15dd2e..8bbf8a3650f2 100644
--- a/oox/util/makefile.mk
+++ b/oox/util/makefile.mk
@@ -68,7 +68,8 @@ SHL1STDLIBS= \
$(RTLLIB) \
$(SALLIB) \
$(BASEGFXLIB) \
- $(SAXLIB)
+ $(SAXLIB) \
+ $(XMLSCRIPTLIB)
# link openssl, copied this bit from ucb/source/ucp/webdav/makefile.mk
.IF "$(GUI)"=="WNT"
diff --git a/postprocess/checkdeliver/checkdeliver.pl b/postprocess/checkdeliver/checkdeliver.pl
index 90a01be3a0a0..afd52ae0fec5 100644
--- a/postprocess/checkdeliver/checkdeliver.pl
+++ b/postprocess/checkdeliver/checkdeliver.pl
@@ -93,9 +93,6 @@ sub get_globals
if ( ! ( $platform && $srcrootdir && $solverdir ) ) {
die "Error: please set environment\n";
}
- if ( ! -d $srcrootdir ) {
- die "Error: cannot find source directory '$srcrootdir'\n";
- }
if ( ! -d $solverdir ) {
die "Error: cannot find solver directory '$solverdir'\n";
}
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index e9bbfbd8b40d..ad8f56600531 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1749,6 +1749,8 @@ public:
{ return eStorageGrammar; }
SfxUndoManager* GetUndoManager();
+ bool IsInVBAMode() const;
+
private: // CLOOK-Impl-Methoden
/**
diff --git a/sc/inc/servuno.hxx b/sc/inc/servuno.hxx
index e45d80e742c7..4f2f1ec40de2 100644
--- a/sc/inc/servuno.hxx
+++ b/sc/inc/servuno.hxx
@@ -88,12 +88,16 @@ class ScDocShell;
// BM
#define SC_SERVICE_CHDATAPROV 37
+// formula parser
#define SC_SERVICE_FORMULAPARS 38
#define SC_SERVICE_OPCODEMAPPER 39
-#define SC_SERVICE_VBACODENAMEPROVIDER 40
-#define SC_SERVICE_VBAGLOBALS 41
-#define SC_SERVICE_COUNT 42
+// VBA specific
+#define SC_SERVICE_VBAOBJECTPROVIDER 40
+#define SC_SERVICE_VBACODENAMEPROVIDER 41
+#define SC_SERVICE_VBAGLOBALS 42
+
+#define SC_SERVICE_COUNT 43
#define SC_SERVICE_INVALID USHRT_MAX
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index f5de35c9d033..5bcc22ae72d3 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -484,6 +484,7 @@
#define SC_UNO_ISEXECUTELINKENABLED "IsExecuteLinkEnabled"
#define SC_UNO_ISCHANGEREADONLYENABLED "IsChangeReadOnlyEnabled"
#define SC_UNO_REFERENCEDEVICE "ReferenceDevice"
+#define SC_UNO_CODENAME "CodeName"
// document properties from FormModel
#define SC_UNO_APPLYFMDES "ApplyFormDesignMode"
diff --git a/sc/inc/unowids.hxx b/sc/inc/unowids.hxx
index 1765b9d06361..f58c3248bf81 100644
--- a/sc/inc/unowids.hxx
+++ b/sc/inc/unowids.hxx
@@ -77,7 +77,8 @@
#define SC_WID_UNO_TABLAYOUT ( SC_WID_UNO_START + 37 )
#define SC_WID_UNO_AUTOPRINT ( SC_WID_UNO_START + 38 )
#define SC_WID_UNO_ABSNAME ( SC_WID_UNO_START + 39 )
-#define SC_WID_UNO_END ( SC_WID_UNO_START + 39 )
+#define SC_WID_UNO_CODENAME ( SC_WID_UNO_START + 40 )
+#define SC_WID_UNO_END ( SC_WID_UNO_START + 40 )
inline BOOL IsScUnoWid( USHORT nWid )
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index c08fb7a10228..138b55f0794c 100644..100755
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -93,6 +93,7 @@
#include "tabprotection.hxx"
#include "formulaparserpool.hxx"
#include "clipparam.hxx"
+#include <basic/basmgr.hxx>
// pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
// dtor plus helpers are convenient.
@@ -934,6 +935,8 @@ BOOL ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
return bValid;
}
+void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String& sModuleSource );
+
ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
SCTAB nDestPos, BOOL bInsertNew,
BOOL bResultsOnly )
@@ -1104,6 +1107,43 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
}
if (!bValid)
nRetVal = 0;
+ BOOL bVbaEnabled = IsInVBAMode();
+
+ if ( bVbaEnabled )
+ {
+ SfxObjectShell* pSrcShell = pSrcDoc ? pSrcDoc->GetDocumentShell() : NULL;
+ if ( pSrcShell )
+ {
+ StarBASIC* pStarBASIC = pSrcShell ? pSrcShell->GetBasic() : NULL;
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ if ( pSrcShell && pSrcShell->GetBasicManager()->GetName().Len() > 0 )
+ {
+ aLibName = pSrcShell->GetBasicManager()->GetName();
+ pStarBASIC = pSrcShell->GetBasicManager()->GetLib( aLibName );
+ }
+
+ String sCodeName;
+ String sSource;
+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = pSrcShell->GetBasicContainer();
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
+ if( xLibContainer.is() )
+ {
+ com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+
+ if( xLib.is() )
+ {
+ String sSrcCodeName;
+ pSrcDoc->GetCodeName( nSrcPos, sSrcCodeName );
+ rtl::OUString sRTLSource;
+ xLib->getByName( sSrcCodeName ) >>= sRTLSource;
+ sSource = sRTLSource;
+ }
+ VBA_InsertModule( *this, nDestPos, sCodeName, sSource );
+ }
+ }
+
return nRetVal;
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3f25ad5a310e..ff132a1f204b 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -51,6 +51,7 @@
#include <tools/tenccvt.hxx>
#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
#include "document.hxx"
#include "table.hxx"
@@ -4972,4 +4973,13 @@ void ScDocument::EnableUndo( bool bVal )
mbUndoEnabled = bVal;
}
-
+bool ScDocument::IsInVBAMode() const
+{
+ bool bResult = false;
+ if ( pShell )
+ {
+ com::sun::star::uno::Reference< com::sun::star::script::XVBACompat > xVBA( pShell->GetBasicContainer(), com::sun::star::uno::UNO_QUERY );
+ bResult = xVBA->getVBACompatModeOn();
+ }
+ return bResult;
+}
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 45959130defc..a3ea403bf4c3 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -104,7 +104,6 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <sfx2/app.hxx>
-
using namespace com::sun::star;
@@ -257,8 +256,6 @@ void ImportExcel8::SheetProtection( void )
void ImportExcel8::ReadBasic( void )
{
- bHasBasic = TRUE;
-
SfxObjectShell* pShell = GetDocShell();
SotStorageRef xRootStrg = GetRootStorage();
SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get();
@@ -270,14 +267,14 @@ void ImportExcel8::ReadBasic( void )
if( bLoadCode || bLoadStrg )
{
SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable;
+ bool bAsComment = !bLoadExecutable;
if ( !bAsComment )
{
- uno::Any aGlobs;
+ uno::Any aGlobs;
uno::Sequence< uno::Any > aArgs(1);
aArgs[ 0 ] <<= pShell->GetModel();
- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
- pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
+ pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
if ( pAppMgr )
pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
@@ -297,6 +294,10 @@ void ImportExcel8::EndSheet( void )
void ImportExcel8::PostDocLoad( void )
{
+ // delay reading basic until sheet object ( codenames etc. ) are read
+
+ if ( bHasBasic )
+ ReadBasic();
// #i11776# filtered ranges before outlines and hidden rows
if( pExcRoot->pAutoFilterBuffer )
pExcRoot->pAutoFilterBuffer->Apply();
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index 637a4777c8ed..5b9cc3180699 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -986,7 +986,7 @@ FltError ImportExcel8::Read( void )
case 0x22: Rec1904(); break; // 1904 [ 2345 ]
case 0x56: Builtinfmtcnt(); break; // BUILTINFMTCNT[ 34 ]
case 0x8D: Hideobj(); break; // HIDEOBJ [ 345 ]
- case 0xD3: ReadBasic(); break;
+ case 0xD3: bHasBasic = true; break;
case 0xDE: Olesize(); break;
case 0x01BA: Codename( TRUE ); break;
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 64ed79e3d3b2..3d055d94a498 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -478,14 +478,14 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb
{
if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
{
- pInfo->SetMacro( XclControlHelper::GetScMacroName( maMacroName ) );
+ pInfo->SetMacro( XclControlHelper::GetScMacroName( maMacroName, GetDocShell() ) );
pInfo->SetHlink( maHyperlink );
}
}
#else
if( mbSimpleMacro && (maMacroName.Len() > 0) )
if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
- pInfo->SetMacro( XclControlHelper::GetScMacroName( maMacroName ) );
+ pInfo->SetMacro( XclControlHelper::GetScMacroName( maMacroName, GetDocShell() ) );
#endif
// call virtual function for object type specific processing
@@ -1947,7 +1947,7 @@ void XclImpTbxObjBase::SetDffProperties( const DffPropSet& rDffPropSet )
bool XclImpTbxObjBase::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor ) const
{
- return XclControlHelper::FillMacroDescriptor( rDescriptor, DoGetEventType(), GetMacroName() );
+ return XclControlHelper::FillMacroDescriptor( rDescriptor, DoGetEventType(), GetMacroName(), GetDocShell() );
}
void XclImpTbxObjBase::ConvertFont( ScfPropertySet& rPropSet ) const
diff --git a/sc/source/filter/excel/xlescher.cxx b/sc/source/filter/excel/xlescher.cxx
index 538fd7fd7242..e1132c1b5606 100644
--- a/sc/source/filter/excel/xlescher.cxx
+++ b/sc/source/filter/excel/xlescher.cxx
@@ -35,6 +35,7 @@
#include "document.hxx"
#include "xistream.hxx"
#include "xlescher.hxx"
+#include <filter/msfilter/msvbahelper.hxx>
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -328,10 +329,16 @@ Reference< XControlModel > XclControlHelper::GetControlModel( Reference< XShape
#define EXC_MACRONAME_PRE "vnd.sun.star.script:Standard."
#define EXC_MACRONAME_SUF "?language=Basic&location=document"
-OUString XclControlHelper::GetScMacroName( const String& rXclMacroName )
+OUString XclControlHelper::GetScMacroName( const String& rXclMacroName, SfxObjectShell* pDocShell )
{
+ String sTmp( rXclMacroName );
if( rXclMacroName.Len() > 0 )
- return CREATE_OUSTRING( EXC_MACRONAME_PRE ) + rXclMacroName + CREATE_OUSTRING( EXC_MACRONAME_SUF );
+ {
+ ooo::vba::VBAMacroResolvedInfo aMacro = ooo::vba::resolveVBAMacro( pDocShell, rXclMacroName, false );
+ if ( aMacro.IsResolved() )
+ return ooo::vba::makeMacroURL( aMacro.ResolvedMacro() );
+
+ }
return OUString();
}
@@ -365,14 +372,14 @@ spTbxListenerData[] =
#define EXC_MACROSCRIPT "Script"
bool XclControlHelper::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor,
- XclTbxEventType eEventType, const String& rXclMacroName )
+ XclTbxEventType eEventType, const String& rXclMacroName, SfxObjectShell* pShell )
{
if( rXclMacroName.Len() > 0 )
{
rDescriptor.ListenerType = OUString::createFromAscii( spTbxListenerData[ eEventType ].mpcListenerType );
rDescriptor.EventMethod = OUString::createFromAscii( spTbxListenerData[ eEventType ].mpcEventMethod );
rDescriptor.ScriptType = CREATE_OUSTRING( EXC_MACROSCRIPT );
- rDescriptor.ScriptCode = GetScMacroName( rXclMacroName );
+ rDescriptor.ScriptCode = GetScMacroName( rXclMacroName, pShell );
return true;
}
return false;
diff --git a/sc/source/filter/inc/xlescher.hxx b/sc/source/filter/inc/xlescher.hxx
index 33b75af8cd2c..95a87b51de12 100644
--- a/sc/source/filter/inc/xlescher.hxx
+++ b/sc/source/filter/inc/xlescher.hxx
@@ -432,7 +432,7 @@ public:
GetControlModel( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
/** Returns the Calc macro name from an Excel macro name. */
- static ::rtl::OUString GetScMacroName( const String& rXclMacroName );
+ static ::rtl::OUString GetScMacroName( const String& rXclMacroName, SfxObjectShell* pShell = NULL );
/** Returns the Excel macro name from a Calc macro name. */
static String GetXclMacroName( const ::rtl::OUString& rScMacroName );
@@ -440,7 +440,7 @@ public:
static bool FillMacroDescriptor(
::com::sun::star::script::ScriptEventDescriptor& rDescriptor,
XclTbxEventType eEventType,
- const String& rXclMacroName );
+ const String& rXclMacroName, SfxObjectShell* pShell = NULL );
/** Tries to extract an Excel macro name from the passed macro descriptor. */
static String ExtractFromMacroDescriptor(
const ::com::sun::star::script::ScriptEventDescriptor& rDescriptor,
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index cd28daa99401..01d03d49b50a 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -48,6 +48,12 @@
#include <svl/zforlist.hxx>
#include <svl/PasswordHelper.hxx>
+#include <basic/sbstar.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
+
#include <list>
#include "docfunc.hxx"
@@ -94,6 +100,7 @@
#include "clipparam.hxx"
#include <memory>
+#include <basic/basmgr.hxx>
using namespace com::sun::star;
using ::com::sun::star::uno::Sequence;
@@ -2576,6 +2583,106 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
}
//------------------------------------------------------------------------
+uno::Reference< uno::XInterface > GetDocModuleObject( SfxObjectShell& rDocSh, String& sCodeName )
+{
+ uno::Reference< lang::XMultiServiceFactory> xSF(rDocSh.GetModel(), uno::UNO_QUERY);
+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
+ uno::Reference< uno::XInterface > xDocModuleApiObject;
+ if ( xSF.is() )
+ {
+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
+ xDocModuleApiObject.set( xVBACodeNamedObjectAccess->getByName( sCodeName ), uno::UNO_QUERY );
+ }
+ return xDocModuleApiObject;
+
+}
+
+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule )
+{
+ ::rtl::OUString sVbaOption( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
+ script::ModuleInfo sModuleInfo;
+ sModuleInfo.ModuleType = script::ModuleType::DOCUMENT;
+ sModuleInfo.ModuleObject = GetDocModuleObject( rDocSh, sModule );
+ return sModuleInfo;
+}
+
+void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String& sSource )
+{
+ SFX_APP()->EnterBasicCall();
+ SfxObjectShell& rDocSh = *rDoc.GetDocumentShell();
+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
+
+ uno::Reference< container::XNameContainer > xLib;
+ if( xLibContainer.is() )
+ {
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ if ( rDocSh.GetBasicManager() && rDocSh.GetBasicManager()->GetName().Len() )
+ aLibName = rDocSh.GetBasicManager()->GetName();
+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+ if( xLib.is() )
+ {
+ // if the Module with codename exists then find a new name
+ sal_Int32 nNum = 0;
+ String genModuleName;
+ if ( sModuleName.Len() )
+ sModuleName = sModuleName;
+ else
+ {
+ genModuleName = String::CreateFromAscii( "Sheet1" );
+ nNum = 1;
+ }
+ while( xLib->hasByName( genModuleName ) )
+ genModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( ++nNum );
+
+ uno::Any aSourceAny;
+ rtl::OUString sTmpSource = sSource;
+ if ( sTmpSource.getLength() == 0 )
+ sTmpSource = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
+ aSourceAny <<= sTmpSource;
+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
+ if ( xVBAModuleInfo.is() )
+ {
+ String sCodeName( genModuleName );
+ rDoc.SetCodeName( nTab, sCodeName );
+ script::ModuleInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, genModuleName );
+ xVBAModuleInfo->insertModuleInfo( genModuleName, sModuleInfo );
+ xLib->insertByName( genModuleName, aSourceAny );
+ }
+
+ }
+ SFX_APP()->LeaveBasicCall();
+}
+
+void VBA_DeleteModule( ScDocShell& rDocSh, String& sModuleName )
+{
+ SFX_APP()->EnterBasicCall();
+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
+
+ uno::Reference< container::XNameContainer > xLib;
+ if( xLibContainer.is() )
+ {
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ if ( rDocSh.GetBasicManager() && rDocSh.GetBasicManager()->GetName().Len() )
+ aLibName = rDocSh.GetBasicManager()->GetName();
+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+ if( xLib.is() )
+ {
+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
+ if( xLib->hasByName( sModuleName ) )
+ xLib->removeByName( sModuleName );
+ if ( xVBAModuleInfo.is() )
+ xVBAModuleInfo->removeModuleInfo( sModuleName );
+
+ }
+ SFX_APP()->LeaveBasicCall();
+}
+
BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
{
@@ -2585,8 +2692,19 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL
ScDocShellModificator aModificator( rDocShell );
ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+
+
+ // Strange loop, also basic is loaded too early ( InsertTable )
+ // is called via the xml import for sheets in described in odf
+ BOOL bInsertDocModule = false;
+
+ if( !rDocShell.GetDocument()->IsImportingXML() )
+ {
+ bInsertDocModule = pDoc ? pDoc->IsInVBAMode() : false;
+ }
+ if ( bInsertDocModule || ( bRecord && !pDoc->IsUndoEnabled() ) )
bRecord = FALSE;
+
if (bRecord)
pDoc->BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
@@ -2597,10 +2715,17 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL
if (pDoc->InsertTab( nTab, rName ))
{
+ String sCodeName;
if (bRecord)
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoInsertTab( &rDocShell, nTab, bAppend, rName));
// Views updaten:
+ // Only insert vba modules if vba mode ( and not currently importing XML )
+ if( bInsertDocModule )
+ {
+ String sSource;
+ VBA_InsertModule( *pDoc, nTab, sCodeName, sSource );
+ }
rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
rDocShell.PostPaintExtras();
@@ -2622,8 +2747,11 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab, BOOL bRecord, BOOL /* bApi */ )
BOOL bSuccess = FALSE;
ScDocument* pDoc = rDocShell.GetDocument();
+ BOOL bVbaEnabled = pDoc ? pDoc->IsInVBAMode() : false;
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
+ if ( bVbaEnabled )
+ bRecord = FALSE;
BOOL bWasLinked = pDoc->IsLinked(nTab);
ScDocument* pUndoDoc = NULL;
ScRefUndoData* pUndoData = NULL;
@@ -2664,6 +2792,8 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab, BOOL bRecord, BOOL /* bApi */ )
pUndoData = new ScRefUndoData( pDoc );
}
+ String sCodeName;
+ BOOL bHasCodeName = pDoc->GetCodeName( nTab, sCodeName );
if (pDoc->DeleteTab( nTab, pUndoDoc ))
{
if (bRecord)
@@ -2674,6 +2804,13 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab, BOOL bRecord, BOOL /* bApi */ )
new ScUndoDeleteTab( &rDocShell, theTabs, pUndoDoc, pUndoData ));
}
// Views updaten:
+ if( bVbaEnabled )
+ {
+ if( bHasCodeName )
+ {
+ VBA_DeleteModule( rDocShell, sCodeName );
+ }
+ }
rDocShell.Broadcast( ScTablesHint( SC_TAB_DELETED, nTab ) );
if (bWasLinked)
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 061ece5efc90..84979e3dbcdf 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -65,6 +65,11 @@
#include "sc.hrc"
#include "waitoff.hxx"
#include "sizedev.hxx"
+#include <basic/sbstar.hxx>
+#include <basic/basmgr.hxx>
+
+// defined in docfunc.cxx
+void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String& sModuleSource );
// ---------------------------------------------------------------------------
@@ -866,6 +871,8 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
if (bRecord)
aDocument.BeginDrawUndo(); // drawing layer must do its own undo actions
+ String sSrcCodeName;
+ aDocument.GetCodeName( nSrcTab, sSrcCodeName );
if (!aDocument.CopyTab( nSrcTab, nDestTab ))
{
//! EndDrawUndo?
@@ -889,8 +896,38 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
GetUndoManager()->AddUndoAction(
new ScUndoCopyTab( this, aSrcList, aDestList ) );
}
- }
+ BOOL bVbaEnabled = aDocument.IsInVBAMode();
+ if ( bVbaEnabled )
+ {
+ StarBASIC* pStarBASIC = GetBasic();
+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ if ( GetBasicManager()->GetName().Len() > 0 )
+ {
+ aLibName = GetBasicManager()->GetName();
+ pStarBASIC = GetBasicManager()->GetLib( aLibName );
+ }
+ SCTAB nTabToUse = nDestTab;
+ if ( nDestTab == SC_TAB_APPEND )
+ nTabToUse = aDocument.GetMaxTableNumber() - 1;
+ String sCodeName;
+ String sSource;
+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = GetBasicContainer();
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
+ if( xLibContainer.is() )
+ {
+ com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
+ aLibAny >>= xLib;
+ }
+ if( xLib.is() )
+ {
+ rtl::OUString sRTLSource;
+ xLib->getByName( sSrcCodeName ) >>= sRTLSource;
+ sSource = sRTLSource;
+ }
+ VBA_InsertModule( aDocument, nTabToUse, sCodeName, sSource );
+ }
+ }
Broadcast( ScTablesHint( SC_TAB_COPIED, nSrcTab, nDestTab ) );
}
else
diff --git a/sc/source/ui/drawfunc/drformsh.src b/sc/source/ui/drawfunc/drformsh.src
index b20ceb9841a5..65e98eea7b2c 100644
--- a/sc/source/ui/drawfunc/drformsh.src
+++ b/sc/source/ui/drawfunc/drformsh.src
@@ -117,12 +117,14 @@
{\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = SID_ANCHOR_PAGE ; \
HelpId = SID_ANCHOR_PAGE ; \
Text [ en-US ] = "To P~age" ; \
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = SID_ANCHOR_CELL ; \
HelpId = SID_ANCHOR_CELL ; \
Text [ en-US ] = "To ~Cell" ; \
diff --git a/sc/source/ui/drawfunc/objdraw.src b/sc/source/ui/drawfunc/objdraw.src
index 0cd8fdd54e4b..82649044b38c 100644
--- a/sc/source/ui/drawfunc/objdraw.src
+++ b/sc/source/ui/drawfunc/objdraw.src
@@ -339,6 +339,7 @@
{\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = SID_ANCHOR_PAGE ; \
HelpId = SID_ANCHOR_PAGE ; \
Text [ en-US ] = "To P~age" ; \
@@ -346,6 +347,7 @@
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = SID_ANCHOR_CELL ; \
HelpId = SID_ANCHOR_CELL ; \
Text [ en-US ] = "To ~Cell" ; \
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index d563dea095dd..afe29a8309a7 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -769,6 +769,7 @@ const SfxItemPropertySet* lcl_GetSheetPropertySet()
{MAP_CHAR_LEN(SC_UNONAME_VALIXML), SC_WID_UNO_VALIXML, &getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &getCppuType((table::CellVertJustify*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_CODENAME), SC_WID_UNO_CODENAME, &getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
{0,0,0,0,0,0}
};
static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl );
@@ -8468,6 +8469,15 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
pDoc->ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
}
}
+ else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
+ {
+ rtl::OUString aCodeName;
+ if ( pDocSh && ( aValue >>= aCodeName ) )
+ {
+ String sNewName( aCodeName );
+ pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), sNewName );
+ }
+ }
else
ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
@@ -8606,6 +8616,13 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
BOOL bAutoPrint = pDoc->IsPrintEntireSheet( nTab );
ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint );
}
+ else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
+ {
+ String aCodeName;
+ if ( pDocSh )
+ pDocSh->GetDocument()->GetCodeName( GetTab_Impl(), aCodeName );
+ rAny <<= rtl::OUString( aCodeName );
+ }
else
ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 85c17f868b0a..e67103cf75e5 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -152,6 +152,7 @@ const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
{MAP_CHAR_LEN(SC_UNO_ISCHANGEREADONLYENABLED), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_REFERENCEDEVICE), 0, &getCppuType((uno::Reference<awt::XDevice>*)0), beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN("BuildId"), 0, &::getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_CODENAME), 0, &getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
{0,0,0,0,0,0}
};
@@ -1652,6 +1653,12 @@ void SAL_CALL ScModelObj::setPropertyValue(
pDoc->SetLanguage( eLatin, eCjk, eCtl );
}
}
+ else if ( aString.EqualsAscii( SC_UNO_CODENAME ) )
+ {
+ rtl::OUString sCodeName;
+ if ( aValue >>= sCodeName )
+ pDoc->SetCodeName( sCodeName );
+ }
else if ( aString.EqualsAscii( SC_UNO_CJK_CLOCAL ) )
{
lang::Locale aLocale;
@@ -1784,6 +1791,12 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
ScUnoConversion::FillLocale( aLocale, eLatin );
aRet <<= aLocale;
}
+ else if ( aString.EqualsAscii( SC_UNO_CODENAME ) )
+ {
+ rtl::OUString sCodeName = pDoc->GetCodeName();
+ aRet <<= sCodeName;
+ }
+
else if ( aString.EqualsAscii( SC_UNO_CJK_CLOCAL ) )
{
LanguageType eLatin, eCjk, eCtl;
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index 956c659f9b15..0b3a6f01f9ea 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include "servuno.hxx"
+#include "unoguard.hxx"
#include "unonames.hxx"
#include "cellsuno.hxx"
#include "fielduno.hxx"
@@ -71,6 +72,121 @@
using namespace ::com::sun::star;
+#ifndef CWS_NPOWER14MISCFIXES
+uno::Reference< uno::XInterface > lcl_createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
+{
+ uno::Any aUnoVar;
+ if ( !pShell || !pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
+ throw lang::IllegalArgumentException();
+ uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW );
+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
+ uno::Reference< uno::XInterface > xIf = xVBAFactory->createInstanceWithArguments( sVarName, aArgs );
+ return xIf;
+}
+#endif
+
+class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
+{
+ uno::Any maWorkbook;
+ uno::Any maCachedObject;
+ ScDocShell* mpDocShell;
+public:
+ ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell )
+ {
+ ScDocument* pDoc = mpDocShell->GetDocument();
+ if ( !pDoc )
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
+
+ uno::Sequence< uno::Any > aArgs(2);
+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
+#ifdef CWS_NPOWER14MISCFIXES
+ maWorkbook <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
+#else
+ maWorkbook <<= lcl_createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
+#endif
+ }
+
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
+ {
+ ScUnoGuard aGuard;
+ maCachedObject = uno::Any(); // clear cached object
+ String sName = aName;
+
+ ScDocument* pDoc = mpDocShell->GetDocument();
+ if ( !pDoc )
+ throw uno::RuntimeException();
+ if ( sName == pDoc->GetCodeName() )
+ maCachedObject = maWorkbook;
+ else
+ {
+ String sCodeName;
+ SCTAB nCount = pDoc->GetTableCount();
+ for( SCTAB i = 0; i < nCount; i++ )
+ {
+ pDoc->GetCodeName( i, sCodeName );
+ if( sCodeName == sName )
+ {
+ String sSheetName;
+ if( pDoc->GetName( i, sSheetName ) )
+ {
+ uno::Reference< frame::XModel > xModel( mpDocShell->GetModel() );
+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference<sheet::XSpreadsheets > xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xIndexAccess( xSheets, uno::UNO_QUERY_THROW );
+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Any > aArgs(3);
+ aArgs[0] = maWorkbook;
+ aArgs[1] = uno::Any( xModel );
+ aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
+#ifdef CWS_NPOWER14MISCFIXES
+ // use the convience function
+ maCachedObject <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
+#else
+ // use the temp function
+ maCachedObject <<= lcl_createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
+#endif
+ break;
+ }
+ }
+ }
+ }
+ return maCachedObject.hasValue();
+
+ }
+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ ScUnoGuard aGuard;
+ OSL_TRACE("ScVbaObjectForCodeNameProvider::getByName( %s )",
+ rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if ( !hasByName( aName ) )
+ throw ::com::sun::star::container::NoSuchElementException();
+ return maCachedObject;
+ }
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ScUnoGuard aGuard;
+ ScDocument* pDoc = mpDocShell->GetDocument();
+ if ( !pDoc )
+ throw uno::RuntimeException();
+ SCTAB nCount = pDoc->GetTableCount();
+ uno::Sequence< rtl::OUString > aNames( nCount + 1 );
+ SCTAB index = 0;
+ String sCodeName;
+ for( ; index < nCount; ++index )
+ {
+ pDoc->GetCodeName( index, sCodeName );
+ aNames[ index ] = sCodeName;
+ }
+ aNames[ index ] = pDoc->GetCodeName();
+ return aNames;
+ }
+ // XElemenAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
+
+};
+
class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
{
ScDocShell* mpDocShell;
@@ -79,6 +195,7 @@ public:
// XCodeNameQuery
rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
{
+ ScUnoGuard aGuard;
rtl::OUString sCodeName;
if ( mpDocShell )
{
@@ -176,7 +293,9 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
{ SC_SERVICENAME_CHDATAPROV, SC_SERVICE_CHDATAPROV },
{ SC_SERVICENAME_FORMULAPARS, SC_SERVICE_FORMULAPARS },
{ SC_SERVICENAME_OPCODEMAPPER, SC_SERVICE_OPCODEMAPPER },
+ { "ooo.vba.VBAObjectModuleObjectProvider", SC_SERVICE_VBAOBJECTPROVIDER },
{ "ooo.vba.VBACodeNameProvider", SC_SERVICE_VBACODENAMEPROVIDER },
+ { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
// case-correct versions of the service names (#i102468#)
{ "com.sun.star.text.textfield.URL", SC_SERVICE_URLFIELD },
@@ -186,8 +305,7 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
{ "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD },
{ "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD },
{ "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD },
- { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
- { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
+ { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD }
};
//
@@ -240,6 +358,7 @@ static const sal_Char* __FAR_DATA aOldNames[SC_SERVICE_COUNT] =
"", // SC_SERVICE_CHDATAPROV
"", // SC_SERVICE_FORMULAPARS
"", // SC_SERVICE_OPCODEMAPPER
+ "", // SC_SERVICE_VBAOBJECTPROVIDER
"", // SC_SERVICE_VBACODENAMEPROVIDER
"", // SC_SERVICE_VBAGLOBALS
};
@@ -446,6 +565,13 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> (pComp))));
break;
}
+ case SC_SERVICE_VBAOBJECTPROVIDER:
+ if ( pDocShell )
+ {
+ OSL_TRACE("**** creating VBA Object mapper");
+ xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
+ }
+ break;
case SC_SERVICE_VBACODENAMEPROVIDER:
{
// Only create the excel faking service for excel docs
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index 4912863a446e..b1c4db637434 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -208,12 +208,11 @@ getViewFrame( const uno::Reference< frame::XModel >& xModel )
}
SfxItemSet*
-ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
+ScVbaCellRangeAccess::GetDataSet( ScCellRangesBase* pRangeObj )
{
- SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ;
- return pDataSet;
-
+ return pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : 0;
}
+
} //excel
} //vba
} //ooo
diff --git a/sc/source/ui/vba/excelvbahelper.hxx b/sc/source/ui/vba/excelvbahelper.hxx
index 34b099e6db46..9af804ab169f 100644
--- a/sc/source/ui/vba/excelvbahelper.hxx
+++ b/sc/source/ui/vba/excelvbahelper.hxx
@@ -30,7 +30,7 @@
#include<vbahelper/vbahelper.hxx>
#include <docsh.hxx>
-class ScCellRangeObj;
+class ScCellRangesBase;
namespace ooo
{
@@ -51,7 +51,7 @@ namespace ooo
class ScVbaCellRangeAccess
{
public:
- static SfxItemSet* GetDataSet( ScCellRangeObj* pRangeObj );
+ static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
};
}
}
diff --git a/sc/source/ui/vba/testvba/runTests.pl b/sc/source/ui/vba/testvba/runTests.pl
index f5051516a9c4..e686a1d4cb89 100644..100755
--- a/sc/source/ui/vba/testvba/runTests.pl
+++ b/sc/source/ui/vba/testvba/runTests.pl
@@ -20,7 +20,7 @@ my $theResult;
my $officepath = shift || die "please specify path to office installation program dir";
my $DocName = shift || "";
my $programpath = "$officepath"."3/program:$officepath/program:";
-my $basiclibrarypath = "$officepath/basis3.2/program";
+my $basiclibrarypath = "$officepath/basis3.3/program";
my $urelibpath = "$officepath/ure/lib";
my $binext = "";
my $testDocDir = "$binDir/TestDocuments";
diff --git a/sc/source/ui/vba/testvba/testclient b/sc/source/ui/vba/testvba/testclient
index 12e9ca1659f4..c9cde8c5b052 100755
--- a/sc/source/ui/vba/testvba/testclient
+++ b/sc/source/ui/vba/testvba/testclient
Binary files differ
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 5d9e513dabeb..3d5af01acef1 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -132,10 +132,16 @@ ScVbaApplication::getActiveWorkbook() throw (uno::RuntimeException)
{
return new ActiveWorkbook( this, mxContext );
}
+
uno::Reference< excel::XWorkbook > SAL_CALL
ScVbaApplication::getThisWorkbook() throw (uno::RuntimeException)
{
- return getActiveWorkbook();
+ uno::Reference< frame::XModel > xModel = getThisExcelDoc(mxContext);
+ if( !xModel.is() )
+ return uno::Reference< excel::XWorkbook >();
+
+ ScVbaWorkbook *pWb = new ScVbaWorkbook( this, mxContext, xModel );
+ return uno::Reference< excel::XWorkbook > (pWb);
}
uno::Reference< XAssistant > SAL_CALL
@@ -769,46 +775,74 @@ bool lcl_canJoin( ScRange& r1, ScRange& r2 )
void lcl_strip_containedRanges( Ranges& vRanges )
{
// get rid of ranges that are surrounded by other ranges
- for( Ranges::iterator it = vRanges.begin(); it != vRanges.end(); ++it )
+ Ranges::iterator it_outer = vRanges.begin();
+ while( it_outer != vRanges.end() )
{
- for( Ranges::iterator it_inner = vRanges.begin(); it_inner != vRanges.end(); ++it_inner )
+ bool it_outer_erased = false; // true = it_outer erased from vRanges
+ Ranges::iterator it_inner = vRanges.begin();
+ /* Exit the inner loop if outer iterator has been erased in its last
+ iteration (this means it has been joined to last it_inner, or that
+ the it_inner contains it completely). The inner loop will restart
+ with next element of the outer loop, and all elements (from the
+ beginning of the list) will be checked against that new element. */
+ while( !it_outer_erased && (it_inner != vRanges.end()) )
{
- if ( it != it_inner )
+ bool it_inner_erased = false; // true = it_inner erased from vRanges
+ if ( it_outer != it_inner )
{
#ifdef DEBUG
- String r1;
- String r2;
- it->Format( r1, SCA_VALID ) ;
- it_inner->Format( r2, SCA_VALID ) ;
- OSL_TRACE( "try strip/join address %s with %s ",
- rtl::OUStringToOString( r1, RTL_TEXTENCODING_UTF8 ).getStr(),
- rtl::OUStringToOString( r2, RTL_TEXTENCODING_UTF8 ).getStr() );
+ String r1;
+ String r2;
+ it_outer->Format( r1, SCA_VALID ) ;
+ it_inner->Format( r2, SCA_VALID ) ;
+ OSL_TRACE( "try strip/join address %s with %s ",
+ rtl::OUStringToOString( r1, RTL_TEXTENCODING_UTF8 ).getStr(),
+ rtl::OUStringToOString( r2, RTL_TEXTENCODING_UTF8 ).getStr() );
#endif
- if ( it->In( *it_inner ) )
+ if ( it_outer->In( *it_inner ) )
+ {
it_inner = vRanges.erase( it_inner );
- else if ( it_inner->In( *it ) )
- it = vRanges.erase( it );
+ it_inner_erased = true;
+ }
+ else if ( it_inner->In( *it_outer ) )
+ {
+ it_outer = vRanges.erase( it_outer );
+ it_outer_erased = true;
+ }
#ifndef OWN_JOIN
- else if ( (*it_inner).aStart.Row() == (*it).aStart.Row()
- && (*it_inner).aEnd.Row() == (*it).aEnd.Row() )
+ else if ( (*it_inner).aStart.Row() == (*it_outer).aStart.Row()
+ && (*it_inner).aEnd.Row() == (*it_outer).aEnd.Row() )
{
- it->ExtendTo( *it_inner );
+ it_outer->ExtendTo( *it_inner );
it_inner = vRanges.erase( it_inner );
+ it_inner_erased = true;
}
#else
- else if ( lcl_canJoin( *it, *it_inner ) )
+ else if ( lcl_canJoin( *it_outer, *it_inner ) )
{
- it->ExtendTo( *it_inner );
+ it_outer->ExtendTo( *it_inner );
it_inner = vRanges.erase( it_inner );
+ it_inner_erased = true;
}
- else if ( lcl_canJoin( *it_inner, *it) )
+ else if ( lcl_canJoin( *it_inner, *it_outer) )
{
- it_inner->ExtendTo( *it );
- it = vRanges.erase( it );
+ it_inner->ExtendTo( *it_outer );
+ it_outer = vRanges.erase( it_outer );
+ it_outer_erased = true;
}
#endif
}
+ /* If it_inner has not been erased from vRanges, continue inner
+ loop with next element. Otherwise, it_inner already points to
+ the next element (return value of list::erase()). */
+ if( !it_inner_erased )
+ ++it_inner;
}
+ /* If it_outer has not been erased from vRanges, continue outer loop
+ with next element. Otherwise, it_outer already points to the next
+ element (return value of list::erase()). */
+ if( !it_outer_erased )
+ ++it_outer;
}
}
diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx
index c98029fb1292..23c2bf96a810 100644
--- a/sc/source/ui/vba/vbaformat.cxx
+++ b/sc/source/ui/vba/vbaformat.cxx
@@ -45,7 +45,10 @@
#include "vbafont.hxx"
#include "vbainterior.hxx"
-#include "unonames.hxx"
+#include <unonames.hxx>
+#include <cellsuno.hxx>
+#include <scitems.hxx>
+#include <attrib.hxx>
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -571,14 +574,24 @@ ScVbaFormat<Ifc1>::getLocked( ) throw (script::BasicErrorException, uno::Runtim
uno::Any aCellProtection = aNULL();
try
{
-
rtl::OUString sCellProt( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLPRO ) );
+
if (!isAmbiguous(sCellProt))
{
- util::CellProtection cellProtection;
- mxPropertySet->getPropertyValue(sCellProt) >>= cellProtection;
-
- aCellProtection = uno::makeAny( cellProtection.IsLocked );
+ SfxItemSet* pDataSet = getCurrentDataSet();
+ if ( pDataSet )
+ {
+ const ScProtectionAttr& rProtAttr = (const ScProtectionAttr &) pDataSet->Get(ATTR_PROTECTION, TRUE);
+ SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION, TRUE, NULL);
+ if(eState != SFX_ITEM_DONTCARE)
+ aCellProtection = uno::makeAny(rProtAttr.GetProtection());
+ }
+ else // fallback to propertyset
+ {
+ util::CellProtection cellProtection;
+ mxPropertySet->getPropertyValue(sCellProt) >>= aCellProtection;
+ aCellProtection = uno::makeAny( cellProtection.IsLocked );
+ }
}
}
catch (uno::Exception& )
@@ -598,9 +611,20 @@ ScVbaFormat<Ifc1>::getFormulaHidden( ) throw (script::BasicErrorException, uno:
rtl::OUString sCellProt( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLPRO ) );
if (!isAmbiguous(sCellProt))
{
- util::CellProtection aCellProtection;
- mxPropertySet->getPropertyValue(sCellProt) >>= aCellProtection;
- aBoolRet = uno::makeAny( aCellProtection.IsFormulaHidden );
+ SfxItemSet* pDataSet = getCurrentDataSet();
+ if ( pDataSet )
+ {
+ const ScProtectionAttr& rProtAttr = (const ScProtectionAttr &) pDataSet->Get(ATTR_PROTECTION, TRUE);
+ SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION, TRUE, NULL);
+ if(eState != SFX_ITEM_DONTCARE)
+ aBoolRet = uno::makeAny(rProtAttr.GetHideFormula());
+ }
+ else
+ {
+ util::CellProtection aCellProtection;
+ mxPropertySet->getPropertyValue(sCellProt) >>= aCellProtection;
+ aBoolRet = uno::makeAny( aCellProtection.IsFormulaHidden );
+ }
}
}
catch (uno::Exception e)
@@ -794,6 +818,24 @@ ScVbaFormat<Ifc1>::getServiceNames()
return aServiceNames;
}
+template< typename Ifc1 >
+ScCellRangesBase*
+ScVbaFormat<Ifc1>::getCellRangesBase() throw ( ::uno::RuntimeException )
+{
+ return ScCellRangesBase::getImplementation( mxPropertySet );
+}
+
+template< typename Ifc1 >
+SfxItemSet*
+ScVbaFormat<Ifc1>::getCurrentDataSet( ) throw ( uno::RuntimeException )
+{
+ SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( getCellRangesBase() );
+ if ( !pDataSet )
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't access Itemset for XPropertySet" ) ), uno::Reference< uno::XInterface >() );
+ return pDataSet;
+}
+
+
template class ScVbaFormat< excel::XStyle >;
template class ScVbaFormat< excel::XRange >;
diff --git a/sc/source/ui/vba/vbaformat.hxx b/sc/source/ui/vba/vbaformat.hxx
index e024cd68b9ad..bfa88d6c7cb8 100644
--- a/sc/source/ui/vba/vbaformat.hxx
+++ b/sc/source/ui/vba/vbaformat.hxx
@@ -38,6 +38,8 @@
#include <com/sun/star/beans/XPropertyState.hpp>
#include <vbahelper/vbahelperinterface.hxx>
+class ScCellRangesBase;
+
template< typename Ifc1 >
class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
{
@@ -60,6 +62,9 @@ protected:
css::uno::Reference< css::beans::XPropertyState > getXPropertyState() throw ( css::uno::RuntimeException );
void initializeNumberFormats() throw ( css::script::BasicErrorException );
void setNumberFormat( css::lang::Locale _aLocale, const rtl::OUString& _sFormatString) throw( css::script::BasicErrorException );
+ SfxItemSet* getCurrentDataSet( ) throw ( css::uno::RuntimeException );
+protected:
+ virtual ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException );
public:
ScVbaFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const css::uno::Reference< css::frame::XModel >& xModel, bool bCheckAmbiguoity ) throw ( css::script::BasicErrorException );
virtual ~ScVbaFormat() {}
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index b3307ffdc55d..1a153b440b15 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -238,21 +238,28 @@ uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges( const uno::Re
return xRange;
}
-ScCellRangeObj* ScVbaRange::getCellRangeObj() throw ( uno::RuntimeException )
+ScCellRangesBase* ScVbaRange::getCellRangesBase() throw ( uno::RuntimeException )
{
- uno::Reference< uno::XInterface > xIf;
- if ( mxRanges.is() )
- xIf.set( mxRanges, uno::UNO_QUERY_THROW );
- else
- xIf.set( mxRange, uno::UNO_QUERY_THROW );
- ScCellRangeObj* pUnoCellRange = dynamic_cast< ScCellRangeObj* >( xIf.get() );
- return pUnoCellRange;
+ if( mxRanges.is() )
+ return ScCellRangesBase::getImplementation( mxRanges );
+ if( mxRange.is() )
+ return ScCellRangesBase::getImplementation( mxRange );
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("General Error creating range - Unknown" ), uno::Reference< uno::XInterface >() );
+}
+
+ScCellRangeObj* ScVbaRange::getCellRangeObj() throw ( uno::RuntimeException )
+{
+ return dynamic_cast< ScCellRangeObj* >( getCellRangesBase() );
+}
+
+ScCellRangesObj* ScVbaRange::getCellRangesObj() throw ( uno::RuntimeException )
+{
+ return dynamic_cast< ScCellRangesObj* >( getCellRangesBase() );
}
SfxItemSet* ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException )
{
- ScCellRangeObj* pUnoCellRange = getCellRangeObj();
- SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( pUnoCellRange );
+ SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( getCellRangesBase() );
if ( !pDataSet )
throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't access Itemset for range" ) ), uno::Reference< uno::XInterface >() );
return pDataSet;
@@ -3852,25 +3859,6 @@ ScVbaRange::getWorksheet() throw (uno::RuntimeException)
return xSheet;
}
-ScCellRangesBase*
-ScVbaRange::getCellRangesBase() throw( uno::RuntimeException )
-{
- ScCellRangesBase* pUnoRangesBase = NULL;
- if ( mxRanges.is() )
- {
- uno::Reference< uno::XInterface > xIf( mxRanges, uno::UNO_QUERY_THROW );
- pUnoRangesBase = dynamic_cast< ScCellRangesBase* >( xIf.get() );
- }
- else if ( mxRange.is() )
- {
- uno::Reference< uno::XInterface > xIf( mxRange, uno::UNO_QUERY_THROW );
- pUnoRangesBase = dynamic_cast< ScCellRangesBase* >( xIf.get() );
- }
- else
- throw uno::RuntimeException( rtl::OUString::createFromAscii("General Error creating range - Unknown" ), uno::Reference< uno::XInterface >() );
- return pUnoRangesBase;
-}
-
// #TODO remove this ugly application processing
// Process an application Range request e.g. 'Range("a1,b2,a4:b6")
uno::Reference< excel::XRange >
@@ -4589,26 +4577,6 @@ ScVbaRange::getValidation() throw (css::uno::RuntimeException)
return m_xValidation;
}
-uno::Any ScVbaRange::getFormulaHidden() throw ( script::BasicErrorException, css::uno::RuntimeException)
-{
- SfxItemSet* pDataSet = getCurrentDataSet();
- const ScProtectionAttr& rProtAttr = (const ScProtectionAttr &)
- pDataSet->Get(ATTR_PROTECTION, TRUE);
- SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION, TRUE, NULL);
- if(eState == SFX_ITEM_DONTCARE)
- return aNULL();
- return uno::makeAny(rProtAttr.GetHideFormula());
-
-}
-void ScVbaRange::setFormulaHidden(const uno::Any& Hidden) throw ( script::BasicErrorException, css::uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY_THROW);
- util::CellProtection rCellAttr;
- xProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLPRO))) >>= rCellAttr;
- Hidden >>= rCellAttr.IsFormulaHidden;
- xProps->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLPRO)), uno::makeAny(rCellAttr));
-}
-
uno::Any ScVbaRange::getShowDetail() throw ( css::uno::RuntimeException)
{
// #FIXME, If the specified range is in a PivotTable report
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index 89ae741c7535..1f161a79d973 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -57,6 +57,7 @@
class ScTableSheetsObj;
class ScCellRangesBase;
class ScCellRangeObj;
+class ScCellRangesObj;
class ScDocShell;
class ScDocument;
@@ -111,14 +112,16 @@ class ScVbaRange : public ScVbaRange_BASE
virtual css::uno::Any getFormulaValue( formula::FormulaGrammar::Grammar ) throw (css::uno::RuntimeException);
virtual void setFormulaValue( const css::uno::Any& aValue, formula::FormulaGrammar::Grammar ) throw ( css::uno::RuntimeException);
css::uno::Reference< ov::excel::XRange > getArea( sal_Int32 nIndex ) throw( css::uno::RuntimeException );
- ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException );
ScCellRangeObj* getCellRangeObj( ) throw ( css::uno::RuntimeException );
- SfxItemSet* getCurrentDataSet( ) throw ( css::uno::RuntimeException );
+ ScCellRangesObj* getCellRangesObj() throw ( css::uno::RuntimeException );
css::uno::Reference< ov::XCollection >& getBorders();
void groupUnGroup( bool bUnGroup = false ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
css::uno::Reference< ov::excel::XRange > PreviousNext( bool bIsPrevious );
css::uno::Reference< ov::excel::XRange > SpecialCellsImpl( sal_Int32 nType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException );
css::awt::Point getPosition() throw ( css::uno::RuntimeException );
+protected:
+ virtual ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException );
+ virtual SfxItemSet* getCurrentDataSet( ) throw ( css::uno::RuntimeException );
public:
ScVbaRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XCellRange >& xRange, sal_Bool bIsRows = false, sal_Bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException );
ScVbaRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges, sal_Bool bIsRows = false, sal_Bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException );
@@ -170,10 +173,6 @@ public:
virtual css::uno::Any SAL_CALL getPageBreak() throw (css::uno::RuntimeException);
virtual void SAL_CALL setPageBreak( const css::uno::Any& _pagebreak ) throw (css::uno::RuntimeException);
virtual css::uno::Reference< ov::excel::XValidation > SAL_CALL getValidation() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getFormulaHidden() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setFormulaHidden(const css::uno::Any& aHidden) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- //virtual css::uno::Any SAL_CALL getLocked() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- //virtual void SAL_CALL setLocked(const css::uno::Any& aLocked) throw (css::script::BasicErrorException, css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getShowDetail() throw (css::uno::RuntimeException);
virtual void SAL_CALL setShowDetail(const css::uno::Any& aShowDetail) throw (css::uno::RuntimeException);
// Methods
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 5fcd094acffc..11ecfa5aae8c 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -87,6 +87,13 @@
#include "docuno.hxx"
#include "charthelper.hxx"
+#include <basic/sbstar.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+using namespace com::sun::star;
+
+// helper func defined in docfunc.cxx
+void VBA_DeleteModule( ScDocShell& rDocSh, String& sModuleName );
// STATIC DATA ---------------------------------------------------------------
@@ -2141,6 +2148,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDocument* pDoc = pDocSh->GetDocument();
+ BOOL bVbaEnabled = pDoc ? pDoc->IsInVBAMode() : FALSE;
SCTAB nNewTab = TheTabs[0];
int i;
WaitObject aWait( GetFrameWin() );
@@ -2212,9 +2220,18 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
for(i=TheTabs.Count()-1;i>=0;i--)
{
+ String sCodeName;
+ BOOL bHasCodeName = pDoc->GetCodeName( TheTabs[sal::static_int_cast<USHORT>(i)], sCodeName );
if (pDoc->DeleteTab( TheTabs[sal::static_int_cast<USHORT>(i)], pUndoDoc ))
{
bDelDone = TRUE;
+ if( bVbaEnabled )
+ {
+ if( bHasCodeName )
+ {
+ VBA_DeleteModule( *pDocSh, sCodeName );
+ }
+ }
pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[sal::static_int_cast<USHORT>(i)] ) );
}
}
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index ab3f121809fa..faad1789a63f 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -109,8 +109,8 @@
</menu:menu>
<menu:menu menu:id=".uno:ViewMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:NormalViewMode"/>
- <menu:menuitem menu:id=".uno:PagebreakMode"/>
+ <menu:menuitem menu:id=".uno:NormalViewMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:PagebreakMode" menu:style="radio"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:AvailableToolbars"/>
<menu:menuitem menu:id=".uno:InputLineVisible"/>
@@ -247,21 +247,21 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:AnchorMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SetAnchorToPage"/>
- <menu:menuitem menu:id=".uno:SetAnchorToCell"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToCell" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:ObjectAlign">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalDefault"/>
- <menu:menuitem menu:id=".uno:CommonAlignLeft"/>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignRight"/>
- <menu:menuitem menu:id=".uno:CommonAlignJustified"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalDefault" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignLeft" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignRight" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignJustified" menu:style="radio"/>
<menu:menuseparator/>
- <menu:menuitem menu:id=".uno:CommonAlignTop"/>
- <menu:menuitem menu:id=".uno:CommonAlignVerticalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignBottom"/>
+ <menu:menuitem menu:id=".uno:CommonAlignTop" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignVerticalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignBottom" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:ArrangeMenu">
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index 3ebe0396dabb..3653c8487bd4 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -363,7 +363,7 @@ File gid_File_Lib_Vbaswobj
TXT_FILE_BODY;
Styles = (PACKED,UNO_COMPONENT);
RegistryID = gid_Starregistry_Services_Rdb;
- Dir = gid_Dir_Program;
+ Dir = SCP2_OOO_BIN_DIR;
#ifdef UNX
Name = STRING(CONCAT4(libvbaswobj,DLLPOSTFIX,.uno,UNXSUFFIX));
#else
@@ -375,7 +375,7 @@ File gid_File_Lib_Vbamsforms
TXT_FILE_BODY;
Styles = (PACKED,UNO_COMPONENT);
RegistryID = gid_Starregistry_Services_Rdb;
- Dir = gid_Dir_Program;
+ Dir = SCP2_OOO_BIN_DIR;
#ifdef UNX
Name = STRING(CONCAT4(libmsforms,DLLPOSTFIX,.uno,UNXSUFFIX));
#else
diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml
index 9e5d927b263e..20ca059b16d5 100644
--- a/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -75,14 +75,14 @@
</menu:menu>
<menu:menu menu:id=".uno:ViewMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:PageMode"/>
- <menu:menuitem menu:id=".uno:MasterPage"/>
+ <menu:menuitem menu:id=".uno:PageMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:MasterPage" menu:style="radio"/>
<menu:menuseparator/>
<menu:menu menu:id=".uno:DisplayQualityMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:OutputQualityColor"/>
- <menu:menuitem menu:id=".uno:OutputQualityGrayscale"/>
- <menu:menuitem menu:id=".uno:OutputQualityBlackWhite"/>
+ <menu:menuitem menu:id=".uno:OutputQualityColor" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityGrayscale" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityBlackWhite" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuseparator/>
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
index c1dacd33e0c0..03d4c238e360 100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -76,12 +76,12 @@
</menu:menu>
<menu:menu menu:id=".uno:ViewMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:NormalMultiPaneGUI"/>
- <menu:menuitem menu:id=".uno:OutlineMode"/>
- <menu:menuitem menu:id=".uno:DiaMode"/>
+ <menu:menuitem menu:id=".uno:NormalMultiPaneGUI" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutlineMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:DiaMode" menu:style="radio"/>
<menu:menuitem menu:id=".uno:Presentation"/>
- <menu:menuitem menu:id=".uno:NotesMode"/>
- <menu:menuitem menu:id=".uno:HandoutMode"/>
+ <menu:menuitem menu:id=".uno:NotesMode" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:HandoutMode" menu:style="radio"/>
<menu:menuseparator/>
<menu:menu menu:id=".uno:MasterPageMenu">
<menu:menupopup>
@@ -93,9 +93,9 @@
</menu:menu>
<menu:menu menu:id=".uno:DisplayQualityMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:OutputQualityColor"/>
- <menu:menuitem menu:id=".uno:OutputQualityGrayscale"/>
- <menu:menuitem menu:id=".uno:OutputQualityBlackWhite"/>
+ <menu:menuitem menu:id=".uno:OutputQualityColor" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityGrayscale" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:OutputQualityBlackWhite" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuseparator/>
diff --git a/soldep/bootstrp/prj.cxx b/soldep/bootstrp/prj.cxx
index d13e08a05283..dfb29fe74754 100644
--- a/soldep/bootstrp/prj.cxx
+++ b/soldep/bootstrp/prj.cxx
@@ -160,45 +160,34 @@ ByteString SimpleConfig::GetNextLine()
ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments )
/*****************************************************************************/
{
+ sal_Bool bStreamOk;
+ sal_Bool bReadNextLine = sal_True;
+ while (bReadNextLine)
+ {
+ bStreamOk = aFileStream.ReadLine ( aTmpStr );
+ if (!bStreamOk)
+ return ByteString();
- aFileStream.ReadLine ( aTmpStr );
- if ( aTmpStr.Search( "#" ) == 0 )
- if (bReadComments )
- return aTmpStr;
- else
- while ( aTmpStr.Search( "#" ) == 0 )
- {
- aFileStream.ReadLine ( aTmpStr );
- }
+ ByteString sTab = "\t";
+ ByteString sDoubleTab = "\t\t";
+ ByteString sSpace = " ";
+ xub_StrLen nIndex = 0;
- aTmpStr = aTmpStr.EraseLeadingChars();
- aTmpStr = aTmpStr.EraseTrailingChars();
-// while ( aTmpStr.SearchAndReplace(String(' '),String('\t') ) != (USHORT)-1 );
- int nLength = aTmpStr.Len();
-// USHORT nPos = 0;
- ByteString aEraseString;
- BOOL bFirstTab = TRUE;
- for ( USHORT i = 0; i<= nLength; i++)
- {
- if ( aTmpStr.GetChar( i ) == 0x20 )
- aTmpStr.SetChar( i, 0x09 );
+ aTmpStr.SearchAndReplaceAll(sSpace, sTab);
+ while ( (nIndex = aTmpStr.SearchAndReplace(sDoubleTab, sTab, nIndex )) != STRING_NOTFOUND );
+
+ aTmpStr = aTmpStr.EraseLeadingAndTrailingChars('\t'); // remove tabs
- if ( aTmpStr.GetChar( i ) == 0x09 )
+ if ( aTmpStr.Search( "#" ) == 0 )
{
- if ( bFirstTab )
- bFirstTab = FALSE;
- else
- {
- aTmpStr.SetChar( i, 0x20 );
- }
+ if (bReadComments )
+ return aTmpStr;
}
- else
- bFirstTab = TRUE;
-
+ else if (aTmpStr != ByteString::EmptyString())
+ bReadNextLine = sal_False;
}
- aTmpStr.EraseAllChars(' ');
- return aTmpStr;
+ return aTmpStr;
}
@@ -824,7 +813,8 @@ Prj::Prj() :
bVisited( FALSE ),
bIsAvailable( TRUE ),
pTempCommandDataList (0),
- bTempCommandDataListPermanent (FALSE)
+ bTempCommandDataListPermanent (FALSE),
+ bError (FALSE)
/*****************************************************************************/
{
}
@@ -841,7 +831,8 @@ Prj::Prj( ByteString aName ) :
bVisited( FALSE ),
bIsAvailable( TRUE ),
pTempCommandDataList (0),
- bTempCommandDataListPermanent (FALSE)
+ bTempCommandDataListPermanent (FALSE),
+ bError (FALSE)
/*****************************************************************************/
{
}
@@ -1146,6 +1137,7 @@ Prj& Prj::operator>> ( SvStream& rStream )
rStream << bFixedDependencies;
rStream << bSorted;
rStream << bIsAvailable;
+ rStream << bError;
if (pPrjDepInfoList)
{
@@ -1178,6 +1170,7 @@ Prj& Prj::operator<< ( SvStream& rStream )
rStream >> bFixedDependencies;
rStream >> bSorted;
rStream >> bIsAvailable;
+ rStream >> bError;
BOOL bDepList;
rStream >> bDepList;
@@ -1509,18 +1502,7 @@ void Star::Read( String &rFileName )
while( aFileList.Count()) {
String ssFileName = *aFileList.GetObject(( ULONG ) 0 );
- ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US);
- StarFile *pFile = new StarFile( ssFileName );
- if ( pFile->Exists()) {
-// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT)))
-// {
-// ReadXmlBuildList(sFileName_l);
-// } else {
- SimpleConfig aSolarConfig( ssFileName );
- while (( aString = aSolarConfig.GetNext()) != "" )
- InsertToken (( char * ) aString.GetBuffer());
-// }
- }
+ StarFile* pFile = ReadBuildlist (ssFileName);
aMutex.acquire();
ReplaceFileEntry (&aLoadedFilesList, pFile);
//aLoadedFilesList.Insert( pFile, LIST_APPEND );
@@ -1575,19 +1557,9 @@ void Star::Read( SolarFileList *pSolarFiles )
ByteString aString;
String ssFileName = *pSolarFiles->GetObject(( ULONG ) 0 );
- ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US);
- StarFile *pFile = new StarFile( ssFileName );
+ StarFile *pFile = ReadBuildlist ( ssFileName);
if ( pFile->Exists()) {
-// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT)))
-// {
-// ReadXmlBuildList(sFileName_l);
-// } else {
- SimpleConfig aSolarConfig( ssFileName );
- while (( aString = aSolarConfig.GetNext()) != "" )
- InsertToken (( char * ) aString.GetBuffer());
-// }
-
DirEntry aEntry( pFile->GetName() );
DirEntry aEntryPrj = aEntry.GetPath().GetPath();
if (aEntryPrj.GetExtension() != String::CreateFromAscii( "" ))
@@ -1721,207 +1693,259 @@ void Star::Expand_Impl()
}
/*****************************************************************************/
-void Star::InsertToken ( char *yytext )
+StarFile* Star::ReadBuildlist (const String& rFilename, BOOL bReadComments, BOOL bExtendAlias)
+/*****************************************************************************/
+{
+ ByteString sFileName_l(rFilename, RTL_TEXTENCODING_ASCII_US);
+ StarFile *pFile = new StarFile( rFilename );
+ if ( pFile->Exists()) {
+ SimpleConfig aSolarConfig( rFilename );
+ DirEntry aEntry(rFilename);
+ ByteString sProjectName (aEntry.GetPath().GetPath().GetName(), RTL_TEXTENCODING_ASCII_US);
+ Prj* pPrj = GetPrj (sProjectName); // 0, if Prj not found
+ if (pPrj)
+ {
+ Remove(pPrj); // Project exist, remove old Project and read again
+ DELETEZ (pPrj); // delete and set pPrj to 0
+ }
+ ByteString aString;
+ while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != ByteString::EmptyString() )
+ InsertTokenLine ( aString, &pPrj, sProjectName, bExtendAlias );
+ }
+ return pFile;
+}
+
+/*****************************************************************************/
+void Star::InsertTokenLine ( const ByteString& rTokenLine, Prj** ppPrj, const ByteString& rProjectName, const sal_Bool bExtendAlias )
/*****************************************************************************/
{
- static int i = 0;
- static ByteString aDirName, aWhat, aWhatOS,
+ int i = 0;
+ ByteString aWhat, aWhatOS,
sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara;
- static BOOL bPrjDep = FALSE;
- static BOOL bHardDep = FALSE;
- static BOOL bFixedDep = FALSE;
- static int nCommandType, nOSType;
+ ByteString aDirName;
+ BOOL bPrjDep = FALSE;
+ BOOL bHardDep = FALSE;
+ BOOL bFixedDep = FALSE;
+ BOOL bNewProject = FALSE;
+ int nCommandType=0, nOSType=0;
+ Prj* pPrj = *ppPrj;
CommandData* pCmdData;
- static SByteStringList *pStaticDepList;
- Prj* pPrj;
+ SByteStringList *pDepList = NULL;
+ ByteString aCommentString;
+ ByteString sToken;
+ ByteString sStringBuffer = rTokenLine;
- switch (i)
+ while (sStringBuffer != ByteString::EmptyString())
{
- case 0:
- aPrefix = yytext;
- pStaticDepList = 0;
- break;
- case 1:
- aDirName = yytext;
- aProjectName = aDirName.GetToken ( 0, 0x5c);
- break;
- case 2:
- if ( !strcmp( yytext, ":" ))
- {
- bPrjDep = TRUE;
- bHardDep = FALSE;
- bFixedDep = FALSE;
- i = 9;
- }
- else if ( !strcmp( yytext, "::" ))
- {
- bPrjDep = TRUE;
- bHardDep = TRUE;
- bFixedDep = FALSE;
- i = 9;
- }
- else if ( !strcmp( yytext, ":::" ))
- {
- bPrjDep = TRUE;
- bHardDep = TRUE;
- bFixedDep = TRUE;
- i = 9;
- }
- else
- {
- bPrjDep = FALSE;
- bHardDep = FALSE;
- bFixedDep = FALSE;
+ ByteString sToken = sStringBuffer.GetToken(0,'\t');
+ sStringBuffer.Erase(0, sToken.Len()+1);
- aWhat = yytext;
- nCommandType = GetJobType(aWhat);
- }
- if (bPrjDep)
- {
- if ( HasProject( aProjectName ))
+ switch (i)
+ {
+ case 0:
+ if ( sToken.Search( "#" ) == 0 )
{
- RemovePrj(GetPrj(aProjectName));
- // Projekt exist. schon, entfernen, später neue anlegen
+ i = -1;
+ aCommentString = sToken;
+ sStringBuffer = ByteString::EmptyString();
+ if ( Count() == 0 )
+ aDirName = "null_entry" ; //comments at begin of file
}
- }
- break;
- case 3:
- if ( !bPrjDep )
- {
- aWhat = yytext;
- if ( aWhat == "-" )
+ else
{
- aCommandPara = ByteString();
+ aPrefix = sToken;
+ pDepList = 0;
}
- else
- aCommandPara = aWhat;
- }
- break;
- case 4:
- if ( !bPrjDep )
- {
- aWhatOS = yytext;
- if ( aWhatOS.GetTokenCount( ',' ) > 1 ) {
- sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 );
- aWhatOS = aWhatOS.GetToken( 0, ',' );
+ break;
+ case 1:
+ aDirName = sToken;
+ aProjectName = aDirName.GetToken ( 0, 0x5c);
+ if (aProjectName != rProjectName)
+ sStringBuffer = ByteString::EmptyString(); // something is wrong, ignore line
+ break;
+ case 2:
+ if ( sToken.CompareTo(":") == COMPARE_EQUAL )
+ {
+ bPrjDep = TRUE;
+ bHardDep = FALSE;
+ bFixedDep = FALSE;
+ i = 9;
}
- nOSType = GetOSType (aWhatOS);
- }
- break;
- case 5:
- if ( !bPrjDep )
- {
- aLogFileName = (ByteString(aProjectName).Append("_")).Append(yytext);
- }
- break;
- default:
- if ( !bPrjDep )
- {
- ByteString aItem = yytext;
- if ( aItem == "NULL" )
+ else if ( sToken.CompareTo("::") == COMPARE_EQUAL )
{
- // Liste zu Ende
- i = -1;
+ bPrjDep = TRUE;
+ bHardDep = TRUE;
+ bFixedDep = FALSE;
+ i = 9;
+ }
+ else if ( sToken.CompareTo(":::") == COMPARE_EQUAL )
+ {
+ bPrjDep = TRUE;
+ bHardDep = TRUE;
+ bFixedDep = TRUE;
+ i = 9;
}
else
{
- // ggfs. Dependency liste anlegen und ergaenzen
- if ( !pStaticDepList )
- pStaticDepList = new SByteStringList;
- ByteString* pStr = new ByteString ((ByteString (aProjectName).Append("_")).Append(aItem));
- pStaticDepList->PutString( pStr );
+ bPrjDep = FALSE;
+ bHardDep = FALSE;
+ bFixedDep = FALSE;
+
+ aWhat = sToken;
+ nCommandType = GetJobType(aWhat);
}
- }
- else
- {
- ByteString aItem = yytext;
- if ( aItem == "NULL" )
+ if (bPrjDep)
{
- // Liste zu Ende
- i = -1;
- bPrjDep= FALSE;
+ if (pPrj)
+ sStringBuffer = ByteString::EmptyString(); // definition more than once or not first line, ignore line
}
- else
+ break;
+ case 3:
+ if ( !bPrjDep )
{
- ByteString sMode;
- BOOL bHasModes = FALSE;
- if (aItem.Search(":") != STRING_NOTFOUND)
+ aWhat = sToken;
+ if ( aWhat == "-" )
{
- sMode = aItem.GetToken ( 0, ':');
- aItem = aItem.GetToken ( 1, ':');
- bHasModes = TRUE;
+ aCommandPara = ByteString();
+ }
+ else
+ aCommandPara = aWhat;
+ }
+ break;
+ case 4:
+ if ( !bPrjDep )
+ {
+ aWhatOS = sToken;
+ if ( aWhatOS.GetTokenCount( ',' ) > 1 ) {
+ sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 );
+ aWhatOS = aWhatOS.GetToken( 0, ',' );
}
+ nOSType = GetOSType (aWhatOS);
+ }
+ break;
+ case 5:
+ if ( !bPrjDep )
+ {
+ if (bExtendAlias)
+ aLogFileName = (ByteString(aProjectName).Append("_")).Append(sToken);
+ else
+ aLogFileName = sToken;
- if ( HasProject( aProjectName ))
+ }
+ break;
+ default:
+ if ( !bPrjDep )
+ {
+ ByteString aItem = sToken;
+ if ( aItem == "NULL" )
{
- pPrj = GetPrj( aProjectName );
- // Projekt exist. schon, neue Eintraege anhaengen
+ // Liste zu Ende
+ i = -1;
}
else
{
- // neues Project anlegen
- pPrj = new Prj ( aProjectName );
- pPrj->SetPreFix( aPrefix );
- Insert(pPrj,LIST_APPEND);
+ // ggfs. Dependency liste anlegen und ergaenzen
+ if ( !pDepList )
+ pDepList = new SByteStringList;
+ ByteString* pStr;
+ if (bExtendAlias)
+ pStr = new ByteString ((ByteString (aProjectName).Append("_")).Append(aItem));
+ else
+ pStr = new ByteString (aItem);
+ pDepList->PutString( pStr );
+ }
+ }
+ else
+ {
+ ByteString aItem = sToken;
+ if ( aItem == "NULL" )
+ {
+ // Liste zu Ende
+ i = -1;
+ bPrjDep= FALSE;
}
- if (bHasModes)
- pPrj->AddDependencies( aItem, sMode );
else
- pPrj->AddDependencies( aItem );
- pPrj->HasHardDependencies( bHardDep );
- pPrj->HasFixedDependencies( bFixedDep );
-
-/*
- if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) {
- String sItem( aItem, RTL_TEXTENCODING_ASCII_US );
- InsertSolarList( sItem );
+ {
+ ByteString sMode;
+ BOOL bHasModes = FALSE;
+ if (aItem.Search(":") != STRING_NOTFOUND)
+ {
+ sMode = aItem.GetToken ( 0, ':');
+ aItem = aItem.GetToken ( 1, ':');
+ bHasModes = TRUE;
+ }
+ if (!pPrj)
+ {
+ // neues Project anlegen
+ pPrj = new Prj ( aProjectName );
+ pPrj->SetPreFix( aPrefix );
+ bNewProject = TRUE;
+ }
+ if (bHasModes)
+ pPrj->AddDependencies( aItem, sMode );
+ else
+ pPrj->AddDependencies( aItem );
+ pPrj->HasHardDependencies( bHardDep );
+ pPrj->HasFixedDependencies( bFixedDep );
}
- */
}
- }
- break;
+ break;
+ }
+ if ( i == -1 )
+ break;
+ i++;
}
/* Wenn dieses Project noch nicht vertreten ist, in die Liste
der Solar-Projekte einfuegen */
if ( i == -1 )
{
- if ( HasProject( aProjectName ))
- {
- pPrj = GetPrj( aProjectName );
- // Projekt exist. schon, neue Eintraege anhaengen
- }
- else
+ if (!pPrj)
{
// neues Project anlegen
pPrj = new Prj ( aProjectName );
pPrj->SetPreFix( aPrefix );
- Insert(pPrj,LIST_APPEND);
+ bNewProject = TRUE;
}
+ if (bNewProject)
+ Insert(pPrj,LIST_APPEND);
+
pCmdData = new CommandData;
pCmdData->SetPath( aDirName );
pCmdData->SetCommandType( nCommandType );
pCmdData->SetCommandPara( aCommandPara );
pCmdData->SetOSType( nOSType );
pCmdData->SetLogFile( aLogFileName );
+ pCmdData->SetComment( aCommentString );
pCmdData->SetClientRestriction( sClientRestriction );
- if ( pStaticDepList )
- pCmdData->SetDependencies( pStaticDepList );
+ if ( pDepList )
+ pCmdData->SetDependencies( pDepList );
- pStaticDepList = 0;
+ pDepList = 0;
pPrj->Insert ( pCmdData, LIST_APPEND );
- aDirName ="";
- aWhat ="";
- aWhatOS = "";
- sClientRestriction = "";
- aLogFileName = "";
- nCommandType = 0;
- nOSType = 0;
- }
- i++;
- // und wer raeumt die depLst wieder ab ?
- // CommandData macht das
+ // und wer raeumt die depLst wieder ab ?
+ // CommandData macht das
+ }
+ else
+ {
+ if (!pPrj)
+ {
+ // new project to set the error flag
+ pPrj = new Prj ( rProjectName );
+ pPrj->SetPreFix( aPrefix );
+ bNewProject = TRUE;
+ }
+ if (pPrj)
+ {
+ pPrj->SetError();
+ if (bNewProject)
+ Insert(pPrj,LIST_APPEND); // add project even if there is a buildlist error
+ }
+ if ( pDepList )
+ delete pDepList;
+ }
+ *ppPrj = pPrj;
}
/*****************************************************************************/
@@ -2572,19 +2596,7 @@ USHORT StarWriter::Read( String aFileName, BOOL bReadComments, USHORT nMode )
while( aFileList.Count()) {
String ssFileName = *aFileList.GetObject(( ULONG ) 0 );
- ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US);
- StarFile *pFile = new StarFile( ssFileName );
- if ( pFile->Exists()) {
-// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT)))
-// {
-// ReadXmlBuildList(sFileName_l);
-// } else {
- SimpleConfig aSolarConfig( ssFileName );
- while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" )
- InsertTokenLine ( aString );
- }
-// }
-
+ StarFile* pFile = ReadBuildlist (ssFileName, bReadComments, FALSE);
aMutex.acquire();
aLoadedFilesList.Insert( pFile, LIST_APPEND );
aMutex.release();
@@ -2608,21 +2620,7 @@ USHORT StarWriter::Read( SolarFileList *pSolarFiles, BOOL bReadComments )
while( pSolarFiles->Count()) {
ByteString aString;
String ssFileName = *pSolarFiles->GetObject(( ULONG ) 0 );
- ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US);
- StarFile *pFile = new StarFile( ssFileName);
- if ( pFile->Exists()) {
-// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT)))
-// {
-// ReadXmlBuildList(sFileName_l);
-// }
-// else
-// {
- SimpleConfig aSolarConfig( ssFileName );
- while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" )
- InsertTokenLine ( aString );
-// }
- }
-
+ StarFile* pFile = ReadBuildlist(ssFileName, bReadComments, FALSE);
aMutex.acquire();
aLoadedFilesList.Insert( pFile, LIST_APPEND );
aMutex.release();
@@ -2803,217 +2801,12 @@ USHORT StarWriter::WriteMultiple( String rSourceRoot )
}
/*****************************************************************************/
-void StarWriter::InsertTokenLine ( ByteString& rString )
+void StarWriter::InsertTokenLine ( const ByteString& rTokenLine )
/*****************************************************************************/
{
- int i = 0;
- ByteString aWhat, aWhatOS,
- sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara;
- static ByteString aDirName;
- BOOL bPrjDep = FALSE;
- BOOL bHardDep = FALSE;
- BOOL bFixedDep = FALSE;
- int nCommandType=0, nOSType=0;
- CommandData* pCmdData;
- SByteStringList *pDepList2 = NULL;
- Prj* pPrj;
-
- ByteString aEmptyString;
- ByteString aToken = rString.GetToken( 0, '\t' );
- ByteString aCommentString;
-
- const char* yytext = aToken.GetBuffer();
-
- while ( !( aToken == aEmptyString ) )
- {
- switch (i)
- {
- case 0:
- if ( rString.Search( "#" ) == 0 )
- {
- i = -1;
- aCommentString = rString;
- rString = aEmptyString;
- if ( Count() == 0 )
- aDirName = "null_entry" ; //comments at begin of file
- break;
- }
- aPrefix = yytext;
- pDepList2 = NULL;
- break;
- case 1:
- aDirName = yytext;
- break;
- case 2:
- if ( !strcmp( yytext, ":" ))
- {
- bPrjDep = TRUE;
- bHardDep = FALSE;
- bFixedDep = FALSE;
- i = 9;
- }
- else if ( !strcmp( yytext, "::" ))
- {
- bPrjDep = TRUE;
- bHardDep = TRUE;
- bFixedDep = FALSE;
- i = 9;
- }
- else if ( !strcmp( yytext, ":::" ))
- {
- bPrjDep = TRUE;
- bHardDep = TRUE;
- bFixedDep = TRUE;
- i = 9;
- }
- else
- {
- bPrjDep = FALSE;
- bHardDep = FALSE;
- bFixedDep = FALSE;
-
- aWhat = yytext;
- nCommandType = GetJobType(aWhat);
- }
- break;
- case 3:
- if ( !bPrjDep )
- {
- aWhat = yytext;
- if ( aWhat == "-" )
- {
- aCommandPara = ByteString();
- }
- else
- aCommandPara = aWhat;
- }
- break;
- case 4:
- if ( !bPrjDep )
- {
- aWhatOS = yytext;
- if ( aWhatOS.GetTokenCount( ',' ) > 1 ) {
- sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 );
- aWhatOS = aWhatOS.GetToken( 0, ',' );
- }
- nOSType = GetOSType (aWhatOS);
- }
- break;
- case 5:
- if ( !bPrjDep )
- {
- aLogFileName = yytext;
- }
- break;
- default:
- if ( !bPrjDep )
- {
- ByteString aItem = yytext;
- if ( aItem == "NULL" )
- {
- // Liste zu Ende
- i = -1;
- }
- else
- {
- // ggfs. Dependency liste anlegen und ergaenzen
- if ( !pDepList2 )
- pDepList2 = new SByteStringList;
- pDepList2->PutString( new ByteString( aItem ));
- }
- }
- else
- {
- ByteString aItem = yytext;
- if ( aItem == "NULL" )
- {
- // Liste zu Ende
- i = -1;
- bPrjDep= FALSE;
- }
- else
- {
- ByteString sMode;
- BOOL bHasModes = FALSE;
- if (aItem.Search(":") != STRING_NOTFOUND)
- {
- sMode = aItem.GetToken ( 0, ':');
- aItem = aItem.GetToken ( 1, ':');
- bHasModes = TRUE;
- }
-
- aProjectName = aDirName.GetToken ( 0, 0x5c);
- if ( HasProject( aProjectName ))
- {
- pPrj = GetPrj( aProjectName );
- // Projekt exist. schon, neue Eintraege anhaengen
- }
- else
- {
- // neues Project anlegen
- pPrj = new Prj ( aProjectName );
- pPrj->SetPreFix( aPrefix );
- Insert(pPrj,LIST_APPEND);
- }
- if (bHasModes)
- pPrj->AddDependencies( aItem, sMode );
- else
- pPrj->AddDependencies( aItem );
- pPrj->HasHardDependencies( bHardDep );
- pPrj->HasFixedDependencies( bFixedDep );
-
- /*
- if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) {
- String sItem( aItem, RTL_TEXTENCODING_ASCII_US );
- InsertSolarList( sItem );
- }
- */
- }
-
- }
- break;
- }
- /* Wenn dieses Project noch nicht vertreten ist, in die Liste
- der Solar-Projekte einfuegen */
- if ( i == -1 )
- {
- aProjectName = aDirName.GetToken ( 0, 0x5c);
- if ( HasProject( aProjectName ))
- {
- pPrj = GetPrj( aProjectName );
- // Projekt exist. schon, neue Eintraege anhaengen
- }
- else
- {
- // neues Project anlegen
- pPrj = new Prj ( aProjectName );
- pPrj->SetPreFix( aPrefix );
- Insert(pPrj,LIST_APPEND);
- }
-
- pCmdData = new CommandData;
- pCmdData->SetPath( aDirName );
- pCmdData->SetCommandType( nCommandType );
- pCmdData->SetCommandPara( aCommandPara );
- pCmdData->SetOSType( nOSType );
- pCmdData->SetLogFile( aLogFileName );
- pCmdData->SetComment( aCommentString );
- pCmdData->SetClientRestriction( sClientRestriction );
- if ( pDepList2 )
- pCmdData->SetDependencies( pDepList2 );
-
- pPrj->Insert ( pCmdData, LIST_APPEND );
-
- }
- i++;
-
- rString.Erase(0, aToken.Len()+1);
- aToken = rString.GetToken( 0, '\t' );
- yytext = aToken.GetBuffer();
-
- }
- // und wer raeumt die depLst wieder ab ?
- // macht CommandData selber
+ ByteString sProjectName = rTokenLine.GetToken(1,'\t');
+ Prj* pPrj = GetPrj (sProjectName); // 0, if Prj not found;
+ Star::InsertTokenLine ( rTokenLine, &pPrj, sProjectName, sal_False );
}
/*****************************************************************************/
diff --git a/soldep/inc/soldep/prj.hxx b/soldep/inc/soldep/prj.hxx
index b04d6ac1fe4e..53feb3c03cf5 100644
--- a/soldep/inc/soldep/prj.hxx
+++ b/soldep/inc/soldep/prj.hxx
@@ -287,6 +287,7 @@ private:
SDepInfoList* RemoveDepInfoList(SDepInfoList* pInfoList );
PrjList* pTempCommandDataList;
BOOL bTempCommandDataListPermanent;
+ BOOL bError;
public:
Prj();
Prj( ByteString aName );
@@ -329,6 +330,9 @@ public:
void SetTempCommandDataListPermanent (BOOL bVar = TRUE) {bTempCommandDataListPermanent = bVar;}
BOOL IsTempCommandDataListPermanent() {return bTempCommandDataListPermanent;}
+ void SetError (BOOL bVar = TRUE) {bError = bVar;}
+ BOOL HasError () {return bError;}
+
Prj& operator<< ( SvStream& rStream );
Prj& operator>> ( SvStream& rStream );
};
@@ -396,6 +400,7 @@ protected:
void Expand_Impl();
void ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj );
ULONG SearchFileEntry( StarFileList *pStarFiles, StarFile* pFile );
+ void InsertTokenLine (const ByteString& rToken, Prj** ppPrj, const ByteString& rProjectName, const sal_Bool bExtendAlias = sal_True);
public:
Star();
@@ -421,7 +426,7 @@ public:
BOOL RemovePrj ( Prj* pPrj );
void RemoveAllPrj ();
- void InsertToken( char *pChar );
+ StarFile* ReadBuildlist (const String& rFilename, BOOL bReadComments = FALSE, BOOL bExtendAlias = TRUE);
BOOL NeedsUpdate();
SolarFileList* NeedsFilesForUpdate();
void ReplaceFileEntry( StarFileList *pStarFiles, StarFile* pFile );
@@ -472,7 +477,7 @@ public:
USHORT Write( String aFileName );
USHORT WriteMultiple( String rSourceRoot );
- void InsertTokenLine( ByteString& rString );
+ void InsertTokenLine ( const ByteString& rTokenLine );
};
#endif
diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl
index 442dcba26946..66afeec6e2c7 100755
--- a/solenv/bin/build.pl
+++ b/solenv/bin/build.pl
@@ -2205,7 +2205,6 @@ sub is_output_tree {
};
return '';
};
-
sub get_tmp_dir {
my $tmp_dir;
if( defined($ENV{TMPDIR}) ) {
@@ -2222,7 +2221,6 @@ sub get_tmp_dir {
return $tmp_dir;
};
-
sub retrieve_build_list {
my $module = shift;
my $old_fh = select(STDOUT);
diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm
index ecda4f9a4e0b..cee8b1e0cfe8 100644
--- a/solenv/bin/modules/installer/scriptitems.pm
+++ b/solenv/bin/modules/installer/scriptitems.pm
@@ -1880,7 +1880,7 @@ sub remove_Languagepacklibraries_from_Installset
}
$infoline = "\n";
- push( @installer::globals::globallogfileinfo, $infoline);
+ push( @installer::globals::logfileinfo, $infoline);
return \@newitemsarray;
}
diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm
index 08f6eacf9e24..314bcef64ee2 100644
--- a/solenv/bin/modules/installer/simplepackage.pm
+++ b/solenv/bin/modules/installer/simplepackage.pm
@@ -148,12 +148,15 @@ sub register_extensions
}
close (UNOPKG);
- for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { push( @installer::globals::logfileinfo, "$unopkgoutput[$j]"); }
-
my $returnvalue = $?; # $? contains the return value of the systemcall
if ($returnvalue)
{
+ # Writing content of @unopkgoutput only in the error case into the log file. Sometimes it
+ # contains strings like "Error" even in the case of success. This causes a packaging error
+ # when the log file is analyzed at the end, even if there is no real error.
+ for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { push( @installer::globals::logfileinfo, "$unopkgoutput[$j]"); }
+
$infoline = "ERROR: Could not execute \"$systemcall\"!\nExitcode: '$returnvalue'\n";
push( @installer::globals::logfileinfo, $infoline);
installer::exiter::exit_program("ERROR: $systemcall failed!", "register_extensions");
diff --git a/solenv/config/sdev300.ini b/solenv/config/sdev300.ini
index d4a90f7d1d3c..65ae9636846a 100644
--- a/solenv/config/sdev300.ini
+++ b/solenv/config/sdev300.ini
@@ -563,7 +563,7 @@ unxlngi6
COPY_PACKED TRUE
DEVROOT %SOL_TMP%$/r
PCLEAN_PATH %SOLARROOT%/etools
- PERL %SOL_TMP%$/r$/bt_linux_libc2.32$/%WORK_STAMP%$/bin$/perl
+ PERL %SOL_TMP%$/r$/bt_linux_libc2.5$/%WORK_STAMP%$/bin$/perl
SOLARENV %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv
SOLARROOT %SOL_TMP%$/r
SOLARVER %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%/%WORK_STAMP%
@@ -575,7 +575,7 @@ unxlngi6
COPYALL FALSE
DEVROOT %SOL_TMP%$/r
PCLEAN_PATH %SOL_TMP%$/r/etools
- PERL %SOL_TMP%$/r$/bt_linux_libc2.32$/%WORK_STAMP%$/bin$/perl
+ PERL %SOL_TMP%$/r$/bt_linux_libc2.5$/%WORK_STAMP%$/bin$/perl
SOLARENV %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%$/%WORK_STAMP%$/ooo%UPDMINOREXT%$/solenv
SOLARROOT %SOL_TMP%$/r
SOLARVER %SOL_TMP%$/o%CWS_WORK_STAMP_EXT%/%WORK_STAMP%
@@ -610,14 +610,14 @@ unxlngi6
{
SOLAR_ENV_ROOT /so/env
SOLAR_SOURCE_ROOT %DRIVE_O%
- SOLAR_SYSBASE_ROOT /so/env/gcc_4.2.3_linux_libc2.32/glibc2.3.2
+ SOLAR_SYSBASE_ROOT /so/env/gcc_4.2.3_linux_libc2.5/glibc2.5
}
common1
{
- COMPATH %SOLAR_ENV_ROOT%$/gcc_4.2.3_linux_libc2.32
+ COMPATH %SOLAR_ENV_ROOT%$/gcc_4.2.3_linux_libc2.5
DEVROOT %SOLAR_ENV_ROOT%
LFS_CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
- PERL %SOLAR_ENV_ROOT%/bt_linux_libc2.32/%WORK_STAMP%/bin/perl
+ PERL %SOLAR_ENV_ROOT%/bt_linux_libc2.5/%WORK_STAMP%/bin/perl
PKGFORMAT rpm
SHARED_SOLARENV %SOLAR_SOURCE_ROOT%/%WORK_STAMP%/ooo%UPDMINOREXT%/solenv
SHARED_SOLARVERSION %SOLAR_SOURCE_ROOT%/%WORK_STAMP%
@@ -635,7 +635,7 @@ unxlngi6
common2
{
ENABLE_GRAPHITE TRUE
- BUILD_TOOLS %SOLARROOT%/bt_linux_libc2.32/%WORK_STAMP%/bin
+ BUILD_TOOLS %SOLARROOT%/bt_linux_libc2.5/%WORK_STAMP%/bin
COM GCC
COMMON_BUILD_TOOLS %SOLARROOT%$/btools
COMMON_ENV_TOOLS %SOLARROOT%$/etools
@@ -645,7 +645,7 @@ unxlngi6
ENABLE_KAB TRUE
ENABLE_KDE TRUE
ENABLE_EVOAB2 TRUE
- ENV_TOOLS %SOLARROOT%/et_linux_libc2.32/%WORK_STAMP%/bin
+ ENV_TOOLS %SOLARROOT%/et_linux_libc2.5/%WORK_STAMP%/bin
GUI UNX
GUIBASE unx
GVER VCL
diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk
index ec992a075900..a1d5c1fdcb5c 100644
--- a/solenv/inc/minor.mk
+++ b/solenv/inc/minor.mk
@@ -1,5 +1,5 @@
RSCVERSION=300
-RSCREVISION=300m78(Build:9501)
-BUILD=9501
-LAST_MINOR=m78
+RSCREVISION=300m79(Build:9504)
+BUILD=9504
+LAST_MINOR=m79
SOURCEVERSION=DEV300
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index 68686ff8c8f5..1780e45c5ed6 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -199,9 +199,9 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, ::
uno::Reference< container::XNameAccess > xSubNameAccess;
uno::Any aAny = xNameAccess->getByName( aElements[nInd] );
if ( aAny >>= xInputStream )
- InsertInputStreamToStorage_Impl( pNewStorage, aName, xInputStream );
+ InsertInputStreamToStorage_Impl( pNewStorage, aElements[nInd], xInputStream );
else if ( aAny >>= xSubNameAccess )
- InsertNameAccessToStorage_Impl( pNewStorage, aName, xSubNameAccess );
+ InsertNameAccessToStorage_Impl( pNewStorage, aElements[nInd], xSubNameAccess );
}
}
catch( uno::Exception& )
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx
index b08a7f04f1da..7098d2b0d4ef 100644..100755
--- a/svtools/inc/svtools/accessibletable.hxx
+++ b/svtools/inc/svtools/accessibletable.hxx
@@ -94,9 +94,8 @@ public:
virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0;
/** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
- the accessible object), depending on the specified object type. */
- virtual void FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet,
AccessibleTableControlObjType eObjType ) const= 0;
// Window
@@ -122,8 +121,10 @@ public:
virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0;
virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
- virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
+ virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
virtual std::vector<sal_Int32>& GetSelectedRows() = 0;
+ virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0;
+ virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx
index 8e92abc6c04c..2b3951f6aaf3 100644
--- a/svtools/inc/svtools/table/abstracttablecontrol.hxx
+++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx
@@ -30,6 +30,7 @@
#include <sal/types.h>
#include <vcl/event.hxx>
#include <vcl/seleng.hxx>
+#include "tabletypes.hxx"
//........................................................................
namespace svt { namespace table
{
@@ -112,14 +113,15 @@ namespace svt { namespace table
@see TableControlAction
*/
virtual bool dispatchAction( TableControlAction _eAction ) = 0;
- /** to be called on mouse button up/down
- @return
- <TRUE/> if the click was in the visible area of the table control,
- <FALSE/> otherwise.*/
- virtual bool isClickInVisibleArea( const Point& _rPoint ) = 0;
- /** returns selection engine*/
- virtual SelectionEngine* getSelEngine() = 0;
- virtual void setCursorAtCurrentCell(const Point& rPoint) = 0;
+ /** returns selection engine*/
+ virtual SelectionEngine* getSelEngine() = 0;
+ virtual void setCursorAtCurrentCell(const Point& rPoint) = 0;
+ virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0;
+ virtual RowPos getCurrentRow(const Point& rPoint ) = 0;
+ virtual void resizeColumn(const Point& rPoint ) = 0;
+ virtual bool startResizeColumn(const Point& rPoint) = 0;
+ virtual bool endResizeColumn(const Point& rPoint) = 0;
+ virtual bool isRowSelected(RowPos _nRow) = 0;
virtual ~IAbstractTableControl() {};
};
diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx
index b9e2db31ca01..ca760896d539 100644
--- a/svtools/inc/svtools/table/defaultinputhandler.hxx
+++ b/svtools/inc/svtools/table/defaultinputhandler.hxx
@@ -44,6 +44,7 @@ namespace svt { namespace table
friend class TableDataWindow;
private:
DefaultInputHandler_Impl* m_pImpl;
+ bool m_bResize;
public:
DefaultInputHandler();
diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx
index 13d44617d523..e474306c0423 100644
--- a/svtools/inc/svtools/table/gridtablerenderer.hxx
+++ b/svtools/inc/svtools/table/gridtablerenderer.hxx
@@ -90,10 +90,14 @@ namespace svt { namespace table
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle, rtl::OUString& _rText );
- virtual void PaintCell( ColPos _nColumn,
+ virtual void PaintCellImage( ColPos _nColumn,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText );
+ const StyleSettings& _rStyle, Image* _pCellData );
+ virtual void PaintCellString( ColPos _nColumn,
+ bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle, rtl::OUString& _rText );
virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect);
virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect);
};
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index c1381e3b3c0b..313b2b7b7735 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -27,12 +27,14 @@
#ifndef SVTOOLS_INC_TABLE_TABLECONTROL_HXX
#define SVTOOLS_INC_TABLE_TABLECONTROL_HXX
+#include "svtools/svtdllapi.h"
#include <svtools/table/tablemodel.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/seleng.hxx>
#include <svtools/table/tabledatawindow.hxx>
#include <svtools/accessibletable.hxx>
-#include "svtaccessiblefactory.hxx"
+#include <com/sun/star/util/Color.hpp>
+#include <svtools/accessiblefactory.hxx>
//........................................................................
namespace svt { namespace table
@@ -64,13 +66,19 @@ namespace svt { namespace table
// TODO: scrolling?
*/
- class TableControl : public Control, public IAccessibleTable
+ class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable
{
private:
- DECL_LINK( ImplMouseButtonDownHdl, MouseEvent* );
- DECL_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
TableControl_Impl* m_pImpl;
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText;
+ Link m_aSelectHdl;
+ bool m_bSelectionChanged;
public:
::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable;
@@ -78,7 +86,7 @@ namespace svt { namespace table
~TableControl();
/// sets a new table model
- void SetModel( PTableModel _pModel );
+ SVT_DLLPRIVATE void SetModel( PTableModel _pModel );
/// retrieves the current table model
PTableModel GetModel() const;
@@ -148,65 +156,72 @@ namespace svt { namespace table
{
return GoTo( GetCurrentColumn(), _nRow );
}
- virtual void Resize();
+ SVT_DLLPRIVATE virtual void Resize();
+ virtual void Select();
+ SVT_DLLPRIVATE void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return m_aSelectHdl; }
- /**invalidates the table if table has been changed e.g. new row added
- */
- void InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved);
- /**gets the vector, which contains the selected rows
- */
- std::vector<sal_Int32>& GetSelectedRows();
- /**after removing a row, updates the vector which contains the selected rows
- if the row, which should be removed, is selected, it will be erased from the vector
- */
- void removeSelectedRow(RowPos _nRowPos);
- SelectionEngine* getSelEngine();
- TableDataWindow* getDataWindow();
+ /**invalidates the table if table has been changed e.g. new row added
+ */
+ void InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved);
+ /**gets the vector, which contains the selected rows
+ */
+ std::vector<sal_Int32>& GetSelectedRows();
+ /**after removing a row, updates the vector which contains the selected rows
+ if the row, which should be removed, is selected, it will be erased from the vector
+ */
+ SelectionEngine* getSelEngine();
+ TableDataWindow* getDataWindow();
// Window overridables
virtual void GetFocus();
virtual void LoseFocus();
virtual void KeyInput( const KeyEvent& rKEvt );
- //virtual long Notify(NotifyEvent& rNEvt);
-
- /** Creates and returns the accessible object of the whole BrowseBox. */
- virtual XACC CreateAccessible();
- virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
- virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
- virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
- virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
- virtual void FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
- AccessibleTableControlObjType eObjType ) const;
-
- //// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
- virtual void GrabFocus();
- virtual XACC GetAccessible( BOOL bCreate = TRUE );
- virtual Window* GetAccessibleParentWindow() const;
- virtual Window* GetWindowInstance();
- virtual sal_Int32 GetAccessibleControlCount() const;
- virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
- virtual long GetRowCount() const;
- virtual long GetColumnCount() const;
- virtual sal_Bool HasRowHeader() const;
- virtual sal_Int32 GetSelectedRowCount() const;
- virtual bool IsRowSelected( long _nRow ) const;
- virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
- virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE );
- virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE );
- virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
- virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
- virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
- virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const;
- virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const;
- virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
- virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const;
- virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
- virtual sal_Bool HasRowHeader();
- virtual sal_Bool HasColHeader();
- virtual sal_Bool isAccessibleAlive( ) const;
- virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue );
+ //virtual long Notify(NotifyEvent& rNEvt);
+
+ /** Creates and returns the accessible object of the whole GridControl. */
+ SVT_DLLPRIVATE virtual XACC CreateAccessible();
+ SVT_DLLPRIVATE virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
+ SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
+ SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
+ SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
+ virtual void FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const;
+ //// Window
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual void GrabFocus();
+ virtual XACC GetAccessible( BOOL bCreate = TRUE );
+ virtual Window* GetAccessibleParentWindow() const;
+ virtual Window* GetWindowInstance();
+ virtual sal_Int32 GetAccessibleControlCount() const;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
+ virtual long GetRowCount() const;
+ virtual long GetColumnCount() const;
+ virtual sal_Bool HasRowHeader() const;
+ virtual sal_Int32 GetSelectedRowCount() const;
+ virtual bool IsRowSelected( long _nRow ) const;
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE );
+ virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE );
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const;
+ virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const;
+ virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const;
+ virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
+ virtual sal_Bool HasRowHeader();
+ virtual sal_Bool HasColHeader();
+ virtual sal_Bool isAccessibleAlive( ) const;
+ virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue );
+ virtual void RemoveSelectedRow(RowPos _nRowPos);
+ virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos);
+ ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip();
+ void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols);
+ void selectionChanged(bool _bChanged);
protected:
@@ -219,27 +234,6 @@ namespace svt { namespace table
TableControl& operator=( const TableControl& ); // never implemented
};
- class AccessibleTableControl_Impl
- {
- public:
- AccessibleFactoryAccess m_aFactoryAccess;
- IAccessibleTableControl* m_pAccessible;
-
- public:
- AccessibleTableControl_Impl() : m_pAccessible(NULL)
- {
- }
-
-
- /// @see AccessibleTableControl::getTableRowHeader
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- getAccessibleTableHeader( AccessibleTableControlObjType _eObjType );
- /// @see AccessibleTableControl::getTable
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- getAccessibleTable( );
-
- };
-
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx
index d14a25289c99..c9f96483d943 100644
--- a/svtools/inc/svtools/table/tabledatawindow.hxx
+++ b/svtools/inc/svtools/table/tabledatawindow.hxx
@@ -53,21 +53,27 @@ namespace svt { namespace table
private:
TableControl_Impl& m_rTableControl;
Link m_aMouseButtonDownHdl;
- Link m_aMouseButtonUpHdl;
-
+ Link m_aMouseButtonUpHdl;
+ Link m_aSelectHdl;
+ RowPos m_nRowAlreadySelected;
public:
TableDataWindow( TableControl_Impl& _rTableControl );
inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; }
inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; }
inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; }
inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; }
+ inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
+ inline const Link& GetSelectHdl() const { return m_aSelectHdl; }
// Window overridables
virtual void Paint( const Rectangle& rRect );
virtual void MouseMove( const MouseEvent& rMEvt);
virtual void MouseButtonDown( const MouseEvent& rMEvt);
virtual void MouseButtonUp( const MouseEvent& rMEvt);
-
+ virtual void SetPointer( const Pointer& rPointer );
+ virtual void CaptureMouse();
+ virtual void ReleaseMouse();
+ virtual long Notify(NotifyEvent& rNEvt);
};
//........................................................................
} } // namespace svt::table
diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx
index 34a89cb03e6b..3da396d9d86c 100644
--- a/svtools/inc/svtools/table/tablemodel.hxx
+++ b/svtools/inc/svtools/table/tablemodel.hxx
@@ -27,13 +27,16 @@
#ifndef SVTOOLS_INC_TABLE_TABLEMODEL_HXX
#define SVTOOLS_INC_TABLE_TABLEMODEL_HXX
+#include "svtools/svtdllapi.h"
#include <svtools/table/tabletypes.hxx>
#include <svtools/table/tablerenderer.hxx>
#include <svtools/table/tableinputhandler.hxx>
-
+#include <rtl/ref.hxx>
#include <sal/types.h>
-
+#include <com/sun/star/util/Color.hpp>
#include <boost/shared_ptr.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
//........................................................................
namespace svt { namespace table
@@ -44,21 +47,16 @@ namespace svt { namespace table
//====================================================================
//= cell data
//====================================================================
- struct CellEntryType
+ struct TableContentType
{
- String m_aStr;
- //Image m_aImage;
- //Control m_aControl;
- CellEntryType( const String& _rStr ) :
- m_aStr( _rStr )
- {}
+ ::rtl::OUString sContent;
+ Image* pImage;
+ TableContentType() :
+ sContent(),
+ pImage( )
+ {
+ }
};
-
- //typedef ::std::vector<CellEntryType*> CellColumnContent;
- //vector, which contains text data for each cell
- typedef ::std::vector<String> CellColumnContent;
- //vector, which contains data for rows
- typedef ::std::vector<CellColumnContent> CellContent;
//====================================================================
//= ScrollbarVisibility
//====================================================================
@@ -285,7 +283,24 @@ namespace svt { namespace table
*/
virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0;
+ /** returns the preferred width of the column, or 0 if the column
+ does not have a preferred width.
+
+ @see setMaxWidth
+ @see getMinWidth
+ @see getWidth
+ */
+ virtual TableMetrics getPreferredWidth() const = 0;
+ /** sets the preferred width of the column, to be used when user resizes column
+
+ @see getMaxWidth
+ @see setMinWidth
+ @see setWidth
+ */
+ virtual void setPreferredWidth( TableMetrics _nPrefWidth ) = 0;
+ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0;
+ virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0;
/// deletes the column model instance
virtual ~IColumnModel() { }
};
@@ -296,7 +311,7 @@ namespace svt { namespace table
//====================================================================
/** declares the interface to implement by an abtract table model
*/
- class SAL_NO_VTABLE ITableModel
+ class SAL_NO_VTABLE SVT_DLLPUBLIC ITableModel
{
public:
/** returns the number of columns in the table
@@ -307,8 +322,8 @@ namespace svt { namespace table
*/
virtual TableSize getRowCount() const = 0;
- virtual void setColumnCount(TableSize _nColCount) = 0;
- virtual void setRowCount(TableSize _nRowCount) = 0;
+ SVT_DLLPRIVATE virtual void setColumnCount(TableSize _nColCount) = 0;
+ SVT_DLLPRIVATE virtual void setRowCount(TableSize _nRowCount) = 0;
/** determines whether the table has column headers
@@ -321,12 +336,12 @@ namespace svt { namespace table
/** sets whether the table should have row headers
@see IColumnRenderer
*/
- virtual void setRowHeaders( bool rowHeaders) = 0;
+ SVT_DLLPRIVATE virtual void setRowHeaders( bool rowHeaders) = 0;
/** sets whether the table should have column headers
@see IColumnRenderer
*/
- virtual void setColumnHeaders( bool columnHeaders) = 0;
+ SVT_DLLPRIVATE virtual void setColumnHeaders( bool columnHeaders) = 0;
/** determines whether the table has row headers
@@ -346,11 +361,11 @@ namespace svt { namespace table
/** adds the given listener to the list of ->ITableModelListener's
*/
- virtual void addTableModelListener( const PTableModelListener& listener ) = 0;
+ SVT_DLLPRIVATE virtual void addTableModelListener( const PTableModelListener& listener ) = 0;
/** revokes the given listener from the list of ->ITableModelListener's
*/
- virtual void removeTableModelListener( const PTableModelListener& listener ) = 0;
+ SVT_DLLPRIVATE virtual void removeTableModelListener( const PTableModelListener& listener ) = 0;
/** returns a model for a certain column
@@ -380,7 +395,7 @@ namespace svt { namespace table
@return the renderer to use. Must not be <NULL/>
*/
- virtual PTableRenderer getRenderer() const = 0;
+ SVT_DLLPRIVATE virtual PTableRenderer getRenderer() const = 0;
/** returns the component handling input in a view associated with the model
*/
@@ -392,9 +407,9 @@ namespace svt { namespace table
the logical height of rows in the table, in 1/100 millimeters. The height must be
greater 0.
*/
- virtual TableMetrics getRowHeight() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getRowHeight() const = 0;
- virtual void setRowHeight(TableMetrics _nRowHeight) = 0;
+ SVT_DLLPRIVATE virtual void setRowHeight(TableMetrics _nRowHeight) = 0;
/** determines the height of the column header row
@@ -405,7 +420,7 @@ namespace svt { namespace table
the logical height of the column header row, in 1/100 millimeters.
Must be greater than 0.
*/
- virtual TableMetrics getColumnHeaderHeight() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getColumnHeaderHeight() const = 0;
/** determines the width of the row header column
@@ -416,7 +431,7 @@ namespace svt { namespace table
the logical width of the row header column, in 1/100 millimeters.
Must be greater than 0.
*/
- virtual TableMetrics getRowHeaderWidth() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getRowHeaderWidth() const = 0;
/** determines the visibility of the vertical scrollbar of the table control
@param overAllHeight the height of the table with all rows
@@ -429,19 +444,32 @@ namespace svt { namespace table
@param actWidth the given width of the table
*/
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0;
-
- /** fills cells with content
- */
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)=0;
- /** gets the content of the cells
- */
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent() = 0;
- /**sets title of header rows
- */
- virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)=0;
- /** gets title of header rows
- */
- virtual std::vector<rtl::OUString>& getRowHeaderName() = 0;
+ virtual bool hasVerticalScrollbar() =0;
+ virtual bool hasHorizontalScrollbar() = 0;
+ /** fills cells with content
+ */
+ virtual void setCellContent(const std::vector< std::vector< ::com::sun::star::uno::Any > >& cellContent)=0;
+ /** gets the content of the cells
+ */
+ virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0;
+ /**sets title of header rows
+ */
+ SVT_DLLPRIVATE virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)=0;
+ /** gets title of header rows
+ */
+ virtual std::vector<rtl::OUString>& getRowHeaderName() = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getLineColor() = 0;
+ SVT_DLLPRIVATE virtual void setLineColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0;
+ SVT_DLLPRIVATE virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getTextColor() = 0;
+ SVT_DLLPRIVATE virtual void setTextColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0;
+ SVT_DLLPRIVATE virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0;
+ SVT_DLLPRIVATE virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0;
+ SVT_DLLPRIVATE virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _xAlign) = 0;
/// destroys the table model instance
virtual ~ITableModel() { }
diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx
index cf8cd20680c2..f81771dd22e6 100644
--- a/svtools/inc/svtools/table/tablerenderer.hxx
+++ b/svtools/inc/svtools/table/tablerenderer.hxx
@@ -45,7 +45,7 @@ namespace svt { namespace table
*/
class SAL_NO_VTABLE ITableRenderer
{
- public:
+ public:
/** paints a (part of) header area
There are two header areas in a table control:
@@ -178,10 +178,9 @@ namespace svt { namespace table
@param _rText
the title of the header row
*/
- virtual void PaintRowHeader(
- bool _bActive, bool _bSelected,
+ virtual void PaintRowHeader( bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
/** paints a certain cell
@@ -208,13 +207,46 @@ namespace svt { namespace table
the are into which the cell should be painted
@param _rStyle
the style to be used for drawing
+ @param _pCellData
+ the content of the cell
+ */
+ virtual void PaintCellImage( ColPos _nColumn,
+ bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle, Image* _pCellData ) = 0;
+
+ /** paints a certain cell
+
+ The row to be painted is denoted by the most recent call to
+ ->PrepareRow.
+
+ @param _bSelected
+ <TRUE/> if and only if the cell to be painted is
+ selected currently. This is the case if either
+ the row or the column of the cell is currently selected.
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param _bActive
+ <TRUE/> if the cell is currently active.
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the cell should be painted
+ @param _rStyle
+ the style to be used for drawing
@param _rText
the content of the cell
*/
- virtual void PaintCell( ColPos _nColumn,
+ virtual void PaintCellString( ColPos _nColumn,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
/** draws a cell cursor in the given rectangle
diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx
index f423b64c2faa..645120e30d4b 100644
--- a/svtools/inc/svtools/table/tabletypes.hxx
+++ b/svtools/inc/svtools/table/tabletypes.hxx
@@ -56,17 +56,17 @@ namespace svt { namespace table
/** special column width value which indicates that the column should be
automatically resized to fit the view
*/
-#define COLWIDTH_FIT_TO_VIEW ((TableMetrics)-1)
+#define COLWIDTH_FIT_TO_VIEW ((::svt::table::TableMetrics)-1)
/// denotes the column containing the row headers
-#define COL_ROW_HEADERS ((ColPos)-1)
+#define COL_ROW_HEADERS ((::svt::table::ColPos)-1)
/// denotes the row containing the column headers
-#define ROW_COL_HEADERS ((RowPos)-1)
+#define ROW_COL_HEADERS ((::svt::table::RowPos)-1)
/// denotes an invalid column index
-#define COL_INVALID ((ColPos)-2)
+#define COL_INVALID ((::svt::table::ColPos)-2)
/// denotes an invalid row index
-#define ROW_INVALID ((RowPos)-2)
+#define ROW_INVALID ((::svt::table::RowPos)-2)
//........................................................................
diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst
index 0a3ccd8a9819..4a9e8314e0d8 100644
--- a/svtools/prj/d.lst
+++ b/svtools/prj/d.lst
@@ -1,6 +1,7 @@
mkdir: %COMMON_DEST%\bin%_EXT%\hid
mkdir: %COMMON_DEST%\res%_EXT%
mkdir: %_DEST%\inc%_EXT%\svtools
+mkdir: %_DEST%\inc%_EXT%\svtools\table
..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs
@@ -25,6 +26,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools
..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx
..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
+..\inc\svtools\table\*.hxx %_DEST%\inc%_EXT%\svtools\table\*.hxx
..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx
..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
diff --git a/svtools/source/inc/accessibletableimp.hxx b/svtools/source/inc/accessibletableimp.hxx
new file mode 100644
index 000000000000..3a01c01567d3
--- /dev/null
+++ b/svtools/source/inc/accessibletableimp.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ * 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 SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+#define SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+
+#include "svtaccessiblefactory.hxx"
+
+namespace svt { namespace table
+{
+//........................................................................
+
+
+ class AccessibleTableControl_Impl
+ {
+ public:
+ AccessibleFactoryAccess m_aFactoryAccess;
+ IAccessibleTableControl* m_pAccessible;
+
+ public:
+ AccessibleTableControl_Impl() : m_pAccessible(NULL)
+ {
+ }
+
+
+ /// @see AccessibleTableControl::getTableRowHeader
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleTableHeader( AccessibleTableControlObjType _eObjType );
+ /// @see AccessibleTableControl::getTable
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleTable( );
+
+ };
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx
index b11357db95d1..ad8f7a7562d3 100644
--- a/svtools/source/table/defaultinputhandler.cxx
+++ b/svtools/source/table/defaultinputhandler.cxx
@@ -50,6 +50,7 @@ namespace svt { namespace table
//--------------------------------------------------------------------
DefaultInputHandler::DefaultInputHandler()
:m_pImpl( new DefaultInputHandler_Impl )
+ ,m_bResize(false)
{
}
@@ -62,8 +63,12 @@ namespace svt { namespace table
//--------------------------------------------------------------------
bool DefaultInputHandler::MouseMove( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
{
- (void)_rControl;
- (void)_rMEvt;
+ Point aPoint = _rMEvt.GetPosPixel();
+ if(m_bResize)
+ {
+ _rControl.resizeColumn(aPoint);
+ return true;
+ }
return false;
}
@@ -72,41 +77,60 @@ namespace svt { namespace table
{
bool bHandled = false;
Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.isClickInVisibleArea(aPoint))
+ RowPos nRow = _rControl.getCurrentRow(aPoint);
+ if(nRow == -1)
+ {
+ m_bResize = _rControl.startResizeColumn(aPoint);
+ bHandled = true;
+ }
+ else if(nRow >= 0)
{
if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
{
- LoseFocus(_rControl);
_rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
{
- bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ if(!_rControl.isRowSelected(nRow))
+ bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ else
+ bHandled = true;
}
}
return bHandled;
}
-
//--------------------------------------------------------------------
bool DefaultInputHandler::MouseButtonUp( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
{
bool bHandled = false;
Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.isClickInVisibleArea(aPoint))
+ if(_rControl.getCurrentRow(aPoint) >= 0)
{
- if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
+ if(m_bResize)
+ {
+ m_bResize = _rControl.endResizeColumn(aPoint);
+ bHandled = true;
+ }
+ else if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
{
- GetFocus(_rControl);
- _rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
+ {
bHandled = _rControl.getSelEngine()->SelMouseButtonUp(_rMEvt);
+ }
+ }
+ else
+ {
+ if(m_bResize)
+ {
+ m_bResize = _rControl.endResizeColumn(aPoint);
+ bHandled = true;
+ }
}
return bHandled;
}
-
//--------------------------------------------------------------------
bool DefaultInputHandler::KeyInput( IAbstractTableControl& _rControl, const KeyEvent& rKEvt )
{
@@ -134,11 +158,11 @@ namespace svt { namespace table
{ KEY_PAGEDOWN, KEY_MOD1, cursorToLastLine },
{ KEY_HOME, KEY_MOD1, cursorTopLeft },
{ KEY_END, KEY_MOD1, cursorBottomRight },
- { KEY_SPACE, KEY_MOD1, cursorSelectRow },
- { KEY_UP, KEY_SHIFT, cursorSelectRowUp },
- { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown },
- { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom },
- { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop },
+ { KEY_SPACE, KEY_MOD1, cursorSelectRow },
+ { KEY_UP, KEY_SHIFT, cursorSelectRowUp },
+ { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown },
+ { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom },
+ { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop },
{ 0, 0, invalidTableControlAction }
};
@@ -205,7 +229,6 @@ namespace svt { namespace table
// TODO
return false;
}
-
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index ada2e463c8af..a3f954e0bef5 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -31,6 +31,7 @@
#include <tools/debug.hxx>
#include <vcl/window.hxx>
+#include <vcl/image.hxx>
//........................................................................
namespace svt { namespace table
@@ -78,15 +79,15 @@ namespace svt { namespace table
OSL_PRECOND( _bIsColHeaderArea || _bIsRowHeaderArea,
"GridTableRenderer::PaintHeaderArea: invalid area flags!" );
- // fill the rows with alternating background colors
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor();
- _rDevice.SetFillColor( _rStyle.GetDialogColor() );
+ _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
+ Color background = m_pImpl->rModel.getHeaderBackgroundColor();
+ if( background != 0xFFFFFF)
+ _rDevice.SetFillColor(background);
+ else
+ _rDevice.SetFillColor(_rStyle.GetDialogColor());
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawRect( _rArea );
-
// delimiter lines at bottom/right
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
@@ -99,31 +100,38 @@ namespace svt { namespace table
void GridTableRenderer::PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
- _rDevice.Push( PUSH_LINECOLOR );
-
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ _rDevice.Push( PUSH_LINECOLOR);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
String sHeaderText;
-
PColumnModel pColumn = m_pImpl->rModel.getColumnModel( _nCol );
DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
if ( !!pColumn )
sHeaderText = pColumn->getName();
- Color aRowBackground = _rStyle.GetFieldColor();
- if ( _bSelected )
- {
- aRowBackground = COL_BLUE;
- }
- _rDevice.DrawText( _rArea, sHeaderText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP );
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle aRect(_rArea);
+ aRect.Left()+=4; aRect.Right()-=4;
+ aRect.Bottom()-=2;
+ _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.Pop();
(void)_bActive;
// no special painting for the active column at the moment
- //(void)_bSelected;
- // TODO: selection not yet implemented
+ (void)_bSelected;
+ //selection for column header not yet implemented
}
//--------------------------------------------------------------------
@@ -133,86 +141,218 @@ namespace svt { namespace table
// remember the row for subsequent calls to the other ->ITableRenderer methods
m_pImpl->nCurrentRow = _nRow;
- // fill the rows with alternating background colors
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor();
-
- Color aRowBackground = _rStyle.GetFieldColor();
+ _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
+ Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ //if row is selected background color becomes blue, and lines should be also blue
+ //if they aren't user defined
+ if(_bSelected)
+ {
+ Color aSelected(_rStyle.GetHighlightColor());
+ aRowBackground = aSelected;
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //if row not selected, check the cases whether user defined backgrounds are set
+ //and set line color to be the same
+ else
+ {
+ if(aRowBackground2 != 0xFFFFFF && _nRow%2)
+ {
+ aRowBackground = aRowBackground2;
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //fill the rows with alternating background colors if second background color is specified
+ else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ {
+ //if Line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
+ }
+ }
_rDevice.SetFillColor( aRowBackground );
-
_rDevice.DrawRect( _rRowArea );
- // TODO: active? selected?
+ // TODO: active?
_rDevice.Pop();
- (void) _bSelected;
(void)_bActive;
-
- // no special painting for the active row at the moment
-
- //(void)_bSelected;
- // TODO: selection not yet implemented
}
//--------------------------------------------------------------------
void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle, rtl::OUString& _rText )
{
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
+ _rDevice.Push( PUSH_LINECOLOR);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
- _rDevice.DrawText( _rArea, _rText, TEXT_DRAW_LEFT);
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle aRect(_rArea);
+ aRect.Left()+=4; aRect.Right()-=4;
+ aRect.Bottom()-=2;
+ _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
// TODO: active? selected?
(void)_bActive;
(void)_bSelected;
-
+ //at the moment no special paint for selected row header
_rDevice.Pop();
}
//--------------------------------------------------------------------
- void GridTableRenderer::PaintCell( ColPos _nColumn, bool _bSelected, bool _bActive,
- OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText )
+ void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive,
+ OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData )
{
- _rDevice.Push( PUSH_LINECOLOR );
-
- // draw the grid
- _rDevice.SetLineColor( COL_LIGHTGRAY );
- // TODO: the LIGHTGRAY should probably be a property/setting
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
- _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
-
+ _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION);
+ _rDevice.IntersectClipRegion( _rArea );
+ Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ //if row is selected and line color isn't user specified, set it blue
+ if(_bSelected)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //else set line color to the color of row background
+ else
+ {
+ if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(background2);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(background1);
+ else
{
+ //if line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
+ }
+ }
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ {
// TODO: remove those temporary place holders
Rectangle aRect( _rArea );
++aRect.Left(); --aRect.Right();
- ++aRect.Top(); --aRect.Bottom();
+ aRect.Top(); aRect.Bottom();
+ Point imagePos(Point(aRect.Left(), aRect.Top()));
+ Size imageSize = _pCellData->GetSizePixel();
+ if(aRect.GetWidth() > imageSize.Width())
+ {
+ if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1)
+ imagePos.X() = aRect.Left()+((double)(aRect.GetWidth() - imageSize.Width()))/2;
+ else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2)
+ imagePos.X() = aRect.Right() - imageSize.Width();
+ }
+ else
+ imageSize.Width() = aRect.GetWidth();
+ if(aRect.GetHeight() > imageSize.Height())
+ {
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ imagePos.Y() = aRect.Top()+((double)(aRect.GetHeight() - imageSize.Height()))/2;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ imagePos.Y() = aRect.Bottom() - imageSize.Height();
+ }
+ else
+ imageSize.Height() = aRect.GetHeight()-1;
+ Image& image (*_pCellData);
+ _rDevice.DrawImage(imagePos, imageSize, image, 0);
+ }
+ _rDevice.Pop();
- String sText;
- if(_bSelected)
- {
- Color aRed(COL_BLUE);
- _rDevice.SetFillColor( aRed );
- _rDevice.SetTextColor(COL_WHITE);
- }
- _rDevice.DrawRect( _rArea );
- (void)_nColumn;
- _rDevice.DrawText( aRect, _rText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP);
+ (void)_bActive;
+ // no special painting for the active cell at the moment
+ }
+
+ //--------------------------------------------------------------------
+ void GridTableRenderer::PaintCellString( ColPos _nColumn, bool _bSelected, bool _bActive,
+ OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText )
+ {
+ _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ //if row is selected and line color isn't user specified, set it blue
+ if(_bSelected)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //else set line color to the color of row background
+ else
+ {
+ if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(background2);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(background1);
+ else
+ {
+ //if Line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
}
+ }
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ {
+ // TODO: remove those temporary place holders
+ Rectangle aRect( _rArea );
+ ++aRect.Left(); --aRect.Right();
+ aRect.Top(); aRect.Bottom();
if(_bSelected)
{
- _rDevice.SetFillColor( _rStyle.GetFieldColor() );
- _rDevice.SetTextColor(COL_BLACK);
+ _rDevice.SetTextColor(_rStyle.GetHighlightTextColor());
+ }
+ else
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle textRect(_rArea);
+ textRect.Left()+=4; textRect.Right()-=4;
+ textRect.Bottom()-=2;
+ _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
}
-
_rDevice.Pop();
-
(void)_bActive;
-// // no special painting for the active cell at the moment
- (void)_rStyle;
-// // TODO: do we need this?
+ // no special painting for the active cell at the moment
}
//--------------------------------------------------------------------
@@ -224,7 +364,7 @@ namespace svt { namespace table
//--------------------------------------------------------------------
void GridTableRenderer::HideCellCursor( Window& _rView, const Rectangle& _rCursorRect)
{
- (void)_rCursorRect;
+ (void)_rCursorRect;
_rView.HideFocus();
}
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 71c753d3ea86..418348c81b7d 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -30,6 +30,7 @@
#include "svtools/table/tablecontrol.hxx"
#include "tablegeometry.hxx"
#include "tablecontrol_impl.hxx"
+#include "accessibletableimp.hxx"
#include "svtools/table/tabledatawindow.hxx"
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
@@ -68,15 +69,19 @@ namespace svt { namespace table
TableControl::TableControl( Window* _pParent, WinBits _nStyle )
:Control( _pParent, _nStyle )
,m_pImpl( new TableControl_Impl( *this ) )
+ ,m_bSelectionChanged(false)
{
- m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
- m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ TableDataWindow* aTableData = m_pImpl->getDataWindow();
+ aTableData->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
+ aTableData->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ aTableData->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl());
}
//--------------------------------------------------------------------
TableControl::~TableControl()
{
+ ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
DELETEZ( m_pImpl );
if ( m_pAccessTable->m_pAccessible )
{
@@ -106,6 +111,14 @@ namespace svt { namespace table
{
if ( !m_pImpl->getInputHandler()->KeyInput( *m_pImpl, rKEvt ) )
Control::KeyInput( rKEvt );
+ else
+ {
+ if(m_bSelectionChanged)
+ {
+ Select();
+ m_bSelectionChanged = false;
+ }
+ }
}
//--------------------------------------------------------------------
void TableControl::Resize()
@@ -162,13 +175,21 @@ namespace svt { namespace table
return m_pImpl->goTo( _nColPos, _nRowPos );
}
//--------------------------------------------------------------------
- void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved)
+ void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved)
{
Rectangle _rRect;
if(_bRemoved)
- return m_pImpl->invalidateRows(_nRowStart, _rRect);
+ m_pImpl->invalidateRows();
else
- return m_pImpl->invalidateRow(_nRowStart, _rRect);
+ {
+ if(m_bSelectionChanged)
+ {
+ m_pImpl->invalidateSelectedRegion(_nRowStart, _nRowEnd, _rRect);
+ m_bSelectionChanged = false;
+ }
+ else
+ m_pImpl->invalidateRow(_nRowStart, _rRect);
+ }
}
//--------------------------------------------------------------------
std::vector<sal_Int32>& TableControl::GetSelectedRows()
@@ -176,7 +197,7 @@ namespace svt { namespace table
return m_pImpl->getSelectedRows();
}
//--------------------------------------------------------------------
- void TableControl::removeSelectedRow(RowPos _nRowPos)
+ void TableControl::RemoveSelectedRow(RowPos _nRowPos)
{
m_pImpl->removeSelectedRow(_nRowPos);
}
@@ -187,20 +208,6 @@ namespace svt { namespace table
return m_pImpl->getCurrentRow( rPoint );
}
- //--------------------------------------------------------------------
-
- IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
- {
- CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
- return 1;
- }
-
- IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
- {
- CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
- return 1;
- }
-
SelectionEngine* TableControl::getSelEngine()
{
return m_pImpl->getSelEngine();
@@ -240,6 +247,7 @@ namespace svt { namespace table
::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
{
::rtl::OUString aRetText;
+ //Window* pWin;
switch( eObjType )
{
case TCTYPE_GRIDCONTROL:
@@ -255,7 +263,7 @@ namespace svt { namespace table
aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
break;
case TCTYPE_TABLECELL:
- aRetText = GetCellContent(_nRow, _nCol);
+ aRetText = GetRowName(_nRow);
break;
case TCTYPE_ROWHEADERCELL:
aRetText = GetRowName(_nRow);
@@ -328,20 +336,23 @@ namespace svt { namespace table
// -----------------------------------------------------------------------------
-::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
+::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
{
- ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii("");
- std::vector<std::vector<rtl::OUString> >& aTableContent = GetModel()->getCellContent();
+ ::com::sun::star::uno::Any cellContent(::com::sun::star::uno::Any(::rtl::OUString::createFromAscii("")));
+ std::vector<std::vector< ::com::sun::star::uno::Any > >& aTableContent = GetModel()->getCellContent();
if(&aTableContent)
- {
- std::vector<rtl::OUString>& aRowContent = aTableContent[_nRowPos];
- if(&aRowContent)
- cellContent = aRowContent[_nColPos];
- }
+ cellContent = aTableContent[_nRowPos][_nColPos];
return cellContent;
}
// -----------------------------------------------------------------------------
+::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos)
+{
+ ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos);
+ return m_pImpl->convertToString(cellContent);
+}
+// -----------------------------------------------------------------------------
+
void TableControl::FillAccessibleStateSet(
::utl::AccessibleStateSetHelper& rStateSet,
AccessibleTableControlObjType eObjType ) const
@@ -374,10 +385,6 @@ void TableControl::FillAccessibleStateSet(
break;
case TCTYPE_TABLECELL:
{
- //sal_Int32 nRow = GetCurRow();
- //sal_uInt16 nColumn = GetCurColumnId();
- //if ( IsFieldVisible(nRow,nColumn) )
- // rStateSet.AddState( AccessibleStateType::VISIBLE );
rStateSet.AddState( AccessibleStateType::TRANSIENT );
rStateSet.AddState( AccessibleStateType::SELECTABLE);
if( GetSelectedRowCount()>0)
@@ -516,25 +523,56 @@ void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNew
Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen)
{
(void)_bOnScreen;
- Rectangle aRectTable, aRectTableWithHeaders;
- m_pImpl->impl_getAllVisibleDataCellArea(aRectTable);
- m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders);
- Size aSizeTable(aRectTable.GetSize());
- Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
- if(_bIsColumnBar)
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
- else
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+ return m_pImpl->calcHeaderRect(_bIsColumnBar);
}
// -----------------------------------------------------------------------------
Rectangle TableControl::calcTableRect(BOOL _bOnScreen)
{
(void)_bOnScreen;
- Rectangle aRect;
- m_pImpl->impl_getAllVisibleDataCellArea(aRect);
- return aRect;
+ return m_pImpl->calcTableRect();
+}
+//--------------------------------------------------------------------
+::com::sun::star::uno::Sequence< sal_Int32 >& TableControl::getColumnsForTooltip()
+{
+ return m_nCols;
+}
+//--------------------------------------------------------------------
+::com::sun::star::uno::Sequence< ::rtl::OUString >& TableControl::getTextForTooltip()
+{
+ return m_aText;
+}
+//--------------------------------------------------------------------
+void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols )
+{
+ m_aText = aText;
+ m_nCols = nCols;
+}
+// -----------------------------------------------------------------------
+void TableControl::selectionChanged(bool _bChanged)
+{
+ m_bSelectionChanged = _bChanged;
+}
+// -----------------------------------------------------------------------
+IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG )
+{
+ Select();
+ return 1;
+}
+IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
+{
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
+ return 1;
+}
+IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
+{
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
+ return 1;
+}
+// -----------------------------------------------------------------------
+void TableControl::Select()
+{
+ ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_aSelectHdl, this );
}
-
//........................................................................
}} // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index aacfc28d05be..1526dbdb778d 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -33,9 +33,13 @@
#include "tablecontrol_impl.hxx"
#include "tablegeometry.hxx"
#include "svtools/table/tabledatawindow.hxx"
-
+#include <com/sun/star/awt/XControl.hpp>
#include <vcl/scrbar.hxx>
#include <vcl/seleng.hxx>
+#include <rtl/ref.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <vcl/image.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <functional>
#include <stdlib.h>
@@ -98,22 +102,22 @@ namespace svt { namespace table
{
return false;
}
- virtual void setRowHeaders(bool _bRowHeaders)
+ virtual void setRowHeaders(bool _bRowHeaders)
{
(void)_bRowHeaders;
}
- virtual void setColumnHeaders(bool _bColumnHeaders)
- {
- (void)_bColumnHeaders;
- }
- void setColumnCount(TableSize _nColCount)
- {
- (void) _nColCount;
- }
- void setRowCount(TableSize _nRowCount)
+ virtual void setColumnHeaders(bool _bColumnHeaders)
{
- (void)_nRowCount;
+ (void)_bColumnHeaders;
}
+ void setColumnCount(TableSize _nColCount)
+ {
+ (void) _nColCount;
+ }
+ void setRowCount(TableSize _nRowCount)
+ {
+ (void)_nRowCount;
+ }
virtual bool isCellEditable( ColPos col, RowPos row ) const
{
(void)col;
@@ -166,39 +170,83 @@ namespace svt { namespace table
{
return 0;
}
- virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
- {
- (void)overAllHeight;
- (void)actHeight;
- return ScrollbarShowNever;
- }
- virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
- {
- (void)overAllWidth;
- (void)actWidth;
- return ScrollbarShowNever;
- }
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > pCellEntryType)
- {
- (void)pCellEntryType;
- }
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent()
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility(int , int ) const
{
- return *( new std::vector<std::vector<rtl::OUString> >);
+ return ScrollbarShowNever;
}
- virtual void setRowHeaderName(std::vector<rtl::OUString> pCellEntryType)
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int , int ) const
{
- (void)pCellEntryType;
+ return ScrollbarShowNever;
}
- virtual std::vector<rtl::OUString>& getRowHeaderName()
- {
- aRowHeaderNames.clear();
- aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
- return aRowHeaderNames;
- }
-
- private:
- std::vector<rtl::OUString> aRowHeaderNames;
+ virtual bool hasVerticalScrollbar()
+ {
+ return false;
+ }
+ virtual bool hasHorizontalScrollbar()
+ {
+ return false;
+ }
+ virtual void setCellContent(const std::vector<std::vector< ::com::sun::star::uno::Any > >& )
+ {
+ }
+ virtual ::com::sun::star::util::Color getLineColor()
+ {
+ return 0;
+ }
+ virtual void setLineColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::util::Color getHeaderBackgroundColor()
+ {
+ return -1;
+ }
+ virtual void setHeaderBackgroundColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::util::Color getTextColor()
+ {
+ return 0;
+ }
+ virtual void setTextColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::util::Color getOddRowBackgroundColor()
+ {
+ return -1;
+ }
+ virtual void setOddRowBackgroundColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign()
+ {
+ return com::sun::star::style::VerticalAlignment(0);
+ }
+ virtual void setVerticalAlign(com::sun::star::style::VerticalAlignment )
+ {
+ }
+ virtual ::com::sun::star::util::Color getEvenRowBackgroundColor()
+ {
+ return -1;
+ }
+ virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual std::vector<std::vector< ::com::sun::star::uno::Any > >& getCellContent()
+ {
+ return m_aCellContent;
+ }
+ virtual void setRowHeaderName(const std::vector<rtl::OUString>& )
+ {
+ }
+ virtual std::vector<rtl::OUString>& getRowHeaderName()
+ {
+ aRowHeaderNames.clear();
+ aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
+ return aRowHeaderNames;
+ }
+ private:
+ std::vector<rtl::OUString> aRowHeaderNames;
+ std::vector<std::vector< ::com::sun::star::uno::Any > > m_aCellContent;
};
@@ -222,8 +270,8 @@ namespace svt { namespace table
:m_rTable( _rTable )
,m_nSuspendFlags( _nSuspendFlags )
{
- DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags,
- "SuspendInvariants: cannot suspend what is already suspended!" );
+ //DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags,
+ // "SuspendInvariants: cannot suspend what is already suspended!" );
const_cast< TableControl_Impl& >( m_rTable ).m_nRequiredInvariants &= ~m_nSuspendFlags;
}
~SuspendInvariants()
@@ -303,7 +351,7 @@ namespace svt { namespace table
// m_nColHeaderHeightPixel consistent with the model's value?
{
TableMetrics nHeaderHeight = m_pModel->hasColumnHeaders() ? m_pModel->getColumnHeaderHeight() : 0;
- nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_100TH_MM ).Height();
+ nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_APPFONT ).Height();
if ( nHeaderHeight != m_nColHeaderHeightPixel )
return "column header heights are inconsistent!";
}
@@ -312,7 +360,7 @@ namespace svt { namespace table
if ( !isDummyModel )
{
TableMetrics nRowHeight = m_pModel->getRowHeight();
- nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_100TH_MM ).Height();
+ nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_APPFONT).Height();
if ( nRowHeight != m_nRowHeightPixel )
return "row heights are inconsistent!";
}
@@ -320,13 +368,12 @@ namespace svt { namespace table
// m_nRowHeaderWidthPixel consistent with the model's value?
{
TableMetrics nHeaderWidth = m_pModel->hasRowHeaders() ? m_pModel->getRowHeaderWidth() : 0;
- nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_100TH_MM ).Width();
+ nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_APPFONT ).Width();
if ( nHeaderWidth != m_nRowHeaderWidthPixel )
return "row header widths are inconsistent!";
}
// TODO: check m_aColumnWidthsPixel and m_aAccColumnWidthsPixel
-
if ( m_nCursorHidden < 0 )
return "invalid hidden count for the cursor!";
@@ -369,30 +416,33 @@ namespace svt { namespace table
,m_pModel ( new EmptyTableModel )
,m_pInputHandler ( )
,m_nRowHeightPixel ( 15 )
- ,m_nColHeaderHeightPixel( 0 )
+ ,m_nColHeaderHeightPixel( 0 )
,m_nRowHeaderWidthPixel ( 0 )
,m_nColumnCount ( 0 )
,m_nRowCount ( 0 )
,m_nCurColumn ( COL_INVALID )
,m_nCurRow ( ROW_INVALID )
,m_nLeftColumn ( 0 )
- ,m_nTopRow ( 0 )
+ ,m_nTopRow ( 0 )
,m_nCursorHidden ( 1 )
,m_pDataWindow ( new TableDataWindow( *this ) )
- ,m_pVScroll ( NULL )
+ ,m_pVScroll ( NULL )
,m_pHScroll ( NULL )
,m_pScrollCorner ( NULL )
- ,m_pSelEngine ( )
- ,m_nRowSelected ( )
- ,m_pTableFunctionSet ( new TableFunctionSet(this ) )
- ,m_nAnchor (-1 )
+ ,m_pSelEngine ( )
+ ,m_nRowSelected ( )
+ ,m_pTableFunctionSet ( new TableFunctionSet(this ) )
+ ,m_nAnchor (-1 )
+ ,m_bResizing ( false )
+ ,m_nResizingColumn ( 0 )
+ ,m_bResizingGrid ( false )
#if DBG_UTIL
,m_nRequiredInvariants ( INV_SCROLL_POSITION )
#endif
{
DBG_CTOR( TableControl_Impl, TableControl_Impl_checkInvariants );
- m_pSelEngine = new SelectionEngine(m_pDataWindow, m_pTableFunctionSet);
- m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
+ m_pSelEngine = new SelectionEngine(m_pDataWindow, m_pTableFunctionSet);
+ m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
m_pDataWindow->SetPosPixel( Point( 0, 0 ) );
m_pDataWindow->Show();
}
@@ -427,14 +477,10 @@ namespace svt { namespace table
TempHideCursor aHideCursor( *this );
- // TODO: revoke as table listener from the model
-
m_pModel = _pModel;
- if ( !m_pModel )
+ if ( !m_pModel)
m_pModel.reset( new EmptyTableModel );
- // TODO: register as table listener
- //m_pModel->addTableModelListener(PTableModelListener(m_pTableModelListener));
m_nCurRow = ROW_INVALID;
m_nCurColumn = COL_INVALID;
@@ -504,11 +550,11 @@ namespace svt { namespace table
m_pInputHandler.reset();
m_nColumnCount = m_nRowCount = 0;
- m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_100TH_MM ).Height();
- if ( m_pModel->hasColumnHeaders() )
- m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_100TH_MM ).Height();
+ m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height();
+ if ( m_pModel->hasColumnHeaders() )
+ m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height();
if ( m_pModel->hasRowHeaders() )
- m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_100TH_MM ).Width();
+ m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width();
impl_ni_updateColumnWidths();
@@ -529,34 +575,116 @@ namespace svt { namespace table
return;
TableSize colCount = m_pModel->getColumnCount();
+
m_aColumnWidthsPixel.reserve( colCount );
m_aAccColumnWidthsPixel.reserve( colCount );
- long accumulatedPixelWidth = 0;
- for ( ColPos col = 0; col < colCount; ++col )
+ if(colCount>0)
{
- PColumnModel pColumn = m_pModel->getColumnModel( col );
- DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
- if ( !pColumn )
- continue;
-
- TableMetrics colWidth = pColumn->getWidth();
- DBG_ASSERT( ( colWidth == COLWIDTH_FIT_TO_VIEW ) || ( colWidth > 0 ),
- "TableControl_Impl::impl_ni_updateColumnWidths: invalid column width!" );
-
- long pixelWidth = 0;
- if ( colWidth == COLWIDTH_FIT_TO_VIEW )
+ std::vector<sal_Int32> aPrePixelWidths(0);
+ long accumulatedPixelWidth = 0;
+ int lastResizableCol = -1;
+ double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width();
+ if(m_pModel->hasRowHeaders())
+ {
+ TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth();
+ gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width();
+ }
+ if(m_pModel->hasVerticalScrollbar())
{
- // TODO
- DBG_ERROR( "TableControl_Impl::impl_ni_updateColumnWidths: COLWIDTH_FIT_TO_VIEW not implemented, yet!" );
+ sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
+ gridWidth-=scrollbarWidth;
+ }
+ double colWidthsSum = 0.0;
+ double colWithoutFixedWidthsSum = 0.0;
+ double minColWithoutFixedSum = 0.0;
+ for ( ColPos col = 0; col < colCount; ++col )
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel( col );
+ DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
+ if ( !pColumn )
+ continue;
+ TableMetrics colWidth = 0;
+ TableMetrics colPrefWidth = pColumn->getPreferredWidth();
+ bool bResizable = pColumn->isResizable();
+ if(pColumn->getMinWidth() == 0 && bResizable)
+ {
+ pColumn->setMinWidth(1);
+ minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width();
+ }
+ if(pColumn->getMaxWidth() == 0 && bResizable)
+ pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width());
+ if( colPrefWidth != 0)
+ {
+ if(m_bResizingGrid)
+ {
+ colWidth = pColumn->getWidth();
+ pColumn->setPreferredWidth(0);
+ }
+ else
+ {
+ colWidth = colPrefWidth;
+ pColumn->setWidth(colPrefWidth);
+ }
+ }
+ else
+ colWidth = pColumn->getWidth();
+ long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
+ if(bResizable && colPrefWidth == 0)
+ {
+ colWithoutFixedWidthsSum+=pixelWidth;
+ lastResizableCol = col;
+ }
+ colWidthsSum+=pixelWidth;
+ aPrePixelWidths.push_back(pixelWidth);
+ }
+ double gridWidthWithoutFixed = gridWidth - colWidthsSum + colWithoutFixedWidthsSum;
+ double scalingFactor = 1.0;
+ if(m_bResizingGrid)
+ {
+ if(gridWidthWithoutFixed > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum))
+ scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
}
else
{
- pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_100TH_MM ).Width();
+ if(colWidthsSum < gridWidthWithoutFixed)
+ {
+ if(colWithoutFixedWidthsSum>0)
+ scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
+ }
+ }
+ for ( ColPos i = 0; i < colCount; ++i )
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel( i );
+ DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
+ if ( !pColumn )
+ continue;
+ if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0)
+ {
+ aPrePixelWidths[i]*=scalingFactor;
+ TableMetrics logicColWidth = m_rAntiImpl.PixelToLogic( Size( aPrePixelWidths[i], 0 ), MAP_APPFONT ).Width();
+ pColumn->setWidth(logicColWidth);
+ }
+ m_aColumnWidthsPixel.push_back( aPrePixelWidths[i] );
+ m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += aPrePixelWidths[i] );
+ }
+ if(gridWidth > m_aAccColumnWidthsPixel[colCount-1])
+ {
+ if(lastResizableCol >= 0)
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel(lastResizableCol);
+ m_aColumnWidthsPixel[lastResizableCol]+=gridWidth-m_aAccColumnWidthsPixel[colCount-1];
+ TableMetrics logicColWidth1 = m_rAntiImpl.PixelToLogic( Size( m_aColumnWidthsPixel[lastResizableCol], 0 ), MAP_APPFONT ).Width();
+ pColumn->setWidth(logicColWidth1);
+ while(lastResizableCol < colCount)
+ {
+ if(lastResizableCol == 0)
+ m_aAccColumnWidthsPixel[0] = m_aColumnWidthsPixel[lastResizableCol];
+ else
+ m_aAccColumnWidthsPixel[lastResizableCol]=m_aAccColumnWidthsPixel[lastResizableCol-1]+m_aColumnWidthsPixel[lastResizableCol];
+ ++lastResizableCol;
+ }
+ }
}
-
- m_aColumnWidthsPixel.push_back( pixelWidth );
-
- m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth );
}
}
@@ -678,6 +806,13 @@ namespace svt { namespace table
Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() );
aDataCellPlayground.Left() = m_nRowHeaderWidthPixel;
aDataCellPlayground.Top() = m_nColHeaderHeightPixel;
+ m_nRowCount = m_pModel->getRowCount();
+ m_nColumnCount = m_pModel->getColumnCount();
+
+ if(m_aAccColumnWidthsPixel.empty())
+ {
+ impl_ni_updateColumnWidths();
+ }
// do we need a vertical scrollbar?
bool bFirstRoundVScrollNeed = false;
@@ -709,15 +844,6 @@ namespace svt { namespace table
aDataCellPlayground.Right() -= nScrollbarMetrics;
}
}
- else
- {
- Size regionWithoutHeader = m_rAntiImpl.PixelToLogic(Size(aDataCellPlayground.Right() - aDataCellPlayground.Left(),0),MAP_100TH_MM);
- TableMetrics nColWidth = regionWithoutHeader.Width()/m_nColumnCount;
- for ( ColPos col = 0; col < m_nColumnCount; ++col )
- m_pModel->getColumnModel(col)->setWidth(nColWidth);
- m_rAntiImpl.SetModel(m_pModel);
- }
-
// create or destroy the vertical scrollbar, as needed
lcl_updateScrollbar(
m_rAntiImpl,
@@ -780,6 +906,11 @@ namespace svt { namespace table
m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
m_pScrollCorner->Show();
}
+ else if(bHaveScrollCorner && bNeedScrollCorner)
+ {
+ m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
+ m_pScrollCorner->Show();
+ }
// resize the data window
m_pDataWindow->SetSizePixel( Size(
@@ -792,10 +923,26 @@ namespace svt { namespace table
void TableControl_Impl::onResize()
{
DBG_CHECK_ME();
- impl_ni_updateScrollbars();
- //Rectangle aAllCells;
- // impl_getAllVisibleCellsArea( aAllCells );
- //m_pSelEngine->SetVisibleArea(aAllCells);
+ if(m_nRowCount != 0)
+ {
+ if(m_nColumnCount != 0)
+ {
+ if(m_bResizingGrid)
+ impl_ni_updateColumnWidths();
+ invalidateRows();
+ m_bResizingGrid = true;
+ }
+ }
+ else
+ {
+ //In the case that column headers are defined but data hasn't yet been set,
+ //only column headers will be shown
+ if(m_pModel->hasColumnHeaders())
+ if(m_nColHeaderHeightPixel>1)
+ m_pDataWindow->SetSizePixel( m_rAntiImpl.GetOutputSizePixel());
+ if(m_nColumnCount != 0)
+ impl_ni_updateScrollbars();
+ }
}
//--------------------------------------------------------------------
@@ -805,7 +952,6 @@ namespace svt { namespace table
if ( !getModel() )
return;
-
PTableRenderer pRenderer = getModel()->getRenderer();
DBG_ASSERT( !!pRenderer, "TableDataWindow::Paint: invalid renderer!" );
if ( !pRenderer )
@@ -813,21 +959,28 @@ namespace svt { namespace table
// our current style settings, to be passed to the renderer
const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
-
+ m_nRowCount = m_pModel->getRowCount();
+ TableSize nVisibleRows = impl_getVisibleRows(true);
+ TableSize nActualRows = m_nRowCount;
+ if(m_nRowCount>nVisibleRows)
+ nActualRows = nVisibleRows;
// the area occupied by all (at least partially) visible cells, including
// headers
Rectangle aAllCellsWithHeaders;
impl_getAllVisibleCellsArea( aAllCellsWithHeaders );
- m_nRowCount = m_pModel->getRowCount();
// ............................
// draw the header column area
- if ( getModel()->hasColumnHeaders() )
+ if ( m_pModel->hasColumnHeaders() )
{
TableRowGeometry aHeaderRow( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), ROW_COL_HEADERS );
+ Rectangle aColRect(aHeaderRow.getRect());
+ //to avoid double lines when scrolling horizontally
+ if(m_nLeftColumn != 0)
+ --aColRect.Left();
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aHeaderRow.getRect(), true, false, rStyle
+ *m_pDataWindow, aColRect, true, false, rStyle
);
// Note that strictly, aHeaderRow.getRect() also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
@@ -850,14 +1003,18 @@ namespace svt { namespace table
// the area occupied by the row header, if any
Rectangle aRowHeaderArea;
- if ( getModel()->hasRowHeaders() )
+ if ( m_pModel->hasRowHeaders() )
{
aRowHeaderArea = aAllCellsWithHeaders;
aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1;
- aRowHeaderArea.Bottom() = m_nRowHeightPixel * m_nRowCount + m_nColHeaderHeightPixel - 1;
- pRenderer->PaintHeaderArea(
- *m_pDataWindow, aRowHeaderArea, false, true, rStyle
- );
+ if(m_nTopRow+nActualRows>m_nRowCount)
+ aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1;
+ else
+ aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1;
+ //to avoid double lines when scrolling vertically
+ if(m_nTopRow != 0)
+ --aRowHeaderArea.Top();
+ pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle);
// Note that strictly, aRowHeaderArea also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
// so this hopefully doesn't hurt if we already paint it here.
@@ -866,8 +1023,15 @@ namespace svt { namespace table
{
TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS );
+ Rectangle aInters(aIntersection.getRect());
+ //to avoid double line when scrolling vertically
+ if( m_nTopRow != 0 )
+ {
+ --aInters.Top();
+ --aInters.Bottom();
+ }
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aIntersection.getRect(), true, true, rStyle
+ *m_pDataWindow, aInters, true, true, rStyle
);
}
}
@@ -880,113 +1044,69 @@ namespace svt { namespace table
// paint all rows
Rectangle aAllDataCellsArea;
impl_getAllVisibleDataCellArea( aAllDataCellsArea );
-
- //get the vector, which contains row vectors, each containing the data for the cells in this row
- std::vector<std::vector<rtl::OUString> >& aCellContent = m_pModel->getCellContent();
- //if the vector is empty, fill it with empty data, so the table can be painted
- if(aCellContent.empty())
- {
- std::vector<rtl::OUString> emptyCells;
- while(m_nRowCount!=0)
- {
- aCellContent.push_back(emptyCells);
- --m_nRowCount;
- }
- }
- std::vector<std::vector<rtl::OUString> >::iterator it = aCellContent.begin()+m_nTopRow;
- //get the vector, which contains the row header titles
- std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName();
- ::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin();
-
- if(m_pModel->hasRowHeaders())
- {
- aRowHeaderContent = m_pModel->getRowHeaderName();
- //if the vector is empty, fill it with empty strings, so the table can be painted
- if(aRowHeaderContent.empty())
- {
- while(m_nRowCount!=0)
- {
- aRowHeaderContent.push_back(rtl::OUString::createFromAscii(""));
- --m_nRowCount;
- }
- }
- itRowName = aRowHeaderContent.begin()+m_nTopRow;
- }
+ ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent();
for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() );
aRowIterator.isValid();
aRowIterator.moveDown() )
{
if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() )
- {
- if(m_pModel->hasRowHeaders())
- ++itRowName;
- ++it;
continue;
- }
bool isActiveRow = ( aRowIterator.getRow() == getCurRow() );
bool isSelectedRow = false;
if(!m_nRowSelected.empty())
{
for(std::vector<RowPos>::iterator itSel=m_nRowSelected.begin();
- itSel!=m_nRowSelected.end();++itSel)
+ itSel!=m_nRowSelected.end();++itSel)
{
if(*itSel == aRowIterator.getRow())
isSelectedRow = true;
}
}
- std::vector<rtl::OUString> aCellData;
- if(it != aCellContent.end())
- {
- aCellData = *it;
- ++it;
- }
- ::std::vector<rtl::OUString>::iterator iter = aCellData.begin()+m_nLeftColumn;
-
+ Rectangle aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
+ //to avoid double lines
+ if( aRowIterator.getRow() != 0 )
+ --aRect.Top();
+ if(m_nLeftColumn != 0)
+ --aRect.Left();
// give the redenderer a chance to prepare the row
pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow,
- *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle );
+ *m_pDataWindow, aRect, rStyle );
// paint the row header
if ( m_pModel->hasRowHeaders() )
{
- rtl::OUString rowHeaderName;
- if(itRowName != aRowHeaderContent.end())
- {
- rowHeaderName = *itRowName;
- ++itRowName;
- }
Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
+ rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()];
pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
rStyle, rowHeaderName );
}
if ( !colCount )
continue;
-
// paint all cells in this row
for ( TableCellGeometry aCell( aRowIterator, m_nLeftColumn );
aCell.isValid();
aCell.moveRight()
)
{
- // if ( _rUpdateRect.GetIntersection( aCell.getRect() ).IsEmpty() )
- // continue;
-
- //bool isActiveCell = isActiveRow && ( aCell.getColumn() == getCurColumn() );
bool isSelectedColumn = false;
- rtl::OUString cellData;
- if(aCellData.empty())
- cellData=rtl::OUString::createFromAscii("");
- else if(iter != aCellData.end())
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
+ ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()];
+ if(rCellData>>=xGraphic)
+ {
+ Image* pImage = new Image(xGraphic);
+ if(pImage!=NULL)
+ pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+ *m_pDataWindow, aCell.getRect(), rStyle, pImage );
+ }
+ else
{
- cellData = *iter;
- ++iter;
+ ::rtl::OUString sContent = convertToString(rCellData);
+ pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+ *m_pDataWindow, aCell.getRect(), rStyle, sContent );
}
- pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
- *m_pDataWindow, aCell.getRect(), rStyle, cellData );
- }
+ }
}
}
-
//--------------------------------------------------------------------
void TableControl_Impl::hideCursor()
{
@@ -1016,70 +1136,70 @@ namespace svt { namespace table
switch ( _eAction )
{
case cursorDown:
- if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ //if other rows already selected, deselect them
+ if(m_nRowSelected.size()>0)
{
- //if other rows already selected, deselect them
- if(m_nRowSelected.size()>0)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- }
- if(m_nCurRow < m_nRowCount-1)
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ it!=m_nRowSelected.end();++it)
{
- ++m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(*it, *it, rCells);
}
- else
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- ensureVisible(m_nCurColumn,m_nCurRow,false);
- bSuccess = true;
+ m_nRowSelected.clear();
}
- else
+ if(m_nCurRow < m_nRowCount-1)
{
- if ( m_nCurRow < m_nRowCount - 1 )
- bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 );
+ ++m_nCurRow;
+ m_nRowSelected.push_back(m_nCurRow);
}
+ else
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ ensureVisible(m_nCurColumn,m_nCurRow,false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ else
+ {
+ if ( m_nCurRow < m_nRowCount - 1 )
+ bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 );
+ }
break;
case cursorUp:
- if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ if(m_nRowSelected.size()>0)
{
- if(m_nRowSelected.size()>0)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- }
- if(m_nCurRow>0)
{
- --m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ invalidateSelectedRegion(*it, *it, rCells);
}
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- ensureVisible(m_nCurColumn,m_nCurRow,false);
- bSuccess = true;
+ m_nRowSelected.clear();
+ }
+ if(m_nCurRow>0)
+ {
+ --m_nCurRow;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
else
{
- if ( m_nCurRow > 0 )
- bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 );
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- break;
+ ensureVisible(m_nCurColumn,m_nCurRow,false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ else
+ {
+ if ( m_nCurRow > 0 )
+ bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 );
+ }
+ break;
case cursorLeft:
if ( m_nCurColumn > 0 )
bSuccess = goTo( m_nCurColumn - 1, m_nCurRow );
@@ -1133,225 +1253,251 @@ namespace svt { namespace table
case cursorBottomRight:
bSuccess = goTo( m_nColumnCount - 1, m_nRowCount - 1 );
break;
-
- case cursorSelectRow:
+ case cursorSelectRow:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ //pos is the position of the current row in the vector of selected rows, if current row is selected
+ int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
+ //if current row is selected, it should be deselected, when ALT+SPACE are pressed
+ if(pos>-1)
+ {
+ m_nRowSelected.erase(m_nRowSelected.begin()+pos);
+ if(m_nRowSelected.empty() && m_nAnchor != -1)
+ m_nAnchor = -1;
+ }
+ //else select the row->put it in the vector
+ else
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ break;
+ case cursorSelectRowUp:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- //pos is the position of the current row in the vector of selected rows, if current row is selected
- int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- //if current row is selected, it should be deselected, when ALT+SPACE are pressed
- if(pos>-1)
- m_nRowSelected.erase(m_nRowSelected.begin()+pos);
- //else select the row->put it in the vector
- else
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- bSuccess = true;
+ //if there are other selected rows, deselect them
+ return false;
}
- break;
- case cursorSelectRowUp:
+ else
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ //there are other selected rows
+ if(m_nRowSelected.size()>0)
{
- //if there are other selected rows, deselect them
- return false;
- }
- else
- {
- //there are other selected rows
- if(m_nRowSelected.size()>0)
+ //the anchor wasn't set -> a region is not selected, that's why clear all selection
+ //and select the current row
+ if(m_nAnchor==-1)
{
- //the anchor wasn't set -> a region is not selected, that's why clear all selection
- //and select the current row
- if(m_nAnchor==-1)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ {
+ invalidateSelectedRegion(*it, *it, rCells);
}
+ m_nRowSelected.clear();
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
+ else
+ {
+ //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected
+ int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
+ int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1);
+ if(prevRow>-1)
+ {
+ //if m_nCurRow isn't the upper one, can move up, otherwise not
+ if(m_nCurRow>0)
+ m_nCurRow--;
+ else
+ return bSuccess = true;
+ //if nextRow already selected, deselect it, otherwise select it
+ if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow)
+ {
+ m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells);
+ }
+ else
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
+ }
else
{
- //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected
- int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1);
- if(prevRow>-1)
+ if(m_nCurRow>0)
{
- //if m_nCurRow isn't the upper one, can move up, otherwise not
- if(m_nCurRow>0)
- m_nCurRow--;
- else
- return bSuccess = true;
- //if nextRow already selected, deselect it, otherwise select it
- if(m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRow(m_nCurRow+1, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow--;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
}
}
}
+ }
+ else
+ {
+ //if nothing is selected and the current row isn't the upper one
+ //select the current and one row above
+ //otherwise select only the upper row
+ if(m_nCurRow>0)
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow--;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
+ }
else
{
- //if nothing is selected and the current row isn't the upper one
- //select the current and one row above
- //otherwise select only the upper row
- if(m_nCurRow>0)
- {
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow--;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- m_pSelEngine->SetAnchor(TRUE);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- bSuccess = true;
}
+ m_pSelEngine->SetAnchor(TRUE);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
}
- break;
- case cursorSelectRowDown:
+ }
+ break;
+ case cursorSelectRowDown:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- {
- bSuccess = false;
- }
- else
+ bSuccess = false;
+ }
+ else
+ {
+ if(m_nRowSelected.size()>0)
{
- if(m_nRowSelected.size()>0)
+ //the anchor wasn't set -> a region is not selected, that's why clear all selection
+ //and select the current row
+ if(m_nAnchor==-1)
{
- //the anchor wasn't set -> a region is not selected, that's why clear all selection
- //and select the current row
- if(m_nAnchor==-1)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- else
{
- //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected
- int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1);
- if(prevRow>-1)
- {
- //if m_nCurRow isn't the last one, can move down, otherwise not
- if(m_nCurRow<m_nRowCount)
- m_nCurRow++;
- else
- return bSuccess = true;
- //if net row already selected, deselect it, otherwise select it
- if(m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRow(m_nCurRow-1, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- }
+ invalidateSelectedRegion(*it, *it, rCells);
+ }
+ m_nRowSelected.clear();
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- }
else
{
- //there wasn't any selection, select curennt and row beneath, otherwise onlyrow beneath
- if(m_nCurRow<m_nRowCount-1)
- {
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow++;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+ //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected
+ int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
+ int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1);
+ if(prevRow>-1)
+ {
+ //if m_nCurRow isn't the last one, can move down, otherwise not
+ if(m_nCurRow<m_nRowCount-1)
+ m_nCurRow++;
+ else
+ return bSuccess = true;
+ //if next row already selected, deselect it, otherwise select it
+ if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow)
+ {
+ m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells);
+ }
+ else
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
}
else
{
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ if(m_nCurRow<m_nRowCount-1)
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow++;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+ }
}
}
- m_pSelEngine->SetAnchor(TRUE);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- bSuccess = true;
}
- }
- break;
- case cursorSelectRowAreaTop:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- bSuccess = false;
else
{
- //select the region between the current and the upper row
- RowPos iter = m_nCurRow;
- invalidateSelectedRegion(m_nCurRow, 0, rCells);
- //put the rows in vector
- while(iter>=0)
+ //there wasn't any selection, select current and row beneath, otherwise only row beneath
+ if(m_nCurRow<m_nRowCount-1)
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow++;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+ }
+ else
{
- if(!isRowSelected(m_nRowSelected, iter))
- m_nRowSelected.push_back(iter);
- --iter;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- m_nCurRow = 0;
- m_nAnchor = m_nCurRow;
- m_pSelEngine->SetAnchor(TRUE);
- ensureVisible(m_nCurColumn, 0, false);
- bSuccess = true;
}
+ m_pSelEngine->SetAnchor(TRUE);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
}
+ }
break;
- case cursorSelectRowAreaBottom:
+ case cursorSelectRowAreaTop:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ bSuccess = false;
+ else
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- return bSuccess = false;
- //select the region between the current and the last row
+ //select the region between the current and the upper row
RowPos iter = m_nCurRow;
- invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
- //put the rows in the vector
- while(iter<=m_nRowCount)
+ invalidateSelectedRegion(m_nCurRow, 0, rCells);
+ //put the rows in vector
+ while(iter>=0)
{
if(!isRowSelected(m_nRowSelected, iter))
m_nRowSelected.push_back(iter);
- ++iter;
+ --iter;
}
- m_nCurRow = m_nRowCount-1;
+ m_nCurRow = 0;
m_nAnchor = m_nCurRow;
m_pSelEngine->SetAnchor(TRUE);
- ensureVisible(m_nCurColumn, m_nRowCount, false);
+ ensureVisible(m_nCurColumn, 0, false);
+ m_rAntiImpl.selectionChanged(true);
bSuccess = true;
}
+ }
+ break;
+ case cursorSelectRowAreaBottom:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ return bSuccess = false;
+ //select the region between the current and the last row
+ RowPos iter = m_nCurRow;
+ invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
+ //put the rows in the vector
+ while(iter<=m_nRowCount)
+ {
+ if(!isRowSelected(m_nRowSelected, iter))
+ m_nRowSelected.push_back(iter);
+ ++iter;
+ }
+ m_nCurRow = m_nRowCount-1;
+ m_nAnchor = m_nCurRow;
+ m_pSelEngine->SetAnchor(TRUE);
+ ensureVisible(m_nCurColumn, m_nRowCount-1, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
break;
default:
DBG_ERROR( "TableControl_Impl::dispatchAction: unsupported action!" );
@@ -1367,16 +1513,12 @@ namespace svt { namespace table
{
Rectangle aCellRect;
impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect );
-
- // const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
+ if(!m_pModel->hasRowHeaders() && m_nCurColumn == 0)
+ aCellRect.Left()++;
if ( _bShow )
- {
pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect);
- }
else
- {
pRenderer->HideCellCursor( *m_pDataWindow, aCellRect);
- }
}
}
@@ -1394,16 +1536,12 @@ namespace svt { namespace table
return;
}
- DBG_ASSERT( ( _nColumn >= 0 ) && ( _nColumn < m_pModel->getColumnCount() ),
- "TableControl_Impl::impl_getCellRect: invalid column index!" );
- DBG_ASSERT( ( _nRow >= 0 ) && ( _nRow < m_pModel->getRowCount() ),
- "TableControl_Impl::impl_getCellRect: invalid row index!" );
-
Rectangle aAllCells;
impl_getAllVisibleCellsArea( aAllCells );
TableCellGeometry aCell( *this, aAllCells, _nColumn, _nRow );
_rCellRect = aCell.getRect();
+ _rCellRect.Top()--;_rCellRect.Left()--;
}
//-------------------------------------------------------------------------------
RowPos TableControl_Impl::getCurrentRow(const Point& rPoint)
@@ -1412,8 +1550,7 @@ namespace svt { namespace table
Rectangle rCellRect;
RowPos newRowPos = -2;//-1 is HeaderRow
ColPos newColPos = 0;
- //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!!
- for(int i=0;i<m_nRowCount;i++)
+ for(int i=-1;i<m_nRowCount;i++)
{
for(int j=-1;j<m_nColumnCount;j++)
{
@@ -1422,9 +1559,7 @@ namespace svt { namespace table
{
newRowPos = i;
newColPos = j;
- if(newColPos == -1)
- m_nCurColumn = 0;
- else
+ if(newColPos != -1)
m_nCurColumn = newColPos;
return newRowPos;
}
@@ -1432,7 +1567,7 @@ namespace svt { namespace table
}
return newRowPos;
}
- //-------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------------
void TableControl_Impl::setCursorAtCurrentCell(const Point& rPoint)
{
DBG_CHECK_ME();
@@ -1440,7 +1575,6 @@ namespace svt { namespace table
Rectangle rCellRect;
RowPos newRowPos = -2;//-1 is HeaderRow
ColPos newColPos = 0;
- //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!!
for(int i=0;i<m_nRowCount;i++)
{
for(int j=-1;j<m_nColumnCount;j++)
@@ -1460,7 +1594,6 @@ namespace svt { namespace table
}
showCursor();
}
-
//-------------------------------------------------------------------------------
void TableControl_Impl::invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect)
{
@@ -1475,14 +1608,14 @@ namespace svt { namespace table
if(_nPrevRow == _nCurRow)
{
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()=--rCells.Top();
_rCellRect.Bottom()=rCells.Bottom();
}
//if the region is above the current row
else if(_nPrevRow < _nCurRow )
{
impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()= --rCells.Top();
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
_rCellRect.Bottom()=rCells.Bottom();
}
@@ -1490,46 +1623,31 @@ namespace svt { namespace table
else
{
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()= --rCells.Top();
impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
_rCellRect.Bottom()=rCells.Bottom();
}
m_pDataWindow->Invalidate(_rCellRect);
}
-
- //-------------------------------------------------------------------------------
- //To Do: not really needed, because in method above one row can be invalidate. Please Prove this!!!
- void TableControl_Impl::invalidateSelectedRow(RowPos _nCurRow, Rectangle& _rCellRect)
- {
- DBG_CHECK_ME();
- Rectangle aAllCells;
- impl_getAllVisibleCellsArea( aAllCells );
- _rCellRect.Left() = aAllCells.Left();
- _rCellRect.Right() = aAllCells.Right();
- Rectangle rCells;
- impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
- _rCellRect.Bottom()=rCells.Bottom();
- m_pDataWindow->Invalidate(_rCellRect);
- }
//-------------------------------------------------------------------------------
//this method is to be called, when a new row is added
void TableControl_Impl::invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect)
{
- //DBG_CHECK_ME();
- TempHideCursor aHideCursor( *this );
+ if(m_nCurRow < 0)
+ m_nCurRow = 0;
+ if(m_nCursorHidden == 2)
+ --m_nCursorHidden;
impl_getAllVisibleCellsArea( _rCellRect );
TableRowGeometry _rRow( *this, _rCellRect, _nRowPos);
impl_ni_updateScrollbars();
m_pDataWindow->Invalidate(_rRow.getRect());
}
-
//-------------------------------------------------------------------------------
std::vector<RowPos>& TableControl_Impl::getSelectedRows()
{
return m_nRowSelected;
}
-
+ //-------------------------------------------------------------------------------
void TableControl_Impl::removeSelectedRow(RowPos _nRowPos)
{
int i =0;
@@ -1556,57 +1674,23 @@ namespace svt { namespace table
else
m_nCurRow = _nRowPos-1;
}
- //-------------------------------------------------------------------------------
- void TableControl_Impl::invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect)
+ //------------------------------------------------------------------------------
+ void TableControl_Impl::invalidateRows()
{
- //DBG_CHECK_ME();
- (void)_nRowStart;
- (void)_rCellRect;
- /*TempHideCursor aHideCursor(*this);
- Rectangle aAllCells;
- impl_getAllVisibleCellsArea( aAllCells );
- TableRowGeometry _rRow( *this, aAllCells, _nRowStart);
- _rCellRect = _rRow.getRect();
- Rectangle rCells1;
- impl_getCellRect(m_nCurColumn,m_nRowCount,rCells1);
- _rCellRect.Bottom() = rCells1.Bottom();*/
- /*if(_nRowStart != _nRowEnd)
- {
- TableRowGeometry _rRow( *this, aAllCells, _nRowEnd);
- _rCellRect.Bottom() = _rRow.getRect().Bottom();
- }
- */
- //_rCellRect.Right() = aAllCells.Right();
- //_rCellRect.Left() = aAllCells.Left();
- //Rectangle rCells1;
- //impl_getCellRect(m_nCurColumn,_nRowStart,rCells1);
- //_rCellRect.Top()=rCells1.Top();
- //Rectangle rCells2;
- //impl_getCellRect(m_nCurColumn,_nRowEnd,rCells2);
- //_rCellRect.Bottom()=rCells2.Bottom();
impl_ni_updateScrollbars();
- //m_pDataWindow->Invalidate(_rCellRect);
+ TableSize nVisibleRows = impl_getVisibleRows(true);
+ TableSize nVisibleCols = impl_getVisibleColumns(true);
+ if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows)
+ m_nTopRow--;
+ else
+ m_nTopRow = 0;
+ if(m_nLeftColumn+nVisibleCols>m_nColumnCount && m_nColumnCount>=nVisibleCols)
+ m_nLeftColumn--;
+ else
+ m_nLeftColumn = 0;
m_pDataWindow->Invalidate();
}
-
- //-------------------------------------------------------------------------------
- bool TableControl_Impl::isClickInVisibleArea(const Point& rPoint)
- {
- DBG_CHECK_ME();
- long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
- //clickable area is in the visible table control area without the scrollbars
- Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() );
- aDataCellPlayground.Top() = m_nColHeaderHeightPixel;
- aDataCellPlayground.Right() -= nScrollbarMetrics;
- aDataCellPlayground.Bottom() -= nScrollbarMetrics;
- if((rPoint.X() >= aDataCellPlayground.Left() && rPoint.X() <= aDataCellPlayground.Right()) && rPoint.Y() >= aDataCellPlayground.Top() && rPoint.Y() <= aDataCellPlayground.Bottom())
- {
- return true;
- }
- else
- return false;
- }
//--------------------------------------------------------------------
TableSize TableControl_Impl::impl_getVisibleRows( bool _bAcceptPartialRow ) const
{
@@ -1654,20 +1738,6 @@ namespace svt { namespace table
// ensure that the new cell is visible
ensureVisible( m_nCurColumn, m_nCurRow, false );
-
- // TODO: invalidate all and new column/row header, if present, to enforce
- // re-painting them
- //if(!m_nRowSelected.empty())
- //{
- // Rectangle rCells;
- // for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- // it!=m_nRowSelected.end();++it)
- // {
- // invalidateSelectedRow(*it,rCells);
- // }
- // m_nRowSelected.clear();
- //}
- // TODO: notify listeners about new position
return true;
}
@@ -1735,7 +1805,7 @@ namespace svt { namespace table
&& abs( nPixelDelta ) < aDataArea.GetHeight()
)
{
- m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE );
+ m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE | SCROLL_CHILDREN);
}
else
m_pDataWindow->Invalidate( INVALIDATE_UPDATE );
@@ -1791,42 +1861,310 @@ namespace svt { namespace table
return (TableSize)( m_nLeftColumn - nOldLeftColumn );
}
-
+ //-------------------------------------------------------------------------------
SelectionEngine* TableControl_Impl::getSelEngine()
{
return m_pSelEngine;
}
+ //-------------------------------------------------------------------------------
TableDataWindow* TableControl_Impl::getDataWindow()
{
return m_pDataWindow;
}
- BOOL TableControl_Impl::isRowSelected(::std::vector<RowPos> selectedRows, RowPos current)
+ //-------------------------------------------------------------------------------
+ ScrollBar* TableControl_Impl::getHorzScrollbar()
+ {
+ return m_pHScroll;
+ }
+ //-------------------------------------------------------------------------------
+ ScrollBar* TableControl_Impl::getVertScrollbar()
+ {
+ return m_pVScroll;
+ }
+ //-------------------------------------------------------------------------------
+ BOOL TableControl_Impl::isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current)
+ {
+ return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end();
+ }
+ //-------------------------------------------------------------------------------
+ bool TableControl_Impl::isRowSelected(RowPos current)
+ {
+ return ::std::find(m_nRowSelected.begin(),m_nRowSelected.end(),current) != m_nRowSelected.end();
+ }
+ //-------------------------------------------------------------------------------
+ int TableControl_Impl::getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current)
{
- for(::std::vector<RowPos>::iterator it=selectedRows.begin();
- it!=selectedRows.end();++it)
+ std::vector<RowPos>::const_iterator it = ::std::find(selectedRows.begin(),selectedRows.end(),current);
+ if ( it != selectedRows.end() )
{
- if(*it == current)
- return TRUE;
+ return it - selectedRows.begin();
}
- return FALSE;
+ return -1;
}
-
- int TableControl_Impl::getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current)
+ //-------------------------------------------------------------------------------
+ ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint )
{
- int pos = -1;
- int i = 0;
- for(std::vector<RowPos>::iterator it=selectedRows.begin();it!=selectedRows.end();++it)
+ ::rtl::OUString aTooltipText;
+ RowPos current = getCurrentRow(rPoint);
+ com::sun::star::uno::Sequence< sal_Int32 > cols = m_rAntiImpl.getColumnsForTooltip();
+ com::sun::star::uno::Sequence< ::rtl::OUString > text = m_rAntiImpl.getTextForTooltip();
+ if(text.getLength()==0 && cols.getLength()==0)
{
- if(*it == current)
- return pos = i;
- ++i;
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][m_nCurColumn];
+ aTooltipText = convertToString(content);
+ }
+ else if(text.getLength() == 0)
+ {
+ for(int i=0; i<cols.getLength(); i++)
+ {
+ if(i==0)
+ {
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ aTooltipText = convertToString(content);
+ }
+ else
+ {
+ aTooltipText+= ::rtl::OUString::createFromAscii("\n");
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ aTooltipText += convertToString(content);
+ }
+ }
}
- return pos;
+ else if(cols.getLength() == 0)
+ {
+ for(int i=0; i<text.getLength(); i++)
+ {
+ if(i==0)
+ aTooltipText = text[i];
+ else
+ {
+ aTooltipText+= ::rtl::OUString::createFromAscii("\n");
+ aTooltipText+= text[i];
+ }
+ }
+ }
+ else
+ {
+ int nCols = cols.getLength();
+ int mText = text.getLength();
+ if(nCols < mText )
+ cols.realloc(mText);
+ else if(mText < nCols)
+ text.realloc(nCols);
+ for(int i=0; i<cols.getLength(); i++)
+ {
+ if(i==0)
+ {
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ aTooltipText = text[i] + convertToString(content);
+ }
+ else
+ {
+ aTooltipText+= ::rtl::OUString::createFromAscii("\n");
+ aTooltipText+= text[i];
+ if(nCols > i)
+ {
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
+ aTooltipText += convertToString(content);
+ }
+ }
+ }
+ }
+ return m_aTooltipText = aTooltipText;
}
-
- void TableControl_Impl::setCellContent(CellEntryType* pCellEntryType)
+ //--------------------------------------------------------------------
+ void TableControl_Impl::resizeColumn(const Point& rPoint)
+ {
+ Pointer aNewPointer(POINTER_ARROW);
+ int headerRowWidth = 0;
+ if(m_pModel->hasRowHeaders())
+ headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ int resizingColumn=m_nCurColumn-m_nLeftColumn;
+ PColumnModel pColumn = m_pModel->getColumnModel(m_nCurColumn);
+ impl_ni_getAccVisibleColWidths();
+ int newColWidth = m_aColumnWidthsPixel[m_nCurColumn];
+ //subtract 1 from m_aAccColumnWidthPixel because right border should be part of the current cell
+ if(m_aVisibleColumnWidthsPixel[resizingColumn]-1 == rPoint.X() && pColumn->isResizable())
+ aNewPointer = Pointer( POINTER_HSPLIT );
+ //MouseButton was pressed but not yet released, mouse is moving
+ if(m_bResizing)
+ {
+ if(rPoint.X() > m_pDataWindow->GetOutputSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth)
+ aNewPointer = Pointer( POINTER_NOTALLOWED);
+ else
+ aNewPointer = Pointer( POINTER_HSPLIT );
+ m_pDataWindow->HideTracking();
+ int lineHeight = 0;
+ if(m_pModel->hasColumnHeaders())
+ lineHeight+= m_nColHeaderHeightPixel;
+ lineHeight+=m_nRowHeightPixel*m_nRowCount;
+ int gridHeight = m_pDataWindow->GetOutputSizePixel().Height();
+ if(lineHeight >= gridHeight)
+ lineHeight = gridHeight;
+ m_pDataWindow->ShowTracking(Rectangle(Point(rPoint.X(),0), Size(1, lineHeight )),
+ SHOWTRACK_SPLIT | SHOWTRACK_WINDOW);
+ }
+ m_pDataWindow->SetPointer(aNewPointer);
+ }
+ //--------------------------------------------------------------------
+ bool TableControl_Impl::startResizeColumn(const Point& rPoint)
+ {
+ m_bResizingGrid = false;
+ m_nResizingColumn = m_nCurColumn;
+ PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
+ if(m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-1 == rPoint.X() && pColumn->isResizable())
+ {
+ m_pDataWindow->CaptureMouse();
+ m_bResizing = true;
+ }
+ return m_bResizing;
+ }
+ //--------------------------------------------------------------------
+ bool TableControl_Impl::endResizeColumn(const Point& rPoint)
{
- (void)pCellEntryType;
+ if(m_bResizing)
+ {
+ m_pDataWindow->HideTracking();
+ PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
+ int maxWidth = pColumn->getMaxWidth();
+ int minWidth = pColumn->getMinWidth();
+ int resizeCol = m_nResizingColumn-m_nLeftColumn;
+ //new position of mouse
+ int actX = rPoint.X();
+ //old position of right border
+ int oldX = m_aVisibleColumnWidthsPixel[resizeCol];
+ //position of left border if cursor in the first cell
+ int leftX = 0;
+ if(m_nResizingColumn > m_nLeftColumn)
+ leftX = m_aVisibleColumnWidthsPixel[resizeCol-1];
+ else if(m_nResizingColumn == 0 && m_pModel->hasRowHeaders())
+ leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ int actWidth = actX - leftX;
+ int newActWidth = 0;
+ //minimize the column width
+ if(oldX > actX && actX >= leftX)
+ {
+ if(minWidth < actWidth)
+ {
+ newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width();
+ pColumn->setPreferredWidth(newActWidth);
+ }
+ else
+ pColumn->setPreferredWidth(minWidth);
+ if(m_nLeftColumn != 0)
+ impl_updateLeftColumn();
+ }
+ else if(oldX < actX)
+ {
+ if(actWidth < maxWidth)
+ {
+ newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width();
+ pColumn->setPreferredWidth(newActWidth);
+ }
+ else
+ pColumn->setPreferredWidth(maxWidth);
+ }
+ m_nCurColumn = m_nResizingColumn;
+ impl_ni_updateColumnWidths();
+ impl_ni_updateScrollbars();
+ m_pDataWindow->Invalidate(INVALIDATE_UPDATE);
+ m_pDataWindow->SetPointer(Pointer());
+ m_bResizing = false;
+ m_bResizingGrid = true;
+ }
+ m_pDataWindow->ReleaseMouse();
+ return m_bResizing;
+ }
+ //-------------------------------------------------------------------------------
+ void TableControl_Impl::impl_ni_getAccVisibleColWidths()
+ {
+ TableSize nVisCols = impl_getVisibleColumns(true);
+ int widthsPixel = 0;
+ m_aVisibleColumnWidthsPixel.resize(0);
+ m_aVisibleColumnWidthsPixel.reserve(nVisCols);
+ int headerRowWidth = 0;
+ if(m_pModel->hasRowHeaders())
+ {
+ headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ widthsPixel+=headerRowWidth;
+ }
+ int col = m_nLeftColumn;
+ while(nVisCols)
+ {
+ m_aVisibleColumnWidthsPixel.push_back(widthsPixel+=m_aColumnWidthsPixel[col]);
+ col++;
+ nVisCols--;
+ }
+ }
+ //-------------------------------------------------------------------------------
+ void TableControl_Impl::impl_updateLeftColumn()
+ {
+ int nVisCols = m_aVisibleColumnWidthsPixel.size();
+ int headerRowWidth = 0;
+ //sum of currently visible columns
+ int widthsPixel = 0;
+ //header pixel should be added, because header doesn't vanish when scrolling
+ if(m_pModel->hasRowHeaders())
+ {
+ headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ widthsPixel+=headerRowWidth;
+ }
+ int col = m_nLeftColumn;
+ //add column width of the neighbour of the left column
+ widthsPixel+=m_aColumnWidthsPixel[col-1];
+ //compute the sum of the new column widths
+ while(nVisCols)
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel(col);
+ int colWidth = pColumn->getWidth();
+ int colPrefWidth = pColumn->getPreferredWidth();
+ if(colPrefWidth!=0)
+ colWidth = colPrefWidth;
+ widthsPixel += m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
+ col++;
+ nVisCols--;
+ }
+ //when the sum of all visible columns and the next to the left column is smaller than
+ //window width, then update m_nLeftColumn
+ if(widthsPixel<m_pDataWindow->GetOutputSizePixel().Width())
+ m_nLeftColumn--;
+ }
+ //--------------------------------------------------------------------
+ rtl::OUString TableControl_Impl::convertToString(const ::com::sun::star::uno::Any& value)
+ {
+ sal_Int32 nInt = 0;
+ sal_Bool bBool = false;
+ double fDouble = 0;
+ ::rtl::OUString sNewString;
+ ::rtl::OUString sConvertString;
+ if(value >>= sConvertString)
+ sNewString = sConvertString;
+ else if(value >>= nInt)
+ sNewString = sConvertString.valueOf(nInt);
+ else if(value >>= bBool)
+ sNewString = sConvertString.valueOf(bBool);
+ else if(value >>= fDouble)
+ sNewString = sConvertString.valueOf(fDouble);
+ return sNewString;
+ }
+ Rectangle TableControl_Impl::calcHeaderRect(bool bColHeader)
+ {
+ Rectangle aRectTable, aRectTableWithHeaders;
+ impl_getAllVisibleDataCellArea(aRectTable);
+ impl_getAllVisibleCellsArea(aRectTableWithHeaders);
+ Size aSizeTable(aRectTable.GetSize());
+ Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
+ if(bColHeader)
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
+ else
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+ }
+ Rectangle TableControl_Impl::calcTableRect()
+ {
+ Rectangle aRect;
+ impl_getAllVisibleDataCellArea(aRect);
+ return aRect;
}
//--------------------------------------------------------------------
@@ -1842,34 +2180,33 @@ namespace svt { namespace table
return 0L;
}
-
//---------------------------------------------------------------------------------------
- TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl):
- m_pTableControl( _pTableControl)
- ,m_nCurrentRow (-2)
+ TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl)
+ :m_pTableControl( _pTableControl)
+ ,m_nCurrentRow (-2)
{
}
-
+ //-------------------------------------------------------------------------------
TableFunctionSet::~TableFunctionSet()
{
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::BeginDrag()
{
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::CreateAnchor()
{
m_pTableControl->m_nAnchor = m_pTableControl->m_nCurRow;
}
-
- void TableFunctionSet::DestroyAnchor()
- {
+ //-------------------------------------------------------------------------------
+ void TableFunctionSet::DestroyAnchor()
+ {
m_pTableControl->m_nAnchor = -1;
- }
-
- BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor)
- {
+ }
+ //-------------------------------------------------------------------------------
+ BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor)
+ {
BOOL bHandled = FALSE;
Rectangle rCells;
//curRow is the row where the mouse click happened, m_nCurRow is the last selected row, before the mouse click
@@ -1886,9 +2223,6 @@ namespace svt { namespace table
{
//selecting region,
int diff = m_pTableControl->m_nCurRow - curRow;
- //bool isAlreadySelected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, m_pTableControl->m_nAnchor);
- /* if(!isAlreadySelected && m_nCurrentRow != m_pTableControl->m_nCurRow)
- m_pTableControl->m_nRowSelected.push_back(m_nAnchor);*/
//selected region lies above the last selection
if( diff >= 0)
{
@@ -1924,9 +2258,7 @@ namespace svt { namespace table
else
{
if(m_pTableControl->m_nRowSelected.empty())
- {
m_pTableControl->m_nRowSelected.push_back(curRow);
- }
else
{
if(m_pTableControl->m_pSelEngine->GetSelectionMode()==SINGLE_SELECTION)
@@ -1943,14 +2275,14 @@ namespace svt { namespace table
}
if(m_pTableControl->m_nRowSelected.size()>1 && m_pTableControl->m_pSelEngine->GetSelectionMode()!=SINGLE_SELECTION)
m_pTableControl->m_pSelEngine->AddAlways(TRUE);
- m_pTableControl->invalidateSelectedRow(curRow,rCells);
+ m_pTableControl->invalidateSelectedRegion(curRow, curRow, rCells);
bHandled = TRUE;
}
m_pTableControl->m_nCurRow = curRow;
m_pTableControl->ensureVisible(m_pTableControl->m_nCurColumn,m_pTableControl->m_nCurRow,false);
return bHandled;
}
-
+ //-------------------------------------------------------------------------------
BOOL TableFunctionSet::IsSelectionAtPoint( const Point& rPoint )
{
m_pTableControl->m_pSelEngine->AddAlways(FALSE);
@@ -1965,7 +2297,7 @@ namespace svt { namespace table
return selected;
}
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::DeselectAtPoint( const Point& rPoint )
{
(void)rPoint;
@@ -1978,21 +2310,22 @@ namespace svt { namespace table
if(*it == m_nCurrentRow)
{
pos = i;
- m_pTableControl->invalidateSelectedRow(*it,rCells);
+ m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
}
++i;
}
m_pTableControl->m_nRowSelected.erase(m_pTableControl->m_nRowSelected.begin()+pos);
}
+ //-------------------------------------------------------------------------------
void TableFunctionSet::DeselectAll()
{
if(!m_pTableControl->m_nRowSelected.empty())
{
Rectangle rCells;
for(std::vector<RowPos>::iterator it=m_pTableControl->m_nRowSelected.begin();
- it!=m_pTableControl->m_nRowSelected.end();++it)
+ it!=m_pTableControl->m_nRowSelected.end();++it)
{
- m_pTableControl->invalidateSelectedRow(*it,rCells);
+ m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
}
m_pTableControl->m_nRowSelected.clear();
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index dc875cd137fe..0a487c77c76c 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -39,6 +39,7 @@
#include <vector>
#include <vcl/seleng.hxx>
+
class ScrollBar;
class ScrollBarBox;
@@ -62,60 +63,64 @@ namespace svt { namespace table
friend class TableRowGeometry;
friend class TableColumnGeometry;
friend class SuspendInvariants;
- friend class TableFunctionSet;
+ friend class TableFunctionSet;
private:
/// the control whose impl-instance we implemnt
- TableControl& m_rAntiImpl;
+ TableControl& m_rAntiImpl;
/// the model of the table control
- PTableModel m_pModel;
+ PTableModel m_pModel;
/// the input handler to use, usually the input handler as provided by ->m_pModel
- PTableInputHandler m_pInputHandler;
+ PTableInputHandler m_pInputHandler;
/// the widths of the single columns, measured in pixel
- ArrayOfLong m_aColumnWidthsPixel;
+ ArrayOfLong m_aColumnWidthsPixel;
/** the accumulated widths of the single columns, i.e. their exclusive right borders,
<strong<not</strong> counting the space for a possible row header column
*/
- ArrayOfLong m_aAccColumnWidthsPixel;
+ ArrayOfLong m_aAccColumnWidthsPixel;
+
+ ArrayOfLong m_aVisibleColumnWidthsPixel;
/// the height of a single row in the table, measured in pixels
- long m_nRowHeightPixel;
+ long m_nRowHeightPixel;
/// the height of the column header row in the table, measured in pixels
- long m_nColHeaderHeightPixel;
+ long m_nColHeaderHeightPixel;
/// the width of the row header column in the table, measured in pixels
- long m_nRowHeaderWidthPixel;
+ long m_nRowHeaderWidthPixel;
/// the number of columns in the table control. Cached model value.
- TableSize m_nColumnCount;
+ TableSize m_nColumnCount;
/// the number of rows in the table control. Cached model value.
- TableSize m_nRowCount;
+ TableSize m_nRowCount;
- ColPos m_nCurColumn;
- RowPos m_nCurRow;
- ColPos m_nLeftColumn;
- RowPos m_nTopRow;
+ ColPos m_nCurColumn;
+ RowPos m_nCurRow;
+ ColPos m_nLeftColumn;
+ RowPos m_nTopRow;
- sal_Int32 m_nCursorHidden;
+ sal_Int32 m_nCursorHidden;
/** the window to contain all data content, including header bars
The window's upper left corner is at position (0,0), relative to the
table control, which is the direct parent of the data window.
*/
- TableDataWindow* m_pDataWindow;
+ TableDataWindow* m_pDataWindow;
/// the vertical scrollbar, if any
- ScrollBar* m_pVScroll;
+ ScrollBar* m_pVScroll;
/// the horizontal scrollbar, if any
ScrollBar* m_pHScroll;
- ScrollBarBox* m_pScrollCorner;
- //selection engine - for determining selection range, e.g. single, multiple
- SelectionEngine* m_pSelEngine;
- //vector which contains the selected rows
- std::vector<RowPos> m_nRowSelected;
- //part of selection engine
- TableFunctionSet* m_pTableFunctionSet;
- //part of selection engine
- RowPos m_nAnchor;
-
-
+ ScrollBarBox* m_pScrollCorner;
+ //selection engine - for determining selection range, e.g. single, multiple
+ SelectionEngine* m_pSelEngine;
+ //vector which contains the selected rows
+ std::vector<RowPos> m_nRowSelected;
+ //part of selection engine
+ TableFunctionSet* m_pTableFunctionSet;
+ //part of selection engine
+ RowPos m_nAnchor;
+ bool m_bResizing;
+ ColPos m_nResizingColumn;
+ bool m_bResizingGrid;
+ rtl::OUString m_aTooltipText;
#if DBG_UTIL
#define INV_SCROLL_POSITION 1
@@ -146,7 +151,6 @@ namespace svt { namespace table
inline const TableControl& getAntiImpl() const { return m_rAntiImpl; }
inline TableControl& getAntiImpl() { return m_rAntiImpl; }
- void setCellContent(CellEntryType* pCellEntryType);
public:
TableControl_Impl( TableControl& _rAntiImpl );
@@ -181,53 +185,42 @@ namespace svt { namespace table
<TRUE/> if it's okay that the given cooordinate is only partially visible
*/
void ensureVisible( ColPos _nColumn, RowPos _nRow, bool _bAcceptPartialVisibility );
- /** returns the row, which contains the input point*/
- RowPos getCurrentRow (const Point& rPoint);
-
- void setCursorAtCurrentCell(const Point& rPoint);
- /** proves whether the vector with the selected rows contains the current row*/
- BOOL isRowSelected(::std::vector<RowPos> selectedRows, RowPos current);
- /** returns the position of the current row in the selecttion vector */
- int getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current);
- /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/
- void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
- /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/
- //vielleicht kann man mit den anderen verschmelzen, mit einer Überprüfung ob prev==curr?
- void invalidateSelectedRow( RowPos _nCurRow, Rectangle& _rCellRect );
- /** to be called when a new row is added to the control*/
- void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect );
- /** returns the vector, which contains the selected rows*/
- std::vector<RowPos>& getSelectedRows();
- /** updates the vector, which contains the selected rows after removing the row nRowPos*/
- void removeSelectedRow(RowPos _nRowPos);
- void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect );
- //virtual void DoubleClick();
-
+ /** returns the row, which contains the input point*/
+ virtual RowPos getCurrentRow (const Point& rPoint);
+
+ void setCursorAtCurrentCell(const Point& rPoint);
+ /** checks whether the vector with the selected rows contains the current row*/
+ BOOL isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current);
+
+ bool isRowSelected(RowPos current);
+ /** returns the position of the current row in the selection vector */
+ int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current);
+ /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/
+ void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
+ /** to be called when a new row is added to the control*/
+ void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect );
+ /** returns the vector, which contains the selected rows*/
+ std::vector<RowPos>& getSelectedRows();
+ /** updates the vector, which contains the selected rows after removing the row nRowPos*/
+ void removeSelectedRow(RowPos _nRowPos);
+ void invalidateRows();
// IAbstractTableControl
virtual void hideCursor();
virtual void showCursor();
virtual bool dispatchAction( TableControlAction _eAction );
- virtual bool isClickInVisibleArea(const Point& rPoint);
- virtual SelectionEngine* getSelEngine();
-
- TableDataWindow* getDataWindow();
- /** retrieves the area occupied by the totality of (at least partially) visible cells
-
- The returned area includes row and column headers. Also, it takes into
- account the the fact that there might be less columns than would normally
- find room in the control.
-
- As a result of respecting the partial visibility of rows and columns,
- the returned area might be larger than the data window's output size.
- */
- void impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const;
-
- /** retrieves the area occupied by all (at least partially) visible data cells.
-
- Effectively, the returned area is the same as returned by ->impl_getAllVisibleCellsArea,
- minus the row and column header areas.
- */
- void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const;
+ virtual SelectionEngine* getSelEngine();
+ virtual rtl::OUString& setTooltip(const Point& rPoint );
+ virtual void resizeColumn(const Point& rPoint);
+ virtual bool startResizeColumn(const Point& rPoint);
+ virtual bool endResizeColumn(const Point& rPoint);
+
+ TableDataWindow* getDataWindow();
+ ScrollBar* getHorzScrollbar();
+ ScrollBar* getVertScrollbar();
+
+ ::rtl::OUString convertToString(const ::com::sun::star::uno::Any& _value);
+ Rectangle calcHeaderRect(bool bColHeader);
+ Rectangle calcTableRect();
private:
/** toggles the cursor visibility
@@ -312,10 +305,30 @@ namespace svt { namespace table
column range were reached.
*/
TableSize impl_ni_ScrollColumns( TableSize _nRowDelta );
+ /** retrieves the area occupied by the totality of (at least partially) visible cells
+
+ The returned area includes row and column headers. Also, it takes into
+ account the the fact that there might be less columns than would normally
+ find room in the control.
+
+ As a result of respecting the partial visibility of rows and columns,
+ the returned area might be larger than the data window's output size.
+ */
+ void impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const;
+
+ /** retrieves the area occupied by all (at least partially) visible data cells.
+
+ Effectively, the returned area is the same as returned by ->impl_getAllVisibleCellsArea,
+ minus the row and column header areas.
+ */
+ void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const;
+
+ void impl_ni_getAccVisibleColWidths();
+ void impl_updateLeftColumn();
DECL_LINK( OnScroll, ScrollBar* );
};
- //see seleng.hxx, seleng.cxx, FunctionSet overwritables, part of selection engine
+ //see seleng.hxx, seleng.cxx, FunctionSet overridables, part of selection engine
class TableFunctionSet : public FunctionSet
{
friend class TableDataWindow;
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index 246710488b42..e307071e2699 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -30,6 +30,7 @@
#include "svtools/table/tablecontrol.hxx"
#include "svtools/table/tabledatawindow.hxx"
#include "tablecontrol_impl.hxx"
+#include <vcl/help.hxx>
//........................................................................
namespace svt { namespace table
@@ -44,10 +45,8 @@ namespace svt { namespace table
TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
:Window( &_rTableControl.getAntiImpl() )
,m_rTableControl ( _rTableControl )
+ ,m_nRowAlreadySelected( -1 )
{
- Color backgroundColor = m_rTableControl.getAntiImpl().GetSettings().GetStyleSettings().GetFieldColor();
- SetBackground( backgroundColor );
- SetControlBackground( backgroundColor );
}
//--------------------------------------------------------------------
@@ -55,28 +54,99 @@ namespace svt { namespace table
{
m_rTableControl.doPaintContent( rUpdateRect );
}
+ //--------------------------------------------------------------------
void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
{
+ Point aPoint = rMEvt.GetPosPixel();
if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) )
- Window::MouseMove( rMEvt );
+ {
+ if(m_rTableControl.getCurrentRow(aPoint)>=0 )
+ {
+ SetPointer(POINTER_ARROW);
+ rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint);
+ Help::EnableBalloonHelp();
+ Window::SetHelpText( rHelpText.getStr());
+ }
+ else if(m_rTableControl.getCurrentRow(aPoint) == -1)
+ {
+ if(Help::IsBalloonHelpEnabled())
+ Help::DisableBalloonHelp();
+ m_rTableControl.resizeColumn(aPoint);
+ }
+ else
+ {
+ if(Help::IsBalloonHelpEnabled())
+ Help::DisableBalloonHelp();
+ Window::MouseMove( rMEvt );
+ }
+ }
}
+ //--------------------------------------------------------------------
void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
+ Point aPoint = rMEvt.GetPosPixel();
+ RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint);
if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) )
Window::MouseButtonDown( rMEvt );
else
- m_aMouseButtonDownHdl.Call( (MouseEvent*) &rMEvt);
+ {
+ if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION)
+ {
+ if( m_nRowAlreadySelected != nCurRow )
+ {
+ m_nRowAlreadySelected = nCurRow;
+ m_aSelectHdl.Call( NULL );
+ }
+ else
+ m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
+ }
+ else
+ m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
+ }
m_rTableControl.getAntiImpl().LoseFocus();
}
+ //--------------------------------------------------------------------
void TableDataWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) )
Window::MouseButtonUp( rMEvt );
else
- m_aMouseButtonUpHdl.Call( (MouseEvent*) &rMEvt);
+ m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
m_rTableControl.getAntiImpl().GetFocus();
}
-
+ //--------------------------------------------------------------------
+ void TableDataWindow::SetPointer( const Pointer& rPointer )
+ {
+ Window::SetPointer(rPointer);
+ }
+ //--------------------------------------------------------------------
+ void TableDataWindow::CaptureMouse()
+ {
+ Window::CaptureMouse();
+ }
+ //--------------------------------------------------------------------
+ void TableDataWindow::ReleaseMouse( )
+ {
+ Window::ReleaseMouse();
+ }
+ // -----------------------------------------------------------------------
+ long TableDataWindow::Notify(NotifyEvent& rNEvt )
+ {
+ long nDone = 0;
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ nDone = HandleScrollCommand( rCEvt, m_rTableControl.getHorzScrollbar(), m_rTableControl.getVertScrollbar() );
+ }
+ }
+ }
+ return nDone ? nDone : Window::Notify( rNEvt );
+ }
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablegeometry.cxx b/svtools/source/table/tablegeometry.cxx
index 58bdb531c921..d60de9e6438f 100644
--- a/svtools/source/table/tablegeometry.cxx
+++ b/svtools/source/table/tablegeometry.cxx
@@ -49,8 +49,8 @@ namespace svt { namespace table
{
if ( m_nRowPos == ROW_COL_HEADERS )
{
- DBG_ASSERT( m_rControl.m_pModel->hasColumnHeaders(),
- "TableRowGeometry::TableRowGeometry: why asking for the geoemtry of the non-existent column header row?" );
+ //DBG_ASSERT( m_rControl.m_pModel->hasColumnHeaders(),
+ // "TableRowGeometry::TableRowGeometry: why asking for the geoemtry of the non-existent column header row?" );
m_aRect.Top() = 0;
m_aRect.Bottom() = m_rControl.m_nColHeaderHeightPixel - 1;
}
@@ -87,8 +87,8 @@ namespace svt { namespace table
{
if ( m_nColPos == COL_ROW_HEADERS )
{
- DBG_ASSERT( m_rControl.m_pModel->hasRowHeaders(),
- "TableColumnGeometry::TableColumnGeometry: why asking for the geoemtry of the non-existent row header column?" );
+/* DBG_ASSERT( m_rControl.m_pModel->hasRowHeaders(),
+ "TableColumnGeometry::TableColumnGeometry: why asking for the geoemtry of the non-existent row header column?" )*/;
m_aRect.Left() = 0;
m_aRect.Right() = m_rControl.m_nRowHeaderWidthPixel - 1;
}
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 80c31e65d4f1..b411181c2aab 100644..100755
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -28,6 +28,7 @@
#include "precompiled_svtools.hxx"
#include "svtxgridcontrol.hxx"
+#include "accessibletableimp.hxx"
#include <com/sun/star/view/SelectionType.hpp>
#include "svtools/table/gridtablerenderer.hxx"
#include "svtools/table/defaultinputhandler.hxx"
@@ -37,12 +38,17 @@
#include <rtl/ref.hxx>
#include <tools/debug.hxx>
#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/grid/GridInvalidDataException.hpp>
+#include <com/sun/star/awt/grid/GridInvalidModelException.hpp>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
using ::rtl::OUString;
using namespace ::svt::table;
@@ -63,7 +69,10 @@ SVTXGridControl::SVTXGridControl()
m_bHasColumnHeaders(false),
m_bHasRowHeaders(false),
m_bVScroll(false),
- m_bHScroll(false)
+ m_bHScroll(false),
+ m_bUpdate(false),
+ m_nSelectedRowCount(0),
+ m_aSelectionListeners( *this )
{
}
@@ -76,9 +85,10 @@ SVTXGridControl::~SVTXGridControl()
::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridColumnListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
}
@@ -90,36 +100,26 @@ IMPL_XTYPEPROVIDER_START( SVTXGridControl )
VCLXWindow::getTypes()
IMPL_XTYPEPROVIDER_END
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
TableControl* pTable = (TableControl*)GetWindow();
return pTable->GetCurrentRow( Point(x,y) );
}
+void SAL_CALL SVTXGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ pTable->setTooltip(text, columns);
+}
+
void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- (void)listener;
+ m_aSelectionListeners.addInterface(listener);
}
void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- (void) listener;
+ m_aSelectionListeners.removeInterface(listener);
}
void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
@@ -127,7 +127,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
::vos::OGuard aGuard( GetMutex() );
TableControl* pTable = (TableControl*)GetWindow();
-
switch( GetPropertyId( PropertyName ) )
{
case BASEPROPERTY_GRID_SELECTIONMODE:
@@ -155,6 +154,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
if( aValue >>= bHScroll )
{
m_bHScroll = bHScroll;
+ m_pTableModel->setHorizontalScrollbarVisibility(bHScroll);
}
break;
}
@@ -164,9 +164,11 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
if( aValue >>= bVScroll )
{
m_bVScroll = bVScroll;
+ m_pTableModel->setVerticalScrollbarVisibility(bVScroll);
}
break;
}
+
case BASEPROPERTY_GRID_SHOWROWHEADER:
{
sal_Bool rowHeader = true;
@@ -176,6 +178,66 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
break;
}
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ {
+ sal_Int32 colorHeader = 0x000000;
+ if( aValue >>= colorHeader )
+ {
+ m_pTableModel->setHeaderBackgroundColor(colorHeader);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ {
+ sal_Int32 colorLine = 0x000000;
+ if( aValue >>= colorLine )
+ {
+ m_pTableModel->setLineColor(colorLine);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
+ {
+ sal_Int32 colorEvenRow = 0x000000;
+ if( aValue >>= colorEvenRow )
+ {
+ m_pTableModel->setEvenRowBackgroundColor(colorEvenRow);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_ROW_BACKGROUND:
+ {
+ sal_Int32 colorBackground = 0x000000;
+ if( aValue >>= colorBackground )
+ {
+ m_pTableModel->setOddRowBackgroundColor(colorBackground);
+ }
+ break;
+ }
+ case BASEPROPERTY_TEXTCOLOR:
+ {
+ sal_Int32 colorText = 0xFFFFFF;
+ if( aValue >>= colorText )
+ {
+ m_pTableModel->setTextColor(colorText);
+ }
+ break;
+ }
+ case BASEPROPERTY_VERTICALALIGN:
+ {
+ com::sun::star::style::VerticalAlignment vAlign(com::sun::star::style::VerticalAlignment(0));
+ if( aValue >>= vAlign )
+ {
+ switch( vAlign )
+ {
+ case com::sun::star::style::VerticalAlignment_TOP: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break;
+ case com::sun::star::style::VerticalAlignment_MIDDLE: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(1)); break;
+ case com::sun::star::style::VerticalAlignment_BOTTOM: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(2)); break;
+ default: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break;
+ }
+ }
+ break;
+ }
case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
{
@@ -188,40 +250,97 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_DATAMODEL:
{
- m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
- Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData();
- Sequence<rtl::OUString> rowData(0);
- std::vector< std::vector< rtl::OUString > > aCellContent(0);
- for(int i = 0; i< m_xDataModel->getRowCount();++i)
{
- rowData = cellData[i];
- std::vector<rtl::OUString> newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData));
- if(newRow.size() < (unsigned)m_pTableModel->getColumnCount())
- newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
- aCellContent.push_back(newRow);
+ m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
+ if(m_xDataModel != NULL)
+ {
+ Sequence<Sequence< Any > > cellData = m_xDataModel->getData();
+ if(cellData.getLength()!= 0)
+ {
+ for (int i = 0; i < cellData.getLength(); i++)
+ {
+ std::vector< Any > newRow;
+ Sequence< Any > rawRowData = cellData[i];
+ //check whether the data row vector length matches with the column count
+ if(m_xColumnModel->getColumnCount() == 0)
+ {
+ for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn();
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ }
+ m_xColumnModel->setDefaultColumns(rawRowData.getLength());
+ }
+ else
+ if((unsigned int)rawRowData.getLength()!=(unsigned)m_pTableModel->getColumnCount())
+ throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel);
+
+ for ( int k = 0; k < rawRowData.getLength(); k++)
+ {
+ newRow.push_back(rawRowData[k]);
+ }
+ m_pTableModel->getCellContent().push_back(newRow);
+ }
+
+ Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
+ std::vector< rtl::OUString > newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
+ m_pTableModel->setRowCount(m_xDataModel->getRowCount());
+ m_pTableModel->setRowHeaderName(newRow);
+ }
+ }
+ else
+ throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel);
+ sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height();
+ if(m_xDataModel->getRowHeight() == 0)
+ {
+ m_pTableModel->setRowHeight(fontHeight);
+ m_xDataModel->setRowHeight(fontHeight);
+ }
+ else
+ m_pTableModel->setRowHeight(m_xDataModel->getRowHeight());
+ m_pTableModel->setRowHeaderWidth(m_xDataModel->getRowHeaderWidth());
}
- m_pTableModel->setCellContent(aCellContent);
- Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
- m_pTableModel->setRowCount(m_xDataModel->getRowCount());
- m_pTableModel->setRowHeaderName(newRow);
break;
}
case BASEPROPERTY_GRID_COLUMNMODEL:
{
m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
- Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
- std::vector<Reference< XGridColumn > > aNewColumns(
- comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
- /* if(m_pTable->GetColumnCount().size()>0)
- m_pTable->GetColumnName.clear();*/
- for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
+ if(m_xColumnModel != NULL)
{
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
- m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ if(m_xColumnModel->getColumnCount() != 0)
+ {
+ Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
+ std::vector<Reference< XGridColumn > > aNewColumns(
+ comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
+ sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height();
+ if(m_xColumnModel->getColumnHeaderHeight() == 0)
+ {
+ m_pTableModel->setColumnHeaderHeight(fontHeight);
+ m_xColumnModel->setColumnHeaderHeight(fontHeight);
+ }
+ else
+ m_pTableModel->setColumnHeaderHeight(m_xColumnModel->getColumnHeaderHeight());
+ for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
+ Reference< XGridColumn > xGridColumn = m_xColumnModel->getColumn(col);
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ tableColumn->setHorizontalAlign(xGridColumn->getHorizontalAlign());
+ tableColumn->setWidth(xGridColumn->getColumnWidth());
+ if(xGridColumn->getPreferredWidth() != 0)
+ tableColumn->setPreferredWidth(xGridColumn->getPreferredWidth());
+ if(xGridColumn->getMaxWidth() != 0)
+ tableColumn->setMaxWidth(xGridColumn->getMaxWidth());
+ if(xGridColumn->getMinWidth() != 0)
+ tableColumn->setMinWidth(xGridColumn->getMinWidth());
+ tableColumn->setResizable(xGridColumn->getResizeable());
+ }
+ }
}
+ else
+ throw GridInvalidModelException(rtl::OUString::createFromAscii("The column model isn't set!"), m_xColumnModel);
+
break;
}
default:
@@ -281,7 +400,11 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
BASEPROPERTY_GRID_DATAMODEL,
BASEPROPERTY_GRID_COLUMNMODEL,
- BASEPROPERTY_GRID_SELECTIONMODE,
+ BASEPROPERTY_GRID_SELECTIONMODE,
+ BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND,
+ BASEPROPERTY_GRID_HEADER_BACKGROUND,
+ BASEPROPERTY_GRID_LINE_COLOR,
+ BASEPROPERTY_GRID_ROW_BACKGROUND,
0);
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
@@ -291,7 +414,6 @@ void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun:
if ( pTable )
{
pTable->SetModel(PTableModel(m_pTableModel));
- //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) );
pTable->Show( bVisible );
}
}
@@ -303,17 +425,32 @@ void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeEx
}
void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- std::vector<OUString> aNewRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData));
- if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount())
- aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
- m_pTableModel->getCellContent().push_back(aNewRow);
+ std::vector< Any > newRow;
+ Sequence< Any > rawRowData = Event.rowData;
+ int colCount = m_xColumnModel->getColumnCount();
+ if(colCount == 0)
+ {
+ Reference<XGridColumnListener> listener(*this,UNO_QUERY_THROW);
+ m_xColumnModel->setDefaultColumns(rawRowData.getLength());
+ for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn();
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ m_xColumnModel->getColumn(col)->addColumnListener(listener);
+ }
+
+ }
+ else if((unsigned int)rawRowData.getLength()!=(unsigned)colCount)
+ throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel);
+
+ for ( int k = 0; k < rawRowData.getLength(); k++)
+ newRow.push_back(rawRowData[k]);
+ m_pTableModel->getCellContent().push_back(newRow);
if(m_pTableModel->hasRowHeaders())
m_pTableModel->getRowHeaderName().push_back(Event.headerName);
- m_pTableModel->setRowCount(m_pTableModel->getRowHeaderName().size());
+ m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
TableControl* pTable = (TableControl*)GetWindow();
- pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false);
- //pTable->GrabFocus();
+ pTable->InvalidateDataWindow(m_pTableModel->getCellContent().size()-1, 0, false);
if(pTable->isAccessibleAlive())
{
pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
@@ -335,9 +472,10 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD
void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
TableControl* pTable = (TableControl*)GetWindow();
- //unsigned int rows =m_pImpl->aCellContent.size()-1;
if(Event.index == -1)
{
+ if(!isSelectionEmpty())
+ deselectAllRows();
if(m_pTableModel->hasRowHeaders())
m_pTableModel->getRowHeaderName().clear();
m_pTableModel->getCellContent().clear();
@@ -348,76 +486,242 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri
Any());
}
}
- else
+ else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount())
{
- pTable->removeSelectedRow(Event.index);
- if(m_pTableModel->getCellContent().size()>1)
+ if(isSelectedIndex(Event.index))
{
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
- m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index);
-
- }
- else
- {
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().clear();
- m_pTableModel->getCellContent().clear();
- //m_pImpl->nRowCount=0;
+ Sequence<sal_Int32> selected(1);
+ selected[0]=Event.index;
+ deselectRows(selected);
}
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
+ std::vector<std::vector<Any> >::iterator rowPos =m_pTableModel->getCellContent().begin() + Event.index;
+ m_pTableModel->getCellContent().erase( rowPos );
}
- //pTable->InvalidateDataWindow(Event.index, true);
m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
- pTable->InvalidateDataWindow(Event.index, true);
+ pTable->InvalidateDataWindow(Event.index, Event.index, true);
if(pTable->isAccessibleAlive())
{
pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())),
Any());
- //pTable->commitGridControlEvent(CHILD,
- // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
- // Any());
- //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i)
- //{
- // pTable->commitGridControlEvent(
- // CHILD,
- // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ),
- // Any());
- //}
}
- //pTable->Invalidate();
}
+void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ if(Event.valueName == rtl::OUString::createFromAscii("ColumnResize"))
+ {
+ bool resizable = m_pTableModel->getColumnModel()[Event.index]->isResizable();
+ Event.newValue>>=resizable;
+ m_pTableModel->getColumnModel()[Event.index]->setResizable(resizable);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("ColWidth"))
+ {
+ sal_Int32 colWidth = m_pTableModel->getColumnModel()[Event.index]->getWidth();
+ Event.newValue>>=colWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setWidth(colWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("MaxWidth"))
+ {
+ sal_Int32 maxWidth = m_pTableModel->getColumnModel()[Event.index]->getMaxWidth();
+ Event.newValue>>=maxWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setMaxWidth(maxWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("MinWidth"))
+ {
+ sal_Int32 minWidth = m_pTableModel->getColumnModel()[Event.index]->getMinWidth();
+ Event.newValue>>=minWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setMinWidth(minWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("PrefWidth"))
+ {
+ sal_Int32 prefWidth = m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth();
+ Event.newValue>>=prefWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setPreferredWidth(prefWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("HAlign"))
+ {
+ ::com::sun::star::style::HorizontalAlignment hAlign = m_pTableModel->getColumnModel()[Event.index]->getHorizontalAlign();
+ Event.newValue>>=hAlign;
+ m_pTableModel->getColumnModel()[Event.index]->setHorizontalAlign(hAlign);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("UpdateWidth"))
+ {
+ if(m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth() != 0)
+ m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("PrefWidth"), m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth());
+ m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("ColWidth"), m_pTableModel->getColumnModel()[Event.index]->getWidth());
+ }
+ pTable->Invalidate();
+}
void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- (void) Event;
+ TableControl* pTable = (TableControl*)GetWindow();
+ if(Event.valueName == rtl::OUString::createFromAscii("RowHeight"))
+ {
+ sal_Int32 rowHeight = m_pTableModel->getRowHeight();
+ Event.newValue>>=rowHeight;
+ m_pTableModel->setRowHeight(rowHeight);
+ pTable->Invalidate();
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaderWidth"))
+ {
+ sal_Int32 rowHeaderWidth = m_pTableModel->getRowHeaderWidth();
+ Event.newValue>>=rowHeaderWidth;
+ m_pTableModel->setRowHeaderWidth(rowHeaderWidth);
+ pTable->Invalidate();
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaders"))
+ {
+ Sequence< rtl::OUString > headers(0);
+ Event.newValue>>=headers;
+ std::vector< rtl::OUString > headerNames( comphelper::sequenceToContainer <std::vector< rtl::OUString > >(headers) );
+ m_pTableModel->setRowHeaderName(headerNames);
+ pTable->Invalidate();
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("CellUpdated"))
+ {
+ std::vector< std::vector< Any > >& rowContent = m_pTableModel->getCellContent();
+ sal_Int32 col = -1;
+ Event.oldValue>>=col;
+ rowContent[Event.index][col] = Event.newValue;
+ pTable->InvalidateDataWindow(Event.index, Event.index, false);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("RowUpdated"))
+ {
+ std::vector<std::vector< Any > >& rowContent = m_pTableModel->getCellContent();
+ Sequence< sal_Int32 > cols(0);
+ Sequence< Any > values(0);
+ Event.oldValue>>=cols;
+ Event.newValue>>=values;
+ for(int i = 0; i< cols.getLength(); i++)
+ {
+ if(cols[i]>=0 && cols[i]<m_pTableModel->getColumnCount())
+ rowContent[Event.index][cols[i]]=values[i];
+ else
+ break;
+ }
+ pTable->InvalidateDataWindow(Event.index, Event.index, false);
+ }
}
- void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
- {
+void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
+{
VCLXWindow::disposing( Source );
- }
+}
::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
{
- return 0;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(selectedRows.empty())
+ return -1;
+ else
+ {
+ std::vector<RowPos>::iterator itStart = selectedRows.begin();
+ std::vector<RowPos>::iterator itEnd = selectedRows.end();
+ return *(std::min_element(itStart, itEnd));
+ }
}
::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
{
- return 0;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(selectedRows.empty())
+ return -1;
+ else
+ {
+ std::vector<RowPos>::iterator itStart = selectedRows.begin();
+ std::vector<RowPos>::iterator itEnd = selectedRows.end();
+ return *(std::max_element(itStart, itEnd));
+ }
+}
+
+void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ if(eSelMode != NO_SELECTION)
+ {
+ sal_Int32 start = rangeOfRows[0];
+ int seqSize = rangeOfRows.getLength();
+ sal_Int32 end = rangeOfRows[seqSize-1];
+ if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount()))
+ {
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(!selectedRows.empty())
+ selectedRows.clear();
+ if(eSelMode == SINGLE_SELECTION)
+ {
+ if(rangeOfRows.getLength() == 1)
+ selectedRows.push_back(start);
+ else
+ return;
+ }
+ else
+ {
+ for(int i=0;i<seqSize;i++)
+ selectedRows.push_back(rangeOfRows[i]);
+ }
+ pTable->selectionChanged(true);
+ pTable->InvalidateDataWindow(start, end, false);
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+ }
}
-void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- (void)length;
- (void)start;
+ TableControl* pTable = (TableControl*)GetWindow();
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ if(eSelMode != NO_SELECTION)
+ {
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(!selectedRows.empty())
+ selectedRows.clear();
+ for(int i=0;i<m_pTableModel->getRowCount();i++)
+ selectedRows.push_back(i);
+ pTable->Invalidate();
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ std::vector<RowPos>::iterator itStart = selectedRows.begin();
+ std::vector<RowPos>::iterator itEnd = selectedRows.end();
+ sal_Int32 start = rangeOfRows[0];
+ sal_Int32 end = rangeOfRows[rangeOfRows.getLength()-1];
+ if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount()))
+ {
+ std::vector<RowPos>::iterator iter = std::find(itStart, itEnd, start);
+ selectedRows.erase(iter, iter+(end-start)+1);
+ pTable->selectionChanged(true);
+ pTable->InvalidateDataWindow(start, end, false);
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
}
-void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- (void)end;
- (void)start;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(!selectedRows.empty())
+ selectedRows.clear();
+ pTable->Invalidate();
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
}
::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
@@ -435,21 +739,138 @@ void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int
::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
{
- return sal_False;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(selectedRows.empty())
+ return sal_True;
+ else
+ return sal_False;
}
::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
- (void)index;
- return sal_False;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ return std::find(selectedRows.begin(),selectedRows.end(), index) != selectedRows.end();
}
-void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
- (void)y;
+ if(index<0 || index>=m_pTableModel->getRowCount())
+ return;
+ TableControl* pTable = (TableControl*)GetWindow();
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ if(eSelMode != NO_SELECTION)
+ {
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(eSelMode == MULTIPLE_SELECTION)
+ {
+ if(!isSelectedIndex(index))
+ selectedRows.push_back(index);
+ else
+ return;
+ }
+ else if(eSelMode == SINGLE_SELECTION)
+ {
+ if(!selectedRows.empty())
+ {
+ if(!isSelectedIndex(index))
+ deselectRows(getSelection());
+ else
+ return;
+ }
+ selectedRows.push_back(index);
+ }
+ pTable->selectionChanged(true);
+ pTable->InvalidateDataWindow(index, index, false);
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
}
void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
{
(void)x;
}
+void SVTXGridControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ m_aSelectionListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABLEROW_SELECT:
+ {
+ TableControl* pTable = (TableControl*)GetWindow();
+
+ if( pTable )
+ {
+ if ( m_aSelectionListeners.getLength() )
+ {
+ ImplCallItemListeners();
+ }
+ }
+ }
+ break;
+
+ default:
+ VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+void SVTXGridControl::ImplCallItemListeners()
+{
+ TableControl* pTable = (TableControl*) GetWindow();
+ if ( pTable && m_aSelectionListeners.getLength() )
+ {
+ ::std::vector<sal_Int32> selRows = pTable->GetSelectedRows();
+ ::com::sun::star::awt::grid::GridSelectionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Column = 0;
+ sal_Int32 actSelRowCount = selRows.size();
+ sal_Int32 diff = actSelRowCount - m_nSelectedRowCount;
+ //row added to selection
+ if(diff >= 1)
+ {
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(0);
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Range = diff;
+ }
+ //selected row changed
+ else if(diff == 0)
+ {
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
+ aEvent.Range = 0;
+ }
+ else
+ {
+ //selection changed: multiple row deselected, only 1 row is selected
+ if(actSelRowCount == 1)
+ {
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
+ }
+ //row is deselected
+ else
+ {
+ aEvent.Row = pTable->GetCurrentRow();
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(1);
+ }
+ aEvent.Range = 0;
+ }
+ m_nSelectedRowCount=actSelRowCount;
+ m_aSelectionListeners.selectionChanged( aEvent );
+ }
+}
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index 8e6931d0d805..bcb8badf72e5 100644..100755
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -32,21 +32,23 @@
#include <svtools/table/tablecontrol.hxx>
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
#include <com/sun/star/awt/grid/GridDataEvent.hpp>
+#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/awt/vclxwindows.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/implbase2.hxx>
-//#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
using namespace ::svt::table;
-class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
- ::com::sun::star::awt::grid::XGridDataListener>
+class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
+ ::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener>
{
private:
UnoControlTableModel* m_pTableModel;
@@ -56,34 +58,42 @@ private:
bool m_bHasRowHeaders;
bool m_bVScroll;
bool m_bHScroll;
+ bool m_bUpdate;
+ sal_Int32 m_nSelectedRowCount;
+ SelectionListenerMultiplexer m_aSelectionListeners;
+
+protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ void ImplCallItemListeners();
public:
- SVTXGridControl();
+ SVTXGridControl();
~SVTXGridControl();
//XGridDataListener overridables
virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+
+ //XGridColumnListener overridables
+ virtual void SAL_CALL columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
- void SAL_CALL release() throw() { VCLXWindow::release(); }
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
+ void SAL_CALL release() throw() { VCLXWindow::release(); }
// ::com::sun::star::lang::XTypeProvider
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
//::com::sun::star::awt::grid::XGridControl
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException);
-
virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
@@ -93,11 +103,15 @@ public:
virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException);
void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
};
#endif // _SVT_GRIDCONTROL_HXX_
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index febb187fb289..d239ee3c740d 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -42,21 +42,32 @@
using ::rtl::OUString;
using namespace ::svt::table;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn)
:m_nID( 0 )
,m_sName()
- ,m_bIsResizable( false )
- ,m_nWidth( 10 * 100 ) // 1 cm
- ,m_nMinWidth( 0 ) // no min width
- ,m_nMaxWidth( 0 ) // no max width
+ ,m_bIsResizable( true )
+ ,m_nWidth( 4 )
+ ,m_nMinWidth( 0 )
+ ,m_nMaxWidth( 0 )
+ ,m_nPrefWidth ( 0 )
+ ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0))
+ {
+ m_sName = m_xGridColumn->getTitle();
+ }
+ //--------------------------------------------------------------------
+ UnoControlTableColumn::UnoControlTableColumn()
+ :m_nID( 0 )
+ ,m_sName()
+ ,m_bIsResizable( true )
+ ,m_nWidth( 4 )
+ ,m_nMinWidth( 0 )
+ ,m_nMaxWidth( 0 )
+ ,m_nPrefWidth ( 0 )
+ ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0))
{
- //m_nID = m_xGridColumn->getIdentifier();
- //m_nWidth = m_xGridColumn->getColumnWidth();
- m_sName = m_xGridColumn->getTitle();
}
//--------------------------------------------------------------------
@@ -68,11 +79,7 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
bool UnoControlTableColumn::setID( const ColumnID _nID )
{
- // TODO: conflict check
-
m_nID = _nID;
- // TODO: notifications?
-
return true;
}
@@ -86,9 +93,7 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setName( const String& _rName )
{
m_sName = _rName;
- // TODO: notifications?
}
-
//--------------------------------------------------------------------
bool UnoControlTableColumn::isResizable() const
{
@@ -99,7 +104,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setResizable( bool _bResizable )
{
m_bIsResizable = _bResizable;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -112,7 +116,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setWidth( TableMetrics _nWidth )
{
m_nWidth = _nWidth;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -125,7 +128,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setMinWidth( TableMetrics _nMinWidth )
{
m_nMinWidth = _nMinWidth;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -138,7 +140,28 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setMaxWidth( TableMetrics _nMaxWidth )
{
m_nMaxWidth = _nMaxWidth;
- // TODO: notifications?
+ }
+ //--------------------------------------------------------------------
+ TableMetrics UnoControlTableColumn::getPreferredWidth() const
+ {
+ return m_nPrefWidth;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableColumn::setPreferredWidth( TableMetrics _nPrefWidth )
+ {
+ m_nPrefWidth = _nPrefWidth;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::style::HorizontalAlignment UnoControlTableColumn::getHorizontalAlign()
+ {
+ return m_xHorizontalAlign;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableColumn::setHorizontalAlign( com::sun::star::style::HorizontalAlignment _align )
+ {
+ m_xHorizontalAlign = _align;
}
//====================================================================
@@ -146,30 +169,46 @@ using namespace ::com::sun::star::awt::grid;
//====================================================================
struct UnoControlTableModel_Impl
{
- ::std::vector< PColumnModel >& aColumns;
+ ::std::vector< PColumnModel > aColumns;
TableSize nRowCount;
bool bHasColumnHeaders;
bool bHasRowHeaders;
+ bool bVScroll;
+ bool bHScroll;
PTableRenderer pRenderer;
PTableInputHandler pInputHandler;
TableMetrics nRowHeight;
TableMetrics nColumnHeaderHeight;
TableMetrics nRowHeaderWidth;
- std::vector<rtl::OUString>& aRowHeadersTitle;
- std::vector<std::vector<rtl::OUString> >& aCellContent;
+ std::vector<rtl::OUString> aRowHeadersTitle;
+ std::vector<std::vector< Any > > aCellContent;
+ ::com::sun::star::util::Color m_xLineColor;
+ ::com::sun::star::util::Color m_xHeaderColor;
+ ::com::sun::star::util::Color m_xTextColor;
+ ::com::sun::star::util::Color m_xRowColor1;
+ ::com::sun::star::util::Color m_xRowColor2;
+ ::com::sun::star::style::VerticalAlignment m_xVerticalAlign;
UnoControlTableModel_Impl()
- :aColumns ( *(new std::vector< PColumnModel> (0)))
- ,nRowCount ( 0 )
+ :aColumns ( )
+ ,nRowCount ( 0 )
,bHasColumnHeaders ( false )
,bHasRowHeaders ( false )
+ ,bVScroll ( false )
+ ,bHScroll ( false )
,pRenderer ( )
,pInputHandler ( )
- ,nRowHeight ( 4 * 100 ) // 40 mm
- ,nColumnHeaderHeight( 5 * 100 ) // 50 mm
- ,nRowHeaderWidth ( 10 * 100 ) // 50 mm
- ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0)))
- ,aCellContent ( *(new std::vector<std::vector<OUString> >(0)))
+ ,nRowHeight ( 0 )
+ ,nColumnHeaderHeight( 0 )
+ ,nRowHeaderWidth ( 10 )
+ ,aRowHeadersTitle ( )
+ ,aCellContent ( )
+ ,m_xLineColor ( 0xFFFFFF )
+ ,m_xHeaderColor ( 0xFFFFFF )
+ ,m_xTextColor ( 0 )//black as default
+ ,m_xRowColor1 ( 0xFFFFFF )
+ ,m_xRowColor2 ( 0xFFFFFF )
+ ,m_xVerticalAlign (com::sun::star::style::VerticalAlignment(0))
{
}
};
@@ -196,7 +235,6 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
TableSize UnoControlTableModel::getColumnCount() const
{
- //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount());
return (TableSize)m_pImpl->aColumns.size();
}
@@ -250,7 +288,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableModel::addTableModelListener( const PTableModelListener& listener )
{
(void) listener;
- //listener->onTableModelChanged(PTableModel(this));
// TODO
DBG_ERROR( "DefaultTableModel::addTableModelListener: not yet implemented!" );
}
@@ -321,6 +358,17 @@ using namespace ::com::sun::star::awt::grid;
DBG_ASSERT( hasRowHeaders(), "DefaultTableModel::getRowHeaderWidth: invalid call!" );
return m_pImpl->nRowHeaderWidth;
}
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setColumnHeaderHeight(TableMetrics _nHeight)
+ {
+ m_pImpl->nColumnHeaderHeight = _nHeight;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setRowHeaderWidth(TableMetrics _nWidth)
+ {
+ m_pImpl->nRowHeaderWidth = _nWidth;
+ }
//--------------------------------------------------------------------
void UnoControlTableModel::SetTitleHeight( TableMetrics _nHeight )
@@ -341,7 +389,7 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
{
- if(overAllHeight>=actHeight)// && !m_bVScroll)
+ if(overAllHeight>=actHeight && !m_pImpl->bVScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
@@ -350,59 +398,116 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
{
- if(overAllWidth>=actWidth)// && !m_bHScroll)
+ if(overAllWidth>=actWidth && !m_pImpl->bHScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
}
//--------------------------------------------------------------------
- void UnoControlTableModel::setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)
+ void UnoControlTableModel::setVerticalScrollbarVisibility(bool _bVScroll) const
{
- //if(cellContent.empty())
- //{
- // unsigned int i = m_pImpl->aColumns.size();
- // std::vector<rtl::OUString>& emptyCells;
- // while(i!=0)
- // {
- // cellContent.push_back(emptyCells);
- // --i;
- // }
- //}
- //std::vector<rtl::OUString> cCC;
- //for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter)
- //{
- // cCC = *iter;
- // m_pImpl->aCellContent.push_back(cCC);
- //}
- m_pImpl->aCellContent.swap( cellContent );
+ m_pImpl->bVScroll = _bVScroll;
}
- std::vector<std::vector<rtl::OUString> >& UnoControlTableModel::getCellContent()
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setHorizontalScrollbarVisibility(bool _bHScroll) const
{
- return m_pImpl->aCellContent;
+ m_pImpl->bHScroll = _bHScroll;
+ }
+ //--------------------------------------------------------------------
+ bool UnoControlTableModel::hasVerticalScrollbar()
+ {
+ return m_pImpl->bVScroll;
+ }
+ //--------------------------------------------------------------------
+ bool UnoControlTableModel::hasHorizontalScrollbar()
+ {
+ return m_pImpl->bHScroll;
+ }
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setCellContent(const std::vector<std::vector< Any > >& cellContent)
+ {
+ m_pImpl->aCellContent = cellContent;
}
+ std::vector<std::vector< Any > >& UnoControlTableModel::getCellContent()
+ {
+ return m_pImpl->aCellContent;
+ }
//--------------------------------------------------------------------
- void UnoControlTableModel::setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)
+ void UnoControlTableModel::setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)
{
- if(cellColumnContent.empty())
- {
- unsigned int i = m_pImpl->aColumns.size();
- while(i!=0)
- {
- cellColumnContent.push_back(rtl::OUString::createFromAscii(""));
- --i;
- }
- }
- for(::std::vector<rtl::OUString>::iterator iter = cellColumnContent.begin(); iter!= cellColumnContent.end();++iter)
- {
- rtl::OUString s = *iter;
- m_pImpl->aRowHeadersTitle.push_back(*iter);
- }
+ m_pImpl->aRowHeadersTitle = cellColumnContent;
}
std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName()
{
return m_pImpl->aRowHeadersTitle;
}
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getLineColor()
+ {
+ return m_pImpl->m_xLineColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setLineColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xLineColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getHeaderBackgroundColor()
+ {
+ return m_pImpl->m_xHeaderColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setHeaderBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xHeaderColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getTextColor()
+ {
+ return m_pImpl->m_xTextColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setTextColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xTextColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getOddRowBackgroundColor()
+ {
+ return m_pImpl->m_xRowColor1;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setOddRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xRowColor1 = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getEvenRowBackgroundColor()
+ {
+ return m_pImpl->m_xRowColor2;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setEvenRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xRowColor2 = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign()
+ {
+ return m_pImpl->m_xVerticalAlign;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setVerticalAlign( com::sun::star::style::VerticalAlignment _xAlign )
+ {
+ m_pImpl->m_xVerticalAlign = _xAlign;
+ }
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index 5be4ff2a16f7..c00642448f79 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -41,7 +41,9 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-//#include <toolkit/helper/listenermultiplexer.hxx>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
using namespace ::svt::table;
@@ -49,7 +51,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt::grid;
class UnoControlTableColumn : public IColumnModel
- {
+{
private:
ColumnID m_nID;
String m_sName;
@@ -57,9 +59,12 @@ class UnoControlTableColumn : public IColumnModel
TableMetrics m_nWidth;
TableMetrics m_nMinWidth;
TableMetrics m_nMaxWidth;
+ TableMetrics m_nPrefWidth;
+ ::com::sun::star::style::HorizontalAlignment m_xHorizontalAlign;
public:
UnoControlTableColumn(Reference<XGridColumn>);
+ UnoControlTableColumn();
// IColumnModel overridables
virtual ColumnID getID() const;
@@ -74,12 +79,16 @@ class UnoControlTableColumn : public IColumnModel
virtual void setMinWidth( TableMetrics _nMinWidth );
virtual TableMetrics getMaxWidth() const;
virtual void setMaxWidth( TableMetrics _nMaxWidth );
- };
+ virtual TableMetrics getPreferredWidth() const;
+ virtual void setPreferredWidth( TableMetrics _nPrefWidth );
+ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign();
+ virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign);
+};
- struct UnoControlTableModel_Impl;
+struct UnoControlTableModel_Impl;
- class UnoControlTableModel : public ITableModel
- {
+class UnoControlTableModel : public ITableModel
+{
private:
UnoControlTableModel_Impl* m_pImpl;
@@ -91,6 +100,10 @@ class UnoControlTableColumn : public IColumnModel
inline TableMetrics GetRowHeight() const { return getRowHeight(); }
/// sets a new row height.
void setRowHeight( TableMetrics _nHeight );
+ /// sets a new row header width.
+ void setRowHeaderWidth( TableMetrics _nWidth );
+ /// sets a new column header height.
+ void setColumnHeaderHeight( TableMetrics _nHeight );
/// returns the height of the title row (containing the column headers)
inline TableMetrics GetTitleHeight() const { return getColumnHeaderHeight(); }
@@ -107,23 +120,21 @@ class UnoControlTableColumn : public IColumnModel
/// retrieves the width of a column, in 1/100th millimeters
inline TableMetrics GetColumnWidth( ColPos _nColumn );
- // TODO: setters and getters for ID, Name, Resizable, MinWidth, MaxWidth
-
public:
// ITableModel overridables
virtual TableSize getColumnCount() const;
virtual TableSize getRowCount() const;
- virtual void setColumnCount(TableSize _nColCount);
+ virtual void setColumnCount(TableSize _nColCount);
virtual void setRowCount(TableSize _nRowCount);
virtual bool hasColumnHeaders() const;
virtual bool hasRowHeaders() const;
- virtual void setRowHeaders(bool _bRowHeaders);
- virtual void setColumnHeaders(bool _bColumnHeaders);
+ virtual void setRowHeaders(bool _bRowHeaders);
+ virtual void setColumnHeaders(bool _bColumnHeaders);
virtual bool isCellEditable( ColPos col, RowPos row ) const;
virtual void addTableModelListener( const PTableModelListener& listener );
virtual void removeTableModelListener( const PTableModelListener& listener );
virtual PColumnModel getColumnModel( ColPos column );
- virtual std::vector<PColumnModel>& getColumnModel();
+ virtual std::vector<PColumnModel>& getColumnModel();
virtual PColumnModel getColumnModelByID( ColumnID id );
virtual PTableRenderer getRenderer() const;
virtual PTableInputHandler getInputHandler() const;
@@ -132,19 +143,35 @@ class UnoControlTableColumn : public IColumnModel
virtual TableMetrics getRowHeaderWidth() const;
virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const;
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const;
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent);
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent();
- virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent);
- virtual std::vector<rtl::OUString>& getRowHeaderName();
- };
-
- inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
- {
+ virtual void setVerticalScrollbarVisibility(bool _bVScroll) const;
+ virtual void setHorizontalScrollbarVisibility(bool _bHScroll) const;
+ virtual void setCellContent(const std::vector<std::vector< Any > >& cellContent);
+ virtual std::vector<std::vector< Any > >& getCellContent();
+ virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent);
+ virtual std::vector<rtl::OUString>& getRowHeaderName();
+ virtual ::com::sun::star::util::Color getLineColor();
+ virtual void setLineColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getHeaderBackgroundColor();
+ virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getTextColor();
+ virtual void setTextColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getOddRowBackgroundColor();
+ virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getEvenRowBackgroundColor();
+ virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign();
+ virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
+ virtual bool hasVerticalScrollbar();
+ virtual bool hasHorizontalScrollbar();
+};
+
+inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
+{
getColumnModel( _nColumn )->setWidth( _nWidth100thMM );
- }
+}
- inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn )
- {
- return getColumnModel( _nColumn )->getWidth();
- }
+inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn )
+{
+ return getColumnModel( _nColumn )->getWidth();
+}
#endif // _UNOCONTROL_TABLEMODEL_HXX_
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 5f3aa24394a3..01dc2c0591cc 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -831,6 +831,18 @@ void SvxSearchDialog::CalculateDelta_Impl()
pMoreBtn->AddWindow( &aNoFormatBtn );
}
+ if (bDrawApp || bImpressApp)
+ {
+ // "Find All" button is hidden--align "Find" vertically to the
+ // search listbox
+ Point aNewPt(aSearchBtn.GetPosPixel());
+ const Size aBtnSz(aSearchBtn.GetSizePixel());
+ const Size aLBSz(aSearchLB.GetSizePixel());
+ const int nOff((aLBSz.Height() - aBtnSz.Height()) / 2);
+ aNewPt.Y() = aSearchLB.GetPosPixel().Y() + nOff;
+ aSearchBtn.SetPosPixel(aNewPt);
+ }
+
if ( bDrawApp )
{
// Draw App: "Regular expressions" and "Search for Styles" check boxes are hidden
@@ -1016,6 +1028,8 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern )
if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_DRAW )
{
+ aSearchAllBtn.Hide();
+
aRegExpBtn.Hide();
aLayoutBtn.Hide();
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 1e79962736aa..13b8e758ce12 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -577,6 +577,37 @@ void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
}
//----------------------------------------------------------------------
+// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ if(mpModel)
+ {
+ SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ basegfx::B2DHomMatrix aTransform;
+ const double fMMToTWIPS(72.0 / 127.0);
+
+ aTransform.scale(fMMToTWIPS, fMMToTWIPS);
+ rPolyPolygon.transform(aTransform);
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+ }
+}
+// <--
+
+//----------------------------------------------------------------------
void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
{
DBG_TESTSOLARMUTEX();
@@ -604,6 +635,38 @@ void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
}
//----------------------------------------------------------------------
+// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
+ if(mpModel)
+ {
+ eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ basegfx::B2DHomMatrix aTransform;
+ const double fTWIPSToMM(127.0 / 72.0);
+ aTransform.scale(fTWIPSToMM, fTWIPSToMM);
+ rPolyPolygon.transform(aTransform);
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("Missing unit translation to 100th mm!");
+ }
+ }
+ }
+ }
+}
+// <--
+//----------------------------------------------------------------------
+
+
//----------------------------------------------------------------------
void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
SfxItemSet& rSet, uno::Reference< beans::XPropertySet > xSet, const SfxItemPropertyMap* pMap )
@@ -635,7 +698,6 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet&
{
if(rSet.GetPool()->IsWhich(pEntry->nWID))
rSet.Put(rSet.GetPool()->GetDefaultItem(pEntry->nWID));
-
// setzen
SvxItemPropertySet_setPropertyValue(rPropSet, pEntry, *pUsrAny, rSet);
}
@@ -650,7 +712,6 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet&
}
-
void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
{
DBG_TESTSOLARMUTEX();
@@ -2505,10 +2566,15 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
if( rValue >>= aUnoPoint )
{
Point aPoint( aUnoPoint.X, aUnoPoint.Y );
+
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ // perform metric change before applying anchor position,
+ // because the anchor position is in pool metric.
+ ForceMetricToItemPoolMetric( aPoint );
+ // <--
if( mpModel->IsWriter() )
aPoint += mpObj->GetAnchorPos();
- ForceMetricToItemPoolMetric( aPoint );
pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
return true;
}
@@ -2532,6 +2598,9 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
if ( rValue >>= aPolyPoly )
{
basegfx::B2DPolyPolygon aNewPolyPolygon( SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aPolyPoly ) );
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ ForceMetricToItemPoolMetric( aNewPolyPolygon );
+ // <--
if( mpModel->IsWriter() )
{
Point aPoint( mpObj->GetAnchorPos() );
@@ -2554,6 +2623,9 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
{
Point aPoint( aUnoPoint.X, aUnoPoint.Y );
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ ForceMetricToItemPoolMetric( aPoint );
+ // <--
if( mpModel->IsWriter() )
aPoint += mpObj->GetAnchorPos();
@@ -2970,6 +3042,9 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
Point aPoint( mpObj->GetAnchorPos() );
aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
}
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
+ ForceMetricTo100th_mm( aPolyPoly );
+ // <--
drawing::PolyPolygonBezierCoords aRetval;
SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
rValue <<= aRetval;
@@ -2990,6 +3065,9 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
if( mpModel->IsWriter() )
aPoint -= mpObj->GetAnchorPos();
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
+ ForceMetricTo100th_mm( aPoint );
+ // <--
awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
rValue <<= aUnoPoint;
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 217ff06a8be1..cf3a4a779487 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -199,6 +199,8 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
inline void TryDeleteSwpHints();
+ SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet);
+
public:
bool IsWordCountDirty() const;
bool IsWrongDirty() const;
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 782161557753..0e52ce256754 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -24,8 +24,11 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _SHELLIO_HXX
-#define _SHELLIO_HXX
+#ifndef SW_SHELLIO_HXX
+#define SW_SHELLIO_HXX
+
+#include <memory>
+#include <boost/utility.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/embed/XStorage.hpp>
@@ -431,7 +434,9 @@ extern BOOL SetHTMLTemplate( SwDoc &rDoc ); //Fuer Vorlagen aus HTML.vor laden s
class IDocumentSettingAccess;
class IDocumentStylePoolAccess;
-class SW_DLLPUBLIC Writer : public SvRefBase
+class SW_DLLPUBLIC Writer
+ : public SvRefBase
+ , private ::boost::noncopyable
{
SwAsciiOptions aAscOpts;
String sBaseURL;
@@ -439,10 +444,10 @@ class SW_DLLPUBLIC Writer : public SvRefBase
void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont );
void _AddFontItems( SfxItemPool& rPool, USHORT nWhichId );
+ ::std::auto_ptr<Writer_Impl> m_pImpl;
+
protected:
- Writer_Impl* pImpl;
- SvStream* pStrm;
SwPaM* pOrigPam; // der letze zu bearbeitende Pam
const String* pOrigFileName;
@@ -534,12 +539,8 @@ public:
inline SvStream& OutLong( long nVal ) { return OutLong( Strm(), nVal ); }
inline SvStream& OutULong( ULONG nVal ) { return OutULong( Strm(), nVal ); }
- void SetStrm( SvStream& rStrm ) { pStrm = &rStrm; }
-#ifndef DBG_UTIL
- SvStream& Strm() { return *pStrm; }
-#else
+ void SetStream(SvStream *const pStream);
SvStream& Strm();
-#endif
void SetOrganizerMode( BOOL bSet ) { bOrganizerMode = bSet; }
};
diff --git a/sw/inc/unoflatpara.hxx b/sw/inc/unoflatpara.hxx
index caacec514174..acc004d473ab 100644
--- a/sw/inc/unoflatpara.hxx
+++ b/sw/inc/unoflatpara.hxx
@@ -29,6 +29,7 @@
#define _UNOFLATPARA_HXX
#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/text/XFlatParagraph.hpp>
#include <com/sun/star/text/XFlatParagraphIterator.hpp>
#include <calbck.hxx>
@@ -51,9 +52,10 @@ class SwDoc;
******************************************************************************/
class SwXFlatParagraph:
- public ::cppu::WeakImplHelper1
+ public ::cppu::WeakImplHelper2
<
- css::text::XFlatParagraph
+ css::text::XFlatParagraph,
+ css::lang::XUnoTunnel
>,
public SwXTextMarkup
{
@@ -85,6 +87,12 @@ public:
const SwTxtNode* getTxtNode() const;
+ static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId)
+ throw (css::uno::RuntimeException);
+
private:
SwXFlatParagraph( const SwXFlatParagraph & ); // not defined
SwXFlatParagraph & operator = ( const SwXFlatParagraph & ); // not defined
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
index fa06142ea627..1213bfaea896 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -242,7 +242,7 @@ void SwRect::Justify()
}
if ( m_Size.getWidth() < 0 )
{
- m_Point.Y() += m_Size.getWidth() + 1;
+ m_Point.X() += m_Size.getWidth() + 1;
m_Size.setWidth(-m_Size.getWidth());
}
}
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 000da4987cbf..71dc70106245 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1109,8 +1109,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
case POS_EQUAL:
case POS_INSIDE:
- // TODO Check if there is any side effect
- //delete pNewRedl, pNewRedl = 0;
+ delete pNewRedl, pNewRedl = 0;
break;
case POS_OUTSIDE:
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 08b5038a5c0d..9c2ce7af3139 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -919,6 +919,12 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
bool bCopyBookmarks = true;
BOOL bStartIsTxtNode = 0 != pSttTxtNd;
+ // #i104585# copy outline num rule to clipboard (for ASCII filter)
+ if (pDoc->IsClipBoard() && GetOutlineNumRule())
+ {
+ pDoc->SetOutlineNumRule(*GetOutlineNumRule());
+ }
+
// --> OD 2009-08-25 #i86492#
// Correct the search for a previous list:
// First search for non-outline numbering list. Then search for non-outline
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 190cb5ecdf36..d6d13316a1e9 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -235,10 +235,7 @@ BOOL SwFEShell::SelectObj( const Point& rPt, BYTE nFlag, SdrObject *pObj )
if( bForget )
{
pDView->UnmarkAll();
- if ( pTmpObj )
- pDView->MarkObj( pTmpObj, Imp()->GetPageView(), bAddSelect, bEnterGroup );
- else
- pDView->MarkObj( rPt, MINMOVE );
+ pDView->MarkObj( pTmpObj, Imp()->GetPageView(), bAddSelect, bEnterGroup );
break;
}
}
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 3ddd3189bf6c..4ad6c773db1d 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -157,14 +157,16 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
if( !pTxtAttr )
return;
+ // don't do anything, especially not expand!
+ if( pNew && pNew->Which() == RES_OBJECTDYING )
+ return;
+
SwTxtNode* pTxtNd = (SwTxtNode*)&pTxtAttr->GetTxtNode();
ASSERT( pTxtNd, "wo ist denn mein Node?" );
if( pNew )
{
switch( pNew->Which() )
{
- case RES_OBJECTDYING:
- return; // don't do anything, especially not expand!
case RES_TXTATR_FLDCHG:
// "Farbe hat sich geaendert !"
// this, this fuer "nur Painten"
@@ -189,6 +191,8 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
case RES_FMT_CHG:
pTxtNd->Modify( pOld, pNew );
return;
+ default:
+ break;
}
}
@@ -265,6 +269,11 @@ SwTxtFld::SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStartPos )
SwTxtFld::~SwTxtFld( )
{
+ SwFmtFld & rFmtFld( static_cast<SwFmtFld &>(GetAttr()) );
+ if (this == rFmtFld.pTxtAttr)
+ {
+ rFmtFld.pTxtAttr = 0; // #i110140# invalidate!
+ }
}
/*************************************************************************
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 7b08a0cb87e4..ff79d2266ba7 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -444,8 +444,6 @@ USHORT SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& rOut
void SwFntObj::CreateScrFont( const ViewShell& rSh, const OutputDevice& rOut )
{
-static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring";
-
if ( pScrFont )
return;
@@ -481,6 +479,10 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring";
pScrFont = pPrtFont;
FontMetric aMet = pPrt->GetFontMetric( );
+ //Don't loose "faked" properties of the logical font that don't truly
+ //exist in the physical font metrics which vcl which fake up for us
+ aMet.SetWeight(pScrFont->GetWeight());
+ aMet.SetItalic(pScrFont->GetItalic());
bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet();
@@ -490,178 +492,6 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring";
if ( USHRT_MAX == nExtLeading )
nExtLeading = static_cast<USHORT>(aMet.GetExtLeading());
-#if OSL_DEBUG_LEVEL > 1
- const XubString aDbgTxt1( pPrtFont->GetName() );
- const XubString aDbgTxt2( aMet.GetName() );
-#endif
-
- if ( aMet.IsDeviceFont( ) )
- {
- if ( (RTL_TEXTENCODING_DONTKNOW == pPrtFont->GetCharSet() ||
- FAMILY_DONTKNOW == pPrtFont->GetFamily() ||
- PITCH_DONTKNOW == pPrtFont->GetPitch() ) &&
- (RTL_TEXTENCODING_DONTKNOW == aMet.GetCharSet() ||
- FAMILY_DONTKNOW == aMet.GetFamily() ||
- PITCH_DONTKNOW == aMet.GetPitch() ) )
- {
- // Das folgende ist teuer, aber selten: ein unbekannter Font
- // kann vom Drucker nicht vernuenftig zugeordnet werden. Dann
- // nehmen wir eben das Mapping des Bildschirms in Anspruch und
- // setzen den Familyname, Charset und Pitch wie dort. Dieser
- // Font wird nun nochmals auf dem Drucker eingestellt.
- Font aFnt1 = pOut->GetFontMetric();
- Font aFnt2( *pPrtFont );
-
- if (RTL_TEXTENCODING_DONTKNOW == pPrtFont->GetCharSet())
- aFnt2.SetCharSet( aFnt1.GetCharSet() );
- if (FAMILY_DONTKNOW == pPrtFont->GetFamily())
- aFnt2.SetFamily( aFnt1.GetFamily() );
- if (PITCH_DONTKNOW == pPrtFont->GetPitch())
- aFnt2.SetPitch( aFnt1.GetPitch() );
-
- pPrt->SetFont( aFnt2 );
- aMet = pPrt->GetFontMetric( );
- }
-
- const XubString aStandardStr( sStandardString,
- RTL_TEXTENCODING_MS_1252 );
-
- // This is the reference width
- const long nOWidth = pPrt->GetTextWidth( aStandardStr );
-
- // Let's have a look what's the difference to the width
- // calculated for the output device using the font set at the
- // reference device
- long nSWidth = nOWidth - pOut->GetTextWidth( aStandardStr );
- nScrHeight = (USHORT) pOut->GetTextHeight();
-
- // Um Aerger mit dem Generic Printer aus dem Wege zu gehen.
- if( aMet.GetSize().Height() )
- {
- BOOL bScrSymbol = FALSE;
- CharSet ePrtChSet = aMet.GetCharSet();
- // NoSymbol bedeutet, dass der Drucker sich fuer einen
- // Nicht-Symbol-Font entschieden hat.
- BOOL bNoSymbol = ( RTL_TEXTENCODING_DONTKNOW != ePrtChSet &&
- RTL_TEXTENCODING_SYMBOL != ePrtChSet );
- if ( bNoSymbol )
- bScrSymbol = RTL_TEXTENCODING_SYMBOL ==
- pOut->GetFontMetric().GetCharSet();
- Size aTmp( aMet.GetSize() );
-
- if( aTmp.Width() && !pPrtFont->GetSize().Width() )
- {
- aTmp.Width() = 0;
- aMet.SetSize( aTmp );
- }
-
- // Now we set the metrics used at the reference device at the
- // output device
- pOut->SetFont( aMet );
-
- if( bNoSymbol && ( bScrSymbol != ( RTL_TEXTENCODING_SYMBOL ==
- pOut->GetFontMetric().GetCharSet() ) ) )
- {
- // Hier landen wir, wenn der Drucker keinen Symbolfont waehlt,
- // aber genau einer der beiden Screenfonts ein Symbolfont ist.
- // Wir nehmen dann eben den anderen.
- if ( bScrSymbol )
- pScrFont = new Font( aMet ); // mit Abgleich
- else
- pOut->SetFont( *pPrtFont ); // ohne Abgleich
- }
- else
- {
- // Let's have a look what's the difference to the width
- // calculated for the output device using the metrics set at
- // the reference device
- long nPWidth = nOWidth - pOut->GetTextWidth( aStandardStr );
-
- // We prefer smaller fonts
- BYTE nNeg = 0;
- if ( nSWidth<0 ) { nSWidth *= -2; nNeg = 1; }
- if ( nPWidth<0 ) { nPWidth *= -2; nNeg |= 2; }
-
- // nSWidth = Difference between string width on reference device
- // and string width on output device with user font set.
- // nPWidth = Difference between string width on reference device
- // and string width on output device with metric obtained
- // from reference device.
- // We prefer to take the font with the smaller deviation,
- // exception: keep the original font unless the deviation
- // is really bad (at least 3%)
- // Since the test string is neither localized nor has a high resemblance
- // of the "real text for this font" a higher deviation is reasonable
-
- if ( (nSWidth <= nPWidth)
- || (nSWidth * 32 <= nOWidth ) )
- {
- // No adjustment, we take the same font for the output
- // device like for the reference device
- pOut->SetFont( *pPrtFont );
- pScrFont = pPrtFont;
- nPWidth = nSWidth;
- nNeg &= 1;
- }
- else
- {
- // The metrics give a better result. So we build
- // a new font for the output device based on the
- // metrics used at the reference device
- pScrFont = new Font( aMet ); // mit Abgleich
- nSWidth = nPWidth;
- nNeg &= 2;
- }
-
- //
- // now pScrFont is set to the better font and this should
- // be set at the output device
- //
-
- // we still have to check if the choosed font is not to wide
- if( nNeg && nOWidth )
- {
- nPWidth *= 100;
- nPWidth /= nOWidth;
-
- // if the screen font is too wide, we try to reduce
- // the font height and get a smaller one
- if( nPWidth > 25 )
- {
- if( nPWidth > 80 )
- nPWidth = 80;
- nPWidth = 100 - nPWidth/4;
- Size aTmpSize = pScrFont->GetSize();
- aTmpSize.Height() *= nPWidth;
- aTmpSize.Height() /= 100;
- if( aTmpSize.Width() )
- {
- aTmpSize.Width() *= nPWidth;
- aTmpSize.Width() /= 100;
- }
- Font *pNew = new Font( *pScrFont );
- pNew->SetSize( aTmpSize );
- pOut->SetFont( *pNew );
- nPWidth = nOWidth -
- pOut->GetTextWidth( aStandardStr );
- if( nPWidth < 0 ) { nPWidth *= -2; }
- if( nPWidth < nSWidth )
- {
- if( pScrFont != pPrtFont )
- delete pScrFont;
- pScrFont = pNew;
- }
- else
- {
- delete pNew;
- pOut->SetFont( *pScrFont );
- }
- }
- }
- }
- }
- }
-
// reset the original reference device font
pPrt->SetFont( aOldPrtFnt );
}
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index 0cdf431ca2e6..c4c78fd6d59d 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -367,7 +367,7 @@ bool SwpHintsArray::Check() const
CHECK_ERR( !isCHRATR(nWhich),
"HintsCheck: Character attribute in end array" );
- // 8) portion check
+ // 8) style portion check
#if OSL_DEBUG_LEVEL > 1
const SwTxtAttr* pHtThis = m_HintStarts[i];
const SwTxtAttr* pHtLast = i > 0 ? m_HintStarts[i-1] : 0;
@@ -375,11 +375,19 @@ bool SwpHintsArray::Check() const
( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
- ( *pHtThis->GetStart() == *pHtLast->GetStart() && *pHtThis->GetEnd() == *pHtLast->GetEnd() ) ||
- ( *pHtThis->GetStart() == *pHtThis->GetEnd() ),
+ ( ( ( (*pHtThis->GetStart() == *pHtLast->GetStart())
+ && (*pHtThis->GetEnd() == *pHtLast->GetEnd())
+ ) // same range
+ || (*pHtThis->GetStart() == *pHtThis->GetEnd())
+ )
+ && ( (pHtThis->Which() != RES_TXTATR_AUTOFMT)
+ || (pHtLast->Which() != RES_TXTATR_AUTOFMT)
+ ) // never two AUTOFMT on same range
+ ),
"HintsCheck: Portion inconsistency. "
"This can be temporarily ok during undo operations" );
+ // 9) nesting portion check
if (pHtThis->IsNesting())
{
for ( USHORT j = 0; j < Count(); ++j )
@@ -397,7 +405,7 @@ bool SwpHintsArray::Check() const
}
}
- // 9) dummy char check (unfortunately cannot check SwTxtNode::m_Text)
+ // 10) dummy char check (unfortunately cannot check SwTxtNode::m_Text)
if (pHtThis->HasDummyChar())
{
for ( USHORT j = 0; j < i; ++j )
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index a2e326777383..ff2a40cdd9eb 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -773,7 +773,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
// For each attribute in the automatic style check if it
// is also set the the new character style:
- SfxItemSet aNewSet( *pOldStyle->GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END );
+ SfxItemSet aNewSet( *pOldStyle->GetPool(),
+ aCharAutoFmtSetRange);
SfxItemIter aItemIter( *pOldStyle );
const SfxPoolItem* pItem = aItemIter.GetCurItem();
while( TRUE )
@@ -2059,25 +2060,202 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
return rSet.Count() ? TRUE : FALSE;
}
-int lcl_IsNewAttrInSet( const SwpHints& rHints, const SfxPoolItem& rItem,
- const xub_StrLen nEnd )
+
+namespace
+{
+
+typedef std::pair<USHORT, USHORT> AttrSpan_t;
+typedef std::multimap<AttrSpan_t, const SwTxtAttr*> AttrSpanMap_t;
+
+
+struct IsAutoStyle
{
- int bIns = TRUE;
- for( USHORT i = 0; i < rHints.Count(); ++i )
+ bool
+ operator()(const AttrSpanMap_t::value_type& i_rAttrSpan)
+ const
{
- const SwTxtAttr *pOther = rHints[ i ];
- if( *pOther->GetStart() )
- break;
+ return i_rAttrSpan.second && i_rAttrSpan.second->Which() == RES_TXTATR_AUTOFMT;
+ }
+};
+
+
+/** Removes from io_rAttrSet all items that are set by style on the
+ given span.
+ */
+struct RemovePresentAttrs
+{
+ RemovePresentAttrs(SfxItemSet& io_rAttrSet)
+ : m_rAttrSet(io_rAttrSet)
+ {
+ }
+
+ void
+ operator()(const AttrSpanMap_t::value_type& i_rAttrSpan)
+ const
+ {
+ if (!i_rAttrSpan.second)
+ {
+ return;
+ }
- if( pOther->GetEnd() &&
- *pOther->GetEnd() == nEnd &&
- ( pOther->IsCharFmtAttr() || pOther->Which() == rItem.Which() ) )
+ const SwTxtAttr* const pAutoStyle(i_rAttrSpan.second);
+ SfxItemIter aIter(m_rAttrSet);
+ const SfxPoolItem* pItem(aIter.GetCurItem());
+ while (true)
+ {
+ const USHORT nWhich(pItem->Which());
+ if (CharFmt::IsItemIncluded(nWhich, pAutoStyle))
+ {
+ m_rAttrSet.ClearItem(nWhich);
+ }
+
+ if (aIter.IsAtEnd())
+ {
+ break;
+ }
+ pItem = aIter.NextItem();
+ }
+ }
+
+private:
+ SfxItemSet& m_rAttrSet;
+};
+
+
+/** Collects all style-covered spans from i_rHints to o_rSpanMap. In
+ addition inserts dummy spans with pointer to format equal to 0 for
+ all gaps (i.e. spans not covered by any style). This simplifies
+ creation of autostyles for all needed spans, but it means all code
+ that tries to access the pointer has to check if it's non-null!
+ */
+void
+lcl_CollectHintSpans(const SwpHints& i_rHints, const USHORT nLength,
+ AttrSpanMap_t& o_rSpanMap)
+{
+ USHORT nLastEnd(0);
+
+ for (USHORT i(0); i != i_rHints.Count(); ++i)
+ {
+ const SwTxtAttr* const pHint(i_rHints[i]);
+ const USHORT nWhich(pHint->Which());
+ if (nWhich == RES_TXTATR_CHARFMT || nWhich == RES_TXTATR_AUTOFMT)
+ {
+ const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd());
+ o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint));
+
+ if (aSpan.first != nLastEnd)
+ {
+ // insert dummy span covering the gap
+ o_rSpanMap.insert(AttrSpanMap_t::value_type(
+ AttrSpan_t(nLastEnd, aSpan.first), 0));
+ }
+
+ nLastEnd = aSpan.second;
+ }
+ }
+
+ // no hints at the end (special case: no hints at all in i_rHints)
+ if (nLastEnd != nLength && nLength != 0)
+ {
+ o_rSpanMap.insert(
+ AttrSpanMap_t::value_type(AttrSpan_t(nLastEnd, nLength), 0));
+ }
+}
+
+
+void
+lcl_FillWhichIds(const SfxItemSet& i_rAttrSet, std::vector<USHORT>& o_rClearIds)
+{
+ o_rClearIds.reserve(i_rAttrSet.Count());
+ SfxItemIter aIter(i_rAttrSet);
+ const SfxPoolItem* pItem(aIter.GetCurItem());
+ while (true)
+ {
+ o_rClearIds.push_back(pItem->Which());
+
+ if (aIter.IsAtEnd())
{
- bIns = FALSE;
break;
}
+ pItem = aIter.NextItem();
+ }
+}
+
+struct SfxItemSetClearer
+{
+ SfxItemSet & m_rItemSet;
+ SfxItemSetClearer(SfxItemSet & rItemSet) : m_rItemSet(rItemSet) { }
+ void operator()(USHORT const nWhich) { m_rItemSet.ClearItem(nWhich); }
+};
+
+}
+
+
+/** Does the hard work of SwTxtNode::FmtToTxtAttr: the real conversion
+ of items to automatic styles.
+ */
+void
+SwTxtNode::impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet)
+{
+ typedef AttrSpanMap_t::iterator AttrSpanMap_iterator_t;
+ AttrSpanMap_t aAttrSpanMap;
+
+ if (i_rAttrSet.Count() == 0)
+ {
+ return;
+ }
+
+ // 1. Identify all spans in hints' array
+
+ lcl_CollectHintSpans(*m_pSwpHints, m_Text.Len(), aAttrSpanMap);
+
+ // 2. Go through all spans and insert new attrs
+
+ AttrSpanMap_iterator_t aCurRange(aAttrSpanMap.begin());
+ const AttrSpanMap_iterator_t aEnd(aAttrSpanMap.end());
+ while (aCurRange != aEnd)
+ {
+ typedef std::pair<AttrSpanMap_iterator_t, AttrSpanMap_iterator_t>
+ AttrSpanMapRange_t;
+ AttrSpanMapRange_t aRange(aAttrSpanMap.equal_range(aCurRange->first));
+
+ // 2a. Collect attributes to insert
+
+ SfxItemSet aCurSet(i_rAttrSet);
+ std::for_each(aRange.first, aRange.second, RemovePresentAttrs(aCurSet));
+
+ // 2b. Insert automatic style containing the collected attributes
+
+ if (aCurSet.Count() != 0)
+ {
+ AttrSpanMap_iterator_t aAutoStyleIt(
+ std::find_if(aRange.first, aRange.second, IsAutoStyle()));
+ if (aAutoStyleIt != aRange.second)
+ {
+ // there already is an automatic style on that span:
+ // create new one and remove the original one
+ SwTxtAttr* const pAutoStyle(const_cast<SwTxtAttr*>(aAutoStyleIt->second));
+ const boost::shared_ptr<SfxItemSet> pOldStyle(
+ static_cast<const SwFmtAutoFmt&>(
+ pAutoStyle->GetAttr()).GetStyleHandle());
+ aCurSet.Put(*pOldStyle);
+
+ // remove the old hint
+ m_pSwpHints->Delete(pAutoStyle);
+ DestroyAttr(pAutoStyle);
+ }
+ m_pSwpHints->Insert(
+ MakeTxtAttr(*GetDoc(), aCurSet,
+ aCurRange->first.first, aCurRange->first.second));
+ }
+
+ aCurRange = aRange.second;
}
- return bIns;
+
+ // 3. Clear items from the node
+ std::vector<USHORT> aClearedIds;
+ lcl_FillWhichIds(i_rAttrSet, aClearedIds);
+ ClearItemsFromAttrSet(aClearedIds);
}
void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
@@ -2090,91 +2268,79 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
if( pNd == this )
{
- if( aThisSet.Count() )
- {
- SfxItemIter aIter( aThisSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- std::vector<USHORT> aClearWhichIds;
-
- while ( true )
- {
- if (lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ))
- {
- m_pSwpHints->SwpHintsArray::Insert(
- MakeTxtAttr( *GetDoc(),
- const_cast<SfxPoolItem&>(*pItem),
- 0, GetTxt().Len() ) );
- aClearWhichIds.push_back( pItem->Which() );
- }
-
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
- }
-
- ClearItemsFromAttrSet( aClearWhichIds );
- }
+ impl_FmtToTxtAttr(aThisSet);
}
else
{
+ // There are five possible combinations of items from this and
+ // pNd (pNd is the 'main' node):
+ //
+ // case pNd this action
+ // ----------------------------------------------------
+ // 1 - - do nothing
+ // 2 - a convert item to attr of this
+ // 3 a - convert item to attr of pNd
+ // 4 a a clear item in this
+ // 5 a b convert item to attr of this
+
SfxItemSet aNdSet( pNd->GetDoc()->GetAttrPool(), aCharFmtSetRange );
if( pNd->HasSwAttrSet() && pNd->GetpSwAttrSet()->Count() )
aNdSet.Put( *pNd->GetpSwAttrSet() );
pNd->GetOrCreateSwpHints();
+ std::vector<USHORT> aProcessedIds;
+
if( aThisSet.Count() )
{
SfxItemIter aIter( aThisSet );
- const SfxPoolItem* pItem = aIter.GetCurItem(), *pNdItem;
+ const SfxPoolItem* pItem = aIter.GetCurItem(), *pNdItem = 0;
+ SfxItemSet aConvertSet( GetDoc()->GetAttrPool(), aCharFmtSetRange );
std::vector<USHORT> aClearWhichIds;
- while( TRUE )
+ while( true )
{
- if( ( SFX_ITEM_SET != aNdSet.GetItemState( pItem->Which(), FALSE,
- &pNdItem ) || *pItem != *pNdItem ) &&
- lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ) )
+ if( SFX_ITEM_SET == aNdSet.GetItemState( pItem->Which(), FALSE, &pNdItem ) )
{
- m_pSwpHints->SwpHintsArray::Insert( MakeTxtAttr( *GetDoc(),
- const_cast<SfxPoolItem&>(*pItem),
- 0, GetTxt().Len() ) );
- aClearWhichIds.push_back( pItem->Which() );
+ if (*pItem == *pNdItem) // 4
+ {
+ aClearWhichIds.push_back( pItem->Which() );
+ }
+ else // 5
+ {
+ aConvertSet.Put(*pItem);
+ }
+ aProcessedIds.push_back(pItem->Which());
+ }
+ else // 2
+ {
+ aConvertSet.Put(*pItem);
}
- aNdSet.ClearItem( pItem->Which() );
if( aIter.IsAtEnd() )
break;
pItem = aIter.NextItem();
}
+
+ // 4/ clear items of this that are set with the same value on pNd
ClearItemsFromAttrSet( aClearWhichIds );
+
+ // 2, 5/ convert all other items to attrs
+ impl_FmtToTxtAttr(aConvertSet);
}
- if( aNdSet.Count() )
{
- SfxItemIter aIter( aNdSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- std::vector<USHORT> aClearWhichIds;
+ std::for_each(aProcessedIds.begin(), aProcessedIds.end(),
+ SfxItemSetClearer(aNdSet));
- while ( true )
- {
- if ( lcl_IsNewAttrInSet( *pNd->m_pSwpHints, *pItem,
- pNd->GetTxt().Len() ) )
- {
- pNd->m_pSwpHints->SwpHintsArray::Insert(
- MakeTxtAttr( *pNd->GetDoc(),
- const_cast<SfxPoolItem&>(*pItem),
- 0, pNd->GetTxt().Len() ) );
- }
- aClearWhichIds.push_back( pItem->Which() );
+ // 3/ convert items to attrs
+ pNd->impl_FmtToTxtAttr(aNdSet);
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ if( aNdSet.Count() )
+ {
+ SwFmtChg aTmp1( pNd->GetFmtColl() );
+ pNd->SwModify::Modify( &aTmp1, &aTmp1 );
}
-
- pNd->ClearItemsFromAttrSet( aClearWhichIds );
- SwFmtChg aTmp1( pNd->GetFmtColl() );
- pNd->SwModify::Modify( &aTmp1, &aTmp1 );
}
}
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index ec04b3d3db8c..2923b4e46317 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -30,6 +30,7 @@
#include <editeng/unolingu.hxx>
+#include <unobaseclass.hxx>
#include <unoflatpara.hxx>
#include <vos/mutex.hxx>
@@ -265,6 +266,24 @@ css::uno::Sequence< ::sal_Int32 > SAL_CALL SwXFlatParagraph::getLanguagePortions
return css::uno::Sequence< ::sal_Int32>();
}
+
+const uno::Sequence< sal_Int8 >&
+SwXFlatParagraph::getUnoTunnelId()
+{
+ static uno::Sequence<sal_Int8> aSeq(CreateUnoTunnelId());
+ return aSeq;
+}
+
+
+sal_Int64 SAL_CALL
+SwXFlatParagraph::getSomething(
+ const uno::Sequence< sal_Int8 >& rId)
+ throw (uno::RuntimeException)
+{
+ return sw::UnoTunnelImpl(rId, this);
+}
+
+
/******************************************************************************
* SwXFlatParagraphIterator
******************************************************************************/
@@ -426,8 +445,9 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co
if (!mpDoc)
return xRet;
- text::XFlatParagraph* pFP = xPara.get();
- SwXFlatParagraph* pFlatParagraph = static_cast<SwXFlatParagraph*>(pFP);
+ const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
+ OSL_ASSERT(xFPTunnel.is());
+ SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel));
if ( !pFlatParagraph )
return xRet;
@@ -472,8 +492,9 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c
if (!mpDoc)
return xRet;
- text::XFlatParagraph* pFP = xPara.get();
- SwXFlatParagraph* pFlatParagraph = static_cast<SwXFlatParagraph*>(pFP);
+ const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
+ OSL_ASSERT(xFPTunnel.is());
+ SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel));
if ( !pFlatParagraph )
return xRet;
@@ -508,4 +529,3 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c
return xRet;
}
-
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index eadaea834d80..9249d4e5d11b 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -169,7 +169,14 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
SwASC_AttrIter aAttrIter( (SwASCWriter&)rWrt, rNd, nStrPos );
if( !nStrPos && rWrt.bExportPargraphNumbering )
- rWrt.Strm().WriteUnicodeOrByteText( rNd.GetNumString() );
+ {
+ String numString( rNd.GetNumString() );
+ if (numString.Len())
+ {
+ numString.Append(' ');
+ rWrt.Strm().WriteUnicodeOrByteText(numString);
+ }
+ }
String aStr( rNd.GetTxt() );
if( rWrt.bASCII_ParaAsBlanc )
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index a569f91e5966..7dcb732df601 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -510,12 +510,12 @@ void OutRTF_SwFlyFrmFmt( SwRTFWriter& rRTFWrt )
// ueberhaupt eigene Attribute gibt !
SvMemoryStream aTmpStrm;
SvStream* pSaveStrm = &rRTFWrt.Strm();
- rRTFWrt.SetStrm( aTmpStrm );
+ rRTFWrt.SetStream( &aTmpStrm );
rRTFWrt.bRTFFlySyntax = false;
OutRTF_SwFmt( rRTFWrt, *rRTFWrt.pFlyFmt );
- rRTFWrt.SetStrm( *pSaveStrm ); // Stream-Pointer wieder zurueck
+ rRTFWrt.SetStream( pSaveStrm ); // Stream-Pointer wieder zurueck
if ( aTmpStrm.GetEndOfData() ) // gibt es SWG spezifische Attribute?
{
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index d37b8b6ff0a0..d70b6d6c754e 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -58,19 +58,22 @@ DECLARE_TABLE( SwBookmarkNodeTable, SvPtrarr* )
struct Writer_Impl
{
+ SvStream * m_pStream;
+
SvStringsSortDtor *pSrcArr, *pDestArr;
SvPtrarr* pFontRemoveLst, *pBkmkArr;
SwBookmarkNodeTable* pBkmkNodePos;
- Writer_Impl( const SwDoc& rDoc );
+ Writer_Impl();
~Writer_Impl();
void RemoveFontList( SwDoc& rDoc );
void InsertBkmk( const ::sw::mark::IMark& rBkmk );
};
-Writer_Impl::Writer_Impl( const SwDoc& /*rDoc*/ )
- : pSrcArr( 0 ), pDestArr( 0 ), pFontRemoveLst( 0 ), pBkmkNodePos( 0 )
+Writer_Impl::Writer_Impl()
+ : m_pStream(0)
+ , pSrcArr( 0 ), pDestArr( 0 ), pFontRemoveLst( 0 ), pBkmkNodePos( 0 )
{
}
@@ -141,7 +144,8 @@ void Writer_Impl::InsertBkmk(const ::sw::mark::IMark& rBkmk)
*/
Writer::Writer()
- : pImpl(0), pStrm(0), pOrigPam(0), pOrigFileName(0), pDoc(0), pCurPam(0)
+ : m_pImpl(new Writer_Impl)
+ , pOrigPam(0), pOrigFileName(0), pDoc(0), pCurPam(0)
{
bWriteAll = bShowProgress = bUCS2_WithStartChar = true;
bASCII_NoLastLineEnd = bASCII_ParaAsBlanc = bASCII_ParaAsCR =
@@ -164,9 +168,11 @@ const IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() const { re
void Writer::ResetWriter()
{
- if( pImpl && pImpl->pFontRemoveLst )
- pImpl->RemoveFontList( *pDoc );
- delete pImpl, pImpl = 0;
+ if (m_pImpl->pFontRemoveLst)
+ {
+ m_pImpl->RemoveFontList( *pDoc );
+ }
+ m_pImpl.reset(new Writer_Impl);
if( pCurPam )
{
@@ -177,7 +183,6 @@ void Writer::ResetWriter()
pCurPam = 0;
pOrigFileName = 0;
pDoc = 0;
- pStrm = 0;
bShowProgress = bUCS2_WithStartChar = TRUE;
bASCII_NoLastLineEnd = bASCII_ParaAsBlanc = bASCII_ParaAsCR =
@@ -246,13 +251,14 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx,
/////////////////////////////////////////////////////////////////////////////
// Stream-spezifisches
-#ifdef DBG_UTIL
SvStream& Writer::Strm()
{
- ASSERT( pStrm, "Oh-oh. Dies ist ein Storage-Writer. Gleich knallts!" );
- return *pStrm;
+ ASSERT( m_pImpl->m_pStream, "Oh-oh. Writer with no Stream!" );
+ return *m_pImpl->m_pStream;
}
-#endif
+
+void Writer::SetStream(SvStream *const pStream)
+{ m_pImpl->m_pStream = pStream; }
SvStream& Writer::OutHex( SvStream& rStrm, ULONG nHex, BYTE nLen )
@@ -314,10 +320,9 @@ ULONG Writer::Write( SwPaM& rPaM, SvStream& rStrm, const String* pFName )
return nResult;
}
- pStrm = &rStrm;
pDoc = rPaM.GetDoc();
pOrigFileName = pFName;
- pImpl = new Writer_Impl( *pDoc );
+ m_pImpl->m_pStream = &rStrm;
// PaM kopieren, damit er veraendert werden kann
pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() );
@@ -368,20 +373,20 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm )
INET_PROT_NEWS >= aTargetUrl.GetProtocol() ) )
return bRet;
- if( pImpl->pSrcArr )
+ if (m_pImpl->pSrcArr)
{
// wurde die Datei schon verschoben
USHORT nPos;
- if( pImpl->pSrcArr->Seek_Entry( &rFileNm, &nPos ))
+ if (m_pImpl->pSrcArr->Seek_Entry( &rFileNm, &nPos ))
{
- rFileNm = *(*pImpl->pDestArr)[ nPos ];
+ rFileNm = *(*m_pImpl->pDestArr)[ nPos ];
return TRUE;
}
}
else
{
- pImpl->pSrcArr = new SvStringsSortDtor( 4, 4 );
- pImpl->pDestArr = new SvStringsSortDtor( 4, 4 );
+ m_pImpl->pSrcArr = new SvStringsSortDtor( 4, 4 );
+ m_pImpl->pDestArr = new SvStringsSortDtor( 4, 4 );
}
String *pSrc = new String( rFileNm );
@@ -400,8 +405,8 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm )
if( bRet )
{
- pImpl->pSrcArr->Insert( pSrc );
- pImpl->pDestArr->Insert( pDest );
+ m_pImpl->pSrcArr->Insert( pSrc );
+ m_pImpl->pDestArr->Insert( pDest );
rFileNm = *pDest;
}
else
@@ -415,9 +420,6 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm )
void Writer::PutNumFmtFontsInAttrPool()
{
- if( !pImpl )
- pImpl = new Writer_Impl( *pDoc );
-
// dann gibt es noch in den NumRules ein paar Fonts
// Diese in den Pool putten. Haben sie danach einen RefCount > 1
// kann es wieder entfernt werden - ist schon im Pool
@@ -457,9 +459,6 @@ void Writer::PutNumFmtFontsInAttrPool()
void Writer::PutEditEngFontsInAttrPool( BOOL bIncl_CJK_CTL )
{
- if( !pImpl )
- pImpl = new Writer_Impl( *pDoc );
-
SfxItemPool& rPool = pDoc->GetAttrPool();
if( rPool.GetSecondaryPool() )
{
@@ -474,9 +473,6 @@ void Writer::PutEditEngFontsInAttrPool( BOOL bIncl_CJK_CTL )
void Writer::PutCJKandCTLFontsInAttrPool()
{
- if( !pImpl )
- pImpl = new Writer_Impl( *pDoc );
-
SfxItemPool& rPool = pDoc->GetAttrPool();
_AddFontItems( rPool, RES_CHRATR_CJK_FONT );
_AddFontItems( rPool, RES_CHRATR_CTL_FONT );
@@ -513,11 +509,13 @@ void Writer::_AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont )
rPool.Remove( *pItem );
else
{
- if( !pImpl->pFontRemoveLst )
- pImpl->pFontRemoveLst = new SvPtrarr( 0, 10 );
+ if (!m_pImpl->pFontRemoveLst)
+ {
+ m_pImpl->pFontRemoveLst = new SvPtrarr( 0, 10 );
+ }
void* p = (void*)pItem;
- pImpl->pFontRemoveLst->Insert( p, pImpl->pFontRemoveLst->Count() );
+ m_pImpl->pFontRemoveLst->Insert( p, m_pImpl->pFontRemoveLst->Count() );
}
}
@@ -529,7 +527,9 @@ void Writer::CreateBookmarkTbl()
for(IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getBookmarksBegin();
ppBkmk != pMarkAccess->getBookmarksEnd();
++ppBkmk)
- pImpl->InsertBkmk(**ppBkmk);
+ {
+ m_pImpl->InsertBkmk(**ppBkmk);
+ }
}
@@ -540,7 +540,8 @@ USHORT Writer::GetBookmarks(const SwCntntNode& rNd, xub_StrLen nStt,
ASSERT( !rArr.Count(), "es sind noch Eintraege vorhanden" );
ULONG nNd = rNd.GetIndex();
- SvPtrarr* pArr = pImpl->pBkmkNodePos ? pImpl->pBkmkNodePos->Get( nNd ) : 0;
+ SvPtrarr* pArr = (m_pImpl->pBkmkNodePos) ?
+ m_pImpl->pBkmkNodePos->Get( nNd ) : 0;
if( pArr )
{
// there exist some bookmarks, search now all which is in the range
@@ -586,11 +587,10 @@ ULONG StgWriter::WriteStream()
ULONG StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName )
{
- pStrm = 0;
+ SetStream(0);
pStg = &rStg;
pDoc = rPaM.GetDoc();
pOrigFileName = pFName;
- pImpl = new Writer_Impl( *pDoc );
// PaM kopieren, damit er veraendert werden kann
pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() );
@@ -607,12 +607,11 @@ ULONG StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName )
ULONG StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const String* pFName, SfxMedium* pMedium )
{
- pStrm = 0;
+ SetStream(0);
pStg = 0;
xStg = rStg;
pDoc = rPaM.GetDoc();
pOrigFileName = pFName;
- pImpl = new Writer_Impl( *pDoc );
// PaM kopieren, damit er veraendert werden kann
pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() );
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 85fa45120ec4..0871325a2d43 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -435,7 +435,8 @@ void MSWordStyles::WriteProperties( const SwFmt* pFmt, bool bParProp, USHORT nPo
m_rExport.OutputFormat( *pFmt, bParProp, !bParProp );
- ASSERT( m_rExport.pCurrentStyle != pFmt, "current style was changed" ); // reset current style...
+ ASSERT( m_rExport.pCurrentStyle == pFmt, "current style was changed" );
+ // reset current style...
m_rExport.pCurrentStyle = NULL;
if ( bInsDefCharSiz ) // nicht abgeleitet v. anderem Style
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 6bf7ecbb8cdf..dd6dd6d0d0e7 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2980,7 +2980,6 @@ void WW8Export::ExportDocument_Impl()
pFib = new WW8Fib( bWrtWW8 ? 8 : 6 );
- SvStream* pOldStrm = &(Strm()); // JP 19.05.99: wozu das ???
SvStorageStreamRef xWwStrm( GetWriter().GetStorage().OpenSotStream( aMainStg ) );
SvStorageStreamRef xTableStrm( xWwStrm ), xDataStrm( xWwStrm );
xWwStrm->SetBufferSize( 32768 );
@@ -3000,7 +2999,7 @@ void WW8Export::ExportDocument_Impl()
xDataStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
}
- GetWriter().SetStrm( *xWwStrm );
+ GetWriter().SetStream( & *xWwStrm );
pTableStrm = &xTableStrm;
pDataStrm = &xDataStrm;
@@ -3022,7 +3021,8 @@ void WW8Export::ExportDocument_Impl()
{
bEncrypt =true;
- GetWriter().SetStrm( *aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ) );
+ GetWriter().SetStream(
+ aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ) );
pTableStrm = aTempTable.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE );
@@ -3174,7 +3174,7 @@ void WW8Export::ExportDocument_Impl()
delete pPiece;
delete pDop;
delete pFib;
- GetWriter().SetStrm( *pOldStrm );
+ GetWriter().SetStream( 0 );
xWwStrm->SetBufferSize( 0 );
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 81dad77566b2..16e20f5725a2 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -597,6 +597,7 @@ Menu MN_TAB_POPUPMENU
MN_EDIT_CONTOUR\
MenuItem\
{\
+ Checkable = TRUE ; \
Identifier = FN_WRAP_ANCHOR_ONLY ; \
HelpID = FN_WRAP_ANCHOR_ONLY ; \
Text [ en-US ] = "~First Paragraph" ; \
@@ -661,6 +662,7 @@ String MN_DRAW_POPUPMENU
MN_WRAP_CONTOUR_1\
MenuItem\
{\
+ Checkable = TRUE ; \
Identifier = FN_WRAP_ANCHOR_ONLY ; \
HelpID = FN_WRAP_ANCHOR_ONLY ; \
Text [ en-US ] = "~First Paragraph" ; \
@@ -686,6 +688,7 @@ String MN_DRAW_POPUPMENU
#define MN_AT_FRAME \
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_FRAME ; \
HelpID = FN_TOOL_ANKER_FRAME ; \
Text [ en-US ] = "To ~Frame" ; \
@@ -704,24 +707,28 @@ String MN_DRAW_POPUPMENU
{\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_PAGE ; \
HelpID = FN_TOOL_ANKER_PAGE ; \
Text [ en-US ] = "To P~age" ; \
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_PARAGRAPH ; \
HelpID = FN_TOOL_ANKER_PARAGRAPH ; \
Text [ en-US ] = "To ~Paragraph" ; \
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_AT_CHAR ; \
HelpID = FN_TOOL_ANKER_AT_CHAR ; \
Text [ en-US ] = "To ~Character" ; \
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_CHAR ; \
HelpID = FN_TOOL_ANKER_CHAR ; \
Text [ en-US ] = "As C~haracter" ; \
diff --git a/sw/source/ui/inc/swmn_tmpl.hrc b/sw/source/ui/inc/swmn_tmpl.hrc
index 3128f741be30..bf375e4ab010 100644
--- a/sw/source/ui/inc/swmn_tmpl.hrc
+++ b/sw/source/ui/inc/swmn_tmpl.hrc
@@ -131,7 +131,6 @@
HelpID = MN_FORMAT_ALGN ; \
Command = ".uno:AlignTextMenu" ; \
Text [ en-US ] = "A~lignment" ; \
- RadioCheck = TRUE ; \
SubMenu = Menu\
{\
ItemList = \
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index a3f2b67b69b6..9ebfd8c8cf36 100644
--- a/sw/source/ui/lingu/olmenu.cxx
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -307,6 +307,9 @@ USHORT SwSpellPopup::fillLangPopupMenu(
}
}
+ bool bMultipleLanguages = (nLangTable != 0) || (curLang.compareToAscii( "*" ) == 0);
+ bool bNothingSelected = true;
+ MenuItemBits nMenuItemStyle = !bMultipleLanguages ? MIB_RADIOCHECK : 0;
for (std::map< rtl::OUString, rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it)
{
rtl::OUString aEntryTxt( it->first );
@@ -322,22 +325,25 @@ USHORT SwSpellPopup::fillLangPopupMenu(
else if (nLangTable == 2) // language for document
aLangTable_Document[nItemId] = aEntryTxt;
- pPopupMenu->InsertItem( nItemId, aEntryTxt, MIB_RADIOCHECK );
- if (aEntryTxt == curLang)
+ pPopupMenu->InsertItem( nItemId, aEntryTxt, nMenuItemStyle );
+ if ((nLangTable == 0) && (aEntryTxt == curLang))
{
//make a check mark for the current language
pPopupMenu->CheckItem( nItemId, TRUE );
+ bNothingSelected = false;
}
}
}
//7--none
nItemId++;
- pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK );
+ pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_NONE )), nMenuItemStyle );
+ if (bNothingSelected && !bMultipleLanguages)
+ pPopupMenu->CheckItem( nItemId, TRUE );
//More...
nItemId++;
- pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_MORE )), MIB_RADIOCHECK );
+ pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_MORE )) );
return nItemId - Lang_Start; // return number of inserted entries
}
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index 24049e571f60..0504fb1107ad 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -905,12 +905,12 @@ void SAL_CALL SwXTextView::setRubyList(
-----------------------------------------------------------------------*/
SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ )
{
- SwWrtShell* pOldSh = &m_pView->GetWrtShell();
- SfxPrinter *pPrt = pOldSh->getIDocumentDeviceAccess()->getPrinter( false );
+ SwWrtShell& rOldSh = m_pView->GetWrtShell();
+ SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false );
SwDocShell* pDocSh;
SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) );
xDocSh->DoInitNew( 0 );
- pOldSh->FillPrtDoc(pDocSh->GetDoc(), pPrt);
+ rOldSh.FillPrtDoc(pDocSh->GetDoc(), pPrt);
SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
SwView* pDocView = (SwView*) pDocFrame->GetViewShell();
pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird.
@@ -919,22 +919,19 @@ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/
IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
SfxPrinter* pTempPrinter = pIDDA->getPrinter( true );
- if( pOldSh )
- {
- const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc());
-
- IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess();
+ const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc());
- if( pIDDA_old->getPrinter( false ) )
- {
- pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
- //#69563# if it isn't the same printer then the pointer has been invalidated!
- pTempPrinter = pIDDA->getPrinter( true );
- }
+ IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess();
- pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
+ if( pIDDA_old->getPrinter( false ) )
+ {
+ pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
+ //#69563# if it isn't the same printer then the pointer has been invalidated!
+ pTempPrinter = pIDDA->getPrinter( true );
}
+ pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
+
return xDocSh;
}
diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml
index 4b46f4d46a2a..01fbb454bff5 100644
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -65,8 +65,8 @@
<menu:menuitem menu:id=".uno:PasteSpecial"/>
<menu:menu menu:id=".uno:SelectionModeMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SelectionModeDefault"/>
- <menu:menuitem menu:id=".uno:SelectionModeBlock"/>
+ <menu:menuitem menu:id=".uno:SelectionModeDefault" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SelectionModeBlock" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuitem menu:id=".uno:SelectTextMode"/>
@@ -240,11 +240,11 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:AnchorMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SetAnchorToPage"/>
- <menu:menuitem menu:id=".uno:SetAnchorToPara"/>
- <menu:menuitem menu:id=".uno:SetAnchorAtChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToFrame"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPara" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorAtChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToFrame" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:WrapMenu">
@@ -264,10 +264,10 @@
</menu:menu>
<menu:menu menu:id=".uno:ObjectAlign">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:CommonAlignLeft"/>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignRight"/>
- <menu:menuitem menu:id=".uno:CommonAlignJustified"/>
+ <menu:menuitem menu:id=".uno:CommonAlignLeft" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignRight" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignJustified" menu:style="radio"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:CommonAlignTop"/>
<menu:menuitem menu:id=".uno:CommonAlignVerticalCenter"/>
diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml
index 4be8c6f8e791..b9368a94c273 100644
--- a/sw/uiconfig/sweb/menubar/menubar.xml
+++ b/sw/uiconfig/sweb/menubar/menubar.xml
@@ -54,8 +54,8 @@
<menu:menuitem menu:id=".uno:SelectTextMode"/>
<menu:menu menu:id=".uno:SelectionModeMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SelectionModeDefault"/>
- <menu:menuitem menu:id=".uno:SelectionModeBlock"/>
+ <menu:menuitem menu:id=".uno:SelectionModeDefault" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SelectionModeBlock" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuitem menu:id=".uno:SelectAll"/>
@@ -187,11 +187,11 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:AnchorMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SetAnchorToPage"/>
- <menu:menuitem menu:id=".uno:SetAnchorToPara"/>
- <menu:menuitem menu:id=".uno:SetAnchorAtChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToFrame"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPara" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorAtChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToFrame" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:WrapMenu">
@@ -211,10 +211,10 @@
</menu:menu>
<menu:menu menu:id=".uno:ObjectAlign">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:CommonAlignLeft"/>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignRight"/>
- <menu:menuitem menu:id=".uno:CommonAlignJustified"/>
+ <menu:menuitem menu:id=".uno:CommonAlignLeft" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignRight" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignJustified" menu:style="radio"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:CommonAlignTop"/>
<menu:menuitem menu:id=".uno:CommonAlignVerticalCenter"/>
diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml
index 13448e424754..2174db8a0cf4 100644
--- a/sw/uiconfig/swform/menubar/menubar.xml
+++ b/sw/uiconfig/swform/menubar/menubar.xml
@@ -66,8 +66,8 @@
<menu:menuitem menu:id=".uno:SelectTextMode"/>
<menu:menu menu:id=".uno:SelectionModeMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SelectionModeDefault"/>
- <menu:menuitem menu:id=".uno:SelectionModeBlock"/>
+ <menu:menuitem menu:id=".uno:SelectionModeDefault" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SelectionModeBlock" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuitem menu:id=".uno:SelectAll"/>
@@ -240,11 +240,11 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:AnchorMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SetAnchorToPage"/>
- <menu:menuitem menu:id=".uno:SetAnchorToPara"/>
- <menu:menuitem menu:id=".uno:SetAnchorAtChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToFrame"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPara" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorAtChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToFrame" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:WrapMenu">
@@ -264,10 +264,10 @@
</menu:menu>
<menu:menu menu:id=".uno:ObjectAlign">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:CommonAlignLeft"/>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignRight"/>
- <menu:menuitem menu:id=".uno:CommonAlignJustified"/>
+ <menu:menuitem menu:id=".uno:CommonAlignLeft" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignRight" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignJustified" menu:style="radio"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:CommonAlignTop"/>
<menu:menuitem menu:id=".uno:CommonAlignVerticalCenter"/>
diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml
index 1f94b7ced1c3..6cd3f3c8c7d7 100644
--- a/sw/uiconfig/swreport/menubar/menubar.xml
+++ b/sw/uiconfig/swreport/menubar/menubar.xml
@@ -66,8 +66,8 @@
<menu:menuitem menu:id=".uno:SelectTextMode"/>
<menu:menu menu:id=".uno:SelectionModeMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SelectionModeDefault"/>
- <menu:menuitem menu:id=".uno:SelectionModeBlock"/>
+ <menu:menuitem menu:id=".uno:SelectionModeDefault" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SelectionModeBlock" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuitem menu:id=".uno:SelectAll"/>
@@ -240,11 +240,11 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:AnchorMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SetAnchorToPage"/>
- <menu:menuitem menu:id=".uno:SetAnchorToPara"/>
- <menu:menuitem menu:id=".uno:SetAnchorAtChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToFrame"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPara" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorAtChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToFrame" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:WrapMenu">
@@ -264,10 +264,10 @@
</menu:menu>
<menu:menu menu:id=".uno:ObjectAlign">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:CommonAlignLeft"/>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignRight"/>
- <menu:menuitem menu:id=".uno:CommonAlignJustified"/>
+ <menu:menuitem menu:id=".uno:CommonAlignLeft" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignRight" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignJustified" menu:style="radio"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:CommonAlignTop"/>
<menu:menuitem menu:id=".uno:CommonAlignVerticalCenter"/>
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index 7c44f84982a9..c88c0b327c7f 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -69,8 +69,8 @@
<menu:menuitem menu:id=".uno:SelectTextMode"/>
<menu:menu menu:id=".uno:SelectionModeMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SelectionModeDefault"/>
- <menu:menuitem menu:id=".uno:SelectionModeBlock"/>
+ <menu:menuitem menu:id=".uno:SelectionModeDefault" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SelectionModeBlock" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuitem menu:id=".uno:SelectAll"/>
@@ -243,11 +243,11 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:AnchorMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SetAnchorToPage"/>
- <menu:menuitem menu:id=".uno:SetAnchorToPara"/>
- <menu:menuitem menu:id=".uno:SetAnchorAtChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToFrame"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPara" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorAtChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToFrame" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:WrapMenu">
@@ -267,10 +267,10 @@
</menu:menu>
<menu:menu menu:id=".uno:ObjectAlign">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:CommonAlignLeft"/>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignRight"/>
- <menu:menuitem menu:id=".uno:CommonAlignJustified"/>
+ <menu:menuitem menu:id=".uno:CommonAlignLeft" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignRight" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignJustified" menu:style="radio"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:CommonAlignTop"/>
<menu:menuitem menu:id=".uno:CommonAlignVerticalCenter"/>
diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml
index b37a8e14d232..85008cae2471 100644
--- a/sw/uiconfig/swxform/menubar/menubar.xml
+++ b/sw/uiconfig/swxform/menubar/menubar.xml
@@ -67,8 +67,8 @@
<menu:menuitem menu:id=".uno:SelectTextMode"/>
<menu:menu menu:id=".uno:SelectionModeMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SelectionModeDefault"/>
- <menu:menuitem menu:id=".uno:SelectionModeBlock"/>
+ <menu:menuitem menu:id=".uno:SelectionModeDefault" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SelectionModeBlock" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menuitem menu:id=".uno:SelectAll"/>
@@ -241,11 +241,11 @@
<menu:menuseparator/>
<menu:menu menu:id=".uno:AnchorMenu">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:SetAnchorToPage"/>
- <menu:menuitem menu:id=".uno:SetAnchorToPara"/>
- <menu:menuitem menu:id=".uno:SetAnchorAtChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToChar"/>
- <menu:menuitem menu:id=".uno:SetAnchorToFrame"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToPara" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorAtChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToChar" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:SetAnchorToFrame" menu:style="radio"/>
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:WrapMenu">
@@ -265,10 +265,10 @@
</menu:menu>
<menu:menu menu:id=".uno:ObjectAlign">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:CommonAlignLeft"/>
- <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter"/>
- <menu:menuitem menu:id=".uno:CommonAlignRight"/>
- <menu:menuitem menu:id=".uno:CommonAlignJustified"/>
+ <menu:menuitem menu:id=".uno:CommonAlignLeft" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignHorizontalCenter" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignRight" menu:style="radio"/>
+ <menu:menuitem menu:id=".uno:CommonAlignJustified" menu:style="radio"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:CommonAlignTop"/>
<menu:menuitem menu:id=".uno:CommonAlignVerticalCenter"/>
diff --git a/testautomation/framework/optional/f_basic_vba-compat.bas b/testautomation/framework/optional/f_basic_vba-compat.bas
index 3a6d41d3e0af..80b48eb5c1e6 100755
--- a/testautomation/framework/optional/f_basic_vba-compat.bas
+++ b/testautomation/framework/optional/f_basic_vba-compat.bas
@@ -36,13 +36,17 @@ sub main
use "framework\optional\includes\basic_vba-compat_import_nothing.inc"
use "framework\optional\includes\basic_vba-compat_import_disabled.inc"
use "framework\optional\includes\basic_vba-compat_import_enabled.inc"
- use "framework\optional\includes\basic_vba-compat_security_check.inc"
-
+ use "framework\optional\includes\basic_vba-compat_thisworkbook.inc"
+ use "framework\optional\includes\basic_vba-compat_application-union.inc"
+ use "framework\optional\includes\basic_vba-compat_xlsm-xlsb.inc"
+
call hStatusIn( "framework" , "f_basic_vba-compat.bas" )
call tBasicVBACompatImportNothing()
call tBasicVBACompatImportDisabled()
call tBasicVBACompatImportEnabled()
- call tBasicVBACompatSecurityCheck()
+ call tBasicVBACompatThisWorkBook()
+ call tBasicVBACompatApplicationUnion()
+ call tBasicVBACompatXLSM_XLSB()
call hStatusOut()
end sub
@@ -56,6 +60,7 @@ sub LoadIncludeFiles
use "global\tools\includes\optional\t_basic_organizer_tools.inc"
use "global\tools\includes\optional\t_treelist_tools.inc"
+ use "global\tools\includes\optional\t_stringtools.inc"
use "global\tools\includes\optional\t_security_tools.inc"
use "global\tools\includes\optional\t_macro_tools.inc"
use "global\tools\includes\optional\t_docfuncs.inc"
diff --git a/testautomation/framework/optional/includes/basic_gridcontrol.inc b/testautomation/framework/optional/includes/basic_gridcontrol.inc
index dc96ef30e16c..f2d2f74cbdd4 100644..100755
--- a/testautomation/framework/optional/includes/basic_gridcontrol.inc
+++ b/testautomation/framework/optional/includes/basic_gridcontrol.inc
@@ -54,72 +54,18 @@ testcase tGridcontrolLoad
call sleep 1
printlog "Start the macro, that performs the test"
- printlog "Tools->Macros->Run Macro..."
- ToolsMacrosRunMacro
- Kontext "ScriptSelector"
- if ScriptSelector.exists(10) then
- x = LibraryTreeList.getItemCount
- printlog "Look for library 'gridcontrol'"
- for i = 1 to x
- sTemp = LibraryTreeList.getItemText(i)
- 'printlog "("+i+"/"+x+"): '" + sTemp + "'"
- if (instr(sTemp,"gridcontrol")>0 OR instr(sTemp,"GRIDCONTROL")) then
- a = i
- printlog "Found library ("+i+"/"+x+"): '" + sTemp + "'"
- endif
+ Kontext "GridControlDialogStarter"
+ ShowGridcontrol.typeKeys "<space>"
+ Kontext "GridControlDialog"
+ if GridControlDialog.exists(5) then
+ for i=1 to gridcontrolcontrol.getcolumncount
+ for a=1 to gridcontrolcontrol.getrowcount
+ printlog " " + i + ":"+a+": '" + gridcontrolcontrol.getitemtype (i,a) + "' '" + gridcontrolcontrol.getitemtext (i,a) + "'"
+ next a
next i
- if 0 <> a then
- printlog "Select the library and unfold it"
- LibraryTreeList.select(a)
- LibraryTreeList.typeKeys("+")
- printlog "Go to 'Standard' and unfold"
- LibraryTreeList.typeKeys("<down>")
- LibraryTreeList.typeKeys("+")
- printlog "Go to 'Module1'"
- LibraryTreeList.typeKeys("<down>")
-
- printlog "Select macro name 'VclTestTool'"
- x = ScriptList.getItemCount
- for i = 1 to x
- sTemp = ScriptList.getItemText(i)
- 'printlog "("+i+"/"+x+"): '" + sTemp + "'"
- if "VclTestTool" = sTemp then
- a = i
- printlog "Found macro ("+i+"/"+x+"): '" + sTemp + "'"
- endif
- next i
- if (0 <> a) then
- printlog "Select the macro"
- ScriptList.select(a)
- printlog "Start the macro by pressing the button 'run'"
- ScriptSelector.ok
- printlog "sleep... at least 60 seconds"
- call sleep(60)
- printlog "If macro fails for whatever reason, a message comes up"
- Kontext
- if active.exists() then
- warnlog "" + active.getText
- active.ok
- try
- EditCopy
- warnlog getclipboard()
- catch
- endcatch
- printlog "close basic ide"
- call hCloseDocument()
- printlog "close document"
- call hCloseDocument()
- goto endsub
- endif
-
- else
- warnlog sLocation + "Macro not found: 'Main'"
- endif
- else
- warnlog sLocation + "Library not found: 'gridcontrol'"
- endif
+ GridControlDialog.close
else
- warnlog sLocation + "'Run macro dialog' didn't came up"
+ warnlog "Gridcontrol Dialog did not come up after pressing button"
endif
printlog "clean up"
diff --git a/testautomation/framework/optional/includes/basic_vba-compat_application-union.inc b/testautomation/framework/optional/includes/basic_vba-compat_application-union.inc
new file mode 100755
index 000000000000..222b99215f81
--- /dev/null
+++ b/testautomation/framework/optional/includes/basic_vba-compat_application-union.inc
@@ -0,0 +1,132 @@
+'encoding UTF-8 Do not remove or change this line!
+'*******************************************************************************
+' 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.
+'
+'/******************************************************************************
+'*
+'* owner : joerg.skottke@sun.com
+'*
+'* short description : Test VBA compatibility switches
+'*
+'\******************************************************************************
+
+testcase tBasicVBACompatApplicationUnion()
+
+ printlog( "Functionality of Application.Union" )
+ ' Based on issue #i110724
+
+ const IMPORT_EXCEL_MACROS = TRUE
+ const EXEC_EXCEL_MACROS = TRUE
+ const DOCUMENT_NAME = "vba-application-union.xls"
+ const LIBRARY_NAME = "Standard"
+ const MODULE_NAME = "Module1"
+ const EXPECTED_MACRO_COUNT = 6
+ const MAX_WAIT = 2
+ const RC_FAILURE = -1
+
+ dim macro_identifier( EXPECTED_MACRO_COUNT )
+ macro_identifier( 1 ) = "1: True"
+ macro_identifier( 2 ) = "2: True"
+ macro_identifier( 3 ) = "3: True"
+ macro_identifier( 4 ) = "4: True"
+ macro_identifier( 5 ) = "5: True"
+ macro_identifier( 6 ) = "6: True"
+
+ dim cTestFile as string
+ cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/" & DOCUMENT_NAME
+
+ dim iMacroPosition as integer
+ dim iCurrentMacro as integer
+ dim iRepeat as integer
+
+ printlog( "Set macro security to low" )
+ hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
+
+ printlog( "Open Tools/Options" )
+ hSetExcelBasicImportMode( IMPORT_EXCEL_MACROS, EXEC_EXCEL_MACROS )
+
+ printlog( "Load the test file" )
+ hFileOpen( cTestFile )
+
+ ToolsMacro_uno
+
+ kontext "Makro"
+ if ( Makro.exists( MAX_WAIT ) ) then
+
+ iMacroPosition = hSelectNodeByName( MakroAus, DOCUMENT_NAME )
+ hExpandNode( MakroAus, iMacroPosition )
+
+ printlog( "Move to node <" & LIBRARY_NAME & ">" )
+ iMacroPosition = hSelectNextNode( MakroAus )
+ if ( not hVerifyNodeName( MakroAus, LIBRARY_NAME ) ) then
+ warnlog( "This is not the expected library" )
+ endif
+
+ printlog( "Move to node <" & MODULE_NAME & ">" )
+ hSelectNextNode( MakroAus )
+ if ( not hVerifyNodeName( MakroAus, MODULE_NAME ) ) then
+ warnlog( "This is not the expected module" )
+ endif
+
+ printlog( "Click <Ausfuehren> to execute the macro" )
+ if ( hClickButton( Ausfuehren ) <> RC_FAILURE ) then
+
+ printlog( "Check for the " & EXPECTED_MACRO_COUNT & " expected messageboxes" )
+ for iCurrentMacro = 1 to EXPECTED_MACRO_COUNT
+
+ printlog( "" )
+ kontext "Active"
+ printlog( iCurrentMacro & ": Check for messagebox: " & macro_identifier( iCurrentMacro ) )
+ if ( Active.exists( MAX_WAIT ) ) then
+
+ if ( Active.getText() = macro_identifier( iCurrentMacro ) ) then
+ printlog( "The expected macro was executed" )
+ else
+ warnlog( "Unexpected macro executed: " & Active.getText() )
+ endif
+ Active.ok()
+
+ else
+ warnlog( "Expected messagebox not displayed within reasonable timeframe" )
+ goto endsub
+ endif
+
+ next iCurrentMacro
+ else
+ warnlog( "Unable to execute macro, the <Run Macro> button is disabled" )
+ kontext "Makro"
+ Makro.close()
+ endif
+ else
+ warnlog( "Failed to open BASIC organizer" )
+ endif
+
+ printlog( "Cleanup" )
+ hCloseDocument()
+ hSetExcelImportModeDefault()
+ hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )
+
+endcase
+
+
diff --git a/testautomation/framework/optional/includes/basic_vba-compat_import_disabled.inc b/testautomation/framework/optional/includes/basic_vba-compat_import_disabled.inc
index f5576308a6a9..764ba407236a 100755
--- a/testautomation/framework/optional/includes/basic_vba-compat_import_disabled.inc
+++ b/testautomation/framework/optional/includes/basic_vba-compat_import_disabled.inc
@@ -36,12 +36,23 @@ testcase tBasicVBACompatImportDisabled()
printlog( "Test VBA compatibility switch / executable Microsoft(R) Excel(R) Macros" )
printlog( "Test case 2: Import macros but do not set the executable mode" )
-
' This test case is based on the use cases provided in issue #i88690
' Spec: http://specs.openoffice.org/appwide/options_settings/Option_Dialog.odt
+
+ const NODE_COUNT = 78
+
+ const DOCUMENT_POSITION_OFFSET = -7
+
+ const IMPORT_EXCEL_MACROS = TRUE
+ const EXEC_EXCEL_MACROS = FALSE
+
+ const DOCUMENT_NAME = "vba-test.xls"
+ const MATCH_NONE = 0
+ const MATCH_EXACT = 1
+ const MATCH_PARTLY = 2
dim cTestFile as string
- cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/vba-test.xls"
+ cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/" & DOCUMENT_NAME
dim cNodeCount as integer
@@ -57,15 +68,6 @@ testcase tBasicVBACompatImportDisabled()
dim iCurrentModule as integer
dim cCurrentModule as string
dim bFound as boolean
-
- ' Depending on the mode of macro import we have differtent basic libraries listed
- const NODE_COUNT_OOO = 78 ' OpenOffice.org
- const NODE_COUNT = 80 ' branded product
-
- const DOCUMENT_POSITION_OFFSET = -7
-
- const IMPORT_EXCEL_MACROS = TRUE
- const EXEC_EXCEL_MACROS = FALSE
printlog( "Set macro security to low" )
hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
@@ -92,9 +94,11 @@ testcase tBasicVBACompatImportDisabled()
printlog( "Verify position of the document node" )
MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET )
- if ( MakroAus.getSelText() <> "vba-test.xls" ) then
- qaerrorlog( "The document node is not at the expected position" )
- endif
+ select case( hCompareSubStrings( MakroAus.getSelText(), DOCUMENT_NAME ) )
+ case MATCH_NONE : warnlog ( "The document is not listed at the expected position" )
+ case MATCH_EXACT : printlog( "The document is at the expected position and writable" )
+ case MATCH_PARTLY : printlog( "The document is at the expected position and write protected" )
+ end select
for iCurrentModule = 2 to 7
@@ -135,7 +139,6 @@ testcase tBasicVBACompatImportDisabled()
hSetExcelImportModeDefault()
hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )
-
endcase
diff --git a/testautomation/framework/optional/includes/basic_vba-compat_import_enabled.inc b/testautomation/framework/optional/includes/basic_vba-compat_import_enabled.inc
index 3e6450e4c2e7..98173ee8ba48 100755
--- a/testautomation/framework/optional/includes/basic_vba-compat_import_enabled.inc
+++ b/testautomation/framework/optional/includes/basic_vba-compat_import_enabled.inc
@@ -39,22 +39,40 @@ testcase tBasicVBACompatImportEnabled()
' This test case is based on the use cases provided in issue #i88690
' Spec: http://specs.openoffice.org/appwide/options_settings/Option_Dialog.odt
-
- dim cFile as string : cFile = "vba-test.xls"
+
+ ' Depending on the mode of macro import we have differtent basic libraries listed
+ const NODE_COUNT = 78
+
+ const DOCUMENT_POSITION_OFFSET = -7
+
+ const IMPORT_EXCEL_MACROS = TRUE
+ const EXEC_EXCEL_MACROS = TRUE
+
+ const DOCUMENT_NAME = "vba-test.xls"
+ const MATCH_NONE = 0
+ const MATCH_EXACT = 1
+ const MATCH_PARTLY = 2
dim cTestFile as string
- cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/" & cFile
+ cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/" & DOCUMENT_NAME
dim cNodeCount as integer
- ' note that index 0 and 1 are ommitted intentionally
- dim caNodeData( 3 ) as string
- caNodeData( 2 ) = "Modul1"
- caNodeData( 3 ) = "Modul2"
-
- dim caScripts( 3 ) as string
- caScripts( 2 ) = "ConcatFct Ende"
- caScripts( 3 ) = "WriteIt"
+ dim caNodeData( 7 ) as string
+ caNodeData( 0 ) = DOCUMENT_NAME ' The document, not used
+ caNodeData( 1 ) = "Standard" ' The default library, not used
+ caNodeData( 2 ) = "DieseArbeitsmappe"
+ caNodeData( 3 ) = "Modul1"
+ caNodeData( 4 ) = "Modul2"
+ caNodeData( 5 ) = "Tabelle1"
+ caNodeData( 6 ) = "Tabelle2"
+ caNodeData( 7 ) = "Tabelle3"
+
+ ' These are the scripts belonging to each node above. If multiple scripts exist
+ ' they are separated by spaces. Example: "Modul1" has "ConcatFct" and "Ende" scripts.
+ dim caScripts( 7 ) as string
+ caScripts( 3 ) = "ConcatFct Ende"
+ caScripts( 4 ) = "WriteIt"
dim iCurrentModule as integer
dim iCurrentScript as integer
@@ -62,19 +80,10 @@ testcase tBasicVBACompatImportEnabled()
dim cTempString as string
dim bFound as boolean
- ' Depending on the mode of macro import we have differtent basic libraries listed
- const NODE_COUNT_OOO = 74
- const NODE_COUNT = 76
-
- const DOCUMENT_POSITION_OFFSET = -3
-
- const IMPORT_EXCEL_MACROS = TRUE
- const EXEC_EXCEL_MACROS = TRUE
-
printlog( "Set macro security to low" )
hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
- printlog( "Open Tools/Options" )
+ printlog( "Open Tools/Options and set the VBA macro execution mode" )
hSetExcelBasicImportMode( IMPORT_EXCEL_MACROS, EXEC_EXCEL_MACROS )
@@ -96,26 +105,13 @@ testcase tBasicVBACompatImportEnabled()
printlog( "Verify position of the document node." )
MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET )
- cTempString = MakroAus.getSelText()
- if ( cTempString <> cFile ) then
- qaerrorlog( "The filename does not match. File may be read-only." )
- if ( instr( cTempString, cFile ) > 1 ) then
- printlog( "Filename is contained in the UI string." )
- select case ( getAttr( cTestFile ) )
- case 0 : warnlog( "The file appears to be read-only but it is " & _
- "not write-protected on filesystem level." )
- case 1 : printlog( "The file is read-only on filesystem level. Ok." )
- case else
- warnlog( "getAttr() returned unexpected value. 1 or 2 are allowed" )
- printlog( "RC from getAttr() is: " & getAttr( cTestFile ) )
- end select
- else
- qaerrorlog( "The document node is not at the expected position." )
- qaerrorlog( "Object at this position is: " & MakroAus.getSelText() )
- endif
- endif
+ select case( hCompareSubStrings( MakroAus.getSelText(), DOCUMENT_NAME ) )
+ case MATCH_NONE : warnlog ( "The document is not listed at the expected position" )
+ case MATCH_EXACT : printlog( "The document is at the expected position and writable" )
+ case MATCH_PARTLY : printlog( "The document is at the expected position and write protected" )
+ end select
- for iCurrentModule = 2 to 3
+ for iCurrentModule = 2 to 7
printlog( "Look for: " & caNodeData( iCurrentModule ) )
diff --git a/testautomation/framework/optional/includes/basic_vba-compat_import_nothing.inc b/testautomation/framework/optional/includes/basic_vba-compat_import_nothing.inc
index bab6bf1a4b1b..50c59cf88e10 100755
--- a/testautomation/framework/optional/includes/basic_vba-compat_import_nothing.inc
+++ b/testautomation/framework/optional/includes/basic_vba-compat_import_nothing.inc
@@ -38,21 +38,24 @@ testcase tBasicVBACompatImportNothing()
' This test case is based on the use cases provided in issue #i88690
' Spec: http://specs.openoffice.org/appwide/options_settings/Option_Dialog.odt
-
- dim cTestFile as string
- cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/vba-test.xls"
-
- dim cNodeCount as integer
-
- ' Depending on the mode of macro import we have differtent basic libraries listed
- const NODE_COUNT = 74 ' Do not import Microsoft(R) Excel(R) macros at all
- const NODE_COUNT_OOO = 72
- const MACRO_LIST = 0 ' The document library should have no scripts listed
+' Depending on the mode of macro import we have differtent basic libraries listed
+ const NODE_COUNT = 72 ' Do not import Microsoft(R) Excel(R) macros at all
+ const MACRO_LIST = 0 ' The document library should have no scripts listed
const DOCUMENT_POSITION_OFFSET = -1
-
+
const IMPORT_EXCEL_MACROS = FALSE
const EXEC_EXCEL_MACROS = FALSE
-
+
+ const DOCUMENT_NAME = "vba-test.xls"
+ const MATCH_NONE = 0
+ const MATCH_EXACT = 1
+ const MATCH_PARTLY = 2
+
+ dim cTestFile as string
+ cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/" & DOCUMENT_NAME
+
+ dim cNodeCount as integer
+
printlog( "Set macro security to low" )
hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
@@ -78,9 +81,11 @@ testcase tBasicVBACompatImportNothing()
printlog( "Verify position of the document node" )
MakroAus.select( cNodeCount + DOCUMENT_POSITION_OFFSET )
- if ( MakroAus.getSelText() <> "vba-test.xls" ) then
- qaerrorlog( "The document node is not at the expected position" )
- endif
+ select case( hCompareSubStrings( MakroAus.getSelText(), DOCUMENT_NAME ) )
+ case MATCH_NONE : warnlog ( "The document is not listed at the expected position" )
+ case MATCH_EXACT : printlog( "The document is at the expected position and writable" )
+ case MATCH_PARTLY : printlog( "The document is at the expected position and write protected" )
+ end select
printlog( "Select the last node, this should be the standard Library for the document" )
MakroAus.select( cNodeCount )
diff --git a/testautomation/framework/optional/includes/basic_vba-compat_thisworkbook.inc b/testautomation/framework/optional/includes/basic_vba-compat_thisworkbook.inc
new file mode 100755
index 000000000000..03c52146a8fb
--- /dev/null
+++ b/testautomation/framework/optional/includes/basic_vba-compat_thisworkbook.inc
@@ -0,0 +1,143 @@
+'encoding UTF-8 Do not remove or change this line!
+'*******************************************************************************
+' 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.
+'
+'/******************************************************************************
+'*
+'* owner : joerg.skottke@sun.com
+'*
+'* short description : Test VBA compatibility switches
+'*
+'\******************************************************************************
+
+testcase tBasicVBACompatThisWorkBook()
+
+ printlog( "Functionality of .thisWorkbook" )
+ ' Based on issue #i110672
+
+ const IMPORT_EXCEL_MACROS = TRUE
+ const EXEC_EXCEL_MACROS = TRUE
+ const DOCUMENT_NAME = "vba-thisworkbook.xls"
+ const LIBRARY_NAME = "Standard"
+ const MODULE_NAME = "Module1"
+ const EXPECTED_MACRO_COUNT = 2
+ const MAX_REPEAT_COUNT = 2
+ const MAX_WAIT = 2
+
+ dim macro_identifier( EXPECTED_MACRO_COUNT )
+ macro_identifier( 1 ) = "Test 1 passed."
+ macro_identifier( 2 ) = "Test 2 passed."
+
+ dim cTestFile as string
+ cTestFile = gTesttoolPath & "framework/optional/input/vba-compat/" & DOCUMENT_NAME
+
+ dim iMacroPosition as integer
+ dim iCurrentMacro as integer
+ dim iRepeat as integer
+
+ printlog( "Set macro security to low" )
+ hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
+
+ printlog( "Open Tools/Options" )
+ hSetExcelBasicImportMode( IMPORT_EXCEL_MACROS, EXEC_EXCEL_MACROS )
+
+ printlog( "Load the test file" )
+ hFileOpen( cTestFile )
+
+ printlog( "Execute the procedure twice to trigger issue 111553" )
+ for iRepeat = 1 to MAX_REPEAT_COUNT
+
+ ToolsMacro_uno
+
+ kontext "Makro"
+ if ( Makro.exists( MAX_WAIT ) ) then
+
+ iMacroPosition = hSelectNodeByName( MakroAus, DOCUMENT_NAME )
+ hExpandNode( MakroAus, iMacroPosition )
+
+ printlog( "Move to node <" & LIBRARY_NAME & ">" )
+ iMacroPosition = hSelectNextNode( MakroAus )
+ if ( not hVerifyNodeName( MakroAus, LIBRARY_NAME ) ) then
+ warnlog( "This is not the expected library" )
+ endif
+
+ printlog( "Move to node <" & MODULE_NAME & ">" )
+ hSelectNextNode( MakroAus )
+ if ( not hVerifyNodeName( MakroAus, MODULE_NAME ) ) then
+ warnlog( "This is not the expected module" )
+ endif
+
+ printlog( "Click <Ausfuehren> to execute the macro" )
+ iMacroPosition = hClickButton( Ausfuehren )
+
+ printlog( "Check for two expected messageboxes" )
+ for iCurrentMacro = 1 to EXPECTED_MACRO_COUNT
+
+ kontext "Active"
+ printlog( "Check for messagebox: " & macro_identifier( iCurrentMacro ) )
+ if ( Active.exists( MAX_WAIT ) ) then
+
+ if ( Active.getText() = macro_identifier( iCurrentMacro ) ) then
+ printlog( "Correct macro executed" )
+ else
+ printlog( "Macro execution error, trying to identify..." )
+ if ( instr( Active.getText(), "BASIC runtime error." ) > 0 ) then
+ if ( iRepeat = MAX_REPEAT_COUNT ) then
+ warnlog( "#i111533 - Cannot execute ThisWorkbook macro twice" )
+ Active.ok()
+ hFileCloseAll()
+ goto endsub
+ else
+ warnlog( "Executing macro failed" )
+ goto endsub
+ endif
+ else
+ warnlog( "Unknown messagebox. Aborting test" )
+ goto endsub
+ endif
+ endif
+
+ Active.ok()
+
+ else
+ warnlog( "Expected messagebox not displayed within reasonable timeframe" )
+ goto endsub
+ endif
+
+ next iCurrentMacro
+ else
+ warnlog( "A macro with the name <" & MODULE_NAME & "> could not be found" )
+ goto endsub
+ endif
+
+ next iRepeat
+
+ printlog( "Cleanup" )
+ hCloseDocument()
+ hSetExcelImportModeDefault()
+ hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )
+
+endcase
+
+
diff --git a/testautomation/framework/optional/includes/basic_vba-compat_xlsm-xlsb.inc b/testautomation/framework/optional/includes/basic_vba-compat_xlsm-xlsb.inc
new file mode 100755
index 000000000000..cfc8f06072e3
--- /dev/null
+++ b/testautomation/framework/optional/includes/basic_vba-compat_xlsm-xlsb.inc
@@ -0,0 +1,187 @@
+'encoding UTF-8 Do not remove or change this line!
+'*******************************************************************************
+' 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.
+'
+'/******************************************************************************
+'*
+'* owner : joerg.skottke@sun.com
+'*
+'* short description : Test VBA compatibility switches
+'*
+'\******************************************************************************
+
+testcase tBasicVBACompatXLSM_XLSB()
+
+ printlog( "Functionality of macros in XLSM/XLSB files" )
+ ' Based on issue #i111007
+
+ const IMPORT_EXCEL_MACROS = TRUE
+ const EXEC_EXCEL_MACROS = TRUE
+
+ const FILE_COUNT = 2
+ const MODULE_COUNT = 7
+
+ const MODULE_NOT_FOUND = 0
+ const MAX_DELAY = 3
+ const RC_TIMEOUT = -1
+
+ const THE_MODULE_THAT_BEHAVES_DIFFERENTLY = 6
+
+ const RELATIVE_PATH = "framework/optional/input/vba-compat/"
+
+ ' We have two files to load, on e .xlsm and one .xlsb
+ dim cFileList( FILE_COUNT ) as string
+ cFileList( 1 ) = "vba-project.xlsm"
+ cFileList( 2 ) = "vba-project.xlsb"
+
+ ' both documents import the same modules
+ dim cTestModuleList( MODULE_COUNT )
+ cTestModuleList( 1 ) = "MyChartModule"
+ cTestModuleList( 2 ) = "MyCodeModule"
+ cTestModuleList( 3 ) = "MyPrivateClassModule"
+ cTestModuleList( 4 ) = "MyPublicClassModule"
+ cTestModuleList( 5 ) = "MySheetModule"
+ cTestModuleList( 6 ) = "MyUserForm"
+ cTestModuleList( 7 ) = "MyWorkbookModule"
+
+ dim cTestFile as string
+ dim iCurrentFile as integer
+ dim iCurrentModule as integer
+
+ printlog( "Set macro security to low" )
+ hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_LOW )
+
+ printlog( "Open Tools/Options" )
+ hSetExcelBasicImportMode( IMPORT_EXCEL_MACROS, EXEC_EXCEL_MACROS )
+
+ for iCurrentFile = 1 to FILE_COUNT
+
+ cTestFile = gTesttoolPath & RELATIVE_PATH & cFileList( iCurrentFile )
+
+ printlog( "Loading document: " & cTestFile )
+ hFileOpen( cTestFile )
+
+ for iCurrentModule = 1 to MODULE_COUNT
+
+ printlog( "" )
+ printlog( "Tryng to execute macro: " & cTestModuleList( iCurrentModule ) )
+ ToolsMacro_uno
+
+ kontext "Makro"
+ if ( Makro.exists( MAX_DELAY ) ) then
+
+ if ( hSelectNodeByName( MakroAus, cTestModuleList( iCurrentModule ) ) <> MODULE_NOT_FOUND ) then
+
+ printlog( "Execute the default macro <Test> for the current module" )
+
+ if ( hClickButton( Ausfuehren ) <> RC_TIMEOUT ) then
+ if ( iCurrentModule = THE_MODULE_THAT_BEHAVES_DIFFERENTLY ) then
+ ' Fuzzy matching message string
+ hTestMacroType2( cTestModuleList( iCurrentModule ) )
+ else
+ ' Exact matching message string
+ hTestMacroType1( cTestModuleList( iCurrentModule ) )
+ endif
+ else
+ warnlog( "No executable macro found for the current module / <Run> button is disabled" )
+ endif
+ else
+ warnlog( "the expected macro module could not be found" )
+ endif
+ else
+ warnlog( "BASIC Macro organizer did not open" )
+ endif
+
+ next iCurrentModule
+
+ printlog( "Close the document" )
+ hFileCloseAll()
+
+ next iCurrentFile
+
+ hSetExcelImportModeDefault()
+ hSetMacroSecurityAPI( GC_MACRO_SECURITY_LEVEL_DEFAULT )
+
+endcase
+
+'*******************************************************************************
+
+function hTestMacroType1( cMessage as string ) as boolean
+
+ ' exact matching
+
+ kontext "Active"
+ if ( Active.exists( 2 ) ) then
+ if ( Active.getText() = cMessage ) then
+ printlog( "Correct macro has been executed" )
+ hTestMacroType1() = true
+ else
+ warnlog( "Incorrect macro executed: " )
+ printlog( "Expected: " & cMessage )
+ printlog( "Found...: " & Active.getText() )
+ hTestMacroType1() = false
+ endif
+
+ Active.ok()
+ WaitSlot()
+
+ else
+ warnlog( "Messagebox missing, macro was not executed" )
+ hTestMacroType1() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hTestMacroType2( cMessage as string ) as boolean
+
+ ' fuzzy matching
+
+ dim iCurrentMessage as integer
+
+ for iCurrentMessage = 1 to 2
+
+ kontext "Active"
+ if ( Active.exists( 2 ) ) then
+ if ( instr( Active.getText() , cMessage ) > 0 ) then
+ printlog( "Correct macro has been executed" )
+ hTestMacroType2() = true
+ else
+ warnlog( "Incorrect macro executed: " )
+ printlog( "Expected: " & cMessage )
+ printlog( "Found...: " & Active.getText() )
+ hTestMacroType2() = false
+ endif
+
+ Active.ok()
+ WaitSlot()
+
+ else
+ warnlog( "Messagebox missing, macro not executed" )
+ hTestMacroType2() = false
+ endif
+ next iCurrentMessage
+
+end function \ No newline at end of file
diff --git a/testautomation/framework/optional/input/gridcontrol.odt b/testautomation/framework/optional/input/gridcontrol.odt
index b3e5c6fb40bb..d11d70cfbc09 100755
--- a/testautomation/framework/optional/input/gridcontrol.odt
+++ b/testautomation/framework/optional/input/gridcontrol.odt
Binary files differ
diff --git a/testautomation/framework/optional/input/vba-compat/vba-application-union.xls b/testautomation/framework/optional/input/vba-compat/vba-application-union.xls
new file mode 100755
index 000000000000..b1f1be816b7b
--- /dev/null
+++ b/testautomation/framework/optional/input/vba-compat/vba-application-union.xls
Binary files differ
diff --git a/testautomation/framework/optional/input/vba-compat/vba-project.xlsb b/testautomation/framework/optional/input/vba-compat/vba-project.xlsb
new file mode 100755
index 000000000000..9fd88a8e545c
--- /dev/null
+++ b/testautomation/framework/optional/input/vba-compat/vba-project.xlsb
Binary files differ
diff --git a/testautomation/framework/optional/input/vba-compat/vba-project.xlsm b/testautomation/framework/optional/input/vba-compat/vba-project.xlsm
new file mode 100755
index 000000000000..6a8896e18599
--- /dev/null
+++ b/testautomation/framework/optional/input/vba-compat/vba-project.xlsm
Binary files differ
diff --git a/testautomation/framework/optional/input/vba-compat/vba-thisworkbook.xls b/testautomation/framework/optional/input/vba-compat/vba-thisworkbook.xls
new file mode 100644
index 000000000000..f275fd9cca0e
--- /dev/null
+++ b/testautomation/framework/optional/input/vba-compat/vba-thisworkbook.xls
Binary files differ
diff --git a/testautomation/global/tools/includes/optional/t_treelist_tools.inc b/testautomation/global/tools/includes/optional/t_treelist_tools.inc
index b459b2c0f4a0..36cfe7370901 100644..100755
--- a/testautomation/global/tools/includes/optional/t_treelist_tools.inc
+++ b/testautomation/global/tools/includes/optional/t_treelist_tools.inc
@@ -356,6 +356,16 @@ function hSelectNodeByName( oControl as object , _name as string ) as integer
iThisNode = iCurrentNode
exit for
endif
+
+ if ( instr( cNodeName, _name ) > 0 ) then
+ if ( instr( cNodeName, "(" ) > 0 ) then
+ printlog( CFN & "Node has readonly marker" )
+ iThisNode = iCurrentNode
+ exit for
+ else
+ qaerrorlog( CFN & "Fuzzy match. This might or might not be the correct node" )
+ endif
+ endif
next iCurrentNode
endcatch
diff --git a/testautomation/global/win/dial_d_h.win b/testautomation/global/win/dial_d_h.win
index 1540dbd8743f..ab6183ad7724 100755
--- a/testautomation/global/win/dial_d_h.win
+++ b/testautomation/global/win/dial_d_h.win
@@ -483,6 +483,12 @@ Gruppenliste HID_TEMPLATE_FILTER
Interlace filter:CheckBox:DLG_EXPORT_GIF:CBX_INTERLACED
TransparentSpeichern filter:CheckBox:DLG_EXPORT_GIF:CBX_TRANSLUCENT
+*GridControlDialogStarter ACTIVE
+ShowGridcontrol sym:showGridcontrol
+
+*GridControlDialog sym:gridcontroldialog
+gridcontrolcontrol sym:gridcontrolself
+
*GroupingDlg HID_SC_DPDATEGROUP
AutoStart sc:RadioButton:RID_SCDLG_DPNUMGROUP:RB_AUTOSTART
ManualStart sc:RadioButton:RID_SCDLG_DPNUMGROUP:RB_MANSTART
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
index 65e555f9d799..b9fb82c3d4bb 100644
--- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -54,7 +54,7 @@
#include <osl/mutex.hxx>
#include <toolkit/helper/mutexhelper.hxx>
#include <toolkit/helper/macros.hxx>
-
+#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
// ----------------------------------------------------
// class ListenerMultiplexerBase
// ----------------------------------------------------
@@ -244,8 +244,12 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer, ::com::sun::
virtual void SAL_CALL nodeEdited( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node, const ::rtl::OUString& NewText ) throw (::com::sun::star::uno::RuntimeException);
DECL_LISTENERMULTIPLEXER_END
-
-
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+ void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index d9adc182f4d7..d5f484145316 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -196,6 +196,10 @@ namespace rtl {
#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
#define BASEPROPERTY_REFERENCE_DEVICE 146
#define BASEPROPERTY_HIGHCONTRASTMODE 147
+#define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148
+#define BASEPROPERTY_GRID_HEADER_BACKGROUND 149
+#define BASEPROPERTY_GRID_LINE_COLOR 150
+#define BASEPROPERTY_GRID_ROW_BACKGROUND 151
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index fdf91d6a6593..011f3502cdd8 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -30,6 +30,7 @@
#include "defaultgridcolumnmodel.hxx"
#include <comphelper/sequence.hxx>
#include <toolkit/helper/servicenames.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <rtl/ref.hxx>
using ::rtl::OUString;
@@ -38,8 +39,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::lang;
-
-#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" ))
+using namespace ::com::sun::star::style;
namespace toolkit
{
@@ -48,8 +48,10 @@ namespace toolkit
// class DefaultGridColumnModel
///////////////////////////////////////////////////////////////////////
-DefaultGridColumnModel::DefaultGridColumnModel()
+DefaultGridColumnModel::DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory)
: columns(std::vector< Reference< XGridColumn > >())
+ ,m_nColumnHeaderHeight(0)
+ ,m_xFactory(xFactory)
{
}
@@ -61,71 +63,6 @@ DefaultGridColumnModel::~DefaultGridColumnModel()
//---------------------------------------------------------------------
-void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent )
-{
- ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() );
- if( pIter )
- {
- ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
- while(aListIter.hasMoreElements())
- {
- XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next());
- switch( eType )
- {
- case column_added: pListener->columnAdded(aEvent); break;
- case column_removed: pListener->columnRemoved(aEvent); break;
- case column_changed: pListener->columnChanged(aEvent); break;
- }
- }
- }
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL );
- broadcast( column_changed, aEvent);
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
- broadcast( column_added, aEvent);
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
- broadcast( column_changed, aEvent);
-}
-
-//---------------------------------------------------------------------
-// XDefaultGridColumnModel
-//---------------------------------------------------------------------
-::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException)
-{
- return selectionAllowed;
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
-{
- sal_Bool oldValue = selectionAllowed;
- selectionAllowed = value;
- broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed));
-}
-
-//---------------------------------------------------------------------
-
::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
{
return columns.size();
@@ -136,11 +73,10 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- columns.push_back(column);
-
+ Reference<XGridColumn> xColumn(column);
+ columns.push_back(xColumn);
sal_Int32 index = columns.size() - 1;
- broadcast_add(index, column );
+ xColumn->setIndex(index);
return index;
}
@@ -156,23 +92,48 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
if ( index >=0 && index < ((sal_Int32)columns.size()))
+ {
return columns[index];
+ }
else
return Reference< XGridColumn >();
}
-
-void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridColumnModel::setColumnHeaderHeight(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_nColumnHeaderHeight = _value;
+}
+//---------------------------------------------------------------------
+sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnHeaderHeight() throw (::com::sun::star::uno::RuntimeException)
{
- BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
+ return m_nColumnHeaderHeight;
}
//---------------------------------------------------------------------
+void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+ for(sal_Int32 i=0;i<rowElements;i++)
+ {
+ Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
+ columns.push_back(xColumn);
+ xColumn->setIndex(i);
+ }
+}
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
{
- BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
+ Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
+ xColumn->setColumnWidth(column->getColumnWidth());
+ xColumn->setPreferredWidth(column->getPreferredWidth());
+ xColumn->setMaxWidth(column->getMaxWidth());
+ xColumn->setMinWidth(column->getMinWidth());
+ xColumn->setPreferredWidth(column->getPreferredWidth());
+ xColumn->setResizeable(column->getResizeable());
+ xColumn->setTitle(column->getTitle());
+ xColumn->setHorizontalAlign(column->getHorizontalAlign());
+ return xColumn;
}
-
//---------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------
@@ -232,8 +193,8 @@ sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString
}
-Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& _rFactory)
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
index 896427ce3e2b..8b8c8bfc795c 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
@@ -29,7 +29,7 @@
#include "precompiled_toolkit.hxx"
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
+//#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -38,6 +38,9 @@
#include <rtl/ref.hxx>
#include <vector>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -49,45 +52,49 @@ using namespace ::com::sun::star::lang;
namespace toolkit
{
-enum broadcast_type { column_added, column_removed, column_changed};
+//enum broadcast_type { column_added, column_removed, column_changed};
class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >,
public MutexAndBroadcastHelper
{
public:
- DefaultGridColumnModel();
+ DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory);
virtual ~DefaultGridColumnModel();
// XGridColumnModel
- virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
+ //virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException);
+ //virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
-
+ //virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+ //virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL setColumnHeaderHeight( sal_Int32 _value) throw (com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getColumnHeaderHeight() throw (com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (RuntimeException);
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
private:
- void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
+ /*void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue, sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
void broadcast_add( sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
- void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
+ void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );*/
std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns;
sal_Bool selectionAllowed;
+ sal_Int32 m_nColumnHeaderHeight;
+ Reference< XMultiServiceFactory > m_xFactory;
};
}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
index 70c79e0bcbfa..7ffafdf0ddb6 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -41,6 +41,9 @@ using namespace ::com::sun::star::lang;
#define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ))
#define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" ))
+#define CELLUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CellUpdated" ))
+#define ROWUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowUpdated" ))
+#define ROWHEADERWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaderWidth" ))
namespace toolkit
{
@@ -51,7 +54,8 @@ namespace toolkit
DefaultGridDataModel::DefaultGridDataModel()
: rowHeight(0),
- rowHeaders(std::vector< ::rtl::OUString >())
+ rowHeaders(std::vector< ::rtl::OUString >()),
+ m_nRowHeaderWidth(10)
{
}
@@ -61,7 +65,7 @@ DefaultGridDataModel::~DefaultGridDataModel()
{
}
-void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent )
+void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() );
if( pIter )
@@ -82,25 +86,27 @@ void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent&
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() );
+ GridDataEvent aEvent( xSource, name, oldValue, newValue, index, ::rtl::OUString(), Sequence< Any >());
broadcast( data_changed, aEvent);
}
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName,
+ ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, (const ::com::sun::star::uno::Sequence< Any >&)rowData );
broadcast( row_added, aEvent);
}
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName,
+ ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
@@ -124,7 +130,7 @@ void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com
sal_Int32 oldValue = rowHeight;
rowHeight = value;
- broadcast_changed( ROWHEIGHT, Any(oldValue), Any(value) );
+ broadcast_changed( ROWHEIGHT, 0, Any(oldValue), Any(value));
}
//---------------------------------------------------------------------
@@ -160,24 +166,26 @@ void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::S
i++;
}
- broadcast_changed( ROWHEADERS, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
+ broadcast_changed( ROWHEADERS, 0, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
}
//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
{
// store header name
rowHeaders.push_back(headername);
-
// store row data
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rRowdata));
+ std::vector< Any > newRow;
+ for ( int i = 0; i < rRowdata.getLength();i++)
+ {
+ newRow.push_back(rRowdata[i]);
+ }
data.push_back( newRow );
- broadcast_add( data.size()-1, headername, rRowdata);
+ broadcast_add( data.size()-1, headername, comphelper::containerToSequence(newRow));
}
@@ -187,16 +195,10 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
{
if ( index >= 0 && index <= getRowCount()-1)
{
- /* if(Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index ))
- {
- ::com::sun::star::uno::Sequence<::sal_Int32> selectedRows = Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
- selectedRow.erase(selectedRows.begin()+index);
- }*/
-
::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] );
rowHeaders.erase(rowHeaders.begin() + index);
- Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] );
+ Sequence< Any >& rowData ( (Sequence< Any >&)data[index] );
data.erase(data.begin() + index);
broadcast_remove( index, headerName, rowData);
}
@@ -204,19 +206,19 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
return;
}
//---------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
{
- std::vector< std::vector< ::rtl::OUString > >::iterator iterator;
- std::vector< Sequence< ::rtl::OUString > > dummyContainer(0);
+ std::vector< std::vector< Any > >::iterator iterator;
+ std::vector< Sequence< Any > > dummyContainer(0);
for(iterator = data.begin(); iterator != data.end(); iterator++)
{
- Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator));
+ Sequence< Any > cols(comphelper::containerToSequence(*iterator));
dummyContainer.push_back( cols );
}
- Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer));
+ Sequence< Sequence< Any > > dataSequence(comphelper::containerToSequence(dummyContainer));
return dataSequence;
}
@@ -234,14 +236,52 @@ void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDa
{
BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener );
}
-
+//---------------------------------------------------------------------
void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException)
{
rowHeaders.clear();
data.clear();
broadcast_remove( -1, ::rtl::OUString(), 0);
}
-
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridDataModel::setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 oldValue = m_nRowHeaderWidth;
+ m_nRowHeaderWidth = _value;
+ broadcast_changed( ROWHEADERWIDTH, 0, Any(oldValue), Any(_value) );
+}
+//---------------------------------------------------------------------
+sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nRowHeaderWidth;
+}
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridDataModel::updateCell(::sal_Int32 row, ::sal_Int32 column, const Any& value) throw (::com::sun::star::uno::RuntimeException)
+{
+ if(row >= 0 && row < (signed)data.size())
+ {
+ if(column >= 0 && column < (signed)data[0].size())
+ {
+ data[row][column] = value;
+ Sequence< Any >dataSeq(comphelper::containerToSequence(data[row]));
+ broadcast_changed( CELLUPDATED, row, Any(column), value );
+ }
+ }
+}
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridDataModel::updateRow(::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 > & columns, const ::com::sun::star::uno::Sequence< Any > & values) throw (::com::sun::star::uno::RuntimeException)
+{
+ if(row >= 0 && row < (signed)data.size())
+ {
+ if(columns.getLength() == values.getLength())
+ {
+ for(int i = 0; i < columns.getLength(); i++)
+ data[row][i] = values[i];
+ Sequence< Any >dataSeq(comphelper::containerToSequence(data[row]));
+ broadcast_changed( ROWUPDATED, row, Any(columns), Any(values) );
+ }
+ }
+}
//---------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------
@@ -302,6 +342,5 @@ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString&
Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel() );
}
-
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
index 1aebc07bc2a8..ea11a8a9a00a 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
#include <com/sun/star/awt/grid/GridDataEvent.hpp>
#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -64,13 +65,16 @@ public:
virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & data) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & data) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
virtual void SAL_CALL removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
virtual void SAL_CALL removeAll() throw (RuntimeException);
-
+ virtual void SAL_CALL setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCell( ::sal_Int32 row, ::sal_Int32 column, const ::com::sun::star::uno::Any& value ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRow( ::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& values ) throw (::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (RuntimeException);
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
@@ -83,14 +87,15 @@ public:
private:
- void broadcast( broadcast_type eType, const GridDataEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
- void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
- void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
+ void broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
sal_Int32 rowHeight;
- std::vector< std::vector < ::rtl::OUString > > data;
+ std::vector< std::vector < Any > > data;
std::vector< ::rtl::OUString > rowHeaders;
+ sal_Int32 m_nRowHeaderWidth;
};
}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
index 39c4960351d3..6720d639f5c1 100644
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -38,6 +38,16 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::style;
+
+#define COLWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColWidth" ))
+#define MAXWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MaxWidth" ))
+#define MINWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ))
+#define PREFWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PrefWidth" ))
+#define HALIGN ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HAlign" ))
+#define TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" ))
+#define COLRESIZE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnResize" ))
+#define UPDATE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UpdateWidth" ))
namespace toolkit
{
@@ -48,6 +58,13 @@ namespace toolkit
GridColumn::GridColumn()
: identifier(Any())
+,index(0)
+,columnWidth(4)
+,preferredWidth(0)
+,maxWidth(0)
+,minWidth(0)
+,bResizeable(true)
+,horizontalAlign(HorizontalAlignment(0))
{
}
@@ -59,6 +76,39 @@ GridColumn::~GridColumn()
//---------------------------------------------------------------------
+void GridColumn::broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent )
+{
+ ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() );
+ if( pIter )
+ {
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next());
+ switch( eType )
+ {
+ case column_attribute_changed: pListener->columnChanged(aEvent); break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void GridColumn::broadcast_changed(::rtl::OUString name, Any oldValue, Any newValue)
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, name, oldValue, newValue, index);
+ broadcast( column_attribute_changed, aEvent);
+}
+
+void SAL_CALL GridColumn::updateColumn(const ::rtl::OUString& name, sal_Int32 width) throw (::com::sun::star::uno::RuntimeException)
+{
+ if(PREFWIDTH == name)
+ preferredWidth = width;
+ else if (COLWIDTH == name)
+ columnWidth = width;
+}
//---------------------------------------------------------------------
// XGridColumn
//---------------------------------------------------------------------
@@ -79,6 +129,7 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value
::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
{
+ broadcast_changed(UPDATE, Any(columnWidth), Any());
return columnWidth;
}
@@ -87,6 +138,50 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value
void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
{
columnWidth = value;
+ broadcast_changed(COLWIDTH, Any(columnWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ broadcast_changed(UPDATE, Any(preferredWidth), Any());
+ return preferredWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ preferredWidth = value;
+ broadcast_changed(PREFWIDTH, Any(preferredWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return maxWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ maxWidth = value;
+ broadcast_changed(MAXWIDTH, Any(maxWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return minWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ minWidth = value;
+ broadcast_changed(MINWIDTH, Any(minWidth),Any(value));
}
//--------------------------------------------------------------------
@@ -101,6 +196,45 @@ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::s
void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
{
title = value;
+ broadcast_changed(TITLE, Any(title),Any(value));
+}
+//--------------------------------------------------------------------
+
+sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException)
+{
+ return bResizeable;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
+{
+ bResizeable = value;
+ broadcast_changed(COLRESIZE, Any(bResizeable),Any(value));
+}
+//---------------------------------------------------------------------
+HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException)
+{
+ return horizontalAlign;
+}
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException)
+{
+ horizontalAlign = align;
+ broadcast_changed(HALIGN, Any(horizontalAlign),Any(align));
+}
+//---------------------------------------------------------------------
+void SAL_CALL GridColumn::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
}
//---------------------------------------------------------------------
@@ -109,22 +243,30 @@ void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::
void SAL_CALL GridColumn::dispose() throw (RuntimeException)
{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ BrdcstHelper.aLC.disposeAndClear( aEvent );
}
//---------------------------------------------------------------------
void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
- (void) xListener;
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
}
//---------------------------------------------------------------------
void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
- (void) xListener;
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+void SAL_CALL GridColumn::setIndex(sal_Int32 _nIndex) throw (::com::sun::star::uno::RuntimeException)
+{
+ index = _nIndex;
}
-
//---------------------------------------------------------------------
// XServiceInfo
//---------------------------------------------------------------------
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
index 7f6d104127ec..38d43d55a07b 100644
--- a/toolkit/source/controls/grid/gridcolumn.hxx
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -28,6 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
+#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -36,6 +38,7 @@
#include <rtl/ref.hxx>
#include <vector>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -47,6 +50,7 @@ using namespace ::com::sun::star::lang;
namespace toolkit
{
+enum broadcast_column_type { column_attribute_changed};
class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >,
public MutexAndBroadcastHelper
{
@@ -59,9 +63,21 @@ public:
virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getPreferredWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPreferredWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
-
+ virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateColumn( const ::rtl::OUString& name, ::sal_Int32 width ) throw (::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (RuntimeException);
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
@@ -72,11 +88,20 @@ public:
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
+ virtual void SAL_CALL setIndex(sal_Int32 _nIndex)throw (::com::sun::star::uno::RuntimeException);
private:
+ void broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue);
+
Any identifier;
+ sal_Int32 index;
sal_Int32 columnWidth;
+ sal_Int32 preferredWidth;
+ sal_Int32 maxWidth;
+ sal_Int32 minWidth;
+ sal_Bool bResizeable;
::rtl::OUString title;
+ ::com::sun::star::style::HorizontalAlignment horizontalAlign;
};
}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index f19648ab0af2..5125c1349ade 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/view/SelectionType.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
#include <toolkit/helper/property.hxx>
@@ -68,12 +69,21 @@ UnoGridModel::UnoGridModel()
ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
ImplRegisterProperty( BASEPROPERTY_HSCROLL );
ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL );
ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL );
ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
-
+ ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
+ ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
+ ImplRegisterProperty( BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
+ ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND );
}
UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
@@ -99,6 +109,22 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
case BASEPROPERTY_GRID_SELECTIONMODE:
return uno::makeAny( SelectionType(1) );
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_GRID_DATAMODEL:
+ return uno::makeAny( Reference<XGridDataModel> ());
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ return uno::makeAny(Reference<XGridColumnModel>() );
+ case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_ROW_BACKGROUND:
+ return uno::makeAny(com::sun::star::util::Color(0xFFFFFF) );
default:
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
@@ -128,7 +154,8 @@ Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(Runtime
// class UnoGridControl
// ----------------------------------------------------
UnoGridControl::UnoGridControl()
-: mSelectionMode(SelectionType(1))
+: mSelectionMode(SelectionType(1)),
+ m_aSelectionListeners( *this )
{
}
@@ -139,6 +166,9 @@ OUString UnoGridControl::GetComponentServiceName()
void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aSelectionListeners.disposeAndClear( aEvt );
UnoControl::dispose();
}
@@ -147,63 +177,39 @@ void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
UnoControlBase::createPeer( rxToolkit, rParentPeer );
Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
+ xGrid->addSelectionListener(&m_aSelectionListeners);
Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW );
+ Reference<XGridColumnListener> xColListener ( getPeer(), UNO_QUERY_THROW );
Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
- xGridDataModel->addDataListener(xListener);
+ if(xGridDataModel != NULL)
+ xGridDataModel->addDataListener(xListener);
+ Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
+ if(xGridColumnModel != NULL)
+ {
+ for(int i = 0;i<xGridColumnModel->getColumnCount();i++)
+ {
+ xGridColumnModel->getColumn(i)->addColumnListener(xColListener);
+ }
+ }
}
// -------------------------------------------------------------------
// XGridControl
-// -------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoGridControl::getColumnModel() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
-
- return xGridColumnModel;
-}
-
-void SAL_CALL UnoGridControl::setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- xPropSet->setPropertyValue(OUString::createFromAscii( "ColumnModel" ), Any (model));
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoGridControl::getDataModel() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
-
- return xGridDataModel;
-}
-
-void SAL_CALL UnoGridControl::setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model));
-}
::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y );
+ Reference< XGridControl > xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getItemIndexAtPoint( x, y );
}
-/*
-void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addMouseListener( listener );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->setToolTip( text, columns );
}
-
-void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeMouseListener( listener );
-}
-*/
// -------------------------------------------------------------------
// XGridSelection
// -------------------------------------------------------------------
@@ -218,16 +224,24 @@ void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::R
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex();
}
-void SAL_CALL UnoGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length);
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRows( rangeOfRows);
}
-void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
+}
+void SAL_CALL UnoGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRows( rangeOfRows);
}
+void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
+}
::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
{
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
@@ -250,14 +264,14 @@ void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::
void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addSelectionListener( listener );
+ m_aSelectionListeners.addInterface( listener );
}
void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener );
-}
+ m_aSelectionListeners.removeInterface( listener );
}
+}//namespace toolkit
Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& )
{
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
index 4195a1f624e5..0c8ddb1c02b6 100644
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -30,10 +30,11 @@
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/view/SelectionType.hpp>
-#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/helper/servicenames.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
@@ -87,20 +88,18 @@ public:
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::grid::XGridControl
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException);
+
virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- //virtual void SAL_CALL addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::grid::XGridSelection
virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
@@ -114,6 +113,7 @@ public:
using UnoControl::getPeer;
private:
::com::sun::star::view::SelectionType mSelectionMode;
+ SelectionListenerMultiplexer m_aSelectionListeners;
};
} // toolkit
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
index fcfd6214780e..9b8df60521ae 100644
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -206,3 +206,8 @@ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com
// ----------------------------------------------------
IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener )
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 7ede81d485d7..6711e4503511 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -281,8 +281,12 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT )
- };
+ DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
+ DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID )
+ };
pPropertyInfos = aImplPropertyInfos;
nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
}
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 72c89aeac19d..a7e50e7e232d 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -64,6 +64,19 @@
#include <comphelper/stlunosequence.hxx>
#include <comphelper/sequenceasvector.hxx>
#include <comphelper/makesequence.hxx>
+#include <librdf.h>
+#include <libxslt/security.h>
+
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/bind.hpp>
+
+#include <map>
+#include <functional>
+#include <algorithm>
+
+#include <string.h>
/**
@@ -1889,7 +1902,15 @@ librdf_world *librdf_TypeConverter::createWorld() const
m_rRep);
}
//FIXME logger, digest, features?
+ xsltSecurityPrefsPtr origprefs = xsltGetDefaultSecurityPrefs();
librdf_world_open(pWorld);
+ xsltSecurityPrefsPtr newprefs = xsltGetDefaultSecurityPrefs();
+ if (newprefs != origprefs) {
+ // #i110523# restore libxslt global configuration
+ // (gratuitously overwritten by raptor_init_parser_grddl_common)
+ // (this is the only reason unordf is linked against libxslt)
+ xsltSetDefaultSecurityPrefs(origprefs);
+ }
return pWorld;
}
diff --git a/unoxml/source/rdf/makefile.mk b/unoxml/source/rdf/makefile.mk
index 1fd36f45ce0b..3f6d7f445297 100644
--- a/unoxml/source/rdf/makefile.mk
+++ b/unoxml/source/rdf/makefile.mk
@@ -41,6 +41,13 @@ ENABLE_EXCEPTIONS=TRUE
CFLAGS+=-DSYSTEM_REDLAND $(REDLAND_CFLAGS)
.ENDIF
+.IF "$(SYSTEM_LIBXSLT)" == "YES"
+CFLAGS+= $(LIBXSLT_CFLAGS)
+.ELSE
+LIBXSLTINCDIR=external$/libxslt
+CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR)
+.ENDIF
+
# --- Files --------------------------------------------------------
.IF "$(L10N_framework)"==""
@@ -64,6 +71,7 @@ DEF1NAME=$(SHL1TARGET)
SHL1STDLIBS= \
$(REDLANDLIB) \
+ $(XSLTLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index aa7ff9b292a7..166ad76475d8 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -66,6 +66,8 @@ namespace ooo
VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/prj/build.lst b/vbahelper/prj/build.lst
index 0db5274b7ad3..20001db859c8 100644
--- a/vbahelper/prj/build.lst
+++ b/vbahelper/prj/build.lst
@@ -1,4 +1,4 @@
-vba vbahelper : oovbaapi basic sfx2 svx cppuhelper vcl comphelper svtools tools sal NULL
+vba vbahelper : oovbaapi basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL
vba vbahelper usr1 - all vba_mkout NULL
#vba vbahelper\inc nmake - all vba_inc NULL
vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL
diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk
index 3284ec5cec9d..b11b4ffa0a4f 100644
--- a/vbahelper/source/vbahelper/makefile.mk
+++ b/vbahelper/source/vbahelper/makefile.mk
@@ -41,7 +41,6 @@ dummy:
.INCLUDE : settings.mk
SLOFILES=\
- $(SLO)$/msvbahelper.obj \
$(SLO)$/vbahelper.obj \
$(SLO)$/vbapropvalue.obj \
$(SLO)$/vbacommandbars.obj \
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 7f8e563cbab6..54b635d2f08d 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include "vbacommandbars.hxx"
-#include <vbahelper/msvbahelper.hxx>
+#include <filter/msfilter/msvbahelper.hxx>
// start basic includes
#include <basic/sbx.hxx>
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
index e081a723db04..a4bb3adc7dbf 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
@@ -27,7 +27,7 @@
#include "vbacommandbarcontrol.hxx"
#include "vbacommandbarcontrols.hxx"
#include <vbahelper/vbahelper.hxx>
-#include <vbahelper/msvbahelper.hxx>
+#include <filter/msfilter/msvbahelper.hxx>
using namespace com::sun::star;
using namespace ooo::vba;
diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx
index 4226a6bfbf53..c7c33b93b1a3 100644
--- a/vbahelper/source/vbahelper/vbaglobalbase.cxx
+++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx
@@ -85,7 +85,6 @@ VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpeci
{
uno::Reference< uno::XInterface > xReturn;
-
if ( hasServiceName( ServiceSpecifier ) )
xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( ServiceSpecifier, Arguments, mxContext );
return xReturn;
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index a7921da9a4f7..a9e72318536d 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -448,6 +448,18 @@ getCurrentDocCtx( const rtl::OUString& ctxName, const uno::Reference< uno::XComp
return xModel;
}
+uno::Reference< frame::XModel >
+getThisExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
+{
+ return getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ExcelDocumentContext" ) ), xContext );
+}
+
+uno::Reference< frame::XModel >
+getThisWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
+{
+ return getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext" ) ), xContext );
+}
+
uno::Reference< frame::XModel >
getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
{
@@ -459,7 +471,7 @@ getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) t
}
catch( uno::Exception& e )
{
- xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ExcelDocumentContext" ) ), xContext );
+ xModel = getThisExcelDoc( xContext );
}
return xModel;
}
@@ -475,7 +487,7 @@ getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) th
}
catch( uno::Exception& e )
{
- xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext" ) ), xContext );
+ xModel = getThisWordDoc( xContext );
}
return xModel;
}
diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk
index 49bc8e7d39b0..dda4be0cbc81 100644
--- a/vbahelper/util/makefile.mk
+++ b/vbahelper/util/makefile.mk
@@ -60,6 +60,7 @@ SHL1STDLIBS= \
$(SVLLIB) \
$(VCLLIB) \
$(SVTOOLLIB) \
+ $(MSFILTERLIB) \
$(TKLIB)
SHL1DEPN=
diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx
index 048eb1d5a670..fcf1d2ee0387 100644
--- a/vcl/inc/vcl/vclevent.hxx
+++ b/vcl/inc/vcl/vclevent.hxx
@@ -192,6 +192,7 @@ namespace com { namespace sun { namespace star {
#define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos
#define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText)
+#define VCLEVENT_TABLEROW_SELECT 1225
class VCL_DLLPUBLIC VclSimpleEvent
{
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index 02750f76dcc6..75310d90f0ae 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -262,11 +262,11 @@ enum XMLTextPAttrTokens
XML_TOK_TEXT_P_PROPERTY,
XML_TOK_TEXT_P_CONTENT,
XML_TOK_TEXT_P_DATATYPE,
+ XML_TOK_TEXT_P_TEXTID,
XML_TOK_TEXT_P_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME,
XML_TOK_TEXT_P_LEVEL,
XML_TOK_TEXT_P_CLASS_NAMES,
- XML_TOK_TEXT_P_ID,
XML_TOK_TEXT_P_IS_LIST_HEADER,
XML_TOK_TEXT_P_RESTART_NUMBERING,
XML_TOK_TEXT_P_START_VALUE,
diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx
index 0459fcc7b13a..03903f38a331 100644
--- a/xmloff/inc/xmloff/xmlexp.hxx
+++ b/xmloff/inc/xmloff/xmlexp.hxx
@@ -590,6 +590,12 @@ public:
/// name of stream in package, e.g., "content.xml"
::rtl::OUString GetStreamName() const;
+ // FIXME: this is only for legacy stuff that has not yet been adapted
+ // to implement XMetadatable; this can write duplicate IDs!
+ /// add xml:id and legacy namespace id
+ void SAL_DLLPRIVATE AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue);
+
/// add xml:id attribute (for RDF metadata)
void AddAttributeXmlId(::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> const & i_xIfc);
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 8154d284f628..ccc400305044 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -41,9 +41,7 @@
#include <tools/globname.hxx>
#include <sot/clsids.hxx>
-#ifndef _SVTOOLS_NMSPMAP_HXX
#include <xmloff/nmspmap.hxx>
-#endif
#include "xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx>
#include <xmloff/families.hxx>
@@ -1526,8 +1524,11 @@ void SchXMLExportHelper::exportTable()
// to allow a correct re-association when copying via clipboard
if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd )
{
- if( (*aColumnDescriptions_RangeIter).getLength())
- mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aColumnDescriptions_RangeIter );
+ if ((*aColumnDescriptions_RangeIter).getLength())
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ *aColumnDescriptions_RangeIter);
+ }
++aColumnDescriptions_RangeIter;
}
exportText( *aIt );
@@ -1559,7 +1560,10 @@ void SchXMLExportHelper::exportTable()
// write the original range name as id into the local table
// to allow a correct re-association when copying via clipboard
if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd )
- mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aRowDescriptions_RangeIter++ );
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ *aRowDescriptions_RangeIter++);
+ }
exportText( *aRowDescriptionsIter );
++aRowDescriptionsIter;
if( nC < nComplexCount )
@@ -1581,8 +1585,11 @@ void SchXMLExportHelper::exportTable()
if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) &&
( mbRowSourceColumns || (aColIt == aRowIt->begin())) )
{
- if( (*aDataRangeIter).getLength())
- mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aDataRangeIter );
+ if ((*aDataRangeIter).getLength())
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ *aDataRangeIter);
+ }
++aDataRangeIter;
}
exportText( msString, false ); // do not convert tabs and lfs
diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx
index 646d82e4ab79..972bc9016d4f 100644
--- a/xmloff/source/chart/SchXMLParagraphContext.cxx
+++ b/xmloff/source/chart/SchXMLParagraphContext.cxx
@@ -60,6 +60,7 @@ void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttr
{
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
rtl::OUString aValue;
+ bool bHaveXmlId( false );
for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
@@ -67,11 +68,20 @@ void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttr
rtl::OUString aLocalName;
USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- if( nPrefix == XML_NAMESPACE_TEXT &&
- IsXMLToken( aLocalName, XML_ID ) )
+ if (IsXMLToken(aLocalName, XML_ID))
{
- (*mpId) = xAttrList->getValueByIndex( i );
- break; // we only need this attribute
+ if (nPrefix == XML_NAMESPACE_XML)
+ {
+ (*mpId) = xAttrList->getValueByIndex( i );
+ bHaveXmlId = true;
+ }
+ if (nPrefix == XML_NAMESPACE_TEXT)
+ { // text:id shall be ignored if xml:id exists
+ if (!bHaveXmlId)
+ {
+ (*mpId) = xAttrList->getValueByIndex( i );
+ }
+ }
}
}
}
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 4c52cc2ce4cb..c10ac0a23c03 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2535,6 +2535,22 @@ SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const
}
void
+SvXMLExport::AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue)
+{
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: break;
+ default: // ODF 1.2: xml:id
+ AddAttribute(XML_NAMESPACE_XML, XML_ID, rValue);
+ }
+ // in ODF 1.1 this was form:id, anim:id, draw:id, or text:id
+ // backward compatibility: in ODF 1.2 write _both_ id attrs
+ AddAttribute(nLegacyPrefix, XML_ID, rValue);
+ // FIXME: this function simply assumes that rValue is unique
+}
+
+void
SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
{
// check version >= 1.2
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 7ebcef8ffde4..eaf83444114c 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -28,24 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateColor_HPP_
#include <com/sun/star/animations/XAnimateColor.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateSet_HPP_
#include <com/sun/star/animations/XAnimateSet.hpp>
-#endif
#include <com/sun/star/animations/XCommand.hpp>
#include <com/sun/star/animations/Timing.hpp>
#include <com/sun/star/animations/Event.hpp>
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateMotion_HPP_
#include <com/sun/star/animations/XAnimateMotion.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateTransform_HPP_
#include <com/sun/star/animations/XAnimateTransform.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ANIMATIONS_XTransitionFilter_HPP_
#include <com/sun/star/animations/XTransitionFilter.hpp>
-#endif
#include <com/sun/star/animations/XIterateContainer.hpp>
#include <com/sun/star/animations/XAudio.hpp>
#include <com/sun/star/animations/AnimationColorSpace.hpp>
@@ -64,19 +54,12 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/presentation/EffectNodeType.hpp>
-#ifndef _COM_SUN_STAR_PRESENTATION_EffectPresetClass_HPP_
#include <com/sun/star/presentation/EffectPresetClass.hpp>
-#endif
-#ifndef _COM_SUN_STAR_PRESENTATION_ParagraphTarget_HPP_
#include <com/sun/star/presentation/ParagraphTarget.hpp>
-#endif
#include <com/sun/star/presentation/TextAnimationType.hpp>
#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
#include <com/sun/star/presentation/EffectCommands.hpp>
-
-#ifndef _COM_SUN_STAR_DRAWING_XShape_HPP_
#include <com/sun/star/drawing/XShape.hpp>
-#endif
#include <tools/debug.hxx>
#include <tools/time.hxx>
@@ -780,7 +763,10 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod
const OUString& rExportIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xNode );
if( rExportIdentifier.getLength() )
- mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ID, rExportIdentifier );
+ {
+ mrExport.AddAttributeIdLegacy(
+ XML_NAMESPACE_ANIMATION, rExportIdentifier);
+ }
Any aTemp( xNode->getBegin() );
if( aTemp.hasValue() )
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index 4fc6bc93302b..17bba5170c79 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -47,18 +47,14 @@
#include <com/sun/star/animations/XAudio.hpp>
#include <com/sun/star/animations/ValuePair.hpp>
#include <com/sun/star/animations/AnimationColorSpace.hpp>
-#ifndef _COM_SUN_STAR_PRESENTATION_EffectPresetClass_HPP_
#include <com/sun/star/presentation/EffectPresetClass.hpp>
-#endif
#include <com/sun/star/animations/Timing.hpp>
#include <com/sun/star/animations/Event.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/text/XTextRangeCompare.hpp>
-#ifndef _COM_SUN_STAR_PRESENTATION_ParagraphTarget_HPP_
#include <com/sun/star/presentation/ParagraphTarget.hpp>
-#endif
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/animations/EventTrigger.hpp>
@@ -237,7 +233,8 @@ enum AnimationNodeAttributes
ANA_IterateType,
ANA_IterateInterval,
ANA_Formula,
- ANA_ID,
+ ANA_ANIMID,
+ ANA_XMLID,
ANA_Group_Id,
ANA_Command,
ANA_Volume
@@ -294,8 +291,8 @@ const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeAttributeTokenM
{ XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, (sal_uInt16)ANA_IterateType },
{ XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, (sal_uInt16)ANA_IterateInterval },
{ XML_NAMESPACE_ANIMATION, XML_FORMULA, (sal_uInt16)ANA_Formula },
- { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ID },
- { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_ID },
+ { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ANIMID },
+ { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_XMLID },
{ XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, (sal_uInt16)ANA_Group_Id },
{ XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, (sal_uInt16)ANA_Volume },
{ XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)ANA_Command },
@@ -808,6 +805,8 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< :
std::list< NamedValue > aUserData;
XMLTokenEnum meAttributeName = XML_TOKEN_INVALID;
OUString aFrom, aBy, aTo, aValues;
+ bool bHaveXmlId( false );
+ OUString sXmlId;
const sal_Int16 nCount = xAttrList.is() ? xAttrList->getLength() : 0;
sal_uInt16 nEnum;
@@ -1054,13 +1053,15 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< :
}
break;
- case ANA_ID:
+ case ANA_ANIMID:
{
- if( rValue.getLength() )
- {
- Reference< XInterface > xRef( mxNode, UNO_QUERY );
- GetImport().getInterfaceToIdentifierMapper().registerReference( rValue, xRef );
- }
+ if (!bHaveXmlId) { sXmlId = rValue; }
+ }
+ break;
+ case ANA_XMLID:
+ {
+ sXmlId = rValue;
+ bHaveXmlId = true;
}
break;
@@ -1251,6 +1252,13 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< :
}
}
+ if (sXmlId.getLength())
+ {
+ Reference< XInterface > const xRef( mxNode, UNO_QUERY );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
+
sal_Int32 nUserDataCount = aUserData.size();
if( nUserDataCount )
{
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index bc6f72abd2b0..249ce18331d9 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2011,7 +2011,9 @@ void SdXMLExport::_ExportContent()
// write draw:id
const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
if( aPageId.getLength() != 0 )
- AddAttribute ( XML_NAMESPACE_DRAW, XML_ID, aPageId );
+ {
+ AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
+ }
// write page
SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, sal_True, sal_True);
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 8ec97697b138..76942cf817db 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -665,8 +665,8 @@ const SvXMLTokenMap& SdXMLImport::GetDrawPageAttrTokenMap()
{ XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_DRAWPAGE_STYLE_NAME },
{ XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME },
{ XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME },
- { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_ID },
- { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_ID },
+ { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_DRAWID },
+ { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_XMLID },
{ XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DRAWPAGE_HREF },
{ XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_DRAWPAGE_USE_HEADER_NAME },
{ XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_DRAWPAGE_USE_FOOTER_NAME },
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index 1c0b883c9b59..d1cd0df80563 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -130,7 +130,8 @@ enum SdXMLDrawPageAttrTokenMap
XML_TOK_DRAWPAGE_STYLE_NAME,
XML_TOK_DRAWPAGE_MASTER_PAGE_NAME,
XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME,
- XML_TOK_DRAWPAGE_ID,
+ XML_TOK_DRAWPAGE_DRAWID,
+ XML_TOK_DRAWPAGE_XMLID,
XML_TOK_DRAWPAGE_HREF,
XML_TOK_DRAWPAGE_USE_HEADER_NAME,
XML_TOK_DRAWPAGE_USE_FOOTER_NAME,
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 3ec0d01ff1e5..c4f398524a2f 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -47,9 +47,7 @@
#include <xmloff/xmluconv.hxx>
#include "PropertySetMerger.hxx"
-#ifndef _XMLOFF_SHAPEEXPORT_HXX
#include <xmloff/shapeexport.hxx>
-#endif
#include "sdpropls.hxx"
#include "sdxmlexp_impl.hxx"
#include <xmloff/families.hxx>
@@ -677,7 +675,9 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape
uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef );
if( rShapeId.getLength() )
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, rShapeId );
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId);
+ }
}
// --------------------------
diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx
index 9b5290254b46..af5fef0ff9dc 100644
--- a/xmloff/source/draw/ximpbody.cxx
+++ b/xmloff/source/draw/ximpbody.cxx
@@ -62,6 +62,9 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
, mbHadSMILNodes( false )
{
+ bool bHaveXmlId( false );
+ OUString sXmlId;
+
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for(sal_Int16 i=0; i < nAttrCount; i++)
@@ -109,13 +112,17 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
maUseDateTimeDeclName = sValue;
break;
}
-
- case XML_TOK_DRAWPAGE_ID:
+ case XML_TOK_DRAWPAGE_DRAWID:
{
- uno::Reference< uno::XInterface > xRef( rShapes.get() );
- GetImport().getInterfaceToIdentifierMapper().registerReference( sValue, xRef );
- break;
+ if (!bHaveXmlId) { sXmlId = sValue; }
}
+ break;
+ case XML_TOK_DRAWPAGE_XMLID:
+ {
+ sXmlId = sValue;
+ bHaveXmlId = true;
+ }
+ break;
case XML_TOK_DRAWPAGE_HREF:
{
maHREF = sValue;
@@ -124,6 +131,12 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
}
}
+ if (sXmlId.getLength())
+ {
+ uno::Reference< uno::XInterface > const xRef( rShapes.get() );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
GetImport().GetShapeImport()->startPage( rShapes );
uno::Reference< drawing::XDrawPage > xShapeDrawPage(rShapes, uno::UNO_QUERY);
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 365fb000389e..dc362136a3fe 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -776,6 +776,7 @@ void SdXMLShapeContext::SetThumbnail()
// this is called from the parent group for each unparsed attribute in the attribute list
void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
{
+ bool bHaveXmlId( false );
if( XML_NAMESPACE_DRAW == nPrefix )
{
if( IsXMLToken( rLocalName, XML_ZINDEX ) )
@@ -784,7 +785,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr
}
else if( IsXMLToken( rLocalName, XML_ID ) )
{
- maShapeId = rValue;
+ if (!bHaveXmlId) { maShapeId = rValue; };
}
else if( IsXMLToken( rLocalName, XML_NAME ) )
{
@@ -877,6 +878,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr
if( IsXMLToken( rLocalName, XML_ID ) )
{
maShapeId = rValue;
+ bHaveXmlId = true;
}
}
}
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 9baf402e5ea7..eacd5bb735ef 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -313,10 +313,8 @@ namespace xmloff
if (CCA_CONTROL_ID & m_nIncludeCommon)
{
OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportInnerAttributes: have no control id for the control!");
- AddAttribute(
- OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CONTROL_ID),
- OAttributeMetaData::getCommonControlAttributeName(CCA_CONTROL_ID),
- m_sControlId);
+ m_rContext.getGlobalContext().AddAttributeIdLegacy(
+ XML_NAMESPACE_FORM, m_sControlId);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID;
@@ -2035,6 +2033,12 @@ namespace xmloff
OAttributeMetaData::getFormAttributeNamespace(eStringPropertyIds[i]),
OAttributeMetaData::getFormAttributeName(eStringPropertyIds[i]),
aStringPropertyNames[i]);
+
+ // Since as per ODF 1.2, xlink:href and xlink:type need to exist either both or none,
+ // we need to write xlink:type, too, even if it carries no information.
+ // #i111035# / 2010-04-141/ frank.schoenheit@sun.com
+ AddAttributeASCII( XML_NAMESPACE_XLINK, "type", "simple" );
+
// now export the data source name or databaselocation or connection resource
::rtl::OUString sPropValue;
m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue;
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index a39576bd2184..b946c4a20941 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -586,12 +586,21 @@ namespace xmloff
//---------------------------------------------------------------------
void OControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
{
- static const sal_Char* pControlIdAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CONTROL_ID);
static const sal_Char* pLinkedCellAttributeName = OAttributeMetaData::getBindingAttributeName(BA_LINKED_CELL);
- if ( !m_sControlId.getLength() && _rLocalName.equalsAscii( pControlIdAttributeName ) )
+ if (IsXMLToken(_rLocalName, XML_ID))
{ // it's the control id
- m_sControlId = _rValue;
+ if (XML_NAMESPACE_XML == _nNamespaceKey)
+ {
+ m_sControlId = _rValue;
+ }
+ else if (XML_NAMESPACE_FORM == _nNamespaceKey)
+ {
+ if (!m_sControlId.getLength())
+ {
+ m_sControlId = _rValue;
+ }
+ }
}
else if ( _rLocalName.equalsAscii( pLinkedCellAttributeName ) )
{ // it's the address of a spreadsheet cell
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
index fbe388a6a81a..0e2ef69ab9f8 100644
--- a/xmloff/source/forms/formattributes.cxx
+++ b/xmloff/source/forms/formattributes.cxx
@@ -53,7 +53,7 @@ namespace xmloff
case CCA_NAME: return "name";
case CCA_SERVICE_NAME: return "control-implementation";
case CCA_BUTTON_TYPE: return "button-type";
- case CCA_CONTROL_ID: return "id";
+// disabled(AddAttributeIdLegacy) case CCA_CONTROL_ID: return "id";
case CCA_CURRENT_SELECTED: return "current-selected";
case CCA_CURRENT_VALUE: return "current-value";
case CCA_DISABLED: return "disabled";
diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx
index 8aa0a4054821..aab4686339ba 100644
--- a/xmloff/source/meta/xmlmetae.cxx
+++ b/xmloff/source/meta/xmlmetae.cxx
@@ -475,7 +475,9 @@ SvXMLMetaExport::startElement(const ::rtl::OUString & i_rName,
}
// finally, start the element
- mrExport.StartElement(i_rName, sal_True); //FIXME:whitespace?
+ // #i107240# no whitespace here, because the DOM may already contain
+ // whitespace, which is not cleared when loading and thus accumulates.
+ mrExport.StartElement(i_rName, (m_level > 1) ? sal_False : sal_True);
++m_level;
}
diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx
index 68f77790ac49..dcc81ccf9f89 100644
--- a/xmloff/source/style/XMLFontAutoStylePool.cxx
+++ b/xmloff/source/style/XMLFontAutoStylePool.cxx
@@ -27,18 +27,19 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
+
#include <tools/debug.hxx>
#include <svl/cntnrsrt.hxx>
#include <tools/fontenum.hxx>
+
#include "xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmluconv.hxx>
-#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
#include "fonthdl.hxx"
-#endif
#include <xmloff/xmlexp.hxx>
#include <xmloff/XMLFontAutoStylePool.hxx>
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx
index 37b8aa2196f3..49dd6ddac91e 100644
--- a/xmloff/source/style/XMLFontStylesContext.cxx
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -28,25 +28,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-#ifndef _COM_SUN_STAR_AWT_FONTFAMILY_HPP
#include <com/sun/star/awt/FontFamily.hpp>
-#endif
-#ifndef _COM_SUN_STAR_AWT_FONTPITCH_HPP
#include <com/sun/star/awt/FontPitch.hpp>
-#endif
+
+#include <rtl/logfile.hxx>
+
#include <xmloff/nmspmap.hxx>
#include "xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx>
-#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
#include "fonthdl.hxx"
-#endif
#include <xmloff/xmlimp.hxx>
#include <xmloff/maptype.hxx>
-
-#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX
#include <xmloff/XMLFontStylesContext.hxx>
-#endif
-#include <rtl/logfile.hxx>
+
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx
index 4d47ae9b996c..89ad6e9db8b8 100644
--- a/xmloff/source/style/fonthdl.cxx
+++ b/xmloff/source/style/fonthdl.cxx
@@ -28,9 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
#include <fonthdl.hxx>
-#endif
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmluconv.hxx>
#include <rtl/ustrbuf.hxx>
diff --git a/xmloff/source/style/fonthdl.hxx b/xmloff/source/style/fonthdl.hxx
index 49d027579af3..18ddae73af14 100644
--- a/xmloff/source/style/fonthdl.hxx
+++ b/xmloff/source/style/fonthdl.hxx
@@ -25,8 +25,8 @@
*
************************************************************************/
-#ifndef _XMLOFF_PROPERTYHANDLER_FONTYPES_HXX
-#define _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#ifndef XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#define XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
#include <xmloff/xmlprhdl.hxx>
@@ -79,4 +79,4 @@ public:
};
-#endif // _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#endif // XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
index af5448040896..27af64469daf 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -27,10 +27,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
+
#include <com/sun/star/drawing/ColorMode.hpp>
#include <com/sun/star/text/HorizontalAdjust.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+
#include <tools/debug.hxx>
+
#include <xmloff/prhdlfac.hxx>
#include <xmloff/xmltypes.hxx>
#include <xmloff/xmltoken.hxx>
@@ -39,9 +42,7 @@
#include <xmloff/XMLConstantsPropertyHandler.hxx>
#include "cdouthdl.hxx"
#include "csmaphdl.hxx"
-#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
#include "fonthdl.hxx"
-#endif
#include "kernihdl.hxx"
#include <postuhdl.hxx>
#include "shadwhdl.hxx"
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 681fff7ea229..5bc581c7af0b 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -27,15 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <tools/debug.hxx>
-#include <xmloff/nmspmap.hxx>
-#include "xmlnmspe.hxx"
-#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmluconv.hxx>
-#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
-#include "fonthdl.hxx"
-#endif
+
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/style/NumberingType.hpp>
#include <com/sun/star/style/XStyle.hpp>
@@ -52,11 +44,22 @@
// <--
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <tools/debug.hxx>
+
+#include <xmloff/nmspmap.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "fonthdl.hxx"
#include "XMLTextListAutoStylePool.hxx"
#include <xmloff/xmlnume.hxx>
#include <xmloff/xmlexp.hxx>
#include <tools/fontenum.hxx>
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -294,9 +297,12 @@ void SvxXMLNumRuleExport::exportLevelStyle( INT32 nLevel,
OUStringBuffer sTmp;
sTmp.append( nLevel + 1 );
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() );
- if( sTextStyleName.getLength() > 0 )
+ // #i110694#: no style-name on list-level-style-image
+ if ((sTextStyleName.getLength() > 0) && (NumberingType::BITMAP != eType))
+ {
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
GetExport().EncodeStyleName( sTextStyleName ) );
+ }
if( sPrefix.getLength() > 0 )
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX, sPrefix );
if( sSuffix.getLength() > 0 )
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index d64c22be0179..7306c7d5f0de 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -27,16 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/debug.hxx>
-#include <tools/fontenum.hxx>
-#include <xmloff/xmltkmap.hxx>
-#include <xmloff/nmspmap.hxx>
-#include "xmlnmspe.hxx"
-#include <xmloff/xmlimp.hxx>
-#include <xmloff/XMLBase64ImportContext.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -51,26 +42,33 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+#include <tools/fontenum.hxx>
+
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/nmspmap.hxx>
+#include "xmlnmspe.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/XMLBase64ImportContext.hxx>
#include <xmloff/xmltoken.hxx>
#include "i18nmap.hxx"
#include <xmloff/xmluconv.hxx>
-#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
#include "fonthdl.hxx"
-#endif
-#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX
#include <xmloff/XMLFontStylesContext.hxx>
-#endif
-#ifndef _XMLOFF_FAMILIES_HXX
#include <xmloff/families.hxx>
-#endif
#include <xmloff/maptype.hxx>
-
#include <xmloff/xmlnumi.hxx>
#define _SVSTDARR_USHORTS
#include <svl/svstdarr.hxx>
+
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx
index 7e46c66442f4..52e4ccc8e048 100644
--- a/xmloff/source/text/XMLChangedRegionImportContext.cxx
+++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx
@@ -68,6 +68,7 @@ void XMLChangedRegionImportContext::StartElement(
const Reference<XAttributeList> & xAttrList)
{
// process attributes: id
+ bool bHaveXmlId( false );
sal_Int16 nLength = xAttrList->getLength();
for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
{
@@ -77,11 +78,19 @@ void XMLChangedRegionImportContext::StartElement(
&sLocalName );
const OUString sValue = xAttrList->getValueByIndex(nAttr);
- if ( XML_NAMESPACE_TEXT == nPrefix )
+ if (XML_NAMESPACE_XML == nPrefix)
{
- if( IsXMLToken( sLocalName, XML_ID ) )
+ if (IsXMLToken(sLocalName, XML_ID))
{
sID = sValue;
+ bHaveXmlId = true;
+ }
+ }
+ else if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_ID))
+ {
+ if (!bHaveXmlId) { sID = sValue; }
}
else if( IsXMLToken( sLocalName, XML_MERGE_LAST_PARAGRAPH ) )
{
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index d4ab361f1688..67970330f3ef 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -374,7 +374,7 @@ void XMLRedlineExport::ExportChangedRegion(
const Reference<XPropertySet> & rPropSet)
{
// Redline-ID
- rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_ID, GetRedlineID(rPropSet) );
+ rExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, GetRedlineID(rPropSet));
// merge-last-paragraph
Any aAny = rPropSet->getPropertyValue(sMergeLastPara);
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 8c5cf9e83237..bc01112d9b03 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -343,11 +343,11 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] =
{ XML_NAMESPACE_XHTML, XML_PROPERTY, XML_TOK_TEXT_P_PROPERTY },
{ XML_NAMESPACE_XHTML, XML_CONTENT, XML_TOK_TEXT_P_CONTENT },
{ XML_NAMESPACE_XHTML, XML_DATATYPE, XML_TOK_TEXT_P_DATATYPE },
+ { XML_NAMESPACE_TEXT, XML_ID, XML_TOK_TEXT_P_TEXTID },
{ XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_P_STYLE_NAME },
{ XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME },
{ XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,XML_TOK_TEXT_P_LEVEL },
- { XML_NAMESPACE_TEXT, XML_ID, XML_TOK_TEXT_P_ID },
{ XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER },
{ XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING },
{ XML_NAMESPACE_TEXT, XML_START_VALUE,XML_TOK_TEXT_P_START_VALUE },
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 61559549c6e7..140656fd4298 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -1998,7 +1998,18 @@ void XMLTextParagraphExport::exportParagraph(
{
const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( xRef );
if( rIdentifier.getLength() )
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ID, rIdentifier );
+ {
+ // FIXME: this is just temporary until EditEngine
+ // paragraphs implement XMetadatable.
+ // then that must be used and not the mapper, because
+ // when both can be used we get two xml:id!
+ uno::Reference<rdf::XMetadatable> const xMeta(xRef,
+ uno::UNO_QUERY);
+ OSL_ENSURE(!xMeta.is(), "paragraph that implements "
+ "XMetadatable used in interfaceToIdentifierMapper?");
+ GetExport().AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ rIdentifier);
+ }
}
OUString sAutoStyle( sStyle );
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index a2f6c4a01f27..566c94ed166a 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1917,6 +1917,7 @@ XMLParaContext::XMLParaContext(
const SvXMLTokenMap& rTokenMap =
GetImport().GetTextImport()->GetTextPAttrTokenMap();
+ bool bHaveXmlId( false );
OUString aCondStyleName, sClassNames;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
@@ -1933,6 +1934,7 @@ XMLParaContext::XMLParaContext(
{
case XML_TOK_TEXT_P_XMLID:
m_sXmlId = rValue;
+ bHaveXmlId = true;
break;
case XML_TOK_TEXT_P_ABOUT:
m_sAbout = rValue;
@@ -1947,6 +1949,9 @@ XMLParaContext::XMLParaContext(
case XML_TOK_TEXT_P_DATATYPE:
m_sDatatype = rValue;
break;
+ case XML_TOK_TEXT_P_TEXTID:
+ if (!bHaveXmlId) { m_sXmlId = rValue; }
+ break;
case XML_TOK_TEXT_P_STYLE_NAME:
sStyleName = rValue;
break;
@@ -1979,9 +1984,6 @@ XMLParaContext::XMLParaContext(
}
}
break;
- case XML_TOK_TEXT_P_ID:
- sId = rValue;
- break;
case XML_TOK_TEXT_P_RESTART_NUMBERING:
{
sal_Bool bBool;
@@ -2020,14 +2022,17 @@ XMLParaContext::~XMLParaContext()
// if we have an id set for this paragraph, get a cursor for this
// paragraph and register it with the given identifier
- if( sId.getLength() )
+ // FIXME: this is just temporary, and should be removed when
+ // EditEngine paragraphs implement XMetadatable!
+ if (m_sXmlId.getLength())
{
Reference < XTextCursor > xIdCursor( xTxtImport->GetText()->createTextCursorByRange( xStart ) );
if( xIdCursor.is() )
{
xIdCursor->gotoRange( xEnd, sal_True );
Reference< XInterface > xRef( xIdCursor, UNO_QUERY );
- GetImport().getInterfaceToIdentifierMapper().registerReference( sId, xRef );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ m_sXmlId, xRef);
}
}
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index 9c911a5b639c..ecd593ca3d4f 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -46,7 +46,6 @@ class XMLParaContext : public SvXMLImportContext
::com::sun::star::uno::Reference <
::com::sun::star::text::XTextRange > xStart; // xub_StrLen nStart;
::rtl::OUString sStyleName;
- ::rtl::OUString sId;
::rtl::OUString m_sXmlId;
::rtl::OUString m_sAbout;
::rtl::OUString m_sProperty;
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
index d32d46698003..a53d02393ae6 100644
--- a/xmlscript/source/xmldlg_imexp/exp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -117,7 +117,7 @@ public:
inline bool readProp( T * ret, ::rtl::OUString const & rPropName );
css::uno::Any readProp( ::rtl::OUString const & rPropName );
//
- void readDefaults( bool supportPrintable = true );
+ void readDefaults( bool supportPrintable = true, bool supportVisible = true );
//
void readStringAttr(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index 55b46edc1392..b30c24b4b419 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -1138,7 +1138,7 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
}
// collect elements
- readDefaults( false );
+ readDefaults( false, false );
readBoolAttr(
OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":closeable") ) );
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 088d6e841c94..365355375808 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -972,7 +972,7 @@ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUStr
}
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readDefaults( bool supportPrintable )
+void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
{
Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ),
@@ -995,7 +995,7 @@ void ElementDescriptor::readDefaults( bool supportPrintable )
}
sal_Bool bVisible = sal_True;
- try
+ if (supportVisible) try
{
if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ) ) >>= bVisible)
{