summaryrefslogtreecommitdiff
path: root/scratch/sc-vba
diff options
context:
space:
mode:
Diffstat (limited to 'scratch/sc-vba')
-rw-r--r--scratch/sc-vba/POSITION1
-rw-r--r--scratch/sc-vba/ReadMe3
-rw-r--r--scratch/sc-vba/dead-source/helperdecl.hxx143
-rw-r--r--scratch/sc-vba/dead-source/service.cxx116
-rw-r--r--scratch/sc-vba/dead-source/vbaapplication.cxx895
-rw-r--r--scratch/sc-vba/dead-source/vbaapplication.hxx112
-rw-r--r--scratch/sc-vba/dead-source/vbaaxes.cxx211
-rw-r--r--scratch/sc-vba/dead-source/vbaaxes.hxx59
-rw-r--r--scratch/sc-vba/dead-source/vbaaxis.cxx678
-rw-r--r--scratch/sc-vba/dead-source/vbaaxis.hxx106
-rw-r--r--scratch/sc-vba/dead-source/vbaaxistitle.cxx66
-rw-r--r--scratch/sc-vba/dead-source/vbaaxistitle.hxx52
-rw-r--r--scratch/sc-vba/dead-source/vbaborders.cxx584
-rw-r--r--scratch/sc-vba/dead-source/vbaborders.hxx84
-rw-r--r--scratch/sc-vba/dead-source/vbabutton.cxx60
-rw-r--r--scratch/sc-vba/dead-source/vbabutton.hxx54
-rw-r--r--scratch/sc-vba/dead-source/vbacharacters.cxx139
-rw-r--r--scratch/sc-vba/dead-source/vbacharacters.hxx83
-rw-r--r--scratch/sc-vba/dead-source/vbachart.cxx1269
-rw-r--r--scratch/sc-vba/dead-source/vbachart.hxx122
-rw-r--r--scratch/sc-vba/dead-source/vbachartobject.cxx217
-rw-r--r--scratch/sc-vba/dead-source/vbachartobject.hxx88
-rw-r--r--scratch/sc-vba/dead-source/vbachartobjects.cxx203
-rw-r--r--scratch/sc-vba/dead-source/vbachartobjects.hxx83
-rw-r--r--scratch/sc-vba/dead-source/vbacharts.cxx130
-rw-r--r--scratch/sc-vba/dead-source/vbacharts.hxx68
-rw-r--r--scratch/sc-vba/dead-source/vbacharttitle.cxx66
-rw-r--r--scratch/sc-vba/dead-source/vbacharttitle.hxx52
-rw-r--r--scratch/sc-vba/dead-source/vbacollectionimpl.hxx264
-rw-r--r--scratch/sc-vba/dead-source/vbacolorformat.cxx195
-rw-r--r--scratch/sc-vba/dead-source/vbacolorformat.hxx133
-rw-r--r--scratch/sc-vba/dead-source/vbacombobox.cxx147
-rw-r--r--scratch/sc-vba/dead-source/vbacombobox.hxx81
-rw-r--r--scratch/sc-vba/dead-source/vbacomment.cxx224
-rw-r--r--scratch/sc-vba/dead-source/vbacomment.hxx82
-rw-r--r--scratch/sc-vba/dead-source/vbacomments.cxx111
-rw-r--r--scratch/sc-vba/dead-source/vbacomments.hxx67
-rw-r--r--scratch/sc-vba/dead-source/vbacondition.cxx183
-rw-r--r--scratch/sc-vba/dead-source/vbacondition.hxx62
-rw-r--r--scratch/sc-vba/dead-source/vbacontrol.cxx325
-rw-r--r--scratch/sc-vba/dead-source/vbacontrol.hxx112
-rw-r--r--scratch/sc-vba/dead-source/vbadialog.cxx124
-rw-r--r--scratch/sc-vba/dead-source/vbadialog.hxx65
-rw-r--r--scratch/sc-vba/dead-source/vbadialogs.cxx93
-rw-r--r--scratch/sc-vba/dead-source/vbadialogs.hxx66
-rw-r--r--scratch/sc-vba/dead-source/vbafillformat.cxx207
-rw-r--r--scratch/sc-vba/dead-source/vbafillformat.hxx79
-rw-r--r--scratch/sc-vba/dead-source/vbafont.cxx440
-rw-r--r--scratch/sc-vba/dead-source/vbafont.hxx96
-rw-r--r--scratch/sc-vba/dead-source/vbaformat.cxx786
-rw-r--r--scratch/sc-vba/dead-source/vbaformat.hxx111
-rw-r--r--scratch/sc-vba/dead-source/vbaformatcondition.cxx184
-rw-r--r--scratch/sc-vba/dead-source/vbaformatcondition.hxx78
-rw-r--r--scratch/sc-vba/dead-source/vbaformatconditions.cxx308
-rw-r--r--scratch/sc-vba/dead-source/vbaformatconditions.hxx73
-rw-r--r--scratch/sc-vba/dead-source/vbaglobals.cxx175
-rw-r--r--scratch/sc-vba/dead-source/vbaglobals.hxx80
-rw-r--r--scratch/sc-vba/dead-source/vbahelper.cxx773
-rw-r--r--scratch/sc-vba/dead-source/vbahelper.hxx272
-rw-r--r--scratch/sc-vba/dead-source/vbahelperinterface.hxx121
-rw-r--r--scratch/sc-vba/dead-source/vbainterior.cxx147
-rw-r--r--scratch/sc-vba/dead-source/vbainterior.hxx72
-rw-r--r--scratch/sc-vba/dead-source/vbalabel.cxx60
-rw-r--r--scratch/sc-vba/dead-source/vbalabel.hxx54
-rw-r--r--scratch/sc-vba/dead-source/vbalineformat.cxx464
-rw-r--r--scratch/sc-vba/dead-source/vbalineformat.hxx90
-rw-r--r--scratch/sc-vba/dead-source/vbalistbox.cxx294
-rw-r--r--scratch/sc-vba/dead-source/vbalistbox.hxx88
-rw-r--r--scratch/sc-vba/dead-source/vbaname.cxx275
-rw-r--r--scratch/sc-vba/dead-source/vbaname.hxx90
-rw-r--r--scratch/sc-vba/dead-source/vbanames.cxx219
-rw-r--r--scratch/sc-vba/dead-source/vbanames.hxx87
-rw-r--r--scratch/sc-vba/dead-source/vbaoleobject.cxx192
-rw-r--r--scratch/sc-vba/dead-source/vbaoleobject.hxx75
-rw-r--r--scratch/sc-vba/dead-source/vbaoleobjects.cxx193
-rw-r--r--scratch/sc-vba/dead-source/vbaoleobjects.hxx65
-rw-r--r--scratch/sc-vba/dead-source/vbaoutline.cxx73
-rw-r--r--scratch/sc-vba/dead-source/vbaoutline.hxx60
-rw-r--r--scratch/sc-vba/dead-source/vbapalette.cxx112
-rw-r--r--scratch/sc-vba/dead-source/vbapalette.hxx55
-rw-r--r--scratch/sc-vba/dead-source/vbapane.cxx230
-rw-r--r--scratch/sc-vba/dead-source/vbapane.hxx68
-rw-r--r--scratch/sc-vba/dead-source/vbapictureformat.cxx152
-rw-r--r--scratch/sc-vba/dead-source/vbapictureformat.hxx69
-rw-r--r--scratch/sc-vba/dead-source/vbapivotcache.cxx68
-rw-r--r--scratch/sc-vba/dead-source/vbapivotcache.hxx57
-rw-r--r--scratch/sc-vba/dead-source/vbapivottable.cxx71
-rw-r--r--scratch/sc-vba/dead-source/vbapivottable.hxx57
-rw-r--r--scratch/sc-vba/dead-source/vbapivottables.cxx102
-rw-r--r--scratch/sc-vba/dead-source/vbapivottables.hxx73
-rw-r--r--scratch/sc-vba/dead-source/vbapropvalue.cxx53
-rw-r--r--scratch/sc-vba/dead-source/vbapropvalue.hxx65
-rw-r--r--scratch/sc-vba/dead-source/vbaradiobutton.cxx81
-rw-r--r--scratch/sc-vba/dead-source/vbaradiobutton.hxx57
-rw-r--r--scratch/sc-vba/dead-source/vbarange.cxx5012
-rw-r--r--scratch/sc-vba/dead-source/vbarange.hxx279
-rw-r--r--scratch/sc-vba/dead-source/vbaseriescollection.cxx88
-rw-r--r--scratch/sc-vba/dead-source/vbaseriescollection.hxx62
-rw-r--r--scratch/sc-vba/dead-source/vbashape.cxx486
-rw-r--r--scratch/sc-vba/dead-source/vbashape.hxx112
-rw-r--r--scratch/sc-vba/dead-source/vbashaperange.cxx175
-rw-r--r--scratch/sc-vba/dead-source/vbashaperange.hxx71
-rw-r--r--scratch/sc-vba/dead-source/vbashapes.cxx396
-rw-r--r--scratch/sc-vba/dead-source/vbashapes.hxx84
-rw-r--r--scratch/sc-vba/dead-source/vbastyle.cxx194
-rw-r--r--scratch/sc-vba/dead-source/vbastyle.hxx104
-rw-r--r--scratch/sc-vba/dead-source/vbastyles.cxx189
-rw-r--r--scratch/sc-vba/dead-source/vbastyles.hxx65
-rw-r--r--scratch/sc-vba/dead-source/vbatextbox.cxx105
-rw-r--r--scratch/sc-vba/dead-source/vbatextbox.hxx58
-rw-r--r--scratch/sc-vba/dead-source/vbatextframe.cxx178
-rw-r--r--scratch/sc-vba/dead-source/vbatextframe.hxx79
-rw-r--r--scratch/sc-vba/dead-source/vbatitle.hxx170
-rw-r--r--scratch/sc-vba/dead-source/vbavalidation.cxx341
-rw-r--r--scratch/sc-vba/dead-source/vbavalidation.hxx79
-rw-r--r--scratch/sc-vba/dead-source/vbawindow.cxx944
-rw-r--r--scratch/sc-vba/dead-source/vbawindow.hxx136
-rw-r--r--scratch/sc-vba/dead-source/vbawindows.cxx266
-rw-r--r--scratch/sc-vba/dead-source/vbawindows.hxx73
-rw-r--r--scratch/sc-vba/dead-source/vbaworkbook.cxx509
-rw-r--r--scratch/sc-vba/dead-source/vbaworkbook.hxx99
-rw-r--r--scratch/sc-vba/dead-source/vbaworkbooks.cxx470
-rw-r--r--scratch/sc-vba/dead-source/vbaworkbooks.hxx78
-rw-r--r--scratch/sc-vba/dead-source/vbaworksheet.cxx899
-rw-r--r--scratch/sc-vba/dead-source/vbaworksheet.hxx146
-rw-r--r--scratch/sc-vba/dead-source/vbaworksheets.cxx432
-rw-r--r--scratch/sc-vba/dead-source/vbaworksheets.hxx88
-rw-r--r--scratch/sc-vba/dead-source/vbawsfunction.cxx157
-rw-r--r--scratch/sc-vba/dead-source/vbawsfunction.hxx67
-rw-r--r--scratch/sc-vba/makefile.mk133
-rw-r--r--scratch/sc-vba/testvba/README37
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/ApplicationRunTest.xlsbin25088 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/AutoFilter.xlsbin54272 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/CalcFont.xlsbin73728 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/CalcZoom.xlsbin62976 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/FinancialFuncTests.xlsbin71168 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xlsbin78848 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/MiscOperatorTests.xlsbin66048 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/MiscRangeTests.xlsbin126976 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/MiscRegressionTests.xlsbin72192 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/PageBreaks.xlsbin63488 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/Ranges-2.xlsbin2209280 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/Ranges-3.xlsbin54784 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/Ranges.xlsbin2236416 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/Shapes.xlsbin74240 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/StrConv-test.xlsbin65024 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/Template.xlsbin65024 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/TestAddress.xlsbin84480 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest.xlsbin67584 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest2.xlsbin71680 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/TestIntersection.xlsbin81408 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/TestUnion.xlsbin72192 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/VariantTest.xlsbin68608 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/Window.xlsbin87040 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/bytearraystring.xlsbin58880 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/dateserial.xlsbin57344 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/datevalue.xlsbin61952 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/format.xlsbin102400 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/AutoFilter.log20
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/MiscRangeTests.log45
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-2.log68
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-3.log8
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges.log280
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/TestAddress.log62
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest.log60
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest2.log64
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/format.log36
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/AutoFilter.log20
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcFont.log17
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcZoom.log18
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/FinancialFuncTests.log31
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOnErrorTests.log16
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOperatorTests.log30
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRangeTests.log45
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRegressionTests.log16
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/PageBreaks.log10
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-2.log68
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-3.log8
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges.log280
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/Shapes.log77
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/StrConv-test.log9
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/Template.log14
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/TestAddress.log67
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest.log60
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest2.log65
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/TestIntersection.log26
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/TestUnion.log17
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/VariantTest.log47
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/Window.log46
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/bytearraystring.log8
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/dateserial.log9
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/datevalue.log8
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/format.log36
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/pagesetup.log77
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/partition.log11
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log16
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/replace.log14
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/stringplusdouble.log62
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/unix/window2.log41
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/AutoFilter.log20
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/CalcFont.log17
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/MiscOperatorTests.log29
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/MiscRangeTests.log45
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/PageBreaks.log10
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-2.log68
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-3.log8
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges.log280
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/Shapes.log77
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/StrConv-test.log9
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/Template.log14
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/TestAddress.log67
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest.log60
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest2.log65
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/TestIntersection.log26
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/TestUnion.log17
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/VariantTest.log47
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/Window.log46
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/bytearraystring.log8
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/dateserial.log9
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/datevalue.log8
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/format.log36
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/pagesetup.log87
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/partition.log11
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/range-4.log16
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/replace.log14
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/stringplusdouble.log62
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/logs/win/window2.log41
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/notwork/error.xlsbin38400 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/notwork/imagecontrols.xlsbin2415104 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/notwork/keyword.xlsbin50688 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/notwork/objectmodule.xlsbin62464 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/notwork/stringtodouble.odsbin13260 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/partition.xlsbin65536 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/range-4.xlsbin2192384 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/replace.xlsbin64512 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/stringplusdouble.xlsbin75264 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/TestDocuments/window2.xlsbin72192 -> 0 bytes
-rw-r--r--scratch/sc-vba/testvba/makefile.mk77
-rwxr-xr-xscratch/sc-vba/testvba/runTests.pl127
-rwxr-xr-xscratch/sc-vba/testvba/testResult.pl171
-rwxr-xr-xscratch/sc-vba/testvba/testResults.pl163
-rw-r--r--scratch/sc-vba/testvba/testvba.cxx309
-rwxr-xr-xscratch/sc-vba/testvba/timestampsClean.pl73
243 files changed, 0 insertions, 32719 deletions
diff --git a/scratch/sc-vba/POSITION b/scratch/sc-vba/POSITION
deleted file mode 100644
index 66240cbb0..000000000
--- a/scratch/sc-vba/POSITION
+++ /dev/null
@@ -1 +0,0 @@
-sc/source/ui/vba
diff --git a/scratch/sc-vba/ReadMe b/scratch/sc-vba/ReadMe
deleted file mode 100644
index c8192a199..000000000
--- a/scratch/sc-vba/ReadMe
+++ /dev/null
@@ -1,3 +0,0 @@
-This directory contains some patches ( experimental ) that as yet have not moved either into a cws or patches/vba.
-The testvba directory contains the test harness for vba
-The dead-source directory contains a copy of the old scratch source ( will be delated as soon as I am sure that we haven't missed anything )
diff --git a/scratch/sc-vba/dead-source/helperdecl.hxx b/scratch/sc-vba/dead-source/helperdecl.hxx
deleted file mode 100644
index b1af6be1a..000000000
--- a/scratch/sc-vba/dead-source/helperdecl.hxx
+++ /dev/null
@@ -1,143 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <comphelper/servicedecl.hxx>
-#include <org/openoffice/vba/XHelperInterface.hpp>
-
-namespace comphelper {
-namespace service_decl {
-
-namespace detail {
-namespace css = ::com::sun::star;
-template <typename ImplT>
-class OwnServiceImpl
- : public ImplT,
- private ::boost::noncopyable
-{
- typedef ImplT BaseT;
-
-public:
- OwnServiceImpl(
- ServiceDecl const& rServiceDecl,
- css::uno::Sequence<css::uno::Any> const& args,
- css::uno::Reference<css::uno::XComponentContext> const& xContext )
- :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
- OwnServiceImpl(
- ServiceDecl const& rServiceDecl,
- css::uno::Reference<css::uno::XComponentContext> const& xContext )
- : BaseT(xContext), m_rServiceDecl(rServiceDecl) {}
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw (css::uno::RuntimeException) {
- return m_rServiceDecl.getImplementationName();
- }
- virtual sal_Bool SAL_CALL supportsService( ::rtl::OUString const& name )
- throw (css::uno::RuntimeException) {
- return m_rServiceDecl.supportsService(name);
- }
- virtual css::uno::Sequence< ::rtl::OUString>
- SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) {
- return m_rServiceDecl.getSupportedServiceNames();
- }
-
-private:
- ServiceDecl const& m_rServiceDecl;
-};
-
-
-template <typename ImplT, typename WithArgsT>
-struct OwnCreateFunc;
-
-template <typename ImplT>
-struct OwnCreateFunc<ImplT, with_args<false> > {
- explicit OwnCreateFunc( )
- {}
-
- css::uno::Reference<css::uno::XInterface>
- operator()( ServiceDecl const& rServiceDecl,
- css::uno::Sequence<css::uno::Any> const&,
- css::uno::Reference<css::uno::XComponentContext>
- const& xContext ) const
- {
- return css::uno::Reference< org::openoffice::vba::XHelperInterface >(new OwnServiceImpl<ImplT>( rServiceDecl, xContext ));
- }
-};
-
-template <typename ImplT>
-struct OwnCreateFunc<ImplT, with_args<true> > {
- explicit OwnCreateFunc( )
- {}
-
- css::uno::Reference<css::uno::XInterface>
- operator()( ServiceDecl const& rServiceDecl,
- css::uno::Sequence<css::uno::Any> const& args,
- css::uno::Reference<css::uno::XComponentContext>
- const& xContext ) const
- {
- css::uno::Reference< org::openoffice::vba::XHelperInterface > xHelp(
- new OwnServiceImpl<ImplT>( rServiceDecl, args, xContext ) );
- css::uno::Reference< css::uno::XInterface > xIf( xHelp, css::uno::UNO_QUERY ) ;
- return xIf;
- }
-};
-
-} // namespace detail
-
-/** Defines a service implementation class.
-
- @tpl ImplT_ service implementation class
- @WithArgsT whether the implementation class ctor expects arguments
- (uno::Sequence<uno::Any>, uno::Reference<uno::XComponentContext>)
- or just (uno::Reference<uno::XComponentContext>)
-*/
-template <typename ImplT_, typename WithArgsT = with_args<false> >
-struct vba_service_class_ {
- typedef ImplT_ ImplT;
- typedef detail::OwnServiceImpl<ImplT_ > ServiceImplT;
-
- detail::CreateFuncF const m_createFunc;
-
- /** Default ctor. Implementation class without args, expecting
- component context as single argument.
- */
- vba_service_class_() : m_createFunc(
- detail::OwnCreateFunc<ImplT, WithArgsT>() ) {}
-
-};
-
-
-} // namespace service_decl
-} // namespace comphelper
-
diff --git a/scratch/sc-vba/dead-source/service.cxx b/scratch/sc-vba/dead-source/service.cxx
deleted file mode 100644
index ba68bc55a..000000000
--- a/scratch/sc-vba/dead-source/service.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "cppuhelper/implementationentry.hxx"
-#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-#include "com/sun/star/registry/XRegistryKey.hpp"
-#include "comphelper/servicedecl.hxx"
-
-// =============================================================================
-// component exports
-// =============================================================================
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-namespace sdecl = comphelper::service_decl;
-
-// reference service helper(s)
-namespace range
-{
-extern sdecl::ServiceDecl const serviceDecl;
-}
-namespace workbook
-{
-extern sdecl::ServiceDecl const serviceDecl;
-}
-namespace worksheet
-{
-extern sdecl::ServiceDecl const serviceDecl;
-}
-namespace globals
-{
-extern sdecl::ServiceDecl const serviceDecl;
-}
-
-
-
-extern "C"
-{
- void SAL_CALL component_getImplementationEnvironment(
- const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
- {
- OSL_TRACE("In component_getImplementationEnv");
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
- }
-
- sal_Bool SAL_CALL component_writeInfo(
- lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
- {
- OSL_TRACE("In component_writeInfo");
-
- // Component registration
- if ( component_writeInfoHelper( pServiceManager, pRegistryKey,
- range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl ) )
- {
- // Singleton registration
- try
- {
- registry::XRegistryKey * pKey =
- reinterpret_cast< registry::XRegistryKey * >(pRegistryKey);
-
- Reference< registry::XRegistryKey >xKey = pKey->createKey(
- rtl::OUString::createFromAscii( ("org.openoffice.vba.Globals/UNO/SINGLETONS/org.openoffice.vba.theGlobals") ) );
- xKey->setStringValue( ::rtl::OUString::createFromAscii(
- ("org.openoffice.vba.Globals") ) );
- return sal_True;
- }
- catch( uno::Exception& /*e*/ )
- {
- //recomp & friends will detect false returned and fail
- }
- }
- return sal_False;
- }
-
- void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
- registry::XRegistryKey * pRegistryKey )
- {
- OSL_TRACE("In component_getFactory for %s", pImplName );
- void* pRet = component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
-}
diff --git a/scratch/sc-vba/dead-source/vbaapplication.cxx b/scratch/sc-vba/dead-source/vbaapplication.cxx
deleted file mode 100644
index bc55911e6..000000000
--- a/scratch/sc-vba/dead-source/vbaapplication.cxx
+++ /dev/null
@@ -1,895 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaapplication.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <stdio.h>
-
-
-#include<com/sun/star/sheet/XSpreadsheetView.hpp>
-#include <com/sun/star/sheet/XSpreadsheets.hpp>
-#include<com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include<org/openoffice/excel/XlCalculation.hpp>
-#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-#include <com/sun/star/sheet/XCalculatable.hpp>
-#include <com/sun/star/frame/XLayoutManager.hpp>
-#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <org/openoffice/excel/XlMousePointer.hpp>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
-
-#include "vbaapplication.hxx"
-#include "vbaworkbooks.hxx"
-#include "vbaworkbook.hxx"
-#include "vbaworksheets.hxx"
-#include "vbarange.hxx"
-#include "vbawsfunction.hxx"
-#include "vbadialogs.hxx"
-#include "vbawindow.hxx"
-#include "vbawindows.hxx"
-#include "vbaglobals.hxx"
-#include "tabvwsh.hxx"
-#include "gridwin.hxx"
-#include "vbanames.hxx"
-#include "vbashape.hxx"
-#include "sc.hrc"
-
-#include <osl/file.hxx>
-
-#include <sfx2/request.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/app.hxx>
-
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-
-#include <docuno.hxx>
-
-#include <basic/sbx.hxx>
-#include <basic/sbstar.hxx>
-#include <basic/sbuno.hxx>
-#include <basic/sbmeth.hxx>
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-// #TODO is this defined somewhere else?
-#if ( defined UNX ) || ( defined OS2 ) //unix
-#define FILE_PATH_SEPERATOR "/"
-#else // windows
-#define FILE_PATH_SEPERATOR "\\"
-#endif
-
-#define EXCELVERSION "11.0"
-
-class ActiveWorkbook : public ScVbaWorkbook
-{
-protected:
- virtual uno::Reference< frame::XModel > getModel()
- {
- return getCurrentDocument();
- }
-public:
- ActiveWorkbook( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xParent, xContext ){}
-};
-
-ScVbaApplication::ScVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( uno::Reference< vba::XHelperInterface >(), xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
-{
-}
-
-ScVbaApplication::~ScVbaApplication()
-{
-}
-
-
-
-uno::Reference< excel::XWorkbook >
-ScVbaApplication::getActiveWorkbook() throw (uno::RuntimeException)
-{
- return new ActiveWorkbook( this, mxContext );
-}
-uno::Reference< excel::XWorkbook > SAL_CALL
-ScVbaApplication::getThisWorkbook() throw (uno::RuntimeException)
-{
- return getActiveWorkbook();
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::getSelection() throw (uno::RuntimeException)
-{
- uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument()->getCurrentSelection(), uno::UNO_QUERY_THROW );
- rtl::OUString sImpementaionName = xServiceInfo->getImplementationName();
- if( sImpementaionName.equalsIgnoreAsciiCaseAscii("com.sun.star.drawing.SvxShapeCollection") )
- {
- uno::Reference< drawing::XShapes > xShapes( getCurrentDocument()->getCurrentSelection(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShape > xShape( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
- return uno::makeAny( uno::Reference< msforms::XShape >(new ScVbaShape( this, mxContext, xShape, xShapes, ScVbaShape::getType( xShape ) ) ) );
- }
- else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRange")) ||
- xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRanges")))
- {
- uno::Reference< table::XCellRange > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
- if ( !xRange.is() )
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
- if ( xRanges.is() )
- return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( this, mxContext, xRanges ) ) );
-
- }
- return uno::makeAny( uno::Reference< excel::XRange >(new ScVbaRange( this, mxContext, xRange ) ) );
- }
- else
- {
- throw uno::RuntimeException( sImpementaionName + rtl::OUString::createFromAscii(" donot be surpported"), uno::Reference< uno::XInterface >() );
- }
-}
-
-uno::Reference< excel::XRange >
-ScVbaApplication::getActiveCell() throw (uno::RuntimeException )
-{
- uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xView->getActiveSheet(), ::uno::UNO_QUERY_THROW);
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( !pViewShell )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() );
- ScViewData* pTabView = pViewShell->GetViewData();
- if ( !pTabView )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewData available"), uno::Reference< uno::XInterface >() );
-
- sal_Int32 nCursorX = pTabView->GetCurX();
- sal_Int32 nCursorY = pTabView->GetCurY();
-
- return new ScVbaRange( this, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) );
-}
-
-sal_Bool
-ScVbaApplication::getScreenUpdating() throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- return !xModel->hasControllersLocked();
-}
-
-void
-ScVbaApplication::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- if (bUpdate)
- xModel->unlockControllers();
- else
- xModel->lockControllers();
-}
-
-sal_Bool
-ScVbaApplication::getDisplayStatusBar() throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
-
- if( xProps.is() ){
- uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW );
- rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" ));
- if( xLayoutManager.is() && xLayoutManager->isElementVisible( url ) ){
- return sal_True;
- }
- }
- return sal_False;
-}
-
-void
-ScVbaApplication::setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
-
- if( xProps.is() ){
- uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW );
- rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" ));
- if( xLayoutManager.is() ){
- if( bDisplayStatusBar && !xLayoutManager->isElementVisible( url ) ){
- if( !xLayoutManager->showElement( url ) )
- xLayoutManager->createElement( url );
- return;
- }
- else if( !bDisplayStatusBar && xLayoutManager->isElementVisible( url ) ){
- xLayoutManager->hideElement( url );
- return;
- }
- }
- }
- return;
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::Workbooks( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< vba::XCollection > xWorkBooks( new ScVbaWorkbooks( this, mxContext ) );
- if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
- {
- // void then somebody did Workbooks.something in vba
- return uno::Any( xWorkBooks );
- }
-
- return uno::Any ( xWorkBooks->Item( aIndex, uno::Any() ) );
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< excel::XWorkbook > xWorkbook( getActiveWorkbook(), uno::UNO_QUERY );
- uno::Any result;
- if ( xWorkbook.is() )
- result = xWorkbook->Worksheets( aIndex );
-
- else
- // Fixme - check if this is reasonable/desired behavior
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "No ActiveWorkBook available" ), uno::Reference< uno::XInterface >() );
-
- return result;
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::WorksheetFunction( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return uno::makeAny( uno::Reference< script::XInvocation >( new ScVbaWSFunction( this, mxContext) ) );
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::Evaluate( const ::rtl::OUString& Name ) throw (uno::RuntimeException)
-{
- // #TODO Evaluate allows other things to be evaluated, e.g. functions
- // I think ( like SIN(3) etc. ) need to investigate that
- // named Ranges also? e.g. [MyRange] if so need a list of named ranges
- uno::Any aVoid;
- return uno::Any( getActiveWorkbook()->getActiveSheet()->Range( uno::Any( Name ), aVoid ) );
-}
-
-uno::Any
-ScVbaApplication::Dialogs( const uno::Any &aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), mxContext ) );
- if( !aIndex.hasValue() )
- return uno::Any( xDialogs );
- return uno::Any( xDialogs->Item( aIndex ) );
-}
-
-uno::Reference< excel::XWindow > SAL_CALL
-ScVbaApplication::getActiveWindow() throw (uno::RuntimeException)
-{
- // #FIXME sofar can't determine Parent
- return new ScVbaWindow( uno::Reference< vba::XHelperInterface >(), mxContext, getCurrentDocument() );
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::getCutCopyMode() throw (uno::RuntimeException)
-{
- //# FIXME TODO, implementation
- uno::Any result;
- result <<= sal_False;
- return result;
-}
-
-::rtl::OUString
-ScVbaApplication::getVersion() throw (uno::RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(EXCELVERSION));
-}
-
-void SAL_CALL
-ScVbaApplication::setCutCopyMode( const uno::Any& /*_cutcopymode*/ ) throw (uno::RuntimeException)
-{
- //# FIXME TODO, implementation
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::getStatusBar() throw (uno::RuntimeException)
-{
- return uno::makeAny( !getDisplayStatusBar() );
-}
-
-void SAL_CALL
-ScVbaApplication::setStatusBar( const uno::Any& _statusbar ) throw (uno::RuntimeException)
-{
- rtl::OUString sText;
- sal_Bool bDefault = sal_False;
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< task::XStatusIndicatorSupplier > xStatusIndicatorSupplier( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< task::XStatusIndicator > xStatusIndicator( xStatusIndicatorSupplier->getStatusIndicator(), uno::UNO_QUERY_THROW );
- if( _statusbar >>= sText )
- {
- setDisplayStatusBar( sal_True );
- xStatusIndicator->start( sText, 100 );
- //xStatusIndicator->setText( sText );
- }
- else if( _statusbar >>= bDefault )
- {
- if( bDefault == sal_False )
- {
- xStatusIndicator->end();
- setDisplayStatusBar( sal_True );
- }
- }
- else
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid prarameter. It should be a string or False" ),
- uno::Reference< uno::XInterface >() );
-}
-
-double SAL_CALL
-ScVbaApplication::CountA( const uno::Any& arg1 ) throw (uno::RuntimeException)
-{
- double result = 0;
- uno::Reference< script::XInvocation > xInvoc( WorksheetFunction(), uno::UNO_QUERY_THROW );
- if ( xInvoc.is() )
- {
- static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("CountA" ) );
- uno::Sequence< uno::Any > Params(1);
- Params[0] = arg1;
- uno::Sequence< sal_Int16 > OutParamIndex;
- uno::Sequence< uno::Any > OutParam;
- xInvoc->invoke( FunctionName, Params, OutParamIndex, OutParam ) >>= result;
- }
- return result;
-}
-
-::sal_Int32 SAL_CALL
-ScVbaApplication::getCalculation() throw (uno::RuntimeException)
-{
- uno::Reference<sheet::XCalculatable> xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
- if(xCalc->isAutomaticCalculationEnabled())
- return excel::XlCalculation::xlCalculationAutomatic;
- else
- return excel::XlCalculation::xlCalculationManual;
-}
-
-void SAL_CALL
-ScVbaApplication::setCalculation( ::sal_Int32 _calculation ) throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XCalculatable > xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW);
- switch(_calculation)
- {
- case excel::XlCalculation::xlCalculationManual:
- xCalc->enableAutomaticCalculation(sal_False);
- break;
- case excel::XlCalculation::xlCalculationAutomatic:
- case excel::XlCalculation::xlCalculationSemiautomatic:
- xCalc->enableAutomaticCalculation(sal_True);
- break;
- }
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< vba::XCollection > xWindows = ScVbaWindows::Windows( mxContext );
- if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
- return uno::Any( xWindows );
- return uno::Any( xWindows->Item( aIndex, uno::Any() ) );
-}
-void SAL_CALL
-ScVbaApplication::wait( double time ) throw (uno::RuntimeException)
-{
- StarBASIC* pBasic = SFX_APP()->GetBasic();
- SFX_APP()->EnterBasicCall();
- SbxArrayRef aArgs = new SbxArray;
- SbxVariableRef aRef = new SbxVariable;
- aRef->PutDouble( time );
- aArgs->Put( aRef, 1 );
- SbMethod* pMeth = (SbMethod*)pBasic->GetRtl()->Find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WaitUntil") ), SbxCLASS_METHOD );
-
- if ( pMeth )
- {
- pMeth->SetParameters( aArgs );
- SbxVariableRef refTemp = pMeth;
- // forces a broadcast
- SbxVariableRef pNew = new SbxMethod( *((SbxMethod*)pMeth));
- }
- SFX_APP()->LeaveBasicCall();
-
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno::RuntimeException)
-{
- uno::Reference< excel::XRange > xVbRange = ScVbaRange::ApplicationRange( mxContext, Cell1, Cell2 );
- return uno::makeAny( xVbRange );
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::Names( const css::uno::Any& aIndex ) throw ( uno::RuntimeException )
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XNamedRanges > xNamedRanges( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("NamedRanges")) , uno::UNO_QUERY_THROW );
- css::uno::Reference< excel::XNames > xNames ( new ScVbaNames( this , mxContext , xNamedRanges , xModel ) );
- if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
- {
- return uno::Any( xNames );
- }
- return uno::Any( xNames->Item( aIndex, uno::Any() ) );
-}
-
-
-uno::Reference< excel::XWorksheet > SAL_CALL
-ScVbaApplication::getActiveSheet() throw (uno::RuntimeException)
-{
- uno::Reference< excel::XWorksheet > result;
- uno::Reference< excel::XWorkbook > xWorkbook( getActiveWorkbook(), uno::UNO_QUERY );
- if ( xWorkbook.is() )
- {
- uno::Reference< excel::XWorksheet > xWorksheet(
- xWorkbook->getActiveSheet(), uno::UNO_QUERY );
- if ( xWorksheet.is() )
- {
- result = xWorksheet;
- }
- }
-
- if ( !result.is() )
- {
- // Fixme - check if this is reasonable/desired behavior
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "No activeSheet available" ), uno::Reference< uno::XInterface >() );
- }
- return result;
-
-}
-
-/*******************************************************************************
- * In msdn:
- * Reference Optional Variant. The destination. Can be a Range
- * object, a string that contains a cell reference in R1C1-style notation,
- * or a string that contains a Visual Basic procedure name.
- * Scroll Optional Variant. True to scrol, False to not scroll through
- * the window. The default is False.
- * Parser is split to three parts, Range, R1C1 string and procedure name.
- * by test excel, it seems Scroll no effect. ???
-*******************************************************************************/
-void SAL_CALL
-ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) throw (uno::RuntimeException)
-{
- //test Scroll is a boolean
- sal_Bool bScroll = sal_False;
- //R1C1-style string or a string of procedure name.
-
- if( Scroll.hasValue() )
- {
- sal_Bool aScroll = sal_False;
- if( Scroll >>= aScroll )
- {
- bScroll = aScroll;
- }
- else
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "sencond parameter should be boolean" ),
- uno::Reference< uno::XInterface >() );
- }
-
- rtl::OUString sRangeName;
- if( Reference >>= sRangeName )
- {
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
- xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheet > xDoc = xSpreadsheet->getActiveSheet();
-
- ScTabViewShell* pShell = getCurrentBestViewShell();
- ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow();
- try
- {
- uno::Reference< excel::XRange > xVbaSheetRange = ScVbaRange::getRangeObjectForName( mxContext, sRangeName, getDocShell( xModel ), ScAddress::CONV_XL_R1C1 );
-;
- if( bScroll )
- {
- xVbaSheetRange->Select();
- uno::Reference< excel::XWindow > xWindow = getActiveWindow();
- ScSplitPos eWhich = pShell->GetViewData()->GetActivePart();
- sal_Int32 nValueX = pShell->GetViewData()->GetPosX(WhichH(eWhich));
- sal_Int32 nValueY = pShell->GetViewData()->GetPosY(WhichV(eWhich));
- xWindow->SmallScroll( uno::makeAny( (sal_Int16)(xVbaSheetRange->getRow() - 1) ),
- uno::makeAny( (sal_Int16)nValueY ),
- uno::makeAny( (sal_Int16)(xVbaSheetRange->getColumn() - 1) ),
- uno::makeAny( (sal_Int16)nValueX ) );
- gridWindow->GrabFocus();
- }
- else
- {
- xVbaSheetRange->Select();
- gridWindow->GrabFocus();
- }
- }
- catch( uno::RuntimeException )
- {
- //maybe this should be a procedure name
- //TODO for procedure name
- //browse::XBrowseNodeFactory is a singlton. OUString::createFromAscii( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory")
- //and the createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) to get a root browse::XBrowseNode.
- //for query XInvocation interface.
- //but how to directly get the XInvocation?
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid reference for range name, it should be procedure name" ),
- uno::Reference< uno::XInterface >() );
- }
- return;
- }
- uno::Reference< excel::XRange > xRange;
- if( Reference >>= xRange )
- {
- uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY );
- ScTabViewShell* pShell = getCurrentBestViewShell();
- ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow();
- if ( xVbaRange.is() )
- {
- //TODO bScroll should be using, In this time, it doesenot have effection
- if( bScroll )
- {
- xVbaRange->Select();
- uno::Reference< excel::XWindow > xWindow = getActiveWindow();
- ScSplitPos eWhich = pShell->GetViewData()->GetActivePart();
- sal_Int32 nValueX = pShell->GetViewData()->GetPosX(WhichH(eWhich));
- sal_Int32 nValueY = pShell->GetViewData()->GetPosY(WhichV(eWhich));
- xWindow->SmallScroll( uno::makeAny( (sal_Int16)(xVbaRange->getRow() - 1) ),
- uno::makeAny( (sal_Int16)nValueY ),
- uno::makeAny( (sal_Int16)(xVbaRange->getColumn() - 1) ),
- uno::makeAny( (sal_Int16)nValueX ) );
- gridWindow->GrabFocus();
- }
- else
- {
- xVbaRange->Select();
- gridWindow->GrabFocus();
- }
- }
- return;
- }
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid reference or name" ),
- uno::Reference< uno::XInterface >() );
-}
-
-sal_Int32 SAL_CALL
-ScVbaApplication::getCursor() throw (uno::RuntimeException)
-{
- SfxObjectShell* pObject = SfxObjectShell::Current();//SfxObjectShell::GetWorkingDocument();//Current();
- SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObject );
- sal_Int32 result = pFrame->GetFrame()->GetWindow().GetSystemWindow()->GetPointer().GetStyle();
-
- switch( result )
- {
- case POINTER_ARROW:
- return excel::XlMousePointer::xlNorthwestArrow;
- case POINTER_NULL:
- return excel::XlMousePointer::xlDefault;
- case POINTER_WAIT:
- return excel::XlMousePointer::xlWait;
- case POINTER_TEXT:
- return excel::XlMousePointer::xlIBeam;
- default:
- return excel::XlMousePointer::xlDefault;
- }
-}
-
-void SAL_CALL
-ScVbaApplication::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
-{
- SfxObjectShell* pObject = SfxObjectShell::Current();//SfxObjectShell::GetWorkingDocument();
- for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObject ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pObject ) )
- {
- switch( _cursor )
- {
- case excel::XlMousePointer::xlNorthwestArrow:
- {
- const Pointer& rPointer( POINTER_ARROW );
- pFrame->GetFrame()->GetWindow().GetSystemWindow()->SetPointer( rPointer );
- pFrame->GetFrame()->GetWindow().GetSystemWindow()->EnableChildPointerOverwrite( sal_False );
- break;
- }
- case excel::XlMousePointer::xlWait:
- case excel::XlMousePointer::xlIBeam:
- {
- const Pointer& rPointer( static_cast< PointerStyle >( _cursor ) );
- //It will set the edit window, toobar and statusbar's mouse pointer.
- pFrame->GetFrame()->GetWindow().GetSystemWindow()->SetPointer( rPointer );
- pFrame->GetFrame()->GetWindow().GetSystemWindow()->EnableChildPointerOverwrite( sal_True );
- //It only set the edit window's mouse pointer
- //pFrame->GetFrame()->GetWindow().SetPointer( rPointer );
- //pFrame->GetFrame()->GetWindow().EnableChildPointerOverwrite( sal_True );
- //printf("\nset Cursor...%d\n", pFrame->GetFrame()->GetWindow().GetType());
- break;
- }
- case excel::XlMousePointer::xlDefault:
- {
- const Pointer& rPointer( POINTER_NULL );
- pFrame->GetFrame()->GetWindow().GetSystemWindow()->SetPointer( rPointer );
- pFrame->GetFrame()->GetWindow().GetSystemWindow()->EnableChildPointerOverwrite( sal_False );
- break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() );
- }
- }
-}
-
-// #TODO perhaps we should switch the return type depending of the filter
-// type, e.g. return Calc for Calc and Excel if its an imported doc
-rtl::OUString SAL_CALL
-ScVbaApplication::getName() throw (uno::RuntimeException)
-{
- static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Excel" ) );
- return appName;
-}
-
-// #TODO #FIXME get/setDisplayAlerts are just stub impl
-void SAL_CALL
-ScVbaApplication::setDisplayAlerts(sal_Bool /*displayAlerts*/) throw (uno::RuntimeException)
-{
-}
-
-sal_Bool SAL_CALL
-ScVbaApplication::getDisplayAlerts() throw (uno::RuntimeException)
-{
- return sal_True;
-}
-void SAL_CALL
-ScVbaApplication::Calculate() throw( script::BasicErrorException , uno::RuntimeException )
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCalculatable > xCalculatable( getCurrentDocument(), uno::UNO_QUERY_THROW );
- xCalculatable->calculateAll();
-}
-
-uno::Reference< beans::XPropertySet > lcl_getPathSettingsService( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException )
-{
- static uno::Reference< beans::XPropertySet > xPathSettings;
- if ( !xPathSettings.is() )
- {
- uno::Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- xPathSettings.set( xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.util.PathSettings"), xContext), uno::UNO_QUERY_THROW );
- }
- return xPathSettings;
-}
-rtl::OUString ScVbaApplication::getOfficePath( const rtl::OUString& _sPathType ) throw ( uno::RuntimeException )
-{
- rtl::OUString sRetPath;
- uno::Reference< beans::XPropertySet > xProps = lcl_getPathSettingsService( mxContext );
- try
- {
- rtl::OUString sUrl;
- xProps->getPropertyValue( _sPathType ) >>= sUrl;
-
- // if its a list of paths then use the last one
- sal_Int32 nIndex = sUrl.lastIndexOf( ';' ) ;
- if ( nIndex > 0 )
- sUrl = sUrl.copy( nIndex + 1 );
- ::osl::File::getSystemPathFromFileURL( sUrl, sRetPath );
- }
- catch (uno::Exception&)
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return sRetPath;
-}
-void SAL_CALL
-ScVbaApplication::setDefaultFilePath( const ::rtl::OUString& DefaultFilePath ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getPathSettingsService( mxContext );
- rtl::OUString aURL;
- osl::FileBase::getFileURLFromSystemPath( DefaultFilePath, aURL );
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Work")), uno::makeAny( aURL ) );
-
-
-}
-
-::rtl::OUString SAL_CALL
-ScVbaApplication::getDefaultFilePath( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return getOfficePath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Work")));
-}
-
-::rtl::OUString SAL_CALL
-ScVbaApplication::LibraryPath( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return getOfficePath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Basic")));
-}
-
-::rtl::OUString SAL_CALL
-ScVbaApplication::TemplatesPath( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return getOfficePath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Template")));
-}
-
-::rtl::OUString SAL_CALL
-ScVbaApplication::PathSeparator( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- static rtl::OUString sPathSep( RTL_CONSTASCII_USTRINGPARAM( FILE_PATH_SEPERATOR ) );
- return sPathSep;
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaApplication::Intersect( const uno::Reference< excel::XRange >& Arg1, const uno::Reference< excel::XRange >& Arg2, const uno::Any& Arg3, const uno::Any& Arg4, const uno::Any& Arg5, const uno::Any& Arg6, const uno::Any& Arg7, const uno::Any& Arg8, const uno::Any& Arg9, const uno::Any& Arg10, const uno::Any& Arg11, const uno::Any& Arg12, const uno::Any& Arg13, const uno::Any& Arg14, const uno::Any& Arg15, const uno::Any& Arg16, const uno::Any& Arg17, const uno::Any& Arg18, const uno::Any& Arg19, const uno::Any& Arg20, const uno::Any& Arg21, const uno::Any& Arg22, const uno::Any& Arg23, const uno::Any& Arg24, const uno::Any& Arg25, const uno::Any& Arg26, const uno::Any& Arg27, const uno::Any& Arg28, const uno::Any& Arg29, const uno::Any& Arg30 ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- std::vector< uno::Reference< excel::XRange > > vRanges;
- if ( !Arg1.is() || !Arg2.is() )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
-
- vRanges.push_back( Arg1 );
- vRanges.push_back( Arg2 );
-
- if ( Arg3.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg3, uno::UNO_QUERY_THROW ) );
- if ( Arg4.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg4, uno::UNO_QUERY_THROW ) );
- if ( Arg5.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg5, uno::UNO_QUERY_THROW ) );
- if ( Arg6.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg6, uno::UNO_QUERY_THROW ) );
- if ( Arg7.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg7, uno::UNO_QUERY_THROW ) );
- if ( Arg8.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg8, uno::UNO_QUERY_THROW ) );
- if ( Arg9.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg9, uno::UNO_QUERY_THROW ) );
- if ( Arg10.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg10, uno::UNO_QUERY_THROW ) );
- if ( Arg11.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg11, uno::UNO_QUERY_THROW ) );
- if ( Arg12.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg12, uno::UNO_QUERY_THROW ) );
- if ( Arg13.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg13, uno::UNO_QUERY_THROW ) );
- if ( Arg14.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg14, uno::UNO_QUERY_THROW ) );
- if ( Arg15.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg15, uno::UNO_QUERY_THROW ) );
- if ( Arg16.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg16, uno::UNO_QUERY_THROW ) );
- if ( Arg17.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg17, uno::UNO_QUERY_THROW ) );
- if ( Arg18.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg18, uno::UNO_QUERY_THROW ) );
- if ( Arg19.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg19, uno::UNO_QUERY_THROW ) );
- if ( Arg20.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg20, uno::UNO_QUERY_THROW ) );
- if ( Arg21.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg21, uno::UNO_QUERY_THROW ) );
- if ( Arg22.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg22, uno::UNO_QUERY_THROW ) );
- if ( Arg23.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg23, uno::UNO_QUERY_THROW ) );
- if ( Arg24.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg24, uno::UNO_QUERY_THROW ) );
- if ( Arg25.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg25, uno::UNO_QUERY_THROW ) );
- if ( Arg26.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg26, uno::UNO_QUERY_THROW ) );
- if ( Arg27.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg27, uno::UNO_QUERY_THROW ) );
- if ( Arg28.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg28, uno::UNO_QUERY_THROW ) );
- if ( Arg29.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg29, uno::UNO_QUERY_THROW ) );
- if ( Arg30.hasValue() )
- vRanges.push_back( uno::Reference< excel::XRange >( Arg30, uno::UNO_QUERY_THROW ) );
-
- std::vector< uno::Reference< excel::XRange > >::iterator it = vRanges.begin();
- std::vector< uno::Reference< excel::XRange > >::iterator it_end = vRanges.end();
-
- uno::Reference< excel::XRange > xRefRange( *it );
- ++it;
- for ( ; it != it_end; ++it )
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange * >( xRefRange.get());
- if ( pRange )
- xRefRange = pRange->intersect( *it );
- if ( !xRefRange.is() )
- return uno::Reference< excel::XRange >();
- }
- return xRefRange;
-}
-
-void
-ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeException )
-{
- sal_Bool bVolatile = sal_True;
- aVolatile >>= bVolatile;
- return;
-/*
- if ( bVolatile )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Volatile - not supported" ) ), uno::Reference< uno::XInterface >() );
- // bVoloatile is false - currently this only would make sense if
- // the autocalculate mode is set to be true.
-
- // so really this is crap, #TODO try and understand how ( or if )
- // the calculation mode and volatile interoperate
- if ( ! getCalculation() == excel::XlCalculation::xlCalculationAutomatic )
- setCalculation( excel::XlCalculation::xlCalculationAutomatic );
-*/
-}
-
-void SAL_CALL
-ScVbaApplication::DoEvents() throw ( uno::RuntimeException )
-{
-}
-
-::sal_Bool SAL_CALL
-ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException )
-{
- sal_Bool bRes = sal_False;
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- {
- SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE);
- SfxAllItemSet reqList( SFX_APP()->GetPool() );
- reqList.Put( sfxFormBar );
-
- pViewShell->GetState( reqList );
- const SfxPoolItem *pItem=0;
- if ( reqList.GetItemState( FID_TOGGLEINPUTLINE, sal_False, &pItem ) == SFX_ITEM_SET )
- bRes = ((SfxBoolItem*)pItem)->GetValue();
- }
- return bRes;
-}
-
-void SAL_CALL
-ScVbaApplication::setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException )
-{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell && ( _displayformulabar != getDisplayFormulaBar() ) )
- {
- SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE, _displayformulabar);
- SfxAllItemSet reqList( SFX_APP()->GetPool() );
- SfxRequest aReq( FID_TOGGLEINPUTLINE, 0, reqList );
- pViewShell->Execute( aReq );
- }
-}
-
-rtl::OUString&
-ScVbaApplication::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaApplication") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaApplication::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Application" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaapplication.hxx b/scratch/sc-vba/dead-source/vbaapplication.hxx
deleted file mode 100644
index ee08fb05a..000000000
--- a/scratch/sc-vba/dead-source/vbaapplication.hxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_APPLICATION_HXX
-#define SC_VBA_APPLICATION_HXX
-
-
-#include <org/openoffice/excel/XWorksheetFunction.hpp>
-#include <org/openoffice/excel/XApplication.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XApplication > ScVbaApplication_BASE;
-
-class ScVbaApplication : public ScVbaApplication_BASE
-{
-private:
- sal_Int32 m_xCalculation;
- rtl::OUString getOfficePath( const rtl::OUString& sPath ) throw ( css::uno::RuntimeException );
-public:
- ScVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
- virtual ~ScVbaApplication();
-
- // XHelperInterface ( parent is itself )
- virtual css::uno::Reference< oo::vba::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
-
- // XApplication
- virtual ::rtl::OUString SAL_CALL PathSeparator( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setDefaultFilePath( const ::rtl::OUString& DefaultFilePath ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDefaultFilePath( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL LibraryPath( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL TemplatesPath( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-
- virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getDisplayAlerts() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayAlerts( sal_Bool displayAlerts ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCalculation() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCalculation( ::sal_Int32 _calculation ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getSelection() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorkbook > SAL_CALL getActiveWorkbook() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL getActiveCell() throw ( css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getScreenUpdating() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getDisplayFormulaBar() throw ( css::uno::RuntimeException );
- virtual void SAL_CALL setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException );
-
- virtual css::uno::Reference< oo::excel::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Workbooks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL WorksheetFunction( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Evaluate( const ::rtl::OUString& Name ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& DialogIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getCutCopyMode() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCutCopyMode( const css::uno::Any& _cutcopymode ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getStatusBar() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setStatusBar( const css::uno::Any& _statusbar ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCursor() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCursor( ::sal_Int32 _cursor ) throw (css::uno::RuntimeException);
-
- virtual double SAL_CALL CountA( const css::uno::Any& arg1 ) throw (css::uno::RuntimeException) ;
-
- virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL wait( double time ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw ( css::uno::RuntimeException );
- virtual void SAL_CALL GoTo( const css::uno::Any& Reference, const css::uno::Any& Scroll ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Calculate() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< oo::excel::XRange >& Arg1, const css::uno::Reference< oo::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Volatile( const css::uno::Any& Volatile ) throw (css::uno::RuntimeException );
- virtual void SAL_CALL DoEvents() throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif /* SC_VBA_APPLICATION_HXX */
diff --git a/scratch/sc-vba/dead-source/vbaaxes.cxx b/scratch/sc-vba/dead-source/vbaaxes.cxx
deleted file mode 100644
index 821fdea88..000000000
--- a/scratch/sc-vba/dead-source/vbaaxes.cxx
+++ /dev/null
@@ -1,211 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-
-#include "vbaaxes.hxx"
-#include "vbaaxis.hxx"
-#include "vbachart.hxx"
-#include <org/openoffice/excel/XlAxisType.hpp>
-#include <org/openoffice/excel/XlAxisGroup.hpp>
-#include <org/openoffice/excel/XAxis.hpp>
-#include <map>
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-using namespace ::org::openoffice::excel::XlAxisType;
-using namespace ::org::openoffice::excel::XlAxisGroup;
-
-// each 'Item' in the Axes collection is indexed via 2 indexes, group and type.
-// We need to 'flatten' this into a single index in order to be able to wrap
-// iteration over the set of Axis(s) in a XIndexAccess implementation
-//
-typedef ::std::pair<sal_Int32, sal_Int32 > AxesCoordinate; // type and group combination
-typedef ::std::vector< AxesCoordinate > vecAxesIndices;
-
-typedef ::cppu::WeakImplHelper1< container::XIndexAccess > AxisIndexWrapper_BASE;
-
-class EnumWrapper : public EnumerationHelper_BASE
-{
- uno::Reference<container::XIndexAccess > m_xIndexAccess;
- sal_Int32 nIndex;
-public:
- EnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( nIndex < m_xIndexAccess->getCount() );
- }
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( nIndex < m_xIndexAccess->getCount() )
- return m_xIndexAccess->getByIndex( nIndex++ );
- throw container::NoSuchElementException();
- }
-};
-
-
-uno::Reference< excel::XAxis >
-ScVbaAxes::createAxis( const uno::Reference< excel::XChart >& xChart, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 nType, sal_Int32 nAxisGroup ) throw ( uno::RuntimeException )
-{
- ScVbaChart* pChart = static_cast< ScVbaChart* >( xChart.get() );
- if ( !pChart )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Object failure, can't access chart implementation" ), uno::Reference< uno::XInterface >() );
-
- uno::Reference< beans::XPropertySet > xAxisPropertySet;
- if (((nType == xlCategory) || (nType == xlSeriesAxis) || (nType == xlValue)))
- {
- if ((nAxisGroup != xlPrimary) && (nAxisGroup != xlSecondary))
- throw script::BasicErrorException( rtl::OUString(), NULL, SbERR_METHOD_FAILED, rtl::OUString());
- xAxisPropertySet.set( pChart->getAxisPropertySet(nType, nAxisGroup), uno::UNO_QUERY_THROW );
- }
- else
- throw script::BasicErrorException( rtl::OUString(), NULL, SbERR_METHOD_FAILED, rtl::OUString());
- uno::Reference< vba::XHelperInterface > xParent( xChart, uno::UNO_QUERY_THROW );
- return new ScVbaAxis( xParent, xContext, xAxisPropertySet, nType, nAxisGroup);
-}
-
-class AxisIndexWrapper : public AxisIndexWrapper_BASE
-{
- // if necessary for better performance we could change this into a map and cache the
- // indices -> Axis, currently we create a new Axis object
- // on each getByIndex
- uno::Reference< uno::XComponentContext > mxContext;
- vecAxesIndices mCoordinates;
- uno::Reference< excel::XChart > mxChart;
-public:
- AxisIndexWrapper( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< excel::XChart >& xChart ) : mxContext( xContext ), mxChart( xChart )
- {
- if ( mxChart.is() )
- {
- ScVbaChart* pChart = static_cast< ScVbaChart* >( mxChart.get() );
- // primary
- sal_Bool bBool = false;
- uno::Reference< beans::XPropertySet > xDiagramPropertySet( pChart->xDiagramPropertySet() );
- if ( ( xDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasXAxis" ) ) ) >>= bBool ) && bBool )
- mCoordinates.push_back( AxesCoordinate( xlPrimary, xlCategory ) );
- if ( ( xDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasYAxis" ) ) ) >>= bBool ) && bBool )
- mCoordinates.push_back( AxesCoordinate( xlPrimary, xlSeriesAxis ) );
-
- if ( pChart->is3D() )
- mCoordinates.push_back( AxesCoordinate( xlPrimary, xlValue ) );
-
- // secondary
- if ( ( xDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxis" ) ) ) >>= bBool ) && bBool )
- mCoordinates.push_back( AxesCoordinate( xlSecondary, xlCategory ) );
- if ( ( xDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxis" ) ) ) >>= bBool ) && bBool )
- mCoordinates.push_back( AxesCoordinate( xlSecondary, xlSeriesAxis ) );
- }
-
- }
- virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mCoordinates.size(); }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException)
- {
- AxesCoordinate dIndexes = mCoordinates[ Index ];
- return uno::makeAny( ScVbaAxes::createAxis( mxChart, mxContext, dIndexes.second, dIndexes.first ) );
- }
- // XElementAccess
- virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
- {
- return excel::XAxis::static_type(0);
- }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
- {
- return ( mCoordinates.size() > 0 );
- }
-};
-
-uno::Reference< container::XIndexAccess > createIndexWrapper( const uno::Reference< excel::XChart >& xChart, const uno::Reference< uno::XComponentContext >& xContext )
-{
- return new AxisIndexWrapper( xContext, xChart );
-}
-
-// #FIXME The collection semantics will never work as this object is not yet initialised correctly
-ScVbaAxes::ScVbaAxes( const uno::Reference< vba::XHelperInterface >& xParent,const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< excel::XChart >& xChart ) : ScVbaAxes_BASE( xParent, xContext, createIndexWrapper( xChart, xContext )), moChartParent( xChart )
-{
-}
-
-uno::Type SAL_CALL
-ScVbaAxes::getElementType() throw (css::uno::RuntimeException)
-{
- return excel::XAxes::static_type(0);
-}
-
-uno::Reference< container::XEnumeration > SAL_CALL
-ScVbaAxes::createEnumeration() throw (css::uno::RuntimeException)
-{
- return new EnumWrapper( m_xIndexAccess );
-}
-
-uno::Any SAL_CALL
-ScVbaAxes::Item( const css::uno::Any& _nType, const css::uno::Any& _oAxisGroup) throw (css::uno::RuntimeException)
-{
- // #TODO map the possible index combinations to a container::XIndexAccess wrapper impl
- // using a vector of valid std::pair maybe?
- // bodgy helperapi port bits
- sal_Int32 nAxisGroup = xlPrimary;
- sal_Int32 nType = -1;
- if ( !_nType.hasValue() || ( ( _nType >>= nType ) == sal_False ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Axes::Item Failed to extract type" ), uno::Reference< uno::XInterface >() );
-
- if ( _oAxisGroup.hasValue() )
- _oAxisGroup >>= nAxisGroup ;
-
- return uno::makeAny( createAxis( moChartParent, mxContext, nType, nAxisGroup ) );
-}
-
-uno::Any
-ScVbaAxes::createCollectionObject(const css::uno::Any& aSource)
-{
- return aSource; // pass through ( it's already an XAxis object
-}
-
-rtl::OUString&
-ScVbaAxes::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaAxes") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaAxes::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Axes" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbaaxes.hxx b/scratch/sc-vba/dead-source/vbaaxes.hxx
deleted file mode 100644
index ace72b5bd..000000000
--- a/scratch/sc-vba/dead-source/vbaaxes.hxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_AXES_HXX
-#define SC_VBA_AXES_HXX
-#include <org/openoffice/excel/XAxes.hpp>
-#include <org/openoffice/excel/XAxis.hpp>
-#include <org/openoffice/excel/XChart.hpp>
-#include "vbacollectionimpl.hxx"
-
-typedef CollTestImplHelper< oo::excel::XAxes > ScVbaAxes_BASE;
-class ScVbaAxes : public ScVbaAxes_BASE
-{
- css::uno::Reference< oo::excel::XChart > moChartParent; // not the true parent I guess
-public:
- ScVbaAxes( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< oo::excel::XChart >& xChart );
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& aIndex2 ) throw (css::uno::RuntimeException);
- virtual css::uno::Any createCollectionObject(const css::uno::Any&);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- static css::uno::Reference< oo::excel::XAxis > createAxis( const css::uno::Reference< oo::excel::XChart >& xChart, const css::uno::Reference< css::uno::XComponentContext >& xContext, sal_Int32 nType, sal_Int32 nAxisGroup ) throw ( css::uno::RuntimeException );
-};
-
-#endif //SC_VBA_AXES_HXX
diff --git a/scratch/sc-vba/dead-source/vbaaxis.cxx b/scratch/sc-vba/dead-source/vbaaxis.cxx
deleted file mode 100644
index d795e7251..000000000
--- a/scratch/sc-vba/dead-source/vbaaxis.cxx
+++ /dev/null
@@ -1,678 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-
-#include "vbaaxis.hxx"
-#include <org/openoffice/excel/XlAxisCrosses.hpp>
-#include <org/openoffice/excel/XlAxisType.hpp>
-#include <org/openoffice/excel/XlScaleType.hpp>
-#include "vbaaxistitle.hxx"
-#include "vbachart.hxx"
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-using namespace ::org::openoffice::excel::XlAxisCrosses;
-using namespace ::org::openoffice::excel::XlAxisType;
-using namespace ::org::openoffice::excel::XlScaleType;
-
-const rtl::OUString ORIGIN( RTL_CONSTASCII_USTRINGPARAM("Origin") );
-const rtl::OUString AUTOORIGIN( RTL_CONSTASCII_USTRINGPARAM("AutoOrigin") );
-const rtl::OUString MIN( RTL_CONSTASCII_USTRINGPARAM("AutoOrigin") );
-const rtl::OUString MAX( RTL_CONSTASCII_USTRINGPARAM("AutoOrigin") );
-ScVbaChart*
-ScVbaAxis::getChartPtr() throw( uno::RuntimeException )
-{
- ScVbaChart* pChart = static_cast< ScVbaChart* >( moChartParent.get() );
- if ( !pChart )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Can't access parent chart impl"), uno::Reference< uno::XInterface >() );
- return pChart;
-}
-
-sal_Bool
-ScVbaAxis::isValueAxis() throw( script::BasicErrorException )
-{
- if ( getType() == xlCategory )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return sal_True;
-}
-
-ScVbaAxis::ScVbaAxis( const uno::Reference< vba::XHelperInterface >& xParent,const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, sal_Int32 _nType, sal_Int32 _nGroup ) : ScVbaAxis_BASE( xParent, xContext ), mxPropertySet( _xPropertySet ), mnType( _nType ), mnGroup( _nGroup ), bCrossesAreCustomized( sal_False )
-{
- oShapeHelper.reset( new ShapeHelper( uno::Reference< drawing::XShape >( mxPropertySet, uno::UNO_QUERY ) ) );
- moChartParent.set( xParent, uno::UNO_QUERY_THROW );
- setType(_nType);
- setCrosses(xlAxisCrossesAutomatic);
-}
-
-void SAL_CALL
-ScVbaAxis::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< lang::XComponent > xComponent( mxPropertySet, uno::UNO_QUERY_THROW );
- xComponent->dispose();
-}
-
- uno::Reference< ::org::openoffice::excel::XAxisTitle > SAL_CALL
-ScVbaAxis::getAxisTitle( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< excel::XAxisTitle > xAxisTitle;
- try
- {
- ScVbaChart* pChart = getChartPtr();
-
- if (getHasTitle() )
- {
- int nType = getType();
- switch(nType)
- {
- case xlCategory:
- xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisXSupplier->getXAxisTitle());
- break;
- case xlSeriesAxis:
- xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisZSupplier->getZAxisTitle());
- break;
- default: // xlValue:
- xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisYSupplier->getYAxisTitle());
- break;
- }
- }
- }
- catch (uno::Exception& e)
- {
- DebugHelper::exception(e);
- }
- return xAxisTitle;
-
-}
-
-void SAL_CALL
-ScVbaAxis::setDisplayUnit( ::sal_Int32 /*DisplayUnit*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
-}
-
-::sal_Int32 SAL_CALL
-ScVbaAxis::getDisplayUnit( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- return -1;
-}
-
-void SAL_CALL
-ScVbaAxis::setCrosses( ::sal_Int32 _nCrosses ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- double fNum = 0.0;
- switch (_nCrosses)
- {
- case xlAxisCrossesAutomatic: //Microsoft Excel sets the axis crossing point.
- mxPropertySet->setPropertyValue(AUTOORIGIN, uno::makeAny( sal_True ) );
- bCrossesAreCustomized = sal_False;
- return;
- case xlAxisCrossesMinimum: // The axis crosses at the minimum value.
- mxPropertySet->getPropertyValue(MIN) >>= fNum;
- setCrossesAt( fNum );
- bCrossesAreCustomized = sal_False;
- break;
- case xlAxisCrossesMaximum: // The axis crosses at the maximum value.
- mxPropertySet->getPropertyValue(MAX) >>= fNum;
- setCrossesAt(fNum);
- bCrossesAreCustomized = sal_False;
- break;
- default: //xlAxisCrossesCustom
- bCrossesAreCustomized = sal_True;
- break;
- }
- mxPropertySet->setPropertyValue(AUTOORIGIN, uno::makeAny(sal_False) );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-::sal_Int32 SAL_CALL
-ScVbaAxis::getCrosses( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Int32 nCrosses = xlAxisCrossesCustom;
- try
- {
- sal_Bool bisAutoOrigin = sal_False;
- mxPropertySet->getPropertyValue(AUTOORIGIN) >>= bisAutoOrigin;
- if (bisAutoOrigin)
- nCrosses = xlAxisCrossesAutomatic;
- else
- {
- if (bCrossesAreCustomized)
- nCrosses = xlAxisCrossesCustom;
- else
- {
- double forigin = 0.0;
- mxPropertySet->getPropertyValue(ORIGIN) >>= forigin;
-//obsolete double fmax = AnyConverter.toDouble(mxPropertySet.getPropertyValue("Max"));
- double fmin = 0.0;
- mxPropertySet->getPropertyValue(MIN) >>= fmin;
- if (forigin == fmin)
- nCrosses = xlAxisCrossesMinimum;
- else
- nCrosses = xlAxisCrossesMaximum;
- }
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return nCrosses;
-}
-
- void SAL_CALL
-ScVbaAxis::setCrossesAt( double _fCrossesAt ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
-// if (getCrosses() == xlAxisCrossesCustom){
- setMaximumScaleIsAuto( sal_False );
- setMinimumScaleIsAuto( sal_False );
- mxPropertySet->setPropertyValue(ORIGIN, uno::makeAny(_fCrossesAt));
-// }
- }
- catch (uno::Exception& e)
- {
- DebugHelper::exception(e);
- }
-}
-
- double SAL_CALL
-ScVbaAxis::getCrossesAt( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- double fCrosses = 0.0;
- try
- {
- mxPropertySet->getPropertyValue(ORIGIN) >>= fCrosses;
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return fCrosses;
-}
-
-void SAL_CALL
-ScVbaAxis::setType( ::sal_Int32 _nType ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- mnType = _nType;
-}
-
-::sal_Int32 SAL_CALL
-ScVbaAxis::getType( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return mnType;
-}
-
-void SAL_CALL
-ScVbaAxis::setHasTitle( ::sal_Bool _bHasTitle ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- ScVbaChart* pChart = getChartPtr();
- sal_Int32 nType = getType();
- switch(nType)
- {
- case xlCategory:
- pChart->mxDiagramPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasXAxisTitle")), uno::makeAny(_bHasTitle));
- break;
- case xlSeriesAxis:
- pChart->mxDiagramPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasZAxisTitle")), uno::makeAny(_bHasTitle));
- break;
- default: // xlValue:
- pChart->mxDiagramPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasYAxisTitle")), uno::makeAny(_bHasTitle));
- }
-
- }
- catch (uno::Exception& e)
- {
- DebugHelper::exception(e);
- }
-}
-
- ::sal_Bool SAL_CALL
-ScVbaAxis::getHasTitle( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bHasTitle = sal_False;
- try
- {
- ScVbaChart* pChart = getChartPtr();
- int nType = getType();
- switch(nType)
- {
- case xlCategory:
- pChart->mxDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasXAxisTitle")) ) >>= bHasTitle;
- break;
- case xlSeriesAxis:
- pChart->mxDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasZAxisTitle")) ) >>= bHasTitle;
- break;
- default: // xlValue:
- pChart->mxDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasYAxisTitle")) ) >>= bHasTitle;
- }
- }
- catch (uno::Exception& e)
- {
- DebugHelper::exception(e);
- }
- return bHasTitle;
-}
-
-void SAL_CALL
-ScVbaAxis::setMinorUnit( double _fMinorUnit ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if (isValueAxis())
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepHelp") ), uno::makeAny(_fMinorUnit));
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-double SAL_CALL
-ScVbaAxis::getMinorUnit( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- double fMinor = 1.0;
- try
- {
- if (isValueAxis())
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepHelp"))) >>= fMinor;
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return fMinor;
-}
-
-void SAL_CALL
-ScVbaAxis::setMinorUnitIsAuto( ::sal_Bool _bMinorUnitIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if (isValueAxis())
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepHelp" ) ), uno::makeAny(_bMinorUnitIsAuto));
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
- ::sal_Bool SAL_CALL
-ScVbaAxis::getMinorUnitIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bIsAuto = sal_False;
- try
- {
- if (isValueAxis())
- {
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepHelp")) ) >>= bIsAuto;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return bIsAuto;
-}
-
-void SAL_CALL
-ScVbaAxis::setReversePlotOrder( ::sal_Bool /*ReversePlotOrder*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
-}
-
-::sal_Bool SAL_CALL
-ScVbaAxis::getReversePlotOrder( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- return sal_False;
-}
-
-void SAL_CALL
-ScVbaAxis::setMajorUnit( double _fMajorUnit ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if (isValueAxis())
- {
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepMain")), uno::makeAny(_fMajorUnit));
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-double SAL_CALL
-ScVbaAxis::getMajorUnit( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- double fMax = 1.0;
- try
- {
- if (isValueAxis())
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepMain"))) >>= fMax;
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return fMax;
-}
-
-void SAL_CALL
-ScVbaAxis::setMajorUnitIsAuto( ::sal_Bool _bMajorUnitIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if (isValueAxis())
- {
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepMain" ) ), uno::makeAny( _bMajorUnitIsAuto ));
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-::sal_Bool SAL_CALL
-ScVbaAxis::getMajorUnitIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bIsAuto = sal_False;
- try
- {
- if (isValueAxis())
- {
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepMain"))) >>= bIsAuto;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return bIsAuto;
-}
-
-void SAL_CALL
-ScVbaAxis::setMaximumScale( double _fMaximumScale ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if ( isValueAxis() )
- {
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Max" ) ), uno::makeAny(_fMaximumScale));
- }
- }
- catch ( uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-double SAL_CALL
-ScVbaAxis::getMaximumScale( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- double fMax = 1.0;
- try
- {
- if (isValueAxis())
- {
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Max" ))) >>= fMax;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return fMax;
-
-}
-
-void SAL_CALL
-ScVbaAxis::setMaximumScaleIsAuto( ::sal_Bool _bMaximumScaleIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if ( isValueAxis() )
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoMax" ) ), uno::makeAny( _bMaximumScaleIsAuto ));
-
- }
- catch ( uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-
-::sal_Bool SAL_CALL
-ScVbaAxis::getMaximumScaleIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bIsAuto = sal_False;
- try
- {
- if (isValueAxis())
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoMax" )) ) >>= bIsAuto;
- }
- catch ( uno::Exception& )
- {
- DebugHelper::exception( SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return bIsAuto;
-}
-
-void SAL_CALL
-ScVbaAxis::setMinimumScale( double _fMinimumScale ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if (isValueAxis())
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Min") ), uno::makeAny( _fMinimumScale ) );
- }
- catch ( uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-double SAL_CALL
-ScVbaAxis::getMinimumScale( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- double fMin = 0.0;
- try
- {
- if (isValueAxis())
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Min") )) >>= fMin;
- }
- catch (uno::Exception& e)
- {
- DebugHelper::exception(e);
- }
- return fMin;
-}
-
-void SAL_CALL
-ScVbaAxis::setMinimumScaleIsAuto( ::sal_Bool _bMinimumScaleIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if (isValueAxis())
- {
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoMin") ), uno::makeAny(_bMinimumScaleIsAuto));
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-::sal_Bool SAL_CALL
-ScVbaAxis::getMinimumScaleIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bIsAuto = sal_False;
- try
- {
- if (isValueAxis())
- {
- mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoMin")) ) >>= bIsAuto;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return bIsAuto;
-}
-
-::sal_Int32 SAL_CALL
-ScVbaAxis::getAxisGroup( ) throw (uno::RuntimeException)
-{
- return mnGroup;
-}
-
-void SAL_CALL
-ScVbaAxis::setScaleType( ::sal_Int32 _nScaleType ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- if (isValueAxis())
- {
- switch (_nScaleType)
- {
- case xlScaleLinear:
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Logarithmic" ) ), uno::makeAny( sal_False ) );
- break;
- case xlScaleLogarithmic:
- mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Logarithmic" ) ), uno::makeAny( sal_True ) );
- break;
- default:
- // According to MS the paramenter is ignored and no Error is thrown
- break;
- }
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-::sal_Int32 SAL_CALL
-ScVbaAxis::getScaleType( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Int32 nScaleType = xlScaleLinear;
- try
- {
- if (isValueAxis())
- {
- sal_Bool bisLogarithmic = sal_False;
- mxPropertySet->getPropertyValue( rtl::OUString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Logarithmic"))) ) >>= bisLogarithmic;
- if (bisLogarithmic)
- nScaleType = xlScaleLogarithmic;
- else
- nScaleType = xlScaleLinear;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return nScaleType;
-}
-
-double SAL_CALL
-ScVbaAxis::getHeight( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- return oShapeHelper->getHeight();
-}
-
-void SAL_CALL ScVbaAxis::setHeight( double height ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- oShapeHelper->setHeight( height );
-}
-double SAL_CALL ScVbaAxis::getWidth( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- return oShapeHelper->getWidth( );
-}
-void SAL_CALL ScVbaAxis::setWidth( double width ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- oShapeHelper->setWidth( width );
-}
-double SAL_CALL ScVbaAxis::getTop( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- return oShapeHelper->getTop( );
-}
-void SAL_CALL ScVbaAxis::setTop( double top ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- oShapeHelper->setTop( top );
-}
-double SAL_CALL ScVbaAxis::getLeft( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- return oShapeHelper->getLeft( );
-}
-void SAL_CALL ScVbaAxis::setLeft( double left ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- oShapeHelper->setLeft( left );
-}
-
-rtl::OUString&
-ScVbaAxis::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaAxis") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaAxis::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Axis" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbaaxis.hxx b/scratch/sc-vba/dead-source/vbaaxis.hxx
deleted file mode 100644
index 9cbea6a16..000000000
--- a/scratch/sc-vba/dead-source/vbaaxis.hxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_AXIS_HXX
-#define SC_VBA_AXOS_HXX
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/excel/XAxis.hpp>
-#include <org/openoffice/excel/XChart.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XAxis > ScVbaAxis_BASE;
-class ScVbaChart;
-class ScVbaAxis : public ScVbaAxis_BASE
-{
- css::uno::Reference< oo::excel::XChart > moChartParent;
- css::uno::Reference< css::beans::XPropertySet > mxPropertySet;
- sal_Int32 mnType;
- sal_Int32 mnGroup;
- sal_Int32 mnCrosses;
- sal_Bool bCrossesAreCustomized;
- ScVbaChart* getChartPtr() throw( css::uno::RuntimeException );
- sal_Bool isValueAxis() throw( css::script::BasicErrorException );
- std::auto_ptr<oo::ShapeHelper> oShapeHelper;
-
-public:
- ScVbaAxis( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, sal_Int32 _nType, sal_Int32 _nGroup );
- // Methods
- virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< ::org::openoffice::excel::XAxisTitle > SAL_CALL getAxisTitle( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayUnit( ::sal_Int32 DisplayUnit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getDisplayUnit( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setCrosses( ::sal_Int32 Crosses ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCrosses( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setCrossesAt( double CrossesAt ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getCrossesAt( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setType( ::sal_Int32 Type ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getType( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setHasTitle( ::sal_Bool HasTitle ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getHasTitle( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMinorUnit( double MinorUnit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getMinorUnit( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMinorUnitIsAuto( ::sal_Bool MinorUnitIsAuto ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getMinorUnitIsAuto( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setReversePlotOrder( ::sal_Bool ReversePlotOrder ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getReversePlotOrder( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMajorUnit( double MajorUnit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getMajorUnit( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMajorUnitIsAuto( ::sal_Bool MajorUnitIsAuto ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getMajorUnitIsAuto( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMaximumScale( double MaximumScale ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getMaximumScale( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMaximumScaleIsAuto( ::sal_Bool MaximumScaleIsAuto ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getMaximumScaleIsAuto( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMinimumScale( double MinimumScale ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getMinimumScale( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMinimumScaleIsAuto( ::sal_Bool MinimumScaleIsAuto ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getMinimumScaleIsAuto( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getAxisGroup( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setScaleType( ::sal_Int32 ScaleType ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getScaleType( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getHeight( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setHeight( double height ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getWidth( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setWidth( double width ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getTop( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setTop( double top ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual double SAL_CALL getLeft( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setLeft( double left ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_AXIS_HXX
diff --git a/scratch/sc-vba/dead-source/vbaaxistitle.cxx b/scratch/sc-vba/dead-source/vbaaxistitle.cxx
deleted file mode 100644
index 51147fb32..000000000
--- a/scratch/sc-vba/dead-source/vbaaxistitle.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbaaxistitle.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-ScVbaAxisTitle::ScVbaAxisTitle( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& _xTitleShape ) : AxisTitleBase( xParent, xContext, _xTitleShape )
-{
-}
-
-rtl::OUString&
-ScVbaAxisTitle::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaAxisTitle") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaAxisTitle::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- uno::Sequence< rtl::OUString > BaseServiceNames = AxisTitleBase::getServiceNames();
- aServiceNames.realloc( BaseServiceNames.getLength() + 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.AxisTitle" ) );
- for ( sal_Int32 index = 1; index < (BaseServiceNames.getLength() + 1); ++index )
- aServiceNames[ index ] = BaseServiceNames[ index ];
- }
- return aServiceNames;
-}
-
-
diff --git a/scratch/sc-vba/dead-source/vbaaxistitle.hxx b/scratch/sc-vba/dead-source/vbaaxistitle.hxx
deleted file mode 100644
index a8ad5332f..000000000
--- a/scratch/sc-vba/dead-source/vbaaxistitle.hxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_AXISTITLE_HXX
-#define SC_VBA_AXISTITLE_HXX
-
-#include "vbatitle.hxx"
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/excel/XAxisTitle.hpp>
-
-typedef TitleImpl< cppu::WeakImplHelper1< oo::excel::XAxisTitle > > AxisTitleBase;
-
-class ScVbaAxisTitle : public AxisTitleBase
-{
-public:
- ScVbaAxisTitle( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& _xTitleShape );
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif
diff --git a/scratch/sc-vba/dead-source/vbaborders.cxx b/scratch/sc-vba/dead-source/vbaborders.cxx
deleted file mode 100644
index 0d63280db..000000000
--- a/scratch/sc-vba/dead-source/vbaborders.cxx
+++ /dev/null
@@ -1,584 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaborders.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbaborders.hxx"
-
-#include <cppuhelper/implbase3.hxx>
-#include <org/openoffice/excel/XlBordersIndex.hpp>
-#include <org/openoffice/excel/XlBorderWeight.hpp>
-#include <org/openoffice/excel/XlLineStyle.hpp>
-#include <org/openoffice/excel/XlColorIndex.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/table/TableBorder.hpp>
-#include <com/sun/star/table/XColumnRowRange.hpp>
-
-#include "vbapalette.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-using namespace ::org::openoffice::excel;
-
-
-typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base;
-typedef InheritedHelperInterfaceImpl1<excel::XBorder > ScVbaBorder_Base;
-
-// #TODO sort these indexes to match the order in which Excel iterates over the
-// borders, the enumeration will match the order in this list
-static const sal_Int16 supportedIndexTable[] = { XlBordersIndex::xlEdgeLeft, XlBordersIndex::xlEdgeTop, XlBordersIndex::xlEdgeBottom, XlBordersIndex::xlEdgeRight, XlBordersIndex::xlDiagonalDown, XlBordersIndex::xlDiagonalUp, XlBordersIndex::xlInsideVertical, XlBordersIndex::xlInsideHorizontal };
-
-const static rtl::OUString sTableBorder( RTL_CONSTASCII_USTRINGPARAM("TableBorder") );
-
-// Equiv widths in in 1/100 mm
-const static sal_Int32 OOLineThin = 35;
-const static sal_Int32 OOLineMedium = 88;
-const static sal_Int32 OOLineThick = 141;
-const static sal_Int32 OOLineHairline = 2;
-
-class ScVbaBorder : public ScVbaBorder_Base
-{
-private:
- uno::Reference< beans::XPropertySet > m_xProps;
- sal_Int32 m_LineType;
- ScVbaPalette m_Palette;
- bool setBorderLine( table::BorderLine& rBorderLine )
- {
- table::TableBorder aTableBorder;
- m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder;
-
- switch ( m_LineType )
- {
- case XlBordersIndex::xlEdgeLeft:
- aTableBorder.IsLeftLineValid = sal_True;
- aTableBorder.LeftLine= rBorderLine;
- break;
- case XlBordersIndex::xlEdgeTop:
- aTableBorder.IsTopLineValid = sal_True;
- aTableBorder.TopLine = rBorderLine;
- break;
-
- case XlBordersIndex::xlEdgeBottom:
- aTableBorder.IsBottomLineValid = sal_True;
- aTableBorder.BottomLine = rBorderLine;
- break;
- case XlBordersIndex::xlEdgeRight:
- aTableBorder.IsRightLineValid = sal_True;
- aTableBorder.RightLine = rBorderLine;
- break;
- case XlBordersIndex::xlInsideVertical:
- aTableBorder.IsVerticalLineValid = sal_True;
- aTableBorder.VerticalLine = rBorderLine;
- break;
- case XlBordersIndex::xlInsideHorizontal:
- aTableBorder.IsHorizontalLineValid = sal_True;
- aTableBorder.HorizontalLine = rBorderLine;
- break;
- case XlBordersIndex::xlDiagonalDown:
- case XlBordersIndex::xlDiagonalUp:
- // #TODO have to ignore at the momement, would be
- // nice to investigate what we can do here
- break;
- default:
- return false;
- }
- m_xProps->setPropertyValue( sTableBorder, uno::makeAny(aTableBorder) );
- return true;
- }
-
- bool getBorderLine( table::BorderLine& rBorderLine )
- {
- table::TableBorder aTableBorder;
- m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder;
- switch ( m_LineType )
- {
- case XlBordersIndex::xlEdgeLeft:
- if ( aTableBorder.IsLeftLineValid )
- rBorderLine = aTableBorder.LeftLine;
- break;
- case XlBordersIndex::xlEdgeTop:
- if ( aTableBorder.IsTopLineValid )
- rBorderLine = aTableBorder.TopLine;
- break;
-
- case XlBordersIndex::xlEdgeBottom:
- if ( aTableBorder.IsBottomLineValid )
- rBorderLine = aTableBorder.BottomLine;
- break;
- case XlBordersIndex::xlEdgeRight:
- if ( aTableBorder.IsRightLineValid )
- rBorderLine = aTableBorder.RightLine;
- break;
- case XlBordersIndex::xlInsideVertical:
- if ( aTableBorder.IsVerticalLineValid )
- rBorderLine = aTableBorder.VerticalLine;
- break;
- case XlBordersIndex::xlInsideHorizontal:
- if ( aTableBorder.IsHorizontalLineValid )
- rBorderLine = aTableBorder.HorizontalLine;
- break;
-
- case XlBordersIndex::xlDiagonalDown:
- case XlBordersIndex::xlDiagonalUp:
- // #TODO have to ignore at the momement, would be
- // nice to investigate what we can do here
- break;
- default:
- return false;
- }
- return true;
- }
- ScVbaBorder(); // no impl
-protected:
- virtual rtl::OUString& getServiceImplName()
- {
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaBorder") );
- return sImplName;
- }
- virtual css::uno::Sequence<rtl::OUString> getServiceNames()
- {
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Border" ) );
- }
- return aServiceNames;
- }
-public:
- ScVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, ScVbaPalette& rPalette) : ScVbaBorder_Base( uno::Reference< vba::XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {}
-
- // XBorder
- uno::Any SAL_CALL getColor() throw (uno::RuntimeException)
- {
- table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
- return uno::makeAny( OORGBToXLRGB( aBorderLine.Color ) );
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No Implementation available" ) ), uno::Reference< uno::XInterface >() );
- }
- void SAL_CALL setColor( const uno::Any& _color ) throw (uno::RuntimeException)
- {
- sal_Int32 nColor = 0;
- _color >>= nColor;
- table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
- {
- aBorderLine.Color = XLRGBToOORGB( nColor );
- setBorderLine( aBorderLine );
- }
- else
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No Implementation available" ) ), uno::Reference< uno::XInterface >() );
- }
-
- uno::Any SAL_CALL getColorIndex() throw (uno::RuntimeException)
- {
- sal_Int32 nColor = 0;
- XLRGBToOORGB( getColor() ) >>= nColor;
- uno::Reference< container::XIndexAccess > xIndex = m_Palette.getPalette();
- sal_Int32 nElems = xIndex->getCount();
- sal_Int32 nIndex = -1;
- for ( sal_Int32 count=0; count<nElems; ++count )
- {
- sal_Int32 nPaletteColor = 0;
- xIndex->getByIndex( count ) >>= nPaletteColor;
- if ( nPaletteColor == nColor )
- {
- nIndex = count + 1;
- break;
- }
- }
- return uno::makeAny(nIndex);
- }
-
- void SAL_CALL setColorIndex( const uno::Any& _colorindex ) throw (uno::RuntimeException)
- {
- sal_Int32 nColor = 0;
- _colorindex >>= nColor;
- if ( !nColor || nColor == XlColorIndex::xlColorIndexAutomatic )
- nColor = 1;
- setColor( OORGBToXLRGB( m_Palette.getPalette()->getByIndex( --nColor ) ) );
- }
- uno::Any SAL_CALL getWeight() throw (uno::RuntimeException)
- {
- table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
- {
- switch ( aBorderLine.OuterLineWidth )
- {
- case 0: // Thin = default OO thickness
- case OOLineThin:
- return uno::makeAny( XlBorderWeight::xlThin );
- case OOLineMedium:
- return uno::makeAny( XlBorderWeight::xlMedium );
- case OOLineThick:
- return uno::makeAny( XlBorderWeight::xlThick );
- case OOLineHairline:
- return uno::makeAny( XlBorderWeight::xlHairline );
- default:
- break;
- }
- }
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() );
- }
- void SAL_CALL setWeight( const uno::Any& _weight ) throw (uno::RuntimeException)
- {
- sal_Int32 nWeight = 0;
- _weight >>= nWeight;
- table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
- {
- switch ( nWeight )
- {
- case XlBorderWeight::xlThin:
- aBorderLine.OuterLineWidth = OOLineThin;
- break;
- case XlBorderWeight::xlMedium:
- aBorderLine.OuterLineWidth = OOLineMedium;
- break;
- case XlBorderWeight::xlThick:
- aBorderLine.OuterLineWidth = OOLineThick;
- break;
- case XlBorderWeight::xlHairline:
- aBorderLine.OuterLineWidth = OOLineHairline;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() );
- break;
- }
- setBorderLine( aBorderLine );
- }
- else
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() );
- }
-
- uno::Any SAL_CALL getLineStyle() throw (uno::RuntimeException)
- {
- // always return xlContinuous;
- return uno::makeAny( XlLineStyle::xlContinuous );
- }
- void SAL_CALL setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException)
- {
- // Urk no choice but to silently ignore we don't support this attribute
- // #TODO would be nice to support the excel line styles
- sal_Int32 nLineStyle = 0;
- _linestyle >>= nLineStyle;
- table::BorderLine aBorderLine;
- if ( getBorderLine( aBorderLine ) )
- {
- switch ( nLineStyle )
- {
- case XlLineStyle::xlContinuous:
- case XlLineStyle::xlDash:
- case XlLineStyle::xlDashDot:
- case XlLineStyle::xlDashDotDot:
- case XlLineStyle::xlDot:
- case XlLineStyle::xlDouble:
- case XlLineStyle::xlLineStyleNone:
- case XlLineStyle::xlSlantDashDot:
- break;
- default:
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() );
- break;
- }
- setBorderLine( aBorderLine );
- }
- else
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() );
- }
-};
-
-class RangeBorders : public RangeBorders_Base
-{
-private:
- uno::Reference< table::XCellRange > m_xRange;
- uno::Reference< uno::XComponentContext > m_xContext;
- ScVbaPalette m_Palette;
- sal_Int32 getTableIndex( sal_Int32 nConst )
- {
- // hokay return position of the index in the table
- sal_Int32 nIndexes = getCount();
- sal_Int32 realIndex = 0;
- const sal_Int16* pTableEntry = supportedIndexTable;
- for ( ; realIndex < nIndexes; ++realIndex, ++pTableEntry )
- {
- if ( *pTableEntry == nConst )
- return realIndex;
- }
- return getCount(); // error condition
- }
-public:
- RangeBorders( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, ScVbaPalette& rPalette ) : m_xRange( xRange ), m_xContext( xContext ), m_Palette( rPalette )
- {
- }
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
- {
- return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] );
- }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
- {
-
- sal_Int32 nIndex = getTableIndex( Index );
- if ( nIndex >= 0 && nIndex < getCount() )
- {
- uno::Reference< beans::XPropertySet > xProps( m_xRange, uno::UNO_QUERY_THROW );
- return uno::makeAny( uno::Reference< excel::XBorder >( new ScVbaBorder( xProps, m_xContext, supportedIndexTable[ nIndex ], m_Palette )) );
- }
- throw lang::IndexOutOfBoundsException();
- }
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
- {
- return excel::XBorder::static_type(0);
- }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
- {
- return sal_True;
- }
-};
-
-uno::Reference< container::XIndexAccess >
-rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, ScVbaPalette& rPalette )
-{
- return new RangeBorders( xRange, xContext, rPalette );
-}
-
-class RangeBorderEnumWrapper : public EnumerationHelper_BASE
-{
- uno::Reference<container::XIndexAccess > m_xIndexAccess;
- sal_Int32 nIndex;
-public:
- RangeBorderEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( nIndex < m_xIndexAccess->getCount() );
- }
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( nIndex < m_xIndexAccess->getCount() )
- return m_xIndexAccess->getByIndex( nIndex++ );
- throw container::NoSuchElementException();
- }
-};
-
-ScVbaBorders::ScVbaBorders( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, ScVbaPalette& rPalette ): ScVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) ), bRangeIsSingleCell( false )
-{
- uno::Reference< table::XColumnRowRange > xColumnRowRange(xRange, uno::UNO_QUERY_THROW );
- if ( xColumnRowRange->getRows()->getCount() == 1 && xColumnRowRange->getColumns()->getCount() == 1 )
- bRangeIsSingleCell = true;
- m_xProps.set( xRange, uno::UNO_QUERY_THROW );
-}
-
-uno::Reference< container::XEnumeration >
-ScVbaBorders::createEnumeration() throw (uno::RuntimeException)
-{
- return new RangeBorderEnumWrapper( m_xIndexAccess );
-}
-
-uno::Any
-ScVbaBorders::createCollectionObject( const css::uno::Any& aSource )
-{
- return aSource; // its already a Border object
-}
-
-uno::Type
-ScVbaBorders::getElementType() throw (uno::RuntimeException)
-{
- return excel::XBorders::static_type(0);
-}
-
-uno::Any
-ScVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException)
-{
- return createCollectionObject( m_xIndexAccess->getByIndex( nIndex ) );
-}
-
-
-uno::Any SAL_CALL ScVbaBorders::getColor() throw (uno::RuntimeException)
-{
- sal_Int32 count = getCount();
- uno::Any color;
- for( sal_Int32 i = 0; i < count ; i++ )
- {
- if( XlBordersIndex::xlDiagonalDown != supportedIndexTable[i] && XlBordersIndex::xlDiagonalUp != supportedIndexTable[i] )
- {
- uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW );
- if( color.hasValue() )
- {
- if( color != xBorder->getColor() )
- return uno::makeAny( uno::Reference< uno::XInterface >() );
- }
- else
- color = xBorder->getColor();
- }
- }
- return color;
-}
-void SAL_CALL ScVbaBorders::setColor( const uno::Any& _color ) throw (uno::RuntimeException)
-{
- sal_Int32 count = getCount();
- for( sal_Int32 i = 0; i < count ; i++ )
- {
- uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW );
- xBorder->setColor( _color );
- }
-}
-uno::Any SAL_CALL ScVbaBorders::getColorIndex() throw (uno::RuntimeException)
-{
- sal_Int32 count = getCount();
- uno::Any nColorIndex;
- for( sal_Int32 i = 0; i < count ; i++ )
- {
- if( XlBordersIndex::xlDiagonalDown != supportedIndexTable[i] && XlBordersIndex::xlDiagonalUp != supportedIndexTable[i] )
- {
- uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW );
- if( nColorIndex.hasValue() )
- {
- if( nColorIndex != xBorder->getColorIndex() )
- return uno::makeAny( uno::Reference< uno::XInterface >() );
- }
- else
- nColorIndex = xBorder->getColorIndex();
- }
- }
- return nColorIndex;
-}
-void SAL_CALL ScVbaBorders::setColorIndex( const uno::Any& _colorindex ) throw (uno::RuntimeException)
-{
- sal_Int32 count = getCount();
- for( sal_Int32 i = 0; i < count ; i++ )
- {
- uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW );
- xBorder->setColorIndex( _colorindex );
- }
-}
-
-bool
-lcl_areAllLineWidthsSame( const table::TableBorder& maTableBorder, bool bIsCell )
-{
-
- bool bRes = false;
- if (bIsCell)
- {
- bRes = ((maTableBorder.TopLine.OuterLineWidth == maTableBorder.BottomLine.OuterLineWidth) &&
-(maTableBorder.TopLine.OuterLineWidth == maTableBorder.LeftLine.OuterLineWidth) &&
-(maTableBorder.TopLine.OuterLineWidth == maTableBorder.RightLine.OuterLineWidth));
- }
- else
- {
- bRes = ((maTableBorder.TopLine.OuterLineWidth == maTableBorder.BottomLine.OuterLineWidth) &&
-(maTableBorder.TopLine.OuterLineWidth == maTableBorder.LeftLine.OuterLineWidth) &&
-(maTableBorder.TopLine.OuterLineWidth == maTableBorder.HorizontalLine.OuterLineWidth) &&
-(maTableBorder.TopLine.OuterLineWidth == maTableBorder.VerticalLine.OuterLineWidth) &&
-(maTableBorder.TopLine.OuterLineWidth == maTableBorder.RightLine.OuterLineWidth));
- }
- return bRes;
-}
-
-uno::Any SAL_CALL ScVbaBorders::getLineStyle() throw (uno::RuntimeException)
-{
- table::TableBorder maTableBorder;
- m_xProps->getPropertyValue( sTableBorder ) >>= maTableBorder;
-
- sal_Int32 aLinestyle = XlLineStyle::xlLineStyleNone;
-
- if ( lcl_areAllLineWidthsSame( maTableBorder, bRangeIsSingleCell ))
- {
- if (maTableBorder.TopLine.LineDistance != 0)
- {
- aLinestyle = XlLineStyle::xlDouble;
- }
- else if ( maTableBorder.TopLine.OuterLineWidth != 0 )
- {
- aLinestyle = XlLineStyle::xlContinuous;
- }
- }
- return uno::makeAny( aLinestyle );
-}
-void SAL_CALL ScVbaBorders::setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException)
-{
- sal_Int32 count = getCount();
- for( sal_Int32 i = 0; i < count ; i++ )
- {
- uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW );
- xBorder->setLineStyle( _linestyle );
- }
-}
-uno::Any SAL_CALL ScVbaBorders::getWeight() throw (uno::RuntimeException)
-{
- sal_Int32 count = getCount();
- uno::Any weight;
- for( sal_Int32 i = 0; i < count ; i++ )
- {
- if( XlBordersIndex::xlDiagonalDown != supportedIndexTable[i] && XlBordersIndex::xlDiagonalUp != supportedIndexTable[i] )
- {
- uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW );
- if( weight.hasValue() )
- {
- if( weight != xBorder->getWeight() )
- return uno::makeAny( uno::Reference< uno::XInterface >() );
- }
- else
- weight = xBorder->getWeight();
- }
- }
- return weight;
-}
-void SAL_CALL ScVbaBorders::setWeight( const uno::Any& _weight ) throw (uno::RuntimeException)
-{
- sal_Int32 count = getCount();
- for( sal_Int32 i = 0; i < count ; i++ )
- {
- uno::Reference< XBorder > xBorder( getItemByIntIndex( supportedIndexTable[i] ), uno::UNO_QUERY_THROW );
- xBorder->setWeight( _weight );
- }
-}
-
-
-rtl::OUString&
-ScVbaBorders::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaBorders") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaBorders::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Borders" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaborders.hxx b/scratch/sc-vba/dead-source/vbaborders.hxx
deleted file mode 100644
index 06282e3ae..000000000
--- a/scratch/sc-vba/dead-source/vbaborders.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_BORDERS_HXX
-#define SC_VBA_BORDERS_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/excel/XBorders.hpp>
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-
-#include "vbacollectionimpl.hxx"
-
-typedef CollTestImplHelper< oo::excel::XBorders > ScVbaBorders_BASE;
-class ScVbaPalette;
-class ScVbaBorders : public ScVbaBorders_BASE
-{
- // XEnumerationAccess
- virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException);
- bool bRangeIsSingleCell;
- css::uno::Reference< css::beans::XPropertySet > m_xProps;
-public:
- ScVbaBorders( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::table::XCellRange >& xRange, ScVbaPalette& rPalette );
- virtual ~ScVbaBorders() {}
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
-
- // XBorders
-
- // ScVbaCollectionBaseImpl
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-
- virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getLineStyle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setLineStyle( const css::uno::Any& _linestyle ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getWeight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setWeight( const css::uno::Any& ) throw (css::uno::RuntimeException);
- // xxxxBASE
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_BORDERS_HXX
-
diff --git a/scratch/sc-vba/dead-source/vbabutton.cxx b/scratch/sc-vba/dead-source/vbabutton.cxx
deleted file mode 100644
index 6d3ce7e43..000000000
--- a/scratch/sc-vba/dead-source/vbabutton.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbabutton.hxx"
-#include <vector>
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-
-const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-ScVbaButton::ScVbaButton( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : ButtonImpl_BASE( xContext, xControlShape )
-{
-}
-
-// Attributes
-rtl::OUString SAL_CALL
-ScVbaButton::getCaption() throw (css::uno::RuntimeException)
-{
- rtl::OUString Label;
- m_xProps->getPropertyValue( LABEL ) >>= Label;
- return Label;
-}
-
-void SAL_CALL
-ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-{
- m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-}
diff --git a/scratch/sc-vba/dead-source/vbabutton.hxx b/scratch/sc-vba/dead-source/vbabutton.hxx
deleted file mode 100644
index 7131dbcff..000000000
--- a/scratch/sc-vba/dead-source/vbabutton.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_BUTTON_HXX
-#define SC_VBA_BUTTON_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/msforms/XButton.hpp>
-
-#include "vbacontrol.hxx"
-#include "vbahelper.hxx"
-
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XButton > ButtonImpl_BASE;
-
-class ScVbaButton : public ButtonImpl_BASE
-{
-public:
- ScVbaButton( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- // Attributes
- virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
-};
-#endif //SC_VBA_BUTTON_HXX
diff --git a/scratch/sc-vba/dead-source/vbacharacters.cxx b/scratch/sc-vba/dead-source/vbacharacters.cxx
deleted file mode 100644
index ac78c7b1b..000000000
--- a/scratch/sc-vba/dead-source/vbacharacters.cxx
+++ /dev/null
@@ -1,139 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbacharacters.hxx"
-
-#include "vbaglobals.hxx"
-#include "vbafont.hxx"
-
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-ScVbaCharacters::ScVbaCharacters( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, const uno::Reference< text::XSimpleText>& xRange,const css::uno::Any& Start, const css::uno::Any& Length, sal_Bool Replace ) throw ( css::lang::IllegalArgumentException ) : ScVbaCharacters_BASE( xParent, xContext ), m_xSimpleText(xRange), m_aPalette( dPalette), nLength(-1), nStart(1), bReplace( Replace )
-{
- Start >>= nStart;
- if ( nStart < 1 )
- nStart = 1; // silently correct user error ( as ms )
- nStart--; // OOo is 0 based
- Length >>=nLength;
- uno::Reference< text::XTextCursor > xTextCursor( m_xSimpleText->createTextCursor(), uno::UNO_QUERY_THROW );
- xTextCursor->collapseToStart();
- if ( nStart )
- xTextCursor->goRight( nStart, sal_False );
- if ( nLength < 0 ) // expand to end
- xTextCursor->gotoEnd( sal_True );
- else
- xTextCursor->goRight( nLength, sal_True );
- m_xTextRange.set( xTextCursor, uno::UNO_QUERY_THROW );
-
-}
-
-::rtl::OUString SAL_CALL
-ScVbaCharacters::getCaption() throw (css::uno::RuntimeException)
-{
- return m_xTextRange->getString();
-}
-void SAL_CALL
-ScVbaCharacters::setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException)
-{
- m_xTextRange->setString( _caption );
-
-}
-
-::sal_Int32 SAL_CALL
-ScVbaCharacters::getCount() throw (css::uno::RuntimeException)
-{
- return getCaption().getLength();
-}
-
-::rtl::OUString SAL_CALL
-ScVbaCharacters::getText() throw (css::uno::RuntimeException)
-{
- return getCaption();
-}
-void SAL_CALL
-ScVbaCharacters::setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException)
-{
- setCaption( _text );
-}
-uno::Reference< excel::XFont > SAL_CALL
-ScVbaCharacters::getFont() throw (css::uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xTextRange, uno::UNO_QUERY_THROW );
- return uno::Reference< excel::XFont >( new ScVbaFont( this, mxContext, m_aPalette, xProps ) );
-}
-void SAL_CALL
-ScVbaCharacters::setFont( const uno::Reference< excel::XFont >& /*_font*/ ) throw (css::uno::RuntimeException)
-{
- // #TODO #FIXME needs implementation, or can't be done?
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Not Implemented") ), uno::Reference< XInterface >() );
-}
-
-
-// Methods
-void SAL_CALL
-ScVbaCharacters::Insert( const ::rtl::OUString& String ) throw (css::uno::RuntimeException)
-{
- m_xSimpleText->insertString( m_xTextRange, String, bReplace );
-}
-
-void SAL_CALL
-ScVbaCharacters::Delete( ) throw (css::uno::RuntimeException)
-{
- // #FIXME #TODO is this a bit suspect?, I wonder should the contents
- // of the cell be deleted from the parent ( range )
- m_xSimpleText->setString(rtl::OUString());
-}
-
-
-rtl::OUString&
-ScVbaCharacters::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCharacters") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaCharacters::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Characters" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbacharacters.hxx b/scratch/sc-vba/dead-source/vbacharacters.hxx
deleted file mode 100644
index 0c0cfa1a6..000000000
--- a/scratch/sc-vba/dead-source/vbacharacters.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CHARACTERS_HXX
-#define SC_VBA_CHARACTERS_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <org/openoffice/excel/XCharacters.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/text/XSimpleText.hpp>
-
-#include "vbahelperinterface.hxx"
-#include "vbapalette.hxx"
-typedef InheritedHelperInterfaceImpl1< oo::excel::XCharacters > ScVbaCharacters_BASE;
-
-class ScVbaCharacters : public ScVbaCharacters_BASE
-{
-private:
- css::uno::Reference< css::text::XTextRange > m_xTextRange;
- css::uno::Reference< css::text::XSimpleText > m_xSimpleText;
- ScVbaPalette m_aPalette;
- sal_Int16 nLength;
- sal_Int16 nStart;
- // Add becuase of MSO has diferent behavior.
- sal_Bool bReplace;
-public:
- ScVbaCharacters( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, const css::uno::Reference< css::text::XSimpleText >& xRange, const css::uno::Any& Start, const css::uno::Any& Length, sal_Bool bReplace = sal_False ) throw ( css::lang::IllegalArgumentException );
-
- virtual ~ScVbaCharacters() {}
- // Attributes
- virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFont( const css::uno::Reference< oo::excel::XFont >& _font ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL Insert( const ::rtl::OUString& String ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
-
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-
-#endif /* SC_VBA_CHARACTER_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbachart.cxx b/scratch/sc-vba/dead-source/vbachart.cxx
deleted file mode 100644
index dd105222e..000000000
--- a/scratch/sc-vba/dead-source/vbachart.cxx
+++ /dev/null
@@ -1,1269 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbachart.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbachart.hxx"
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/chart/XAxisXSupplier.hpp>
-#include <com/sun/star/chart/XAxisYSupplier.hpp>
-#include <com/sun/star/chart/XAxisZSupplier.hpp>
-#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
-#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
-#include <com/sun/star/chart/XChartDataArray.hpp>
-#include <com/sun/star/chart/ChartSymbolType.hpp>
-#include <com/sun/star/chart/ChartSolidType.hpp>
-#include <com/sun/star/chart/ChartDataRowSource.hpp>
-#include <com/sun/star/chart/ChartDataCaption.hpp>
-#include <org/openoffice/excel/XlChartType.hpp>
-#include <org/openoffice/excel/XlRowCol.hpp>
-#include <org/openoffice/excel/XlAxisType.hpp>
-#include <org/openoffice/excel/XlAxisGroup.hpp>
-
-#include <basic/sberrors.hxx>
-#include "vbachartobject.hxx"
-#include "vbarange.hxx"
-#include "vbacharttitle.hxx"
-#include "vbaaxes.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-using namespace ::org::openoffice::excel::XlChartType;
-using namespace ::org::openoffice::excel::XlRowCol;
-using namespace ::org::openoffice::excel::XlAxisType;
-using namespace ::org::openoffice::excel::XlAxisGroup;
-
-const rtl::OUString CHART_NAME( RTL_CONSTASCII_USTRINGPARAM("Name") );
-// #TODO move this constant to vbaseries.[ch]xx ( when it exists )
-const rtl::OUString DEFAULTSERIESPREFIX( RTL_CONSTASCII_USTRINGPARAM("Series") );
-const rtl::OUString DATAROWSOURCE( RTL_CONSTASCII_USTRINGPARAM("DataRowSource") );
-const rtl::OUString UPDOWN( RTL_CONSTASCII_USTRINGPARAM("UpDown") );
-const rtl::OUString VOLUME( RTL_CONSTASCII_USTRINGPARAM("Volume") );
-const rtl::OUString LINES( RTL_CONSTASCII_USTRINGPARAM("Lines") );
-const rtl::OUString SPLINETYPE( RTL_CONSTASCII_USTRINGPARAM("SplineType") );
-const rtl::OUString SYMBOLTYPE( RTL_CONSTASCII_USTRINGPARAM("SymbolType") );
-const rtl::OUString DEEP( RTL_CONSTASCII_USTRINGPARAM("Deep") );
-const rtl::OUString SOLIDTYPE( RTL_CONSTASCII_USTRINGPARAM("SolidType") );
-const rtl::OUString VERTICAL( RTL_CONSTASCII_USTRINGPARAM("Vertical") );
-const rtl::OUString PERCENT( RTL_CONSTASCII_USTRINGPARAM("Percent") );
-const rtl::OUString STACKED( RTL_CONSTASCII_USTRINGPARAM("Stacked") );
-const rtl::OUString DIM3D( RTL_CONSTASCII_USTRINGPARAM("Dim3D") );
-const rtl::OUString HASMAINTITLE( RTL_CONSTASCII_USTRINGPARAM("HasMainTitle") );
-const rtl::OUString HASLEGEND( RTL_CONSTASCII_USTRINGPARAM("HasLegend") );
-const rtl::OUString DATACAPTION( RTL_CONSTASCII_USTRINGPARAM("DataCaption") );
-
-ScVbaChart::ScVbaChart( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::lang::XComponent >& _xChartComponent, const css::uno::Reference< css::table::XTableChart >& _xTableChart ) : ChartImpl_BASE( _xParent, _xContext ), mxTableChart( _xTableChart )
-{
- mxChartDocument.set( _xChartComponent, uno::UNO_QUERY_THROW ) ;
- // #TODO is is possible that the XPropertySet interface is not set
- // code in setPlotBy seems to indicate that this is possible? but
- // additionally there is no check in most of the places where it is used
- // ( and therefore could possibly be NULL )
- // I'm going to let it throw for the moment ( npower )
- mxDiagramPropertySet.set( mxChartDocument->getDiagram(), uno::UNO_QUERY_THROW );
- mxChartPropertySet.set( _xChartComponent, uno::UNO_QUERY_THROW ) ;
-}
-
-::rtl::OUString SAL_CALL
-ScVbaChart::getName() throw (css::uno::RuntimeException)
-{
- rtl::OUString sName;
- uno::Reference< beans::XPropertySet > xProps( mxChartDocument, uno::UNO_QUERY_THROW );
- try
- {
- xProps->getPropertyValue( CHART_NAME ) >>= sName;
- }
- catch( uno::Exception e ) // swallow exceptions
- {
- }
- return sName;
-}
-
-uno::Any SAL_CALL
-ScVbaChart::SeriesCollection(const uno::Any&) throw (uno::RuntimeException)
-{
- return uno::Any();
-}
-
-::sal_Int32 SAL_CALL
-ScVbaChart::getChartType() throw ( uno::RuntimeException, script::BasicErrorException)
-{
- sal_Int32 nChartType = -1;
- try
- {
- rtl::OUString sDiagramType = mxChartDocument->getDiagram()->getDiagramType();
- if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.AreaDiagram" ))))
- {
- if (is3D())
- {
- nChartType = getStackedType(xl3DAreaStacked, xl3DAreaStacked100, xl3DArea);
- }
- else
- {
- nChartType = getStackedType(xlAreaStacked, xlAreaStacked100, xlArea);
- }
- }
- else if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.PieDiagram"))))
- {
- if (is3D())
- nChartType = xl3DPie;
- else
- nChartType = xlPie; /*TODO XlChartType xlPieExploded, XlChartType xlPieOfPie */
- }
- else if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.BarDiagram"))))
- {
- sal_Int32 nSolidType = chart::ChartSolidType::RECTANGULAR_SOLID;
- if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(SOLIDTYPE))
- { //in 2D diagrams 'SolidType' may not be set
- if (is3D())
- mxDiagramPropertySet->getPropertyValue(SOLIDTYPE) >>= nSolidType;
- }
- switch (nSolidType)
- {
- case chart::ChartSolidType::CONE:
- nChartType = getSolidType(xlConeCol, xlConeColStacked, xlConeColStacked100, xlConeColClustered, xlConeBarStacked, xlConeBarStacked100, xlConeBarClustered);
- break;
- case chart::ChartSolidType::CYLINDER:
- nChartType = getSolidType(xlCylinderCol, xlCylinderColStacked, xlCylinderColStacked100, xlCylinderColClustered, xlCylinderBarStacked, xlCylinderBarStacked100, xlCylinderBarClustered);
- break;
- case chart::ChartSolidType::PYRAMID:
- nChartType = getSolidType(xlPyramidCol, xlPyramidColStacked, xlPyramidColStacked100, xlPyramidColClustered, xlPyramidBarStacked, xlPyramidBarStacked100, xlPyramidBarClustered);
- break;
- default: // RECTANGULAR_SOLID
- if (is3D())
- {
- nChartType = getSolidType(xl3DColumn, xl3DColumnStacked, xl3DColumnStacked100, xl3DColumnClustered, xl3DBarStacked, xl3DBarStacked100, xl3DBarClustered);
- }
- else
- {
- nChartType = getSolidType(xlColumnClustered, xlColumnStacked, xlColumnStacked100, xlColumnClustered, xlBarStacked, xlBarStacked100, xlBarClustered);
- }
- break;
- }
- }
- else if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.StockDiagram"))))
- {
- sal_Bool bVolume = sal_False;
- mxDiagramPropertySet->getPropertyValue(VOLUME) >>= bVolume;
- if (bVolume)
- {
- nChartType = getStockUpDownValue(xlStockVOHLC, xlStockVHLC);
- }
- else
- {
- nChartType = getStockUpDownValue(xlStockOHLC, xlStockHLC);
- }
- }
- else if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.XYDiagram"))))
- {
- sal_Bool bHasLines = sal_False;
- mxDiagramPropertySet->getPropertyValue(LINES) >>= bHasLines;
- sal_Int32 nSplineType = 0;
- mxDiagramPropertySet->getPropertyValue(SPLINETYPE) >>= nSplineType;
- if (nSplineType == 1)
- {
- nChartType = getMarkerType(xlXYScatterSmooth, xlXYScatterSmoothNoMarkers);
- }
- else if (bHasLines)
- {
- nChartType = getMarkerType(xlXYScatterLines, xlXYScatterLinesNoMarkers);
- }
- else
- {
- nChartType = xlXYScatter;
- }
- }
- else if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.LineDiagram"))))
- {
- if (is3D())
- {
- nChartType = xl3DLine;
- }
- else if (hasMarkers())
- {
- nChartType = getStackedType(xlLineMarkersStacked, xlLineMarkersStacked100, xlLineMarkers);
- }
- else
- {
- nChartType = getStackedType(xlLineStacked, xlLineStacked100, xlLine);
- }
- }
- else if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.DonutDiagram"))))
- {
- nChartType = xlDoughnut; // TODO DoughnutExploded ??
- }
- else if (sDiagramType.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.NetDiagram"))))
- {
- nChartType = getMarkerType(xlRadarMarkers, xlRadar);
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return nChartType;
-}
-
-void SAL_CALL
-ScVbaChart::setChartType( ::sal_Int32 _nChartType ) throw ( uno::RuntimeException, script::BasicErrorException)
-{
-try
-{
- switch (_nChartType)
- {
- case xlColumnClustered:
- case xlColumnStacked:
- case xlColumnStacked100:
- case xl3DColumnClustered:
- case xl3DColumnStacked:
- case xl3DColumnStacked100:
- case xl3DColumn:
- case xlBarClustered:
- case xlBarStacked:
- case xlBarStacked100:
- case xl3DBarClustered:
- case xl3DBarStacked:
- case xl3DBarStacked100:
- case xlConeColClustered:
- case xlConeColStacked:
- case xlConeColStacked100:
- case xlConeBarClustered:
- case xlConeBarStacked:
- case xlConeBarStacked100:
- case xlConeCol:
- case xlPyramidColClustered:
- case xlPyramidColStacked:
- case xlPyramidColStacked100:
- case xlPyramidBarClustered:
- case xlPyramidBarStacked:
- case xlPyramidBarStacked100:
- case xlPyramidCol:
- case xlCylinderColClustered:
- case xlCylinderColStacked:
- case xlCylinderColStacked100:
- case xlCylinderBarClustered:
- case xlCylinderBarStacked:
- case xlCylinderBarStacked100:
- case xlCylinderCol:
- case xlSurface: // not possible
- case xlSurfaceWireframe:
- case xlSurfaceTopView:
- case xlSurfaceTopViewWireframe:
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.BarDiagram")));
- break;
- case xlLine:
- case xl3DLine:
- case xlLineStacked:
- case xlLineStacked100:
- case xlLineMarkers:
- case xlLineMarkersStacked:
- case xlLineMarkersStacked100:
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.LineDiagram")));
- break;
- case xl3DArea:
- case xlArea:
- case xlAreaStacked:
- case xlAreaStacked100:
- case xl3DAreaStacked:
- case xl3DAreaStacked100:
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.AreaDiagram")) );
- break;
- case xlDoughnut:
- case xlDoughnutExploded:
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.DonutDiagram") ) );
- break;
- case xlStockHLC:
- case xlStockOHLC:
- case xlStockVHLC:
- case xlStockVOHLC:
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.StockDiagram")));
- mxDiagramPropertySet->setPropertyValue( UPDOWN, uno::makeAny(sal_Bool((_nChartType == xlStockOHLC) || (_nChartType == xlStockVOHLC))));
- mxDiagramPropertySet->setPropertyValue(VOLUME, uno::makeAny(sal_Bool((_nChartType == xlStockVHLC) || (_nChartType == xlStockVOHLC))));
- break;
-
- case xlPieOfPie: // not possible
- case xlPieExploded: // SegmentOffset an ChartDataPointProperties ->am XDiagram abholen //wie macht Excel das?
- case xl3DPieExploded:
- case xl3DPie:
- case xlPie:
- case xlBarOfPie: // not possible (Zoom pie)
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.PieDiagram")));
- break;
-
- case xlRadar:
- case xlRadarMarkers:
- case xlRadarFilled:
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.NetDiagram")));
- break;
- case xlXYScatter:
- case xlBubble: // not possible
- case xlBubble3DEffect: // not possible
- case xlXYScatterLines:
- case xlXYScatterLinesNoMarkers:
- case xlXYScatterSmooth:
- case xlXYScatterSmoothNoMarkers:
- setDiagram( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.XYDiagram")));
- switch(_nChartType)
- {
- case xlXYScatter:
- case xlBubble: // not possible
- case xlBubble3DEffect: // not possible
- mxDiagramPropertySet->setPropertyValue(LINES, uno::makeAny( sal_False ));
- break;
- case xlXYScatterLines:
- case xlXYScatterLinesNoMarkers:
- mxDiagramPropertySet->setPropertyValue(LINES, uno::makeAny( sal_True ));
- break;
- case xlXYScatterSmooth:
- case xlXYScatterSmoothNoMarkers:
- mxDiagramPropertySet->setPropertyValue(SPLINETYPE, uno::makeAny( sal_Int32(1)));
- break;
- default:
- break;
- }
- break;
- default:
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_CONVERSION, rtl::OUString() );
- break;
- }
-
- switch (_nChartType)
- {
- case xlLineMarkers:
- case xlLineMarkersStacked:
- case xlLineMarkersStacked100:
- case xlRadarMarkers:
- case xlXYScatterLines:
- case xlXYScatterSmooth:
- case xlXYScatter:
- case xlBubble: // not possible
- case xlBubble3DEffect: // not possible
- mxDiagramPropertySet->setPropertyValue(SYMBOLTYPE, uno::makeAny( chart::ChartSymbolType::AUTO));
- break;
- default:
- if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(SYMBOLTYPE))
- {
- mxDiagramPropertySet->setPropertyValue(SYMBOLTYPE, uno::makeAny(chart::ChartSymbolType::NONE));
- }
- break;
- }
-
- switch (_nChartType)
- {
- case xlConeCol:
- case xlPyramidCol:
- case xlCylinderCol:
- case xl3DColumn:
- case xlSurface: // not possible
- case xlSurfaceWireframe:
- case xlSurfaceTopView:
- case xlSurfaceTopViewWireframe:
- mxDiagramPropertySet->setPropertyValue(DEEP,uno::makeAny( sal_True ));
- break;
- default:
- if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(DEEP))
- {
- mxDiagramPropertySet->setPropertyValue(DEEP, uno::makeAny( sal_False));
- }
- break;
- }
-
-
- switch (_nChartType)
- {
- case xlConeColClustered:
- case xlConeColStacked:
- case xlConeColStacked100:
- case xlConeBarClustered:
- case xlConeBarStacked:
- case xlConeBarStacked100:
- case xlConeCol:
- mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::CONE));
- break;
- case xlPyramidColClustered:
- case xlPyramidColStacked:
- case xlPyramidColStacked100:
- case xlPyramidBarClustered:
- case xlPyramidBarStacked:
- case xlPyramidBarStacked100:
- case xlPyramidCol:
- mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::PYRAMID));
- break;
- case xlCylinderColClustered:
- case xlCylinderColStacked:
- case xlCylinderColStacked100:
- case xlCylinderBarClustered:
- case xlCylinderBarStacked:
- case xlCylinderBarStacked100:
- case xlCylinderCol:
- mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::CYLINDER));
- break;
- default:
- if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(SOLIDTYPE))
- {
- mxDiagramPropertySet->setPropertyValue(SOLIDTYPE, uno::makeAny(chart::ChartSolidType::RECTANGULAR_SOLID));
- }
- break;
- }
-
- switch ( _nChartType)
- {
- case xlConeCol:
- case xlConeColClustered:
- case xlConeColStacked:
- case xlConeColStacked100:
- case xlPyramidColClustered:
- case xlPyramidColStacked:
- case xlPyramidColStacked100:
- case xlCylinderColClustered:
- case xlCylinderColStacked:
- case xlCylinderColStacked100:
- case xlColumnClustered:
- case xlColumnStacked:
- case xlColumnStacked100:
- case xl3DColumnClustered:
- case xl3DColumnStacked:
- case xl3DColumnStacked100:
- case xlSurface: // not possible
- case xlSurfaceWireframe:
- case xlSurfaceTopView:
- case xlSurfaceTopViewWireframe:
- mxDiagramPropertySet->setPropertyValue(VERTICAL, uno::makeAny( sal_True));
- break;
- default:
- if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(VERTICAL))
- {
- mxDiagramPropertySet->setPropertyValue(VERTICAL, uno::makeAny(sal_False));
- }
- break;
- }
-
- switch (_nChartType)
- {
- case xlColumnStacked:
- case xl3DColumnStacked:
- case xlBarStacked:
- case xl3DBarStacked:
- case xlLineStacked:
- case xlLineMarkersStacked:
- case xlAreaStacked:
- case xl3DAreaStacked:
- case xlCylinderColStacked:
- case xlCylinderBarStacked:
- case xlConeColStacked:
- case xlConeBarStacked:
- case xlPyramidColStacked:
- case xlPyramidBarStacked:
- mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_False ));
- mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_True ));
- break;
- case xlPyramidColStacked100:
- case xlPyramidBarStacked100:
- case xlConeColStacked100:
- case xlConeBarStacked100:
- case xlCylinderBarStacked100:
- case xlCylinderColStacked100:
- case xl3DAreaStacked100:
- case xlLineMarkersStacked100:
- case xlAreaStacked100:
- case xlLineStacked100:
- case xl3DBarStacked100:
- case xlBarStacked100:
- case xl3DColumnStacked100:
- case xlColumnStacked100:
- mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_True));
- mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_True ));
- break;
- default:
- mxDiagramPropertySet->setPropertyValue(PERCENT, uno::makeAny( sal_False));
- mxDiagramPropertySet->setPropertyValue(STACKED, uno::makeAny( sal_False));
- break;
- }
- switch (_nChartType)
- {
- case xl3DArea:
- case xl3DAreaStacked:
- case xl3DAreaStacked100:
- case xl3DBarClustered:
- case xl3DBarStacked:
- case xl3DBarStacked100:
- case xl3DColumn:
- case xl3DColumnClustered:
- case xl3DColumnStacked:
- case xl3DColumnStacked100:
- case xl3DLine:
- case xl3DPie:
- case xl3DPieExploded:
- case xlConeColClustered:
- case xlConeColStacked:
- case xlConeColStacked100:
- case xlConeBarClustered:
- case xlConeBarStacked:
- case xlConeBarStacked100:
- case xlConeCol:
- case xlPyramidColClustered:
- case xlPyramidColStacked:
- case xlPyramidColStacked100:
- case xlPyramidBarClustered:
- case xlPyramidBarStacked:
- case xlPyramidBarStacked100:
- case xlPyramidCol:
- case xlCylinderColClustered:
- case xlCylinderColStacked:
- case xlCylinderColStacked100:
- case xlCylinderBarClustered:
- case xlCylinderBarStacked:
- case xlCylinderBarStacked100:
- case xlCylinderCol:
- mxDiagramPropertySet->setPropertyValue(DIM3D, uno::makeAny( sal_True));
- break;
- default:
- if (mxDiagramPropertySet->getPropertySetInfo()->hasPropertyByName(DIM3D))
- {
- mxDiagramPropertySet->setPropertyValue(DIM3D, uno::makeAny( sal_False));
- }
- break;
- }
- }
- catch ( uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-void SAL_CALL
-ScVbaChart::Activate() throw (script::BasicErrorException, uno::RuntimeException)
-{
- // #TODO how are Chart sheets handled ( I know we don't even consider
- // them in the worksheets/sheets collections ), but.....???
- // note: in vba for excel the parent of a Chart sheet is a workbook,
- // e.g. 'ThisWorkbook'
- uno::Reference< vba::XHelperInterface > xParent( getParent() );
- ScVbaChartObject* pChartObj = static_cast< ScVbaChartObject* >( xParent.get() );
- if ( pChartObj )
- pChartObj->Activate();
- else
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no ChartObject as parent" ) ) );
-}
-
-void SAL_CALL
-ScVbaChart::setSourceData( const css::uno::Reference< ::org::openoffice::excel::XRange >& _xCalcRange, const css::uno::Any& _aPlotBy ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- try
- {
- uno::Sequence< table::CellRangeAddress > mRangeAddresses(1);
- table::CellRangeAddress mSingleRangeAddress;
-
- uno::Reference< sheet::XCellRangeAddressable > xAddressable( _xCalcRange->getCellRange(), uno::UNO_QUERY_THROW );
- mSingleRangeAddress = xAddressable->getRangeAddress();
-
- mRangeAddresses[0] = mSingleRangeAddress;
-
- mxTableChart->setRanges(mRangeAddresses);
-
- sal_Bool bsetRowHeaders = sal_False;
- sal_Bool bsetColumnHeaders = sal_False;
-
- ScVbaRange* pRange = static_cast< ScVbaRange* >( _xCalcRange.get() );
- if ( pRange )
- {
- ScDocument* pDoc = pRange->getScDocument();
- if ( pDoc )
- {
- bsetRowHeaders = pDoc->HasRowHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ) );;
- bsetColumnHeaders = pDoc->HasColHeader( static_cast< SCCOL >( mSingleRangeAddress.StartColumn ), static_cast< SCROW >( mSingleRangeAddress.StartRow ), static_cast< SCCOL >( mSingleRangeAddress.EndColumn ), static_cast< SCROW >( mSingleRangeAddress.EndRow ), static_cast< SCTAB >( mSingleRangeAddress.Sheet ));
-;
- }
- }
- mxTableChart->setHasRowHeaders(bsetRowHeaders);
- mxTableChart->setHasColumnHeaders(bsetColumnHeaders);
-
- if ((!bsetColumnHeaders) || (!bsetRowHeaders))
- {
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
- if (!bsetColumnHeaders)
- {
- xChartDataArray->setColumnDescriptions( getDefaultSeriesDescriptions(xChartDataArray->getColumnDescriptions().getLength() ));
- }
- if (!bsetRowHeaders)
- {
- xChartDataArray->setRowDescriptions(getDefaultSeriesDescriptions(xChartDataArray->getRowDescriptions().getLength() ));
- }
- }
-
- if ( _aPlotBy.hasValue() )
- {
- sal_Int32 nVal = 0;
- _aPlotBy >>= nVal;
- setPlotBy( nVal );
- }
- else
- {
- sal_Int32 nRows = mSingleRangeAddress.EndRow - mSingleRangeAddress.StartRow;
- sal_Int32 nCols = mSingleRangeAddress.EndColumn - mSingleRangeAddress.StartColumn;
- // AutoDetect emulation
- if ( nRows > nCols )
- setPlotBy( xlColumns );
- else if ( nRows <= nCols )
- setPlotBy( xlRows );
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaChart::getDefaultSeriesDescriptions( sal_Int32 _nCount )
-{
- uno::Sequence< rtl::OUString > sDescriptions ( _nCount );
- sal_Int32 nLen = sDescriptions.getLength();
- for (sal_Int32 i = 0; i < nLen; i++)
- {
- sDescriptions[i] = DEFAULTSERIESPREFIX + rtl::OUString::valueOf(i+1);
- }
- return sDescriptions;
-}
-
-void
-ScVbaChart::setDefaultChartType() throw ( script::BasicErrorException )
-{
- setChartType( xlColumnClustered );
-}
-
-void
-ScVbaChart::setPlotBy( ::sal_Int32 _nPlotBy ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- try
- {
- if ( !mxDiagramPropertySet.is() )
- setDefaultChartType();
- switch (_nPlotBy)
- {
- case xlRows:
- mxDiagramPropertySet->setPropertyValue( DATAROWSOURCE, uno::makeAny( chart::ChartDataRowSource_ROWS ) );
- break;
- case xlColumns:
- mxDiagramPropertySet->setPropertyValue( DATAROWSOURCE, uno::makeAny( chart::ChartDataRowSource_COLUMNS) );
- break;
- default:
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-::sal_Int32 SAL_CALL
-ScVbaChart::getPlotBy( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- chart::ChartDataRowSource aChartDataRowSource;
- mxDiagramPropertySet->getPropertyValue(DATAROWSOURCE) >>= aChartDataRowSource;
- if (aChartDataRowSource == chart::ChartDataRowSource_COLUMNS)
- {
- return xlColumns;
- }
- else
- {
- return xlRows;
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return xlColumns;
-}
-
-void
-ScVbaChart::setDiagram( const rtl::OUString& _sDiagramType ) throw( script::BasicErrorException )
-{
- try
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF( mxChartDocument, uno::UNO_QUERY_THROW );
- uno::Reference< chart::XDiagram > xDiagram( xMSF->createInstance( _sDiagramType ), uno::UNO_QUERY_THROW );
- mxChartDocument->setDiagram( xDiagram );
- mxDiagramPropertySet.set( xDiagram, uno::UNO_QUERY_THROW );
- }
- catch ( uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-// #TODO find out why we have Location/getLocation ? there is afaiks no
-// Location property, just a Location function for the Chart object
-sal_Int32 SAL_CALL
-ScVbaChart::Location() throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- return getLocation();
-}
-
-sal_Int32 SAL_CALL
-ScVbaChart::getLocation() throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- return -1;
-}
-
-void SAL_CALL
-ScVbaChart::setLocation( ::sal_Int32 /*where*/, const css::uno::Any& /*Name*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- // Helper api just stubs out the code <shrug>
- // #TODO come back and make sense out of this
-// String sheetName = null;
-//
-// if ((name != null) && name instanceof String) {
-// sheetName = (String) name;
-// }
-// XSpreadsheetDocument xShDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface( XSpreadsheetDocument.class,getXModel() );
-// com.sun.star.sheet.XSpreadsheets xSheets = xShDoc.Sheets();
-//
-// switch (where) {
-// case ClLocationType.clLocationAsObject_value: //{
-//
-// if (sheetName == null) {
-// DebugHelper.writeInfo("Can't embed in Chart without knowing SheetName");
-// return;
-// }
-//
-// try {
-// Any any = (Any) xSheets.getByName(sheetName);
-// chartSheet = (XSpreadsheet) any.getObject();
-//
-// // chartSheet = (XSpreadsheet) xSheets.getByName( sheetName );
-// } catch (NoSuchElementException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-//
-// return;
-// } catch (WrappedTargetException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-//
-// return;
-// } catch (java.lang.Exception e) {
-// e.printStackTrace();
-// }
-//
-// XTableChartsSupplier xTCS = (XTableChartsSupplier) UnoRuntime.queryInterface( XTableChartsSupplier.class, chartSheet);
-// XTableCharts xTableCharts = xTCS.getCharts();
-// XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xTableCharts);
-// int numCharts = xIA.getCount();
-// chartName = "Chart " + (numCharts + 1);
-//
-// //}
-// break;
-//
-// case ClLocationType.clLocationAsNewSheet_value:
-// case ClLocationType.clLocationAutomatic_value:default: //{
-// chartName = "Chart 1"; // Since it's a new sheet, it's the first on it...
-//
-// XIndexAccess xSheetIA = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xSheets);
-//
-// short newSheetNum = (short) (xSheetIA.getCount() + 1);
-//
-// if (sheetName == null){
-// sheetName = "ChartSheet " + newSheetNum; // Why not?
-// }
-// // DPK TODO : Probably should use Sheets to create this!
-// xSheets.insertNewByName(sheetName, newSheetNum);
-//
-// try {
-// chartSheet =
-// (XSpreadsheet) xSheets.getByName(sheetName);
-// } catch (NoSuchElementException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-//
-// return;
-// } catch (WrappedTargetException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-//
-// return;
-// }
-//
-// //}
-// break;
-// }
-//
-// // Last thing should be a call to createChartForReal(), one of them
-// // should succeed.
-// createChartForReal();
-
-}
-
-sal_Bool SAL_CALL
-ScVbaChart::getHasTitle( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bHasTitle = sal_False;
- try
- {
- mxChartPropertySet->getPropertyValue(HASMAINTITLE) >>= bHasTitle;
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return bHasTitle;
-}
-
-void SAL_CALL
-ScVbaChart::setHasTitle( ::sal_Bool bTitle ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- mxChartPropertySet->setPropertyValue(HASMAINTITLE, uno::makeAny( bTitle ));
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
-
-}
-
-::sal_Bool SAL_CALL
-ScVbaChart::getHasLegend( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bHasLegend = sal_False;
- try
- {
- mxChartPropertySet->getPropertyValue(HASLEGEND) >>= bHasLegend;
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return bHasLegend;
-}
-
-void SAL_CALL
-ScVbaChart::setHasLegend( ::sal_Bool bLegend ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- mxChartPropertySet->setPropertyValue(HASLEGEND, uno::makeAny(bLegend));
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-uno::Reference< excel::XChartTitle > SAL_CALL
-ScVbaChart::getChartTitle( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xTitleShape = mxChartDocument->getTitle();
- // #TODO check parent
- return new ScVbaChartTitle(this, mxContext, xTitleShape);
-}
-
-uno::Any SAL_CALL
-ScVbaChart::Axes( const uno::Any& Type, const uno::Any& AxisGroup ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- // mmm chart probably is the parent, #TODO check parent
- uno::Reference< excel::XAxes > xAxes = new ScVbaAxes( this, mxContext, this );
- if ( !Type.hasValue() )
- return uno::makeAny( xAxes );
- return xAxes->Item( Type, AxisGroup );
-}
-bool
-ScVbaChart::is3D() throw ( uno::RuntimeException )
-{
- // #TODO perhaps provide limited Debughelper functionality
- sal_Bool is3d = sal_False;
- mxDiagramPropertySet->getPropertyValue(DIM3D) >>= is3d;
- return is3d;
-}
-
-sal_Int32
-ScVbaChart::getStackedType( sal_Int32 _nStacked, sal_Int32 _n100PercentStacked, sal_Int32 _nUnStacked ) throw ( uno::RuntimeException )
-{
- // #TODO perhaps provide limited Debughelper functionality
- if (isStacked())
- {
- if (is100PercentStacked())
- return _n100PercentStacked;
- else
- return _nStacked;
- }
- else
- return _nUnStacked;
-}
-
-bool
-ScVbaChart::isStacked() throw ( uno::RuntimeException )
-{
- // #TODO perhaps provide limited Debughelper functionality
- sal_Bool bStacked = sal_False;
- mxDiagramPropertySet->getPropertyValue(STACKED) >>= bStacked;
- return bStacked;
-}
-
-bool
-ScVbaChart::is100PercentStacked() throw ( uno::RuntimeException )
-{
- // #TODO perhaps provide limited Debughelper functionality
- sal_Bool b100Percent = sal_False;
- mxDiagramPropertySet->getPropertyValue(PERCENT) >>= b100Percent;
- return b100Percent;
-}
-
-sal_Int32
-ScVbaChart::getSolidType(sal_Int32 _nDeep, sal_Int32 _nVertiStacked, sal_Int32 _nVerti100PercentStacked, sal_Int32 _nVertiUnStacked, sal_Int32 _nHoriStacked, sal_Int32 _nHori100PercentStacked, sal_Int32 _nHoriUnStacked) throw ( script::BasicErrorException )
-{
- sal_Bool bIsVertical = true;
- try
- {
- mxDiagramPropertySet->getPropertyValue(VERTICAL) >>= bIsVertical;
- sal_Bool bIsDeep = false;
- mxDiagramPropertySet->getPropertyValue(DEEP) >>= bIsDeep;
-
- if (bIsDeep)
- {
- return _nDeep;
- }
- else
- {
- if (bIsVertical)
- {
- return getStackedType(_nVertiStacked, _nVerti100PercentStacked, _nVertiUnStacked);
- }
- else
- {
- return getStackedType(_nHoriStacked, _nHori100PercentStacked, _nHoriUnStacked);
- }
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- if (bIsVertical)
- {
- return _nVertiStacked;
- }
- else
- {
- return _nHoriStacked;
- }
-}
-
-
-sal_Int32
-ScVbaChart::getStockUpDownValue(sal_Int32 _nUpDown, sal_Int32 _nNotUpDown) throw (script::BasicErrorException)
-{
- sal_Bool bUpDown = sal_False;
- try
- {
- mxDiagramPropertySet->getPropertyValue(UPDOWN) >>= bUpDown;
- if (bUpDown)
- {
- return _nUpDown;
- }
- else
- {
- return _nNotUpDown;
- }
- }
- catch (uno::Exception& )
- {
- script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return _nNotUpDown;
-}
-
-bool
-ScVbaChart::hasMarkers() throw ( script::BasicErrorException )
-{
- bool bHasMarkers = false;
- try
- {
- sal_Int32 nSymbol=0;
- mxDiagramPropertySet->getPropertyValue(SYMBOLTYPE) >>= nSymbol;
- bHasMarkers = nSymbol != chart::ChartSymbolType::NONE;
- }
- catch ( uno::Exception& )
- {
- script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return bHasMarkers;
-}
-
-sal_Int32
-ScVbaChart::getMarkerType(sal_Int32 _nWithMarkers, sal_Int32 _nWithoutMarkers) throw ( script::BasicErrorException )
-{
- if (hasMarkers())
- return _nWithMarkers;
- return _nWithoutMarkers;
-}
-
-void
-ScVbaChart::assignDiagramAttributes()
-{
- xAxisXSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
- xAxisYSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
- xAxisZSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
- xTwoAxisXSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
- xTwoAxisYSupplier.set( mxDiagramPropertySet, uno::UNO_QUERY_THROW );
-}
-
-bool
-ScVbaChart::isSeriesIndexValid(sal_Int32 _seriesindex) throw( script::BasicErrorException )
-{
- bool bret = false;
- try
- {
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
- // dblValues = xChartDataArray.getData();
- //TODO I guess we have to differentiate between XlRowCol
- if ( !xChartDataArray.is() )
- {
- if (getPlotBy() == xlRows)
- {
- if ((_seriesindex < xChartDataArray->getRowDescriptions().getLength() ) && (_seriesindex >= 0))
- bret = true;
- }
- else
- {
- if ((_seriesindex < xChartDataArray->getColumnDescriptions().getLength() ) && (_seriesindex >= 0))
- bret = true;
- }
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- if (!bret)
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_OUT_OF_RANGE, rtl::OUString() );
- }
- return bret;
-}
-
-bool
-ScVbaChart::areIndicesValid( sal_Int32 _seriesindex, sal_Int32 _valindex) throw ( css::script::BasicErrorException )
-{
- if (isSeriesIndexValid(_seriesindex))
- {
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
- dblValues = xChartDataArray->getData();
- return (_valindex < dblValues[_seriesindex].getLength() );
- }
- return false;
-}
-
-sal_Int32
-ScVbaChart::getSeriesIndex(rtl::OUString _sseriesname) throw ( script::BasicErrorException )
-{
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
- if (getPlotBy() == xlRows)
- return ContainerUtilities::FieldInList(xChartDataArray->getRowDescriptions(), _sseriesname);
- return ContainerUtilities::FieldInList(xChartDataArray->getColumnDescriptions(), _sseriesname);
-}
-void
-ScVbaChart::setSeriesName(sal_Int32 _index, rtl::OUString _sname) throw ( script::BasicErrorException )
-{
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
- if (isSeriesIndexValid(_index))
- {
- uno::Sequence< rtl::OUString > sDescriptions = xChartDataArray->getColumnDescriptions();
- sDescriptions[_index] = _sname;
- xChartDataArray->setColumnDescriptions(sDescriptions);
- }
-}
-
-sal_Int32
-ScVbaChart::getSeriesCount() throw ( script::BasicErrorException )
-{
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
-
- if (getPlotBy() == xlRows)
- return xChartDataArray->getRowDescriptions().getLength();
- return xChartDataArray->getColumnDescriptions().getLength();
-
-}
-
-rtl::OUString
-ScVbaChart::getSeriesName(sal_Int32 _index) throw ( script::BasicErrorException )
-{
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
- uno::Sequence< rtl::OUString > sDescriptions;
- rtl::OUString sName;
- if (isSeriesIndexValid(_index))
- {
- if (getPlotBy() == xlRows)
- sDescriptions = xChartDataArray->getRowDescriptions();
- else
- sDescriptions = xChartDataArray->getColumnDescriptions();
- sName = sDescriptions[_index];
- }
- return sName;
-}
-
-double
-ScVbaChart::getValue(sal_Int32 _seriesindex, sal_Int32 _valindex) throw ( script::BasicErrorException )
-{
- double result = -1.0;
- if (areIndicesValid(_seriesindex, _valindex))
- {
- if (getPlotBy() == xlRows)
- result = dblValues[_seriesindex][_valindex];
- else
- result = dblValues[_valindex][_seriesindex];
- }
- return result;
-}
-
-sal_Int32
-ScVbaChart::getValuesCount(sal_Int32 _seriesIndex) throw ( script::BasicErrorException )
-{
- sal_Int32 nCount = 0;
- uno::Reference< chart::XChartDataArray > xChartDataArray( mxChartDocument->getData(), uno::UNO_QUERY_THROW );
- if (isSeriesIndexValid(_seriesIndex))
- {
- dblValues = xChartDataArray->getData();
- if (getPlotBy() == xlRows)
- nCount = dblValues[_seriesIndex].getLength();
- else
- nCount = dblValues.getLength();
- }
- return nCount;
-}
-
-
-uno::Reference< excel::XDataLabels >
-ScVbaChart::DataLabels( const uno::Reference< oo::excel::XSeries > /*_oSeries*/ ) throw ( css::script::BasicErrorException )
-{
- if ( true )
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- // #TODO #FIXE provide implementation
- return uno::Reference< excel::XDataLabels > ();
-}
-
-bool
-ScVbaChart::getHasDataCaption( const uno::Reference< css::beans::XPropertySet >& _xPropertySet )throw ( script::BasicErrorException )
-{
- bool bResult = false;
- try
- {
- sal_Int32 nChartDataCaption = 0;
- _xPropertySet->getPropertyValue(DATACAPTION) >>= nChartDataCaption;
- bResult = (nChartDataCaption != chart::ChartDataCaption::NONE);
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return bResult;
-}
-
-void
-ScVbaChart::setHasDataCaption( const uno::Reference< beans::XPropertySet >& _xPropertySet, bool _bHasDataLabels )throw ( script::BasicErrorException )
-{
- try
- {
- if ( _bHasDataLabels )
- _xPropertySet->setPropertyValue(DATACAPTION, uno::makeAny ( chart::ChartDataCaption::VALUE) );
- else
- _xPropertySet->setPropertyValue(DATACAPTION, uno::makeAny ( chart::ChartDataCaption::NONE) );
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-uno::Reference< beans::XPropertySet >
-ScVbaChart::getAxisPropertySet(sal_Int32 _nAxisType, sal_Int32 _nAxisGroup) throw ( script::BasicErrorException )
-{
- assignDiagramAttributes();
- uno::Reference< beans::XPropertySet > xAxisProps;
- switch(_nAxisType)
- {
- case xlCategory:
- if (_nAxisGroup == xlPrimary)
- {
- xAxisProps = xAxisXSupplier->getXAxis();
- }
- else if (_nAxisGroup == xlSecondary)
- {
- xAxisProps = xTwoAxisXSupplier->getSecondaryXAxis();
- }
- break;
- case xlSeriesAxis:
-// if (_nAxisGroup == xlPrimary){
- xAxisProps = xAxisZSupplier->getZAxis();
- break;
-// }
-// else if (_nAxisGroup == xlSecondary){
- // return xTwoAxisXSupplier.getSecondaryZAxis();
- // }
- case xlValue:
- if (_nAxisGroup == xlPrimary)
- xAxisProps = xAxisYSupplier->getYAxis();
- else if (_nAxisGroup == xlSecondary)
- xAxisProps = xTwoAxisYSupplier->getSecondaryYAxis();
- break;
- default:
- return xAxisProps;
- }
- return xAxisProps;
-}
-
-
-rtl::OUString&
-ScVbaChart::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaChart") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaChart::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Chart" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbachart.hxx b/scratch/sc-vba/dead-source/vbachart.hxx
deleted file mode 100644
index 03a3a1188..000000000
--- a/scratch/sc-vba/dead-source/vbachart.hxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CHART_HXX
-#define SC_VBA_CHART_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/table/XTableChart.hpp>
-#include <com/sun/star/chart/XChartDocument.hpp>
-#include <com/sun/star/chart/XAxisXSupplier.hpp>
-#include <com/sun/star/chart/XAxisYSupplier.hpp>
-#include <com/sun/star/chart/XAxisZSupplier.hpp>
-#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
-#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
-#include <org/openoffice/excel/XChart.hpp>
-#include <org/openoffice/excel/XDataLabels.hpp>
-#include <org/openoffice/excel/XSeries.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1<oo::excel::XChart > ChartImpl_BASE;
-
-class ScVbaChart : public ChartImpl_BASE
-{
-friend class ScVbaAxis;
-
- css::uno::Reference< css::chart::XChartDocument > mxChartDocument;
- css::uno::Reference< css::table::XTableChart > mxTableChart;
- css::uno::Reference< css::beans::XPropertySet > mxDiagramPropertySet;
- css::uno::Reference< css::beans::XPropertySet > mxChartPropertySet;
- css::uno::Reference< css::chart::XAxisXSupplier > xAxisXSupplier;
- css::uno::Reference< css::chart::XAxisYSupplier> xAxisYSupplier;
- css::uno::Reference< css::chart::XAxisZSupplier > xAxisZSupplier;
- css::uno::Reference< css::chart::XTwoAxisXSupplier > xTwoAxisXSupplier;
- css::uno::Reference< css::chart::XTwoAxisYSupplier > xTwoAxisYSupplier;
-
- css::uno::Sequence< rtl::OUString > getDefaultSeriesDescriptions( sal_Int32 nCount );
- css::uno::Sequence< css::uno::Sequence< double > > dblValues;
- void setDefaultChartType()throw ( css::script::BasicErrorException ) ;
- void setDiagram( const rtl::OUString& _sDiagramType) throw( css::script::BasicErrorException );
- bool isStacked() throw ( css::uno::RuntimeException );
- bool is100PercentStacked() throw ( css::uno::RuntimeException );
- sal_Int32 getStackedType( sal_Int32 _nStacked, sal_Int32 _n100PercentStacked, sal_Int32 _nUnStacked ) throw ( css::uno::RuntimeException );
- sal_Int32 getSolidType(sal_Int32 _nDeep, sal_Int32 _nVertiStacked, sal_Int32 _nVerti100PercentStacked, sal_Int32 _nVertiUnStacked, sal_Int32 _nHoriStacked, sal_Int32 _nHori100PercentStacked, sal_Int32 _nHoriUnStacked) throw ( css::script::BasicErrorException );
- sal_Int32 getStockUpDownValue(sal_Int32 _nUpDown, sal_Int32 _nNotUpDown) throw (css::script::BasicErrorException);
- bool hasMarkers() throw ( css::script::BasicErrorException );
- sal_Int32 getMarkerType(sal_Int32 _nWithMarkers, sal_Int32 _nWithoutMarkers) throw ( css::script::BasicErrorException );
- void assignDiagramAttributes();
- void setDefaultSeriesDescriptionLabels(){}
-public:
- ScVbaChart( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::lang::XComponent >& _xChartComponent, const css::uno::Reference< css::table::XTableChart >& _xTableChart );
-
- // Non-interface
- css::uno::Reference< css::beans::XPropertySet > xDiagramPropertySet() { return mxDiagramPropertySet; }
- bool isSeriesIndexValid(sal_Int32 _seriesindex) throw( css::script::BasicErrorException );
- bool areIndicesValid(sal_Int32 _seriesindex, sal_Int32 _valindex) throw ( css::script::BasicErrorException );
- void setSeriesName(sal_Int32 _index, rtl::OUString _sname) throw ( css::script::BasicErrorException );
- sal_Int32 getSeriesIndex(rtl::OUString _sseriesname) throw ( css::script::BasicErrorException );
- sal_Int32 getSeriesCount() throw ( css::script::BasicErrorException );
- rtl::OUString getSeriesName(sal_Int32 _index) throw ( css::script::BasicErrorException );
- double getValue(sal_Int32 _seriesIndex, sal_Int32 _valindex) throw ( css::script::BasicErrorException );
- sal_Int32 getValuesCount(sal_Int32 _seriesIndex) throw ( css::script::BasicErrorException );
- css::uno::Reference< oo::excel::XDataLabels > DataLabels( const css::uno::Reference< oo::excel::XSeries > _oSeries ) throw ( css::script::BasicErrorException );
- bool getHasDataCaption( const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet )throw ( css::script::BasicErrorException );
- void setHasDataCaption( const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, bool _bHasDataLabels )throw ( css::script::BasicErrorException );
- bool is3D() throw ( css::uno::RuntimeException );
- css::uno::Reference< css::beans::XPropertySet > getAxisPropertySet(sal_Int32 _nAxisType, sal_Int32 _nAxisGroup) throw ( css::script::BasicErrorException );
- // Methods
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SeriesCollection(const css::uno::Any&) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getChartType() throw ( css::uno::RuntimeException, css::script::BasicErrorException);
- virtual void SAL_CALL setChartType( ::sal_Int32 _charttype ) throw ( css::uno::RuntimeException, css::script::BasicErrorException);
- virtual void SAL_CALL Activate( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setSourceData( const css::uno::Reference< ::org::openoffice::excel::XRange >& range, const css::uno::Any& PlotBy ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL Location( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getLocation( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setLocation( ::sal_Int32 where, const css::uno::Any& Name ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getHasTitle( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setHasTitle( ::sal_Bool bTitle ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getHasLegend( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setHasLegend( ::sal_Bool bLegend ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setPlotBy( ::sal_Int32 xlRowCol ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getPlotBy( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XChartTitle > SAL_CALL getChartTitle( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Axes( const css::uno::Any& Type, const css::uno::Any& AxisGroup ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-
-#endif //SC_VBA_WINDOW_HXX
diff --git a/scratch/sc-vba/dead-source/vbachartobject.cxx b/scratch/sc-vba/dead-source/vbachartobject.cxx
deleted file mode 100644
index cfae30612..000000000
--- a/scratch/sc-vba/dead-source/vbachartobject.cxx
+++ /dev/null
@@ -1,217 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbachart.hxx"
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/script/BasicErrorException.hpp>
-#include <basic/sberrors.hxx>
-#include "vbachartobject.hxx"
-#include "vbachartobjects.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-const rtl::OUString CHART_NAME( RTL_CONSTASCII_USTRINGPARAM("Name") );
-const rtl::OUString PERSIST_NAME( RTL_CONSTASCII_USTRINGPARAM("PersistName") );
-
-ScVbaChartObject::ScVbaChartObject( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableChart >& _xTableChart, const css::uno::Reference< css::drawing::XDrawPageSupplier >& _xDrawPageSupplier ) : ChartObjectImpl_BASE( _xParent, _xContext ), xTableChart( _xTableChart ), xDrawPageSupplier( _xDrawPageSupplier )
-{
- xDrawPage = xDrawPageSupplier->getDrawPage();
- xEmbeddedObjectSupplier.set( xTableChart, uno::UNO_QUERY_THROW );
- xNamed.set( xTableChart, uno::UNO_QUERY_THROW );
- sPersistName = getPersistName();
- xShape = setShape();
- setName(sPersistName);
- oShapeHelper.reset(new ShapeHelper(xShape));
-}
-
-rtl::OUString ScVbaChartObject::getPersistName()
-{
- if ( !sPersistName.getLength() )
- sPersistName = xNamed->getName();
- return sPersistName;
-}
-
-uno::Reference< drawing::XShape >
-ScVbaChartObject::setShape() throw ( script::BasicErrorException )
-{
- try
- {
- sal_Int32 nItems = xDrawPage->getCount();
- for (int i = 0; i < nItems; i++)
- {
- xShape.set( xDrawPage->getByIndex(i), uno::UNO_QUERY_THROW );
- if (xShape->getShapeType().compareToAscii("com.sun.star.drawing.OLE2Shape") == 0 )
- {
- uno::Reference< beans::XPropertySet > xShapePropertySet(xShape, uno::UNO_QUERY_THROW );
- rtl::OUString sName;
- xShapePropertySet->getPropertyValue(PERSIST_NAME ) >>=sName;
- if ( sName.equals(sPersistName))
- {
- xNamedShape.set( xShape, uno::UNO_QUERY_THROW );
- return xShape;
- }
- }
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return NULL;
-}
-
-void SAL_CALL
-ScVbaChartObject::setName( const rtl::OUString& sName ) throw (css::uno::RuntimeException)
-{
- xNamedShape->setName(sName);
-}
-
-
-::rtl::OUString SAL_CALL
-ScVbaChartObject::getName() throw (css::uno::RuntimeException)
-{
- return xNamedShape->getName();
-}
-
-void SAL_CALL
-ScVbaChartObject::Delete() throw ( css::script::BasicErrorException )
-{
- // parent of this object is sheet
- uno::Reference< excel::XWorksheet > xParent( getParent(), uno::UNO_QUERY_THROW );
- uno::Reference< excel::XChartObjects > xColl( xParent->ChartObjects( uno::Any() ), uno::UNO_QUERY_THROW );
- ScVbaChartObjects* pChartObjectsImpl = static_cast< ScVbaChartObjects* >( xColl.get() );
- if (pChartObjectsImpl)
- pChartObjectsImpl->removeByName( getPersistName() );
- else
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Parent is not ChartObjects" ) ) );
-}
-
-void
-ScVbaChartObject::Activate() throw ( script::BasicErrorException )
-{
- try
- {
- // #TODO #FIXME should be ThisWorkbook or equivelant
- // XModel
- //uno::Reference< view::XSelectionSupplier > xSelectionSupplier( getXModel().getCurrentController());
- uno::Reference< view::XSelectionSupplier > xSelectionSupplier( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
- xSelectionSupplier->select(uno::makeAny(xShape));
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ChartObject Activate internal error" ) ) );
- }
-}
-
-uno::Reference< excel::XChart > SAL_CALL
-ScVbaChartObject::getChart() throw (css::uno::RuntimeException)
-{
- return new ScVbaChart( this, mxContext, xEmbeddedObjectSupplier->getEmbeddedObject(), xTableChart );
-}
-
-rtl::OUString&
-ScVbaChartObject::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaChartObject") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaChartObject::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.ChartObject" ) );
- }
- return aServiceNames;
-}
-
-double
-ScVbaChartObject::getHeight()
-{
- return oShapeHelper->getHeight();
-}
-
-void
-ScVbaChartObject::setHeight(double _fheight) throw ( script::BasicErrorException )
-{
- oShapeHelper->setHeight(_fheight);
-}
-
-double
-ScVbaChartObject::getWidth()
-{
- return oShapeHelper->getWidth();
-}
-
-void
-ScVbaChartObject::setWidth(double _fWidth) throw ( script::BasicErrorException )
-{
- oShapeHelper->setWidth(_fWidth);
-}
-
-double
-ScVbaChartObject::getLeft()
-{
- return oShapeHelper->getLeft();
-}
-
-void
-ScVbaChartObject::setLeft(double _fLeft)
-{
- oShapeHelper->setLeft(_fLeft);
-}
-
-double
-ScVbaChartObject::getTop()
-{
- return oShapeHelper->getTop();
-}
-
-void
-ScVbaChartObject::setTop(double _fTop)
-{
- oShapeHelper->setTop(_fTop);
-}
-
-uno::Reference< uno::XInterface >
-ScVbaChartObject::getUnoObject() throw (script::BasicErrorException)
-{
- return uno::Reference< uno::XInterface >( xShape, uno::UNO_QUERY );
-}
diff --git a/scratch/sc-vba/dead-source/vbachartobject.hxx b/scratch/sc-vba/dead-source/vbachartobject.hxx
deleted file mode 100644
index 87ba152f6..000000000
--- a/scratch/sc-vba/dead-source/vbachartobject.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CHARTOBJECT_HXX
-#define SC_VBA_CHARTOBJECT_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/table/XTableChart.hpp>
-#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
-#include <org/openoffice/excel/XChartObject.hpp>
-#include "vbahelperinterface.hxx"
-#include <memory>
-
-typedef InheritedHelperInterfaceImpl1<oo::excel::XChartObject > ChartObjectImpl_BASE;
-
-class ScVbaChartObject : public ChartObjectImpl_BASE
-{
-
- css::uno::Reference< css::table::XTableChart > xTableChart;
- css::uno::Reference< css::document::XEmbeddedObjectSupplier > xEmbeddedObjectSupplier;
- css::uno::Reference< css::beans::XPropertySet > xPropertySet;
- css::uno::Reference< css::drawing::XDrawPageSupplier > xDrawPageSupplier;
- css::uno::Reference< css::drawing::XDrawPage > xDrawPage;
- css::uno::Reference< css::drawing::XShape > xShape;
- css::uno::Reference< css::container::XNamed > xNamed;
- rtl::OUString sPersistName;
- std::auto_ptr<oo::ShapeHelper> oShapeHelper;
- css::uno::Reference< css::container::XNamed > xNamedShape;
- rtl::OUString getPersistName();
- css::uno::Reference< css::drawing::XShape > setShape() throw ( css::script::BasicErrorException );
-public:
- ScVbaChartObject( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableChart >& _xTableChart, const css::uno::Reference< css::drawing::XDrawPageSupplier >& _xDrawPageSupplier );
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString& sName ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XChart > SAL_CALL getChart() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Delete() throw ( css::script::BasicErrorException );
- virtual void Activate() throw ( css::script::BasicErrorException );
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- // non interface methods
- double getHeight();
- void setHeight( double _fheight ) throw ( css::script::BasicErrorException );
- double getWidth();
- void setWidth( double _fwidth ) throw ( css::script::BasicErrorException );
- double getLeft();
- void setLeft( double _fleft );
- double getTop();
- void setTop( double _ftop );
- // should make this part of the XHelperInterface with a default
- // implementation returning NULL
- css::uno::Reference< css::uno::XInterface > getUnoObject() throw ( css::script::BasicErrorException );
-};
-
-#endif //SC_VBA_WINDOW_HXX
diff --git a/scratch/sc-vba/dead-source/vbachartobjects.cxx b/scratch/sc-vba/dead-source/vbachartobjects.cxx
deleted file mode 100644
index 92aa59074..000000000
--- a/scratch/sc-vba/dead-source/vbachartobjects.cxx
+++ /dev/null
@@ -1,203 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbachart.hxx"
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
-#include <com/sun/star/table/XTableChartsSupplier.hpp>
-#include <com/sun/star/table/XTableChart.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <org/openoffice/excel/XlChartType.hpp>
-
-
-#include "vbachartobjects.hxx"
-#include "vbachartobject.hxx"
-#include "vbaglobals.hxx"
-#include "cellsuno.hxx"
-#include <vector>
-#include <basic/sberrors.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-
-class ChartObjectEnumerationImpl : public EnumerationHelperImpl
-{
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier;
- uno::Reference< vba::XHelperInterface > xParent;
-
-public:
-
- ChartObjectEnumerationImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< drawing::XDrawPageSupplier >& _xDrawPageSupplier, const uno::Reference< vba::XHelperInterface >& _xParent ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), xDrawPageSupplier( _xDrawPageSupplier ), xParent( _xParent ) {}
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< table::XTableChart > xTableChart( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- // parent Object is sheet
- return uno::makeAny( uno::Reference< excel::XChartObject > ( new ScVbaChartObject( xParent, m_xContext, xTableChart, xDrawPageSupplier ) ) );
- }
-};
-
-
-ScVbaChartObjects::ScVbaChartObjects( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableCharts >& _xTableCharts, const uno::Reference< drawing::XDrawPageSupplier >& _xDrawPageSupplier ) : ChartObjects_BASE(_xParent, _xContext, css::uno::Reference< css::container::XIndexAccess >( _xTableCharts, css::uno::UNO_QUERY ) ), xTableCharts( _xTableCharts ) , xDrawPageSupplier( _xDrawPageSupplier )
-{
-
-}
-
-void
-ScVbaChartObjects::removeByName(const rtl::OUString& _sChartName)
-{
- xTableCharts->removeByName( _sChartName );
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaChartObjects::getChartObjectNames() throw( css::script::BasicErrorException )
-{
- uno::Sequence< rtl::OUString > sChartNames;
- try
- {
- // c++ hackery
- uno::Reference< uno::XInterface > xIf( xDrawPageSupplier, uno::UNO_QUERY_THROW );
- ScCellRangesBase* pUno= dynamic_cast< ScCellRangesBase* >( xIf.get() );
- ScDocShell* pDocShell = NULL;
- if ( !pUno )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Failed to obtain the impl class from the drawpage"), uno::Reference< uno::XInterface >() );
- pDocShell = pUno->GetDocShell();
- if ( !pDocShell )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Failed to obtain the docshell implclass"), uno::Reference< uno::XInterface >() );
-
- uno::Reference< sheet::XSpreadsheetDocument > xSpreadsheetDocument( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheets > xSpreadsheets = xSpreadsheetDocument->getSheets();
- std::vector< rtl::OUString > aChartNamesVector;
-
- uno::Sequence< rtl::OUString > sSheetNames = xSpreadsheets->getElementNames();
- sal_Int32 nItems = sSheetNames.getLength();
- for (sal_Int32 i = 0; i < nItems; i++)
- {
- uno::Reference< table::XTableChartsSupplier > xLocTableChartsSupplier( xSpreadsheets->getByName(sSheetNames[i]), uno::UNO_QUERY_THROW );
- uno::Sequence< rtl::OUString > scurchartnames = xLocTableChartsSupplier->getCharts()->getElementNames();
- sal_Int32 nChartNames = scurchartnames.getLength();
- for (sal_Int32 n = 0; n < nChartNames; n++ )
- aChartNamesVector.push_back(scurchartnames[n]);
- }
- sChartNames.realloc( aChartNamesVector.size() );
- std::vector< rtl::OUString > ::const_iterator it = aChartNamesVector.begin();
- std::vector< rtl::OUString > ::const_iterator it_end = aChartNamesVector.end();
- for ( sal_Int32 index = 0 ; it != it_end; ++it, ++index )
- sChartNames[index] = *it;
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return sChartNames;
-}
-
-// XChartObjects
-uno::Any SAL_CALL
-ScVbaChartObjects::Add( double _nX, double _nY, double _nWidth, double _nHeight ) throw (script::BasicErrorException)
-{
- try
- {
- uno::Sequence< table::CellRangeAddress > aCellRangeAddress( 1 );
- awt::Rectangle aRectangle;
- aRectangle.X = Millimeter::getInHundredthsOfOneMillimeter(_nX);
- aRectangle.Y = Millimeter::getInHundredthsOfOneMillimeter(_nY);
- aRectangle.Width = Millimeter::getInHundredthsOfOneMillimeter(_nWidth);
- aRectangle.Height = Millimeter::getInHundredthsOfOneMillimeter(_nHeight);
- // Note the space at the end of the stem ("Chart "). In ChartSheets only "Chart" is the stem
- rtl::OUString sPersistChartName = ContainerUtilities::getUniqueName( getChartObjectNames(), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Chart " ) ) , rtl::OUString(), 1);
- xTableCharts->addNewByName(sPersistChartName, aRectangle, aCellRangeAddress, true, false );
- uno::Reference< excel::XChartObject > xChartObject( getItemByStringIndex( sPersistChartName ), uno::UNO_QUERY_THROW );
- xChartObject->getChart()->setChartType(excel::XlChartType::xlColumnClustered);
- return uno::makeAny( xChartObject );
- }
- catch ( uno::Exception& ex)
- {
- OSL_TRACE("AddItem caught exception ->%s", rtl::OUStringToOString( ex.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- return aNULL();
-}
-void SAL_CALL ScVbaChartObjects::Delete( ) throw (script::BasicErrorException)
-{
- uno::Sequence< rtl::OUString > sChartNames = xTableCharts->getElementNames();
- sal_Int32 ncount = sChartNames.getLength();
- for (sal_Int32 i = 0; i < ncount ; i++)
- removeByName(sChartNames[i]);
-}
-
-// XEnumerationAccess
-
-uno::Reference< container::XEnumeration >
-ScVbaChartObjects::createEnumeration() throw (uno::RuntimeException)
-{
- css::uno::Reference< container::XEnumerationAccess > xEnumAccess( xTableCharts, uno::UNO_QUERY_THROW );
- return new ChartObjectEnumerationImpl( mxContext, xEnumAccess->createEnumeration(), xDrawPageSupplier, getParent() /* sheet */);
-}
-
-// XElementAccess
-
-uno::Type
-ScVbaChartObjects::getElementType() throw (uno::RuntimeException)
-{
- return excel::XChartObject::static_type(0);
-}
-
-// ScVbaCollectionBaseImpl
-uno::Any
-ScVbaChartObjects::createCollectionObject( const css::uno::Any& aSource )
-{
- uno::Reference< table::XTableChart > xTableChart( aSource, uno::UNO_QUERY_THROW );
- // correct parent object is sheet
- return uno::makeAny( uno::Reference< excel::XChartObject > ( new ScVbaChartObject( getParent(), mxContext, xTableChart, xDrawPageSupplier ) ) );
-}
-
-rtl::OUString&
-ScVbaChartObjects::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaChartObjects") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaChartObjects::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.ChartObjects") );
- }
- return sNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbachartobjects.hxx b/scratch/sc-vba/dead-source/vbachartobjects.hxx
deleted file mode 100644
index 2c5ab16cd..000000000
--- a/scratch/sc-vba/dead-source/vbachartobjects.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CHARTOBJECTS_HXX
-#define SC_VBA_CHARTOBJECTS_HXX
-#include <org/openoffice/excel/XChartObjects.hpp>
-#include <org/openoffice/excel/XChartObject.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/table/XTableCharts.hpp>
-#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include"vbacollectionimpl.hxx"
-#include "vbahelper.hxx"
-#include <hash_map>
-
-typedef CollTestImplHelper< oo::excel::XChartObjects > ChartObjects_BASE;
-/* #TODO see if this hash table is 'really' necessary
-typedef ::std::hash_map< ::rtl::OUString,
-css::uno::Reference< oo::excel::XChartObject >,
- ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > aHashTable;
-*/
-
-class ScVbaChartObjects : public ChartObjects_BASE
-{
-
- css::uno::Reference< css::table::XTableCharts > xTableCharts;
- css::uno::Reference< css::drawing::XDrawPageSupplier > xDrawPageSupplier;
- // method associated with populating the hashmap ( I'm not convinced this is necessary )
- //css::uno::Reference< oo::excel::XChartObject > putByPersistName( const rtl:::OUString& _sPersistChartName );
-public:
- ScVbaChartObjects( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableCharts >& _xTableCharts, const css::uno::Reference< css::drawing::XDrawPageSupplier >& _xDrawPageSupplier );
-
- css::uno::Sequence< rtl::OUString > getChartObjectNames() throw( css::script::BasicErrorException );
- void removeByName(const rtl::OUString& _sChartName);
-
- // XChartObjects
- virtual ::com::sun::star::uno::Any SAL_CALL Add( double Left, double Top, double Width, double Height ) throw (::com::sun::star::script::BasicErrorException);
- virtual void SAL_CALL Delete( ) throw (::com::sun::star::script::BasicErrorException);
- // XEnumerationAccess
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- // XElementAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- // ScVbaCollectionBaseImpl
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- // ChartObjects_BASE
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_WINDOW_HXX
diff --git a/scratch/sc-vba/dead-source/vbacharts.cxx b/scratch/sc-vba/dead-source/vbacharts.cxx
deleted file mode 100644
index bd919ed11..000000000
--- a/scratch/sc-vba/dead-source/vbacharts.cxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbacharts.hxx"
-#include <basic/sberrors.hxx>
-#include <com/sun/star/table/XTableChartsSupplier.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-
-ScVbaCharts::ScVbaCharts( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext ) : Charts_BASE(_xParent, _xContext, uno::Reference< container::XIndexAccess >() )
-{
- // #TODO #FIXME surely this is wrong, you should never use the
- // currently documement ( it could be anything )
- xComponent.set( getCurrentDocument(), uno::UNO_QUERY_THROW );
- xSpreadsheetDocument.set( xComponent, uno::UNO_QUERY_THROW );
-}
-
-uno::Any SAL_CALL
-ScVbaCharts::Add() throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- // Not implemented in the helperapi ( see ChartsImpl.java )
- if ( true )
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_BAD_METHOD, rtl::OUString() );
- return aNULL();
-}
-
-uno::Reference< excel::XChart > SAL_CALL
-ScVbaCharts::getActiveChart() throw (script::BasicErrorException, uno::RuntimeException)
-{
- return xActiveChart;
-}
-
-uno::Reference< container::XEnumeration > SAL_CALL
-ScVbaCharts::createEnumeration() throw (uno::RuntimeException)
-{
- // #FIXME not implemented
- if ( true )
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_BAD_METHOD, rtl::OUString() );
- return uno::Reference< container::XEnumeration >();
-}
-
-// #FIXME #TODO this method shouldn't appear in this class directly
-// a XIndexAccess/XNameAccess wrapper should be passed to the base class instead
-::sal_Int32 SAL_CALL
-ScVbaCharts::getCount() throw (uno::RuntimeException)
-{
- sal_Int32 ncount = 0;
- try
- {
- uno::Reference< sheet::XSpreadsheets > xSpreadsheets( xSpreadsheetDocument->getSheets() );
- uno::Sequence< rtl::OUString > SheetNames = xSpreadsheets->getElementNames();
- sal_Int32 nLen = SheetNames.getLength();
- for (sal_Int32 i = 0; i < nLen; i++)
- {
- uno::Reference< table::XTableChartsSupplier > xTableChartsSupplier( xSpreadsheets->getByName(SheetNames[i]), uno::UNO_QUERY);
- if ( xTableChartsSupplier.is() )
- {
- uno::Reference< table::XTableCharts > xTableCharts = xTableChartsSupplier->getCharts();
- ncount =+ xTableCharts->getElementNames().getLength();
- }
- }
- }
- catch (uno::Exception& )
- {
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return ncount;
-}
-
-uno::Any
-ScVbaCharts::createCollectionObject( const uno::Any& aSource )
-{
- if ( true )
- throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_BAD_METHOD, rtl::OUString() );
- // #TODO implementation please
- return aSource;
-}
-
-rtl::OUString&
-ScVbaCharts::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCharts") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaCharts::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Charts") );
- }
- return sNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbacharts.hxx b/scratch/sc-vba/dead-source/vbacharts.hxx
deleted file mode 100644
index c5b64e290..000000000
--- a/scratch/sc-vba/dead-source/vbacharts.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CHARTS_HXX
-#define SC_VBA_CHARTS_HXX
-#include <org/openoffice/excel/XCharts.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include"vbacollectionimpl.hxx"
-#include "vbahelper.hxx"
-#include <hash_map>
-
-typedef CollTestImplHelper< oo::excel::XCharts > Charts_BASE;
-
-class ScVbaCharts : public Charts_BASE
-{
- css::uno::Reference< oo::excel::XChart > xActiveChart;
- css::uno::Reference< css::sheet::XSpreadsheetDocument > xSpreadsheetDocument;
- css::uno::Reference< css::lang::XComponent > xComponent;
-public:
- ScVbaCharts( const css::uno::Reference< oo::vba::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext );
- // XCharts
- virtual css::uno::Any SAL_CALL Add() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XChart > SAL_CALL getActiveChart( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XCollection
- ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
- // XEnumerationAccess
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- // XElementAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) { return oo::excel::XChart::static_type(0); }
- // ScVbaCollectionBaseImpl
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- // Charts_BASE or HelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif
diff --git a/scratch/sc-vba/dead-source/vbacharttitle.cxx b/scratch/sc-vba/dead-source/vbacharttitle.cxx
deleted file mode 100644
index 1524e3652..000000000
--- a/scratch/sc-vba/dead-source/vbacharttitle.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbacharttitle.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-ScVbaChartTitle::ScVbaChartTitle( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& _xTitleShape ) : ChartTitleBase( xParent, xContext, _xTitleShape )
-{
-}
-
-rtl::OUString&
-ScVbaChartTitle::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaChartTitle") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaChartTitle::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- uno::Sequence< rtl::OUString > BaseServiceNames = ChartTitleBase::getServiceNames();
- aServiceNames.realloc( BaseServiceNames.getLength() + 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Chart" ) );
- for ( sal_Int32 index = 1; index < (BaseServiceNames.getLength() + 1); ++index )
- aServiceNames[ index ] = BaseServiceNames[ index ];
- }
- return aServiceNames;
-}
-
-
diff --git a/scratch/sc-vba/dead-source/vbacharttitle.hxx b/scratch/sc-vba/dead-source/vbacharttitle.hxx
deleted file mode 100644
index f70cc40ba..000000000
--- a/scratch/sc-vba/dead-source/vbacharttitle.hxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CHARTTITLE_HXX
-#define SC_VBA_CHARTTITLE_HXX
-#include "vbatitle.hxx"
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/excel/XChartTitle.hpp>
-
-
-typedef TitleImpl< cppu::WeakImplHelper1< oo::excel::XChartTitle > > ChartTitleBase;
-
-class ScVbaChartTitle : public ChartTitleBase
-{
-public:
- ScVbaChartTitle( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& _xTitleShape );
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif
diff --git a/scratch/sc-vba/dead-source/vbacollectionimpl.hxx b/scratch/sc-vba/dead-source/vbacollectionimpl.hxx
deleted file mode 100644
index 13eb64a0e..000000000
--- a/scratch/sc-vba/dead-source/vbacollectionimpl.hxx
+++ /dev/null
@@ -1,264 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_COLLECTION_IMPL_HXX
-#define SC_VBA_COLLECTION_IMPL_HXX
-
-#include <org/openoffice/vba/XCollection.hpp>
-//#include <org/openoffice/vba/XCollectionTest.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/script/XDefaultMethod.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-#include "vbahelper.hxx"
-#include "vbahelperinterface.hxx"
-#include "vbaglobals.hxx"
-
-#include <vector>
-
-typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
-
-class EnumerationHelperImpl : public EnumerationHelper_BASE
-{
-protected:
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
-public:
-
- EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
-};
-
-// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces
-// only requirement is the object needs to implement XName
-
-
-
-typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE;
-
-template< typename Ifc1 >
-class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
-{
-public:
-typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec;
-private:
-
- class XNamedEnumerationHelper : public EnumerationHelper_BASE
- {
- XNamedVec mXNamedVec;
- typename XNamedVec::iterator mIt;
- public:
- XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {}
-
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException)
- {
- return ( mIt != mXNamedVec.end() );
- }
-
- virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
- {
- if ( hasMoreElements() )
- return css::uno::makeAny( *mIt++ );
- throw css::container::NoSuchElementException();
- }
- };
-
-protected:
- XNamedVec mXNamedVec;
- typename XNamedVec::iterator cachePos;
-public:
- XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(0) {}
- // XElementAccess
- virtual css::uno::Type SAL_CALL getElementType( ) throw (css::uno::RuntimeException) { return Ifc1::static_type(0); }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (css::uno::RuntimeException) { return ( mXNamedVec.size() > 0 ); }
- // XNameAcess
- virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
- {
- if ( !hasByName(aName) )
- throw css::container::NoSuchElementException();
- return css::uno::makeAny( *cachePos );
- }
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (css::uno::RuntimeException)
- {
- css::uno::Sequence< rtl::OUString > sNames( mXNamedVec.size() );
- rtl::OUString* pString = sNames.getArray();
- typename XNamedVec::iterator it = mXNamedVec.begin();
- typename XNamedVec::iterator it_end = mXNamedVec.end();
-
- for ( ; it != it_end; ++it, ++pString )
- {
- css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW );
- *pString = xName->getName();
- }
- return sNames;
- }
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException)
- {
- cachePos = mXNamedVec.begin();
- typename XNamedVec::iterator it_end = mXNamedVec.end();
- for ( ; cachePos != it_end; ++cachePos )
- {
- css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW );
- if ( aName.equals( xName->getName() ) )
- break;
- }
- return ( cachePos != it_end );
- }
-
- // XElementAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) { return mXNamedVec.size(); }
- virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException )
- {
- if ( Index < 0 || Index >= getCount() )
- throw css::lang::IndexOutOfBoundsException();
-
- return css::uno::makeAny( mXNamedVec[ Index ] );
-
- }
- // XEnumerationAccess
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) throw (css::uno::RuntimeException)
- {
- return new XNamedEnumerationHelper( mXNamedVec );
- }
-};
-
-// including a HelperInterface implementation
-template< typename Ifc1 >
-class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 >
-{
-typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
-protected:
- css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
- css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
-
- virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
- {
- if ( !m_xNameAccess.is() )
- throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
-
- return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
- }
-
- virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException)
- {
- if ( !m_xIndexAccess.is() )
- throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase numeric index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
- if ( nIndex <= 0 )
- {
- throw css::lang::IndexOutOfBoundsException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "index is 0 or negative" ) ),
- css::uno::Reference< css::uno::XInterface >() );
- }
- // need to adjust for vba index ( for which first element is 1 )
- return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );
- }
-public:
- ScVbaCollectionBase( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
- //XCollection
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
- {
- return m_xIndexAccess->getCount();
- }
-
- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw (css::uno::RuntimeException)
- {
- if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING )
- {
- sal_Int32 nIndex = 0;
-
- if ( ( Index1 >>= nIndex ) != sal_True )
- {
- rtl::OUString message;
- message = rtl::OUString::createFromAscii(
- "Couldn't convert index to Int32");
- throw css::lang::IndexOutOfBoundsException( message,
- css::uno::Reference< css::uno::XInterface >() );
- }
- return getItemByIntIndex( nIndex );
- }
- rtl::OUString aStringSheet;
-
- Index1 >>= aStringSheet;
- return getItemByStringIndex( aStringSheet );
- }
- // XDefaultMethod
- ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException)
- {
- const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") );
- return sName;
- }
- // XEnumerationAccess
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0;
-
- // XElementAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0;
- // XElementAccess
- virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
- {
- return ( m_xIndexAccess->getCount() > 0 );
- }
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
-
-};
-
-typedef ::cppu::WeakImplHelper1<oo::vba::XCollection> XCollection_InterfacesBASE;
-
-typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1;
-// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this )
-class ScVbaCollectionBaseImpl : public CollImplBase1
-{
-public:
- ScVbaCollectionBaseImpl( const css::uno::Reference< oo::vba::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){}
-
-};
-
-template <typename Ifc> // where Ifc must implement XCollectionTest
-class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
-{
-typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1;
-
-public:
- CollTestImplHelper( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
-};
-
-
-#endif //SC_VBA_COLLECTION_IMPL_HXX
diff --git a/scratch/sc-vba/dead-source/vbacolorformat.cxx b/scratch/sc-vba/dead-source/vbacolorformat.cxx
deleted file mode 100644
index 027a57210..000000000
--- a/scratch/sc-vba/dead-source/vbacolorformat.cxx
+++ /dev/null
@@ -1,195 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/msforms/XLineFormat.hpp>
-#include "vbacolorformat.hxx"
-
-using namespace org::openoffice;
-using namespace com::sun::star;
-
-const sal_Int32
-MsoColorIndizes::getColorIndex( sal_Int32 nIndex )
-{
- const static sal_Int32 COLORINDIZES[56] =
- { HAPICOLOR_BLACK, HAPICOLOR_WITHE, HAPICOLOR_RED, HAPICOLOR_BRIGHTGREEN, HAPICOLOR_BLUE, HAPICOLOR_YELLOW, HAPICOLOR_PINK,
- HAPICOLOR_TURQUOISE, HAPICOLOR_DARKRED, HAPICOLOR_GREEN, HAPICOLOR_DARKBLUE, HAPICOLOR_DARKYELLOW, HAPICOLOR_VIOLET,
- HAPICOLOR_TEAL, HAPICOLOR_GRAY_25_PERCENT, HAPICOLOR_GRAY_50_PERCENT, HAPICOLOR_PERIWINCKLE, HAPICOLOR_PLUM,
- HAPICOLOR_IVORY, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_DARKPRUPLE, HAPICOLOR_CORAL, HAPICOLOR_OCEANBLUE, HAPICOLOR_ICEBLUE,
- HAPICOLOR_GREEN, HAPICOLOR_PINK, HAPICOLOR_YELLOW, HAPICOLOR_TURQUOISE, HAPICOLOR_VIOLET, HAPICOLOR_DARKRED, HAPICOLOR_TEAL,
- HAPICOLOR_BLUE, HAPICOLOR_SKYBLUE, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_LIGHTGREEN, HAPICOLOR_LIGHTYELLOW, HAPICOLOR_PALEBLUE,
- HAPICOLOR_ROSE, HAPICOLOR_LAVENDER, HAPICOLOR_TAN, HAPICOLOR_LIGHTBLUE, HAPICOLOR_AQUA, HAPICOLOR_LIME, HAPICOLOR_GOLD,
- HAPICOLOR_LIGHTORANGE, HAPICOLOR_ORANGE, HAPICOLOR_BLUEGRAY, HAPICOLOR_GRAY_40_PERCENT, HAPICOLOR_DARKTEAL,
- HAPICOLOR_SEAGREEN, HAPICOLOR_NONAME, HAPICOLOR_OLIVEGREEN, HAPICOLOR_BROWN, HAPICOLOR_PLUM, HAPICOLOR_INDIGO,
- HAPICOLOR_GRAY_80_PERCENT
- };
- return COLORINDIZES[nIndex];
-}
-ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< vba::XHelperInterface > xInternalParent, const uno::Reference< drawing::XShape > xShape, const sal_Int16 nColorFormatType ) : ScVbaColorFormat_BASE( xParent, xContext ), m_xInternalParent( xInternalParent ), m_xShape( xShape ), m_nColorFormatType( nColorFormatType )
-{
- m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW );
- m_nFillFormatBackColor = 0;
- try
- {
- uno::Reference< oo::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW );
- m_pFillFormat = ( ScVbaFillFormat* )( xFillFormat.get() );
- }catch ( uno::RuntimeException e )
- {
- m_pFillFormat = NULL;
- }
-}
-
-void
-ScVbaColorFormat::setColorFormat( sal_Int16 _ntype )
-{
- m_nColorFormatType = _ntype;
-}
-
-// Attribute
-sal_Int32 SAL_CALL
-ScVbaColorFormat::getRGB() throw (uno::RuntimeException)
-{
- sal_Int32 nRGB = 0;
- switch( m_nColorFormatType )
- {
- case ColorFormatType::LINEFORMAT_FORECOLOR:
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LineColor") ) >>= nRGB;
- break;
- case ColorFormatType::LINEFORMAT_BACKCOLOR:
- //TODO BackColor not supported
- // m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("Color"), uno::makeAny( nRGB ) );
- break;
- case ColorFormatType::FILLFORMAT_FORECOLOR:
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillColor") ) >>= nRGB;
- break;
- case ColorFormatType::FILLFORMAT_BACKCOLOR:
- nRGB = m_nFillFormatBackColor;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() );
- }
- nRGB = OORGBToXLRGB( nRGB );
- return nRGB;
-}
-
-void SAL_CALL
-ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException)
-{
- sal_Int32 nRGB = XLRGBToOORGB( _rgb );
- switch( m_nColorFormatType )
- {
- case ColorFormatType::LINEFORMAT_FORECOLOR:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineColor" ), uno::makeAny( nRGB ) );
- break;
- case ColorFormatType::LINEFORMAT_BACKCOLOR:
- // TODO BackColor not supported
- break;
- case ColorFormatType::FILLFORMAT_FORECOLOR:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor" ), uno::makeAny( nRGB ) );
- if( m_pFillFormat )
- {
- m_pFillFormat->setForeColorAndInternalStyle(nRGB);
- }
- break;
- case ColorFormatType::FILLFORMAT_BACKCOLOR:
- m_nFillFormatBackColor = nRGB;
- if( m_pFillFormat )
- {
- m_pFillFormat->setForeColorAndInternalStyle(nRGB);
- }
- break;
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() );
- }
-}
-
-sal_Int32 SAL_CALL
-ScVbaColorFormat::getSchemeColor() throw (uno::RuntimeException)
-{
- sal_Int32 nColor = getRGB();
- // #TODO I guess the number of elements is determined by the correct scheme
- // the implementation here seems to be a rehash of color index ( which seems to be a
- // different thing ) - I would guess we need to know/import etc. the correct color scheme
- // or at least find out a little more
- sal_Int32 i = 0;
- for( ; i < 56; i++ )
- {
- if( nColor == MsoColorIndizes::getColorIndex(i) )
- break;
- }
-
- if( i == 56 ) // this is most likely an error condition
- --i;
- return i;
- // #TODO figure out what craziness is this,
- // the 56 colors seems incorrect, as in default XL ( 2003 ) there are 80 colors
-/*
- if( i == 56 )
- {
- i = -2;
- }
-
- return ( i + 2 );
-*/
-}
-
-void SAL_CALL
-ScVbaColorFormat::setSchemeColor( sal_Int32 _schemecolor ) throw (uno::RuntimeException)
-{
- // the table is 0 based
- sal_Int32 nColor = MsoColorIndizes::getColorIndex( _schemecolor );
- // nColor is already xl RGB
- setRGB( nColor );
-}
-
-
-rtl::OUString&
-ScVbaColorFormat::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaColorFormat") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaColorFormat::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msforms.ColorFormat" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbacolorformat.hxx b/scratch/sc-vba/dead-source/vbacolorformat.hxx
deleted file mode 100644
index e6c2751bb..000000000
--- a/scratch/sc-vba/dead-source/vbacolorformat.hxx
+++ /dev/null
@@ -1,133 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_XCOLORFORMAT_HXX
-#define SC_VBA_XCOLORFORMAT_HXX
-
-#include <com/sun/star/drawing/XShape.hpp>
-#include <org/openoffice/msforms/XColorFormat.hpp>
-#include <org/openoffice/msforms/XFillFormat.hpp>
-#include "vbahelperinterface.hxx"
-#include "vbafillformat.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::msforms::XColorFormat > ScVbaColorFormat_BASE;
-
-class ColorFormatType
-{
-public:
- const static sal_Int16 LINEFORMAT_FORECOLOR = 1;
- const static sal_Int16 LINEFORMAT_BACKCOLOR = 2;
- const static sal_Int16 FILLFORMAT_FORECOLOR = 3;
- const static sal_Int16 FILLFORMAT_BACKCOLOR = 4;
- const static sal_Int16 THREEDFORMAT_EXTRUSIONCOLOR = 5;
-};
-
-struct MsoColorIndizes
-{
- const static sal_Int32 HAPICOLOR_BLACK = 0;
- const static sal_Int32 HAPICOLOR_WITHE = 16777215;
- const static sal_Int32 HAPICOLOR_RED = 16711680;
- const static sal_Int32 HAPICOLOR_BRIGHTGREEN = 65280;
- const static sal_Int32 HAPICOLOR_BLUE = 255;
- const static sal_Int32 HAPICOLOR_YELLOW = 16776960;
- const static sal_Int32 HAPICOLOR_PINK = 16711935;
- const static sal_Int32 HAPICOLOR_TURQUOISE = 65535;
- const static sal_Int32 HAPICOLOR_DARKRED = 8388608;
- const static sal_Int32 HAPICOLOR_GREEN = 32768;
- const static sal_Int32 HAPICOLOR_DARKBLUE = 128;
- const static sal_Int32 HAPICOLOR_DARKYELLOW = 8421376;
- const static sal_Int32 HAPICOLOR_VIOLET = 8388736;
- const static sal_Int32 HAPICOLOR_TEAL = 32896;
- const static sal_Int32 HAPICOLOR_GRAY_25_PERCENT = 12632256;
- const static sal_Int32 HAPICOLOR_GRAY_50_PERCENT = 8421504;
- const static sal_Int32 HAPICOLOR_PERIWINCKLE = 10066431;
- const static sal_Int32 HAPICOLOR_PLUM = 10040166;
- const static sal_Int32 HAPICOLOR_IVORY = 16777164;
- const static sal_Int32 HAPICOLOR_LIGHTTURQUOISE = 13434879;
- const static sal_Int32 HAPICOLOR_DARKPRUPLE = 6684774;
- const static sal_Int32 HAPICOLOR_CORAL = 16744576;
- const static sal_Int32 HAPICOLOR_OCEANBLUE = 26316;
- const static sal_Int32 HAPICOLOR_ICEBLUE = 13421823;
- const static sal_Int32 HAPICOLOR_SKYBLUE = 52479;
- const static sal_Int32 HAPICOLOR_LIGHTGREEN = 13434828;
- const static sal_Int32 HAPICOLOR_LIGHTYELLOW = 16777113;
- const static sal_Int32 HAPICOLOR_PALEBLUE = 10079487;
- const static sal_Int32 HAPICOLOR_ROSE = 16751052;
- const static sal_Int32 HAPICOLOR_LAVENDER = 13408767;
- const static sal_Int32 HAPICOLOR_TAN = 16764057;
- const static sal_Int32 HAPICOLOR_LIGHTBLUE = 3368703;
- const static sal_Int32 HAPICOLOR_AQUA = 3394764;
- const static sal_Int32 HAPICOLOR_LIME = 10079232;
- const static sal_Int32 HAPICOLOR_GOLD = 16763904;
- const static sal_Int32 HAPICOLOR_LIGHTORANGE = 16750848;
- const static sal_Int32 HAPICOLOR_ORANGE = 16737792;
- const static sal_Int32 HAPICOLOR_BLUEGRAY = 6710937;
- const static sal_Int32 HAPICOLOR_GRAY_40_PERCENT = 9868950;
- const static sal_Int32 HAPICOLOR_DARKTEAL = 13158;
- const static sal_Int32 HAPICOLOR_SEAGREEN = 3381606;
- const static sal_Int32 HAPICOLOR_NONAME = 13056;
- const static sal_Int32 HAPICOLOR_OLIVEGREEN = 3355392;
- const static sal_Int32 HAPICOLOR_BROWN = 10040064;
- const static sal_Int32 HAPICOLOR_INDIGO = 3355545;
- const static sal_Int32 HAPICOLOR_GRAY_80_PERCENT = 3355443;
-
- const static sal_Int32 getColorIndex( sal_Int32 nIndex );
-
-};
-
-class ScVbaColorFormat : public ScVbaColorFormat_BASE
-{
-private:
- css::uno::Reference< oo::vba::XHelperInterface > m_xInternalParent;
- css::uno::Reference< css::drawing::XShape > m_xShape;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
- ScVbaFillFormat *m_pFillFormat;
- sal_Int16 m_nColorFormatType;
- sal_Int32 m_nFillFormatBackColor;
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- void setColorFormat( sal_Int16 nType );
-public:
- ScVbaColorFormat( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< oo::vba::XHelperInterface > xInternalParent, const css::uno::Reference< css::drawing::XShape > xShape, const sal_Int16 nColorFormatType );
-
- // Attributes
- virtual sal_Int32 SAL_CALL getRGB() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRGB( sal_Int32 _rgb ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getSchemeColor() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSchemeColor( sal_Int32 _schemecolor ) throw (css::uno::RuntimeException);
-
-};
-
-#endif//SC_VBA_XCOLORFORMAT_HXX
diff --git a/scratch/sc-vba/dead-source/vbacombobox.cxx b/scratch/sc-vba/dead-source/vbacombobox.cxx
deleted file mode 100644
index bfee723c3..000000000
--- a/scratch/sc-vba/dead-source/vbacombobox.cxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbacombobox.hxx"
-#include <vector>
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-
-const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") );
-const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-
-ScVbaComboBox::ScVbaComboBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : ComboBoxImpl_BASE( xContext, xControlShape )
-{
- // grab the default value property name
- m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
-}
-
-ScVbaComboBox::ScVbaComboBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertySet >& xPropSet, const css::uno::Reference< css::drawing::XControlShape > xControlShape ) : ComboBoxImpl_BASE( xContext, xPropSet, xControlShape )
-{
- m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
-}
-
-
-// Attributes
-uno::Any SAL_CALL
-ScVbaComboBox::getValue() throw (uno::RuntimeException)
-{
- return m_xProps->getPropertyValue( sSourceName );
-}
-
-void SAL_CALL
-ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
-{
- m_xProps->setPropertyValue( sSourceName, _value );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaComboBox::getText() throw (uno::RuntimeException)
-{
- rtl::OUString result;
- getValue() >>= result;
- return result;
-}
-
-void SAL_CALL
-ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
-{
- setValue( uno::makeAny( _text ) ); // seems the same
-}
-
-// Methods
-void SAL_CALL
-ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
-{
-
- if ( pvargItem.hasValue() )
- {
- uno::Sequence< rtl::OUString > sList;
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
-
- sal_Int32 nIndex = sList.getLength();
-
- if ( pvargIndex.hasValue() )
- pvargIndex >>= nIndex;
-
- rtl::OUString sString;
- pvargItem >>= sString;
-
- // if no index specified or item is to be appended to end of
- // list just realloc the array and set the last item
- if ( nIndex == sList.getLength() )
- {
- sal_Int32 nOldSize = sList.getLength();
- sList.realloc( nOldSize + 1 );
- sList[ nOldSize ] = sString;
- }
- else
- {
- // just copy those elements above the one to be inserted
- std::vector< rtl::OUString > sVec;
- // reserve just the amount we need to copy
- sVec.reserve( sList.getLength() - nIndex );
-
- // point at first element to copy
- rtl::OUString* pString = sList.getArray() + nIndex;
- const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
- // insert the new element
- sVec.push_back( sString );
- // copy elements
- for ( ; pString != pEndString; ++pString )
- sVec.push_back( *pString );
-
- sList.realloc( sList.getLength() + 1 );
-
- // point at first element to be overwritten
- pString = sList.getArray() + nIndex;
- pEndString = sList.getArray() + sList.getLength();
- std::vector< rtl::OUString >::iterator it = sVec.begin();
- for ( ; pString != pEndString; ++pString, ++it)
- *pString = *it;
- //
- }
-
- m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
-
- }
-}
-
-void SAL_CALL
-ScVbaComboBox::Clear( ) throw (uno::RuntimeException)
-{
- setValue( uno::makeAny( rtl::OUString() ) );
- m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
-}
diff --git a/scratch/sc-vba/dead-source/vbacombobox.hxx b/scratch/sc-vba/dead-source/vbacombobox.hxx
deleted file mode 100644
index a40845686..000000000
--- a/scratch/sc-vba/dead-source/vbacombobox.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_COMBOBOX_HXX
-#define SC_VBA_COMBOBOX_HXX
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/script/XDefaultProperty.hpp>
-#include <org/openoffice/msforms/XComboBox.hpp>
-#include <comphelper/proparrhlp.hxx>
-#include <comphelper/propertycontainer.hxx>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-#include "vbacontrol.hxx"
-#include "vbahelper.hxx"
-
-typedef cppu::ImplInheritanceHelper2<ScVbaControl, oo::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
-class ScVbaComboBox : public ComboBoxImpl_BASE
-{
-
- //css::uno::Reference< css::uno::XComponentContext > m_xContext;
- //css::uno::Reference< css::beans::XPropertySet > m_xProps;
- rtl::OUString sSourceName;
- rtl::OUString msDftPropName;
-
-
-public:
- ScVbaComboBox( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- ScVbaComboBox( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::beans::XPropertySet >& xProps,
- const css::uno::Reference< css::drawing::XControlShape> xControlShape );
-
-
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
-
- // XDefaultProperty
- ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-};
-
-#endif //
diff --git a/scratch/sc-vba/dead-source/vbacomment.cxx b/scratch/sc-vba/dead-source/vbacomment.cxx
deleted file mode 100644
index 4bb9b12fc..000000000
--- a/scratch/sc-vba/dead-source/vbacomment.cxx
+++ /dev/null
@@ -1,224 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbacomment.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbacomment.hxx"
-
-#include <org/openoffice/excel/XlCreator.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
-#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
-#include <com/sun/star/sheet/XSheetCellRange.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/table/XCell.hpp>
-#include <com/sun/star/text/XText.hpp>
-
-#include "vbaglobals.hxx"
-#include "vbacomments.hxx"
-
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-ScVbaComment::ScVbaComment( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange ) throw( lang::IllegalArgumentException )
-: ScVbaComment_BASE( xParent, xContext ), mxRange( xRange )
-{
- if ( !xRange.is() )
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "range is not set " ) ), uno::Reference< uno::XInterface >() , 1 );
- uno::Reference< text::XSimpleText > xAnnoText( getAnnotation(), uno::UNO_QUERY );
-}
-
-// private helper functions
-
-uno::Reference< sheet::XSheetAnnotation > SAL_CALL
-ScVbaComment::getAnnotation() throw (uno::RuntimeException)
-{
- uno::Reference< table::XCell > xCell( mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSheetAnnotationAnchor > xAnnoAnchor( xCell, uno::UNO_QUERY_THROW );
- return uno::Reference< sheet::XSheetAnnotation > ( xAnnoAnchor->getAnnotation(), uno::UNO_QUERY_THROW );
-}
-
-uno::Reference< sheet::XSheetAnnotations > SAL_CALL
-ScVbaComment::getAnnotations() throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XSheetCellRange > xSheetCellRange(mxRange, ::uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet();
- uno::Reference< sheet::XSheetAnnotationsSupplier > xAnnosSupp( xSheet, uno::UNO_QUERY_THROW );
-
- return uno::Reference< sheet::XSheetAnnotations > ( xAnnosSupp->getAnnotations(), uno::UNO_QUERY_THROW );
-}
-
-sal_Int32 SAL_CALL
-ScVbaComment::getAnnotationIndex() throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XSheetAnnotations > xAnnos = getAnnotations();
- table::CellAddress aAddress = getAnnotation()->getPosition();
-
- sal_Int32 aIndex = 0;
- sal_Int32 aCount = xAnnos->getCount();
-
- for ( ; aIndex < aCount ; aIndex++ )
- {
- uno::Reference< sheet::XSheetAnnotation > xAnno( xAnnos->getByIndex( aIndex ), uno::UNO_QUERY_THROW );
- table::CellAddress xAddress = xAnno->getPosition();
-
- if ( xAddress.Column == aAddress.Column && xAddress.Row == aAddress.Row && xAddress.Sheet == aAddress.Sheet )
- {
- OSL_TRACE("** terminating search, index is %d", aIndex );
- break;
- }
- }
- OSL_TRACE("** returning index is %d", aIndex );
-
- return aIndex;
-}
-
-uno::Reference< excel::XComment > SAL_CALL
-ScVbaComment::getCommentByIndex( sal_Int32 Index ) throw (uno::RuntimeException)
-{
- uno::Reference< container::XIndexAccess > xIndexAccess( getAnnotations(), uno::UNO_QUERY_THROW );
- // parent is sheet ( parent of the range which is the parent of the comment )
- uno::Reference< vba::XCollection > xColl( new ScVbaComments( getParent()->getParent(), mxContext, xIndexAccess ) );
-
- return uno::Reference< excel::XComment > ( xColl->Item( uno::makeAny( Index ), uno::Any() ), uno::UNO_QUERY_THROW );
- }
-
-// public vba functions
-
-rtl::OUString SAL_CALL
-ScVbaComment::getAuthor() throw (uno::RuntimeException)
-{
- return getAnnotation()->getAuthor();
-}
-
-void SAL_CALL
-ScVbaComment::setAuthor( const rtl::OUString& /*_author*/ ) throw (uno::RuntimeException)
-{
- // #TODO #FIXME implementation needed
-}
-
-sal_Bool SAL_CALL
-ScVbaComment::getVisible() throw (uno::RuntimeException)
-{
- return getAnnotation()->getIsVisible();
-}
-
-void SAL_CALL
-ScVbaComment::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
-{
- getAnnotation()->setIsVisible( _visible );
-}
-
-void SAL_CALL
-ScVbaComment::Delete() throw (uno::RuntimeException)
-{
- getAnnotations()->removeByIndex( getAnnotationIndex() );
-}
-
-uno::Reference< excel::XComment > SAL_CALL
-ScVbaComment::Next() throw (uno::RuntimeException)
-{
- // index: uno = 0, vba = 1
- return getCommentByIndex( getAnnotationIndex() + 2 );
-}
-
-uno::Reference< excel::XComment > SAL_CALL
-ScVbaComment::Previous() throw (uno::RuntimeException)
-{
- // index: uno = 0, vba = 1
- return getCommentByIndex( getAnnotationIndex() );
-}
-
-rtl::OUString SAL_CALL
-ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::Any& Overwrite ) throw (uno::RuntimeException)
-{
- rtl::OUString sText;
- aText >>= sText;
-
- uno::Reference< text::XSimpleText > xAnnoText( getAnnotation(), uno::UNO_QUERY_THROW );
- rtl::OUString sAnnoText = xAnnoText->getString();
-
- if ( aStart.hasValue() )
- {
- sal_Int16 nStart = 0;
- sal_Bool bOverwrite = sal_True;
- Overwrite >>= bOverwrite;
-
- if ( aStart >>= nStart )
- {
- uno::Reference< text::XTextCursor > xTextCursor( xAnnoText->createTextCursor(), uno::UNO_QUERY_THROW );
-
- if ( bOverwrite )
- {
- xTextCursor->collapseToStart();
- xTextCursor->gotoStart( sal_False );
- xTextCursor->goRight( nStart - 1, sal_False );
- xTextCursor->gotoEnd( sal_True );
- }
- else
- {
- xTextCursor->collapseToStart();
- xTextCursor->gotoStart( sal_False );
- xTextCursor->goRight( nStart - 1 , sal_True );
- }
-
- uno::Reference< text::XTextRange > xRange( xTextCursor, uno::UNO_QUERY_THROW );
- xAnnoText->insertString( xRange, sText, bOverwrite );
- }
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScVbaComment::Text - bad Start value " ) ), uno::Reference< uno::XInterface >() );
- }
- else if ( aText.hasValue() )
- xAnnoText->setString( sText );
-
- return sAnnoText;
-}
-
-rtl::OUString&
-ScVbaComment::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComment") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaComment::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.ScVbaComment" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbacomment.hxx b/scratch/sc-vba/dead-source/vbacomment.hxx
deleted file mode 100644
index b6e864d4b..000000000
--- a/scratch/sc-vba/dead-source/vbacomment.hxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_COMMENT_HXX
-#define SC_VBA_COMMENT_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <org/openoffice/excel/XComment.hpp>
-#include <org/openoffice/excel/XApplication.hpp>
-#include <com/sun/star/sheet/XSheetAnnotations.hpp>
-#include <com/sun/star/sheet/XSheetAnnotation.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XComment > ScVbaComment_BASE;
-
-class ScVbaComment : public ScVbaComment_BASE
-{
- css::uno::Reference< css::table::XCellRange > mxRange;
-
-private:
- css::uno::Reference< css::sheet::XSheetAnnotation > SAL_CALL getAnnotation() throw (css::uno::RuntimeException);
- css::uno::Reference< css::sheet::XSheetAnnotations > SAL_CALL getAnnotations() throw (css::uno::RuntimeException);
- sal_Int32 SAL_CALL getAnnotationIndex() throw (css::uno::RuntimeException);
- css::uno::Reference< oo::excel::XComment > SAL_CALL getCommentByIndex( sal_Int32 Index ) throw (css::uno::RuntimeException);
-public:
- ScVbaComment( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XCellRange >& xRange ) throw ( css::lang::IllegalArgumentException );
-
- virtual ~ScVbaComment() {}
-
- // Attributes
- virtual rtl::OUString SAL_CALL getAuthor() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setAuthor( const rtl::OUString& _author ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XComment > SAL_CALL Next() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XComment > SAL_CALL Previous() throw (css::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL Text( const css::uno::Any& Text, const css::uno::Any& Start, const css::uno::Any& Overwrite ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif /* SC_VBA_COMMENT_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbacomments.cxx b/scratch/sc-vba/dead-source/vbacomments.cxx
deleted file mode 100644
index 7cf0d83a9..000000000
--- a/scratch/sc-vba/dead-source/vbacomments.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbacomments.hxx"
-
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/sheet/XSheetAnnotation.hpp>
-
-#include "vbaglobals.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-uno::Any AnnotationToComment( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext )
-{
- uno::Reference< sheet::XSheetAnnotation > xAnno( aSource, uno::UNO_QUERY_THROW );
- uno::Reference< container::XChild > xChild( xAnno, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xCellRange( xChild->getParent(), uno::UNO_QUERY_THROW );
-
- // #FIXME needs to find the correct Parent
- return uno::makeAny( uno::Reference< excel::XComment > ( new ScVbaComment( uno::Reference< vba::XHelperInterface >(), xContext, xCellRange ) ) );
-}
-
-class CommentEnumeration : public EnumerationHelperImpl
-{
-public:
- CommentEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ) {}
-
- virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- return AnnotationToComment( m_xEnumeration->nextElement(), m_xContext );
- }
-
-};
-
-ScVbaComments::ScVbaComments( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess )
-: ScVbaComments_BASE( xParent, xContext, xIndexAccess )
-{
-}
-
-// public helper functions
-
-uno::Reference< container::XEnumeration >
-ScVbaComments::createEnumeration() throw (uno::RuntimeException)
-{
- uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-
- return new CommentEnumeration( mxContext, xEnumAccess->createEnumeration() );
-}
-
-uno::Any
-ScVbaComments::createCollectionObject( const css::uno::Any& aSource )
-{
- return AnnotationToComment( aSource, mxContext );
-}
-
-uno::Type
-ScVbaComments::getElementType() throw (uno::RuntimeException)
-{
- return excel::XComment::static_type(0);
-}
-
-rtl::OUString&
-ScVbaComments::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComments") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaComments::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Comments") );
- }
- return sNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbacomments.hxx b/scratch/sc-vba/dead-source/vbacomments.hxx
deleted file mode 100644
index adab13441..000000000
--- a/scratch/sc-vba/dead-source/vbacomments.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_COMMENTS_HXX
-#define SC_VBA_COMMENTS_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <org/openoffice/excel/XComments.hpp>
-
-#include "vbahelper.hxx"
-#include "vbacollectionimpl.hxx"
-#include "vbacomment.hxx"
-
-typedef CollTestImplHelper< oo::excel::XComments > ScVbaComments_BASE;
-
-class ScVbaComments : public ScVbaComments_BASE
-{
-public:
- ScVbaComments( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-
- virtual ~ScVbaComments() {}
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
- // ScVbaComments_BASE
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-
-#endif /* SC_VBA_COMMENTS_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbacondition.cxx b/scratch/sc-vba/dead-source/vbacondition.cxx
deleted file mode 100644
index 82f5c43d5..000000000
--- a/scratch/sc-vba/dead-source/vbacondition.cxx
+++ /dev/null
@@ -1,183 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-
-#include "vbacondition.hxx"
-#include <org/openoffice/excel/XlFormatConditionOperator.hpp>
-#include <org/openoffice/excel/XFormatCondition.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-const sal_Int32 ISFORMULA = 98765432;
-
-template< typename Ifc1 >
-ScVbaCondition< Ifc1 >::ScVbaCondition( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< sheet::XSheetCondition >& _xSheetCondition ) : ScVbaCondition_BASE( xParent, xContext ), mxSheetCondition( _xSheetCondition )
-{
- mxAddressable.set( xParent, uno::UNO_QUERY_THROW );
-}
-
-template< typename Ifc1 >
-sheet::ConditionOperator
-ScVbaCondition< Ifc1 >::retrieveAPIOperator( const uno::Any& _aOperator) throw ( script::BasicErrorException )
-{
- sheet::ConditionOperator aRetAPIOperator = sheet::ConditionOperator_NONE;
- sal_Int32 nOperator = 0;
- if ( (_aOperator >>= nOperator ) )
- {
- switch(nOperator)
- {
- case excel::XlFormatConditionOperator::xlBetween:
- aRetAPIOperator = sheet::ConditionOperator_BETWEEN;
- break;
- case excel::XlFormatConditionOperator::xlNotBetween:
- aRetAPIOperator = sheet::ConditionOperator_NOT_BETWEEN;
- break;
- case excel::XlFormatConditionOperator::xlEqual:
- aRetAPIOperator = sheet::ConditionOperator_EQUAL;
- break;
- case excel::XlFormatConditionOperator::xlNotEqual:
- aRetAPIOperator = sheet::ConditionOperator_NOT_EQUAL;
- break;
- case excel::XlFormatConditionOperator::xlGreater:
- aRetAPIOperator = sheet::ConditionOperator_GREATER;
- break;
- case excel::XlFormatConditionOperator::xlLess:
- aRetAPIOperator = sheet::ConditionOperator_LESS;
- break;
- case excel::XlFormatConditionOperator::xlGreaterEqual:
- aRetAPIOperator = sheet::ConditionOperator_GREATER_EQUAL;
- break;
- case excel::XlFormatConditionOperator::xlLessEqual:
- aRetAPIOperator = sheet::ConditionOperator_LESS_EQUAL;
- break;
- default:
- aRetAPIOperator = sheet::ConditionOperator_NONE;
- break;
- }
- }
- return aRetAPIOperator;
-}
-
-template< typename Ifc1 >
-rtl::OUString
-ScVbaCondition< Ifc1 >::Formula1( ) throw ( script::BasicErrorException, uno::RuntimeException )
-{
- return mxSheetCondition->getFormula1();
-}
-
-template< typename Ifc1 >
-rtl::OUString
-ScVbaCondition< Ifc1 >::Formula2( ) throw ( script::BasicErrorException, uno::RuntimeException )
-{
- return mxSheetCondition->getFormula2();
-}
-
-template< typename Ifc1 >
-void
-ScVbaCondition< Ifc1 >::setFormula1( const uno::Any& _aFormula1) throw ( script::BasicErrorException )
-{
- rtl::OUString sFormula;
- if ( (_aFormula1 >>= sFormula ))
- {
- mxSheetCondition->setFormula1( sFormula );
- table::CellRangeAddress aCellRangeAddress = mxAddressable->getRangeAddress();
- table::CellAddress aCellAddress( aCellRangeAddress.Sheet, aCellRangeAddress.StartColumn, aCellRangeAddress.StartRow );
- mxSheetCondition->setSourcePosition(aCellAddress);
- }
-}
-
-template< typename Ifc1 >
-void
-ScVbaCondition< Ifc1 >::setFormula2( const uno::Any& _aFormula2) throw ( script::BasicErrorException )
-{
- rtl::OUString sFormula2;
- // #TODO surely this can't be right?
- // ( from helperapi/impl/.../calc/ConditionImpl.java
- if ( (_aFormula2 >>= sFormula2 ))
- mxSheetCondition->setFormula1(sFormula2);
-}
-
-template< typename Ifc1 >
-sal_Int32
-ScVbaCondition< Ifc1 >::Operator(sal_Bool _bIncludeFormulaValue) throw ( script::BasicErrorException )
-{
- sal_Int32 retvalue = -1;
- sheet::ConditionOperator aConditionalOperator = mxSheetCondition->getOperator();
- switch (aConditionalOperator)
- {
- case sheet::ConditionOperator_EQUAL:
- retvalue = excel::XlFormatConditionOperator::xlEqual;
- break;
- case sheet::ConditionOperator_NOT_EQUAL:
- retvalue = excel::XlFormatConditionOperator::xlNotEqual;
- break;
- case sheet::ConditionOperator_GREATER:
- retvalue = excel::XlFormatConditionOperator::xlGreater;
- break;
- case sheet::ConditionOperator_GREATER_EQUAL:
- retvalue = excel::XlFormatConditionOperator::xlGreaterEqual;
- break;
- case sheet::ConditionOperator_LESS:
- retvalue = excel::XlFormatConditionOperator::xlLess;
- break;
- case sheet::ConditionOperator_LESS_EQUAL:
- retvalue = excel::XlFormatConditionOperator::xlLessEqual;
- break;
- case sheet::ConditionOperator_BETWEEN:
- retvalue = excel::XlFormatConditionOperator::xlBetween;
- break;
- case sheet::ConditionOperator_NOT_BETWEEN:
- retvalue = excel::XlFormatConditionOperator::xlNotBetween;
- break;
- case sheet::ConditionOperator_FORMULA:
- if (_bIncludeFormulaValue)
- {
- //#FIXME huh what's this all about
- // from helperapi/impl/.../calc/ConditionImpl
- retvalue = ISFORMULA;
- break;
- }
- case sheet::ConditionOperator_NONE:
- default:
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Operator not supported")));
- break;
- }
- return retvalue;
-}
-
-template class ScVbaCondition< excel::XFormatCondition >;
-
diff --git a/scratch/sc-vba/dead-source/vbacondition.hxx b/scratch/sc-vba/dead-source/vbacondition.hxx
deleted file mode 100644
index 062d3301a..000000000
--- a/scratch/sc-vba/dead-source/vbacondition.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CONDITION_HXX
-#define SC_VBA_CONDITION_HXX
-#include <com/sun/star/sheet/XSheetCondition.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include "vbahelperinterface.hxx"
-#include <com/sun/star/sheet/ConditionOperator.hpp>
-
-template< typename Ifc1 >
-class ScVbaCondition : public InheritedHelperInterfaceImpl1< Ifc1 >
-{
-typedef InheritedHelperInterfaceImpl1< Ifc1 > ScVbaCondition_BASE;
-protected:
- css::uno::Reference< css::sheet::XCellRangeAddressable > mxAddressable;
- css::uno::Reference< css::sheet::XSheetCondition > mxSheetCondition;
-public:
- ScVbaCondition( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::sheet::XSheetCondition >& _xSheetCondition );
-
- static css::sheet::ConditionOperator retrieveAPIOperator( const css::uno::Any& _aOperator) throw ( css::script::BasicErrorException );
-
- virtual rtl::OUString SAL_CALL Formula1( ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- virtual rtl::OUString SAL_CALL Formula2( ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- virtual void setFormula1( const css::uno::Any& _aFormula1) throw ( css::script::BasicErrorException );
- virtual void setFormula2( const css::uno::Any& _aFormula2) throw ( css::script::BasicErrorException );
- virtual sal_Int32 Operator(sal_Bool _bIncludeFormulaValue) throw ( css::script::BasicErrorException );
- virtual sal_Int32 SAL_CALL Operator() throw ( css::script::BasicErrorException, css::uno::RuntimeException ) = 0;
-
-};
-#endif
diff --git a/scratch/sc-vba/dead-source/vbacontrol.cxx b/scratch/sc-vba/dead-source/vbacontrol.cxx
deleted file mode 100644
index 7edab3dd3..000000000
--- a/scratch/sc-vba/dead-source/vbacontrol.cxx
+++ /dev/null
@@ -1,325 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XControl.hpp>
-#include <com/sun/star/awt/XWindow2.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/view/XControlAccess.hpp>
-#include <com/sun/star/container/XChild.hpp>
-
-#include"vbacontrol.hxx"
-#include"vbacombobox.hxx"
-#include "vbabutton.hxx"
-#include "vbalabel.hxx"
-#include "vbatextbox.hxx"
-#include "vbaradiobutton.hxx"
-#include "vbalistbox.hxx"
-
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-sal_Int32 pt2mm( double pt );
-double mm2pt( sal_Int32 mm );
-
-uno::Reference< css::awt::XWindowPeer >
-ScVbaControl::getWindowPeer( const uno::Reference< ::drawing::XControlShape >& xControlShape ) throw (uno::RuntimeException)
-{
- uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), uno::UNO_QUERY_THROW );
- //init m_xWindowPeer
- uno::Reference< container::XChild > xChild( xControlModel, uno::UNO_QUERY_THROW );
- xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
- xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XModel > xModel( xChild->getParent(), uno::UNO_QUERY_THROW );
- uno::Reference< view::XControlAccess > xControlAccess( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< awt::XControl > xControl;
- try
- {
- xControl.set( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY );
- }
- catch( uno::Exception )
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ),
- uno::Reference< uno::XInterface >() );
- }
- return xControl->getPeer();
-}
-
-//ScVbaControlListener
-class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener >
-{
-private:
- ScVbaControl *pControl;
-public:
- ScVbaControlListener( ScVbaControl *pTmpControl );
- virtual ~ScVbaControlListener();
- virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException );
-};
-
-ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl )
-{
-}
-
-ScVbaControlListener::~ScVbaControlListener()
-{
-}
-
-void SAL_CALL
-ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException )
-{
- if( pControl )
- {
- pControl->removeResouce();
- pControl = NULL;
- }
-}
-
-//ScVbaControl
-
-ScVbaControl::ScVbaControl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::drawing::XControlShape >& xControlShape ) : m_xContext( xContext ), m_xControlShape( xControlShape )
-{
- //init m_xProps
- uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xControlModel, uno::UNO_QUERY_THROW );
- m_xProps.set( xProps, uno::UNO_QUERY_THROW );
- //add listener
- m_xEventListener.set( new ScVbaControlListener( this ) );
- uno::Reference< lang::XComponent > xComponent( m_xControlShape, uno::UNO_QUERY_THROW );
- xComponent->addEventListener( m_xEventListener );
-}
-
-ScVbaControl::~ScVbaControl()
-{
- if( m_xControlShape.is() )
- {
- uno::Reference< lang::XComponent > xComponent( m_xControlShape, uno::UNO_QUERY_THROW );
- xComponent->removeEventListener( m_xEventListener );
- }
-}
-
-void ScVbaControl::removeResouce() throw( uno::RuntimeException )
-{
- uno::Reference< lang::XComponent > xComponent( m_xControlShape, uno::UNO_QUERY_THROW );
- xComponent->removeEventListener( m_xEventListener );
- m_xControlShape = NULL;
- m_xProps = NULL;
-}
-
-
-ScVbaControl::ScVbaControl( const uno::Reference< uno::XComponentContext >& xContext,
- const uno::Reference< beans::XPropertySet >& xProps,
- const uno::Reference< drawing::XControlShape > xControlShape ) : m_xContext( xContext ),
- m_xProps( xProps ), m_xControlShape( xControlShape )
-{
- m_xEventListener.set( new ScVbaControlListener( this ) );
- uno::Reference< lang::XComponent > xComponent( m_xControlShape, uno::UNO_QUERY_THROW );
- xComponent->addEventListener( m_xEventListener );
-}
-
-void ScVbaControl::SetControl( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< ::drawing::XControlShape > xControlShape )
-{
- m_xEventListener.set( new ScVbaControlListener( this ) );
- uno::Reference< lang::XComponent > xComponent( m_xControlShape, uno::UNO_QUERY_THROW );
- m_xContext.set( xContext, uno::UNO_QUERY_THROW );
- m_xControlShape.set( xControlShape, uno::UNO_QUERY_THROW );
- //init m_xProps
- uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xControlModel, uno::UNO_QUERY_THROW );
- m_xProps = xProps;
-}
-
-void ScVbaControl::SetControl( const uno::Reference< uno::XComponentContext > xContext,
- const uno::Reference< beans::XPropertySet > xProps,
- const uno::Reference< drawing::XControlShape > xControlShape )
-{
- m_xEventListener.set( new ScVbaControlListener( this ) );
- uno::Reference< lang::XComponent > xComponent( m_xControlShape, uno::UNO_QUERY_THROW );
- m_xContext.set( xContext, uno::UNO_QUERY_THROW );
- m_xProps.set( xProps, uno::UNO_QUERY_THROW );
- m_xControlShape.set( xControlShape, uno::UNO_QUERY_THROW );
-}
-
-//In design model has different behavior
-sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException)
-{
- uno::Any aValue = m_xProps->getPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) );
- sal_Bool bRet = false;
- aValue >>= bRet;
- return bRet;
-}
-
-void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException)
-{
- uno::Any aValue( bVisible );
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue);
-
-}
-
-sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
-{
- uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer( m_xControlShape ), uno::UNO_QUERY_THROW );
- return xWindow2->isVisible();
-}
-
-void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-{
- uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer( m_xControlShape ), uno::UNO_QUERY_THROW );
- xWindow2->setVisible( bVisible );
-}
-double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt( xShape->getSize().Height ) / 100;
-}
-void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- awt::Size aSize( xShape->getSize() );
- aSize.Height = pt2mm( _height ) * 100;
- xShape->setSize( aSize );
-}
-
-double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt( xShape->getSize().Width ) / 100;
-}
-void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- awt::Size aSize( xShape->getSize() );
- aSize.Width = pt2mm( _width ) * 100;
- xShape->setSize( aSize );
-}
-
-double SAL_CALL
-ScVbaControl::getLeft() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt( xShape->getPosition().X / 100 );
-}
-
-void SAL_CALL
-ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException)
-{
- awt::Point oldPosition;
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- oldPosition = xShape->getPosition();
- oldPosition.X = pt2mm( _left ) * 100;
- xShape->setPosition( oldPosition );
-
-}
-
-double SAL_CALL
-ScVbaControl::getTop() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt( xShape->getPosition().Y / 100 );
-}
-
-void SAL_CALL
-ScVbaControl::setTop( double _top ) throw (uno::RuntimeException)
-{
- awt::Point oldPosition;
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- oldPosition = xShape->getPosition();
- oldPosition.Y = pt2mm( _top ) * 100;;
- xShape->setPosition( oldPosition );
-}
-
-//ScVbaControlFactory
-
-ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XControlShape >& xControlShape ): m_xContext( xContext ), m_xControlShape( xControlShape )
-{
- uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xControlModel, uno::UNO_QUERY_THROW );
- m_xProps.set( xProps, uno::UNO_QUERY_THROW );
-}
-
-ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertySet >& xProps, const uno::Reference< drawing::XControlShape > xControlShape ): m_xContext( xContext ), m_xProps( xProps ), m_xControlShape( xControlShape )
-{
-}
-
-ScVbaControl* ScVbaControlFactory::createControl( const sal_Int16 nClassId ) throw (uno::RuntimeException)
-{
- switch( nClassId )
- {
- case form::FormComponentType::COMBOBOX:
- return new ScVbaComboBox( m_xContext, m_xProps, m_xControlShape );
- case form::FormComponentType::COMMANDBUTTON:
- return new ScVbaButton( m_xContext, m_xControlShape );
- case form::FormComponentType::FIXEDTEXT:
- return new ScVbaLabel( m_xContext, m_xControlShape );
- case form::FormComponentType::TEXTFIELD:
- return new ScVbaTextBox( m_xContext, m_xControlShape );
- case form::FormComponentType::RADIOBUTTON:
- return new ScVbaRadioButton( m_xContext, m_xControlShape );
- case form::FormComponentType::LISTBOX:
- return new ScVbaListBox( m_xContext, m_xControlShape );
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Donot surpport this Control Type." ), uno::Reference< uno::XInterface >() );
- }
-}
-
-ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException)
-{
- sal_Int32 nClassId = -1;
- const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
- m_xProps->getPropertyValue( sClassId ) >>= nClassId;
- switch( nClassId )
- {
- case form::FormComponentType::COMBOBOX:
- return new ScVbaComboBox( m_xContext, m_xControlShape );
- case form::FormComponentType::COMMANDBUTTON:
- return new ScVbaButton( m_xContext, m_xControlShape );
- case form::FormComponentType::FIXEDTEXT:
- return new ScVbaLabel( m_xContext, m_xControlShape );
- case form::FormComponentType::TEXTFIELD:
- return new ScVbaTextBox( m_xContext, m_xControlShape );
- case form::FormComponentType::RADIOBUTTON:
- return new ScVbaRadioButton( m_xContext, m_xControlShape );
- case form::FormComponentType::LISTBOX:
- return new ScVbaListBox( m_xContext, m_xControlShape );
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Donot surpport this Control Type." ), uno::Reference< uno::XInterface >() );
- }
-}
diff --git a/scratch/sc-vba/dead-source/vbacontrol.hxx b/scratch/sc-vba/dead-source/vbacontrol.hxx
deleted file mode 100644
index f9dd8e789..000000000
--- a/scratch/sc-vba/dead-source/vbacontrol.hxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_CONTROL_HXX
-#define SC_VBA_CONTROL_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/script/XDefaultProperty.hpp>
-#include <com/sun/star/drawing/XControlShape.hpp>
-#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <org/openoffice/msforms/XControl.hpp>
-
-#include "vbahelper.hxx"
-
-typedef ::cppu::WeakImplHelper1< oo::msforms::XControl > ControlImpl_BASE;
-
-class ScVbaControl : public ControlImpl_BASE
-{
-/* this will cause error when the sheet is invisible.
-private:
- css::uno::Reference< css::awt::XWindowPeer > m_xWindowPeer;
-*/
-private:
- css::uno::Reference< css::awt::XWindowPeer > getWindowPeer( const css::uno::Reference< css::drawing::XControlShape >& xControlShape ) throw (css::uno::RuntimeException);
- com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
-protected:
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::beans::XPropertySet > m_xProps;
- css::uno::Reference< css::drawing::XControlShape > m_xControlShape;
-protected:
- ScVbaControl(){ m_xContext = 0; m_xProps = 0; m_xControlShape = 0; }
- void SetControl( const css::uno::Reference< css::uno::XComponentContext > xContext,
- const css::uno::Reference< css::drawing::XControlShape > xControlShape );
- void SetControl( const css::uno::Reference< css::uno::XComponentContext > xContext,
- const css::uno::Reference< css::beans::XPropertySet > xProps,
- const css::uno::Reference< css::drawing::XControlShape > xControlShape );
-public:
- ScVbaControl( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- ScVbaControl( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::beans::XPropertySet >& xProps,
- const css::uno::Reference< css::drawing::XControlShape > xControlShape );
- virtual ~ScVbaControl();
- // XControl
- virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
-
- //remove resouce because org.openoffice.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
- virtual void removeResouce() throw( css::uno::RuntimeException );
-};
-
-
-class ScVbaControlFactory
-{
-public:
- ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::beans::XPropertySet >& xProps,
- const css::uno::Reference< css::drawing::XControlShape > xControlShape );
- ScVbaControl* createControl( const sal_Int16 nClassID ) throw ( css::uno::RuntimeException );
- ScVbaControl* createControl() throw ( css::uno::RuntimeException );
-private:
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::beans::XPropertySet > m_xProps;
- css::uno::Reference< css::drawing::XControlShape > m_xControlShape;
-};
-
-#endif//SC_VBA_CONTROL_HXX
diff --git a/scratch/sc-vba/dead-source/vbadialog.cxx b/scratch/sc-vba/dead-source/vbadialog.cxx
deleted file mode 100644
index 00d92f150..000000000
--- a/scratch/sc-vba/dead-source/vbadialog.cxx
+++ /dev/null
@@ -1,124 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <org/openoffice/excel/XApplication.hpp>
-
-#include <tools/string.hxx>
-
-#include "vbahelper.hxx"
-#include "vbadialog.hxx"
-#include "vbaglobals.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-// fails silently
-void
-ScVbaDialog::Show() throw(uno::RuntimeException)
-{
- rtl::OUString aURL;
- uno::Reference< frame::XModel > xModel = getCurrentDocument();
- if ( xModel.is() )
- {
- aURL = mapIndexToName( mnIndex );
- if( aURL.getLength() )
- throw uno::RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ),
- uno::Reference< XInterface > () );
- dispatchRequests( xModel, aURL );
- }
-}
-
-
-static const rtl::OUString aStringList[]=
-{
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation") ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) )
-};
-
-const sal_Int32 nDialogSize = sizeof( aStringList ) / sizeof( aStringList[ 0 ] );
-
-rtl::OUString
-ScVbaDialog::mapIndexToName( sal_Int32 nIndex )
-{
- if( nIndex < nDialogSize )
- return aStringList[ nIndex ];
- return rtl::OUString();
-}
-
-rtl::OUString&
-ScVbaDialog::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotTable") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaDialog::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotTable" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbadialog.hxx b/scratch/sc-vba/dead-source/vbadialog.hxx
deleted file mode 100644
index 0dec7d8a3..000000000
--- a/scratch/sc-vba/dead-source/vbadialog.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_DIALOG_HXX
-#define SC_VBA_DIALOG_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <org/openoffice/vba/XGlobals.hpp>
-#include <org/openoffice/excel/XApplication.hpp>
-#include <org/openoffice/excel/XDialog.hpp>
-
-#include "vbahelperinterface.hxx"
-#include "vbadialog.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XDialog > ScVbaDialog_BASE;
-
-class ScVbaDialog : public ScVbaDialog_BASE
-{
- sal_Int32 mnIndex;
-public:
- ScVbaDialog( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, sal_Int32 nIndex, const css::uno::Reference< css::uno::XComponentContext > xContext ):ScVbaDialog_BASE( xParent, xContext ), mnIndex( nIndex ) {}
- virtual ~ScVbaDialog() {}
-
- // Methods
- virtual void SAL_CALL Show() throw (css::uno::RuntimeException);
- rtl::OUString mapIndexToName( sal_Int32 nIndex );
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif /* SC_VBA_DIALOG_HXX */
diff --git a/scratch/sc-vba/dead-source/vbadialogs.cxx b/scratch/sc-vba/dead-source/vbadialogs.cxx
deleted file mode 100644
index fae558dc3..000000000
--- a/scratch/sc-vba/dead-source/vbadialogs.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbadialogs.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <org/openoffice/excel/XApplication.hpp>
-#include <org/openoffice/excel/XDialog.hpp>
-
-#include <tools/string.hxx>
-
-#include "vbahelper.hxx"
-#include "vbadialogs.hxx"
-#include "vbaglobals.hxx"
-#include "vbadialog.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-void
-ScVbaDialogs::Dummy() throw (uno::RuntimeException)
-{
-}
-
-::sal_Int32
-ScVbaDialogs::getCount() throw (uno::RuntimeException)
-{
- //#TODO #FIXEME
- //SC_VBA_STUB();
- return 0;
-}
-
-uno::Any
-ScVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException)
-{
- sal_Int32 nIndex = 0;
- aItem >>= nIndex;
- uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), nIndex, mxContext ) );
- return uno::Any( aDialog );
-}
-rtl::OUString&
-ScVbaDialogs::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorksheet") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaDialogs::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet" ) );
- }
- return aServiceNames;
-}
-
-
-
diff --git a/scratch/sc-vba/dead-source/vbadialogs.hxx b/scratch/sc-vba/dead-source/vbadialogs.hxx
deleted file mode 100644
index 43cc91656..000000000
--- a/scratch/sc-vba/dead-source/vbadialogs.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_DIALOGS_HXX
-#define SC_VBA_DIALOGS_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <org/openoffice/excel/XDialogs.hpp>
-#include <org/openoffice/vba/XCollection.hpp>
-#include "vbahelperinterface.hxx"
-
-class ScModelObj;
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XDialogs > ScVbaDialogs_BASE;
-
-class ScVbaDialogs : public ScVbaDialogs_BASE
-{
-public:
- ScVbaDialogs( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): ScVbaDialogs_BASE( xParent, xContext ) {}
- virtual ~ScVbaDialogs() {}
-
- // XCollection
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
-
- // XDialogs
- virtual void SAL_CALL Dummy() throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif /* SC_VBA_DIALOGS_HXX */
diff --git a/scratch/sc-vba/dead-source/vbafillformat.cxx b/scratch/sc-vba/dead-source/vbafillformat.cxx
deleted file mode 100644
index 667839f53..000000000
--- a/scratch/sc-vba/dead-source/vbafillformat.cxx
+++ /dev/null
@@ -1,207 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbafillformat.cxx,v $
- *
- * $Revision: 1.1.2.4 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 11:47:24 $
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/awt/Gradient.hpp>
-#include <com/sun/star/awt/GradientStyle.hpp>
-#include <org/openoffice/office/MsoGradientStyle.hpp>
-#include "vbafillformat.hxx"
-#include "vbacolorformat.hxx"
-
-using namespace org::openoffice;
-using namespace com::sun::star;
-
-ScVbaFillFormat::ScVbaFillFormat( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaFillFormat_BASE( xParent, xContext ), m_xShape( xShape )
-{
- m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW );
- m_nFillStyle = drawing::FillStyle_SOLID;
- m_nForeColor = 0;
- m_nBackColor = 0;
- m_nGradientAngle = 0;
-}
-
-void
-ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::RuntimeException)
-{
- m_nFillStyle = nFillStyle;
- if( m_nFillStyle == drawing::FillStyle_GRADIENT )
- {
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) );
- awt::Gradient aGradient;
- // AXIAL
- // RADIAL
- // ELLIPTICAL
- // SQUARE
- // RECT
- aGradient.Style = awt::GradientStyle_LINEAR;
- aGradient.StartColor = ForeColor()->getRGB();
- aGradient.EndColor = BackColor()->getRGB();
- aGradient.Angle = m_nGradientAngle;
- aGradient.Border = 0;
- aGradient.XOffset = 0;
- aGradient.YOffset = 0;
- aGradient.StartIntensity = 100;
- aGradient.EndIntensity = 100;
- aGradient.StepCount = 1;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), uno::makeAny( aGradient ) );
- }
- else if( m_nFillStyle == drawing::FillStyle_SOLID )
- {
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) );
- }
-}
-
-void
-ScVbaFillFormat::setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException)
-{
- m_nForeColor = nForeColor;
- setFillStyle( m_nFillStyle );
-}
-
-// Attributes
-sal_Bool SAL_CALL
-ScVbaFillFormat::getVisible() throw (uno::RuntimeException)
-{
- drawing::FillStyle nFillStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= nFillStyle;
- if( nFillStyle == drawing::FillStyle_NONE )
- return sal_False;
- return sal_True;
-}
-
-void SAL_CALL
-ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
-{
- drawing::FillStyle aFillStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= aFillStyle;
- if( !_visible )
- {
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) );
- }
- else
- {
- if( aFillStyle == drawing::FillStyle_NONE )
- {
- setFillStyle( m_nFillStyle );
- }
- }
-}
-
-double SAL_CALL
-ScVbaFillFormat::getTransparency() throw (uno::RuntimeException)
-{
- sal_Int16 nTransparence = 0;
- double dTransparence = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ) ) >>= nTransparence;
- dTransparence = static_cast<double>( nTransparence );
- dTransparence /= 100;
- return dTransparence;
-}
-
-void SAL_CALL
-ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException)
-{
- sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ), uno::makeAny( nTransparence ) );
-}
-
-
-// Methods
-void SAL_CALL
-ScVbaFillFormat::Solid() throw (uno::RuntimeException)
-{
- setFillStyle( drawing::FillStyle_SOLID );
-}
-
-void SAL_CALL
-ScVbaFillFormat::TwoColorGradient( sal_Int32 style, sal_Int32 /*variant*/ ) throw (uno::RuntimeException)
-{
- if( style == office::MsoGradientStyle::msoGradientHorizontal )
- {
- m_nGradientAngle = 0;
- setFillStyle( drawing::FillStyle_GRADIENT );
- }
- else if( style == office::MsoGradientStyle::msoGradientVertical )
- {
- m_nGradientAngle = 900;
- setFillStyle( drawing::FillStyle_GRADIENT );
- }
- else if( style == office::MsoGradientStyle::msoGradientDiagonalDown )
- {
- m_nGradientAngle = 450;
- setFillStyle( drawing::FillStyle_GRADIENT );
- }
- else if( style == office::MsoGradientStyle::msoGradientDiagonalUp )
- {
- m_nGradientAngle = 900 + 450;
- setFillStyle( drawing::FillStyle_GRADIENT );
- }
-}
-
-uno::Reference< msforms::XColorFormat > SAL_CALL
-ScVbaFillFormat::BackColor() throw (uno::RuntimeException)
-{
- if( !m_xColorFormat.is() )
- m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_BACKCOLOR ) );
- return m_xColorFormat;
-}
-
-uno::Reference< msforms::XColorFormat > SAL_CALL
-ScVbaFillFormat::ForeColor() throw (uno::RuntimeException)
-{
- if( !m_xColorFormat.is() )
- m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_FORECOLOR ) );
- return m_xColorFormat;
-}
-
-
-rtl::OUString&
-ScVbaFillFormat::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFillFormat") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaFillFormat::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msforms.FillFormat" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbafillformat.hxx b/scratch/sc-vba/dead-source/vbafillformat.hxx
deleted file mode 100644
index a1bf23f8e..000000000
--- a/scratch/sc-vba/dead-source/vbafillformat.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_XFILLFORMAT_HXX
-#define SC_VBA_XFILLFORMAT_HXX
-
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
-#include <org/openoffice/msforms/XFillFormat.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::msforms::XFillFormat > ScVbaFillFormat_BASE;
-
-class ScVbaFillFormat : public ScVbaFillFormat_BASE
-{
-private:
- css::uno::Reference< css::drawing::XShape > m_xShape;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
- css::uno::Reference< oo::msforms::XColorFormat > m_xColorFormat;
- css::drawing::FillStyle m_nFillStyle;
- sal_Int32 m_nForeColor;
- sal_Int32 m_nBackColor;
- sal_Int16 m_nGradientAngle;
-private:
- void setFillStyle( css::drawing::FillStyle nFillStyle ) throw (css::uno::RuntimeException);
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-public:
- ScVbaFillFormat( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape );
-
- void setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException);
- // Attributes
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL Solid() throw (css::uno::RuntimeException);
- virtual void SAL_CALL TwoColorGradient( sal_Int32 style, sal_Int32 variant ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException);
-
-};
-
-#endif//SC_VBA_XFILLFORMAT_HXX
diff --git a/scratch/sc-vba/dead-source/vbafont.cxx b/scratch/sc-vba/dead-source/vbafont.cxx
deleted file mode 100644
index 503ddd2a9..000000000
--- a/scratch/sc-vba/dead-source/vbafont.cxx
+++ /dev/null
@@ -1,440 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbafont.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/beans/XProperty.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/FontUnderline.hpp>
-#include <com/sun/star/awt/FontStrikeout.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <org/openoffice/excel/XlColorIndex.hpp>
-#include <org/openoffice/excel/XlUnderlineStyle.hpp>
-#include "vbafont.hxx"
-#include "scitems.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-// use local constants there is no need to expose these constants
-// externally. Looking at the Format->Character dialog it seem that
-// these may infact be even be calculated. Leave hardcoded for now
-// #FIXEME #TBD investigate the code for dialog mentioned above
-
-// The font baseline is not specified.
-const short NORMAL = 0;
-
-// specifies a superscripted.
-const short SUPERSCRIPT = 33;
-
-// specifies a subscripted.
-const short SUBSCRIPT = -33;
-
-// specifies a hight of superscripted font
- const sal_Int8 SUPERSCRIPTHEIGHT = 58;
-
-// specifies a hight of subscripted font
-const sal_Int8 SUBSCRIPTHEIGHT = 58;
-
-// specifies a hight of normal font
-const short NORMALHEIGHT = 100;
-
-ScVbaFont::ScVbaFont( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, uno::Reference< beans::XPropertySet > xPropertySet, SfxItemSet* pDataSet ) throw ( uno::RuntimeException ) : ScVbaFont_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mPalette( dPalette ), mpDataSet( pDataSet )
-{
-}
-
-void SAL_CALL
-ScVbaFont::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
-{
-
- sal_Bool bValue = sal_False;
- aValue >>= bValue;
- sal_Int16 nValue = NORMAL;
- sal_Int8 nValue2 = NORMALHEIGHT;
-
- if( bValue )
- {
- nValue = SUPERSCRIPT;
- nValue2 = SUPERSCRIPTHEIGHT;
- }
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue );
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getSuperscript() throw ( uno::RuntimeException )
-{
- short nValue = 0;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
- return uno::makeAny( ( nValue == SUPERSCRIPT ) );
-}
-
-void SAL_CALL
-ScVbaFont::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
-{
- sal_Bool bValue = sal_False;
- aValue >>= bValue;
- sal_Int16 nValue = NORMAL;
- sal_Int8 nValue2 = NORMALHEIGHT;
-
- if( bValue )
- {
- nValue= SUBSCRIPT;
- nValue2 = SUBSCRIPTHEIGHT;
- }
-
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue );
-
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getSubscript() throw ( uno::RuntimeException )
-{
- short nValue = NORMAL;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
- return uno::makeAny( ( nValue == SUBSCRIPT ) );
-}
-
-void SAL_CALL
-ScVbaFont::setSize( const uno::Any& aValue ) throw( uno::RuntimeException )
-{
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), aValue );
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getSize() throw ( uno::RuntimeException )
-{
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT_HEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) );
-}
-
-void SAL_CALL
-ScVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException )
-{
- sal_Int32 nIndex = 0;
- _colorindex >>= nIndex;
- // #FIXME xlColorIndexAutomatic & xlColorIndexNone are not really
- // handled properly here
-
- if ( !nIndex || ( nIndex == excel::XlColorIndex::xlColorIndexAutomatic ) )
- nIndex = 1; // check defualt ( assume black )
- --nIndex; // OOo indices are zero bases
- uno::Reference< container::XIndexAccess > xIndex = mPalette.getPalette();
- // setColor expects colors in XL RGB values
- // #FIXME this is daft we convert OO RGB val to XL RGB val and
- // then back again to OO RGB value
- setColor( OORGBToXLRGB(xIndex->getByIndex( nIndex )) );
-}
-
-
-uno::Any SAL_CALL
-ScVbaFont::getColorIndex() throw ( uno::RuntimeException )
-{
- sal_Int32 nColor = 0;
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT_COLOR, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
-
- // getColor returns Xl ColorValue, need to convert it to OO val
- // as the palette deals with OO RGB values
- // #FIXME this is daft in getColor we convert OO RGB val to XL RGB val
- // and then back again to OO RGB value
- XLRGBToOORGB( getColor() ) >>= nColor;
- uno::Reference< container::XIndexAccess > xIndex = mPalette.getPalette();
- sal_Int32 nElems = xIndex->getCount();
- sal_Int32 nIndex = -1;
- for ( sal_Int32 count=0; count<nElems; ++count )
- {
- sal_Int32 nPaletteColor = 0;
- xIndex->getByIndex( count ) >>= nPaletteColor;
- if ( nPaletteColor == nColor )
- {
- nIndex = count + 1; // 1 based
- break;
- }
- }
- return uno::makeAny( nIndex );
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL
-ScVbaFont::setStandardFontSize( const uno::Any& /*aValue*/ ) throw( uno::RuntimeException )
-{
-//XXX #TODO# #FIXME#
- //mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharSize" ) ), ( uno::Any )fValue );
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setStandardFontSize not supported") ), uno::Reference< uno::XInterface >() );
-}
-
-
-uno::Any SAL_CALL
-ScVbaFont::getStandardFontSize() throw ( uno::RuntimeException )
-{
-//XXX #TODO# #FIXME#
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getStandardFontSize not supported") ), uno::Reference< uno::XInterface >() );
- return uno::Any();
-}
-
-
-void SAL_CALL
-ScVbaFont::setStandardFont( const uno::Any& /*aValue*/ ) throw( uno::RuntimeException )
-{
-//XXX #TODO# #FIXME#
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setStandardFont not supported") ), uno::Reference< uno::XInterface >() );
-}
-
-
-uno::Any SAL_CALL
-ScVbaFont::getStandardFont() throw ( uno::RuntimeException )
-{
-//XXX #TODO# #FIXME#
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getStandardFont not supported") ), uno::Reference< uno::XInterface >() );
- return uno::Any();
-}
-
-void SAL_CALL
-ScVbaFont::setFontStyle( const uno::Any& /*aValue*/ ) throw( uno::RuntimeException )
-{
-//XXX #TODO# #FIXME#
- //mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharSize" ) ), ( uno::Any )aValue );
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setFontStyle not supported") ), uno::Reference< uno::XInterface >() );
-}
-
-
-uno::Any SAL_CALL
-ScVbaFont::getFontStyle() throw ( uno::RuntimeException )
-{
-//XXX
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getFontStyle not supported") ), uno::Reference< uno::XInterface >() );
- return uno::Any();
-}
-
-void SAL_CALL
-ScVbaFont::setBold( const uno::Any& aValue ) throw( uno::RuntimeException )
-{
- sal_Bool bValue = sal_False;
- aValue >>= bValue;
- double fBoldValue = awt::FontWeight::NORMAL;
- if( bValue )
- fBoldValue = awt::FontWeight::BOLD;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), ( uno::Any )fBoldValue );
-
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getBold() throw ( uno::RuntimeException )
-{
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT_WEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
-
- double fValue = 0.0;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ) >>= fValue;
- return uno::makeAny( fValue == awt::FontWeight::BOLD );
-}
-
-void SAL_CALL
-ScVbaFont::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException )
-{
- // default
- sal_Int32 nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone;
- aValue >>= nValue;
- switch ( nValue )
- {
-// NOTE:: #TODO #FIMXE
-// xlUnderlineStyleDoubleAccounting & xlUnderlineStyleSingleAccounting
-// don't seem to be supported in Openoffice.
-// The import filter converts them to single or double underlines as appropriate
-// So, here at the moment we are similarly silently converting
-// xlUnderlineStyleSingleAccounting to xlUnderlineStyleSingle.
-
- case excel::XlUnderlineStyle::xlUnderlineStyleNone:
- nValue = awt::FontUnderline::NONE;
- break;
- case excel::XlUnderlineStyle::xlUnderlineStyleSingle:
- case excel::XlUnderlineStyle::xlUnderlineStyleSingleAccounting:
- nValue = awt::FontUnderline::SINGLE;
- break;
- case excel::XlUnderlineStyle::xlUnderlineStyleDouble:
- case excel::XlUnderlineStyle::xlUnderlineStyleDoubleAccounting:
- nValue = awt::FontUnderline::DOUBLE;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value for Underline")), uno::Reference< uno::XInterface >() );
- }
-
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), ( uno::Any )nValue );
-
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getUnderline() throw ( uno::RuntimeException )
-{
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT_UNDERLINE, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
-
- sal_Int32 nValue = awt::FontUnderline::NONE;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ) ) >>= nValue;
- switch ( nValue )
- {
- case awt::FontUnderline::DOUBLE:
- nValue = excel::XlUnderlineStyle::xlUnderlineStyleDouble;
- break;
- case awt::FontUnderline::SINGLE:
- nValue = excel::XlUnderlineStyle::xlUnderlineStyleSingle;
- break;
- case awt::FontUnderline::NONE:
- nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value retrieved for Underline") ), uno::Reference< uno::XInterface >() );
-
- }
- return uno::makeAny( nValue );
-}
-
-void SAL_CALL
-ScVbaFont::setStrikethrough( const uno::Any& aValue ) throw ( uno::RuntimeException )
-{
- sal_Bool bValue = sal_False;
- aValue >>= bValue;
- short nValue = awt::FontStrikeout::NONE;
- if( bValue )
- nValue = awt::FontStrikeout::SINGLE;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ), ( uno::Any )nValue );
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getStrikethrough() throw ( uno::RuntimeException )
-{
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT_CROSSEDOUT, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
- short nValue = 0;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue;
- return uno::Any( nValue == awt::FontStrikeout::SINGLE );
-}
-
-void SAL_CALL
-ScVbaFont::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException )
-{
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue );
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getShadow() throw (uno::RuntimeException)
-{
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT_SHADOWED, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) );
-}
-
-void SAL_CALL
-ScVbaFont::setItalic( const uno::Any& aValue ) throw ( uno::RuntimeException )
-{
- sal_Bool bValue = sal_False;
- aValue >>= bValue;
- short nValue = awt::FontSlant_NONE;
- if( bValue )
- nValue = awt::FontSlant_ITALIC;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), ( uno::Any )nValue );
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getItalic() throw ( uno::RuntimeException )
-{
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT_POSTURE, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
-
- short nValue = 0;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= nValue;
- return uno::makeAny( nValue == awt::FontSlant_ITALIC );
-}
-
-void SAL_CALL
-ScVbaFont::setName( const uno::Any& aValue ) throw ( uno::RuntimeException )
-{
- rtl::OUString sString;
- aValue >>= sString;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), aValue);
-}
-
-uno::Any SAL_CALL
-ScVbaFont::getName() throw ( uno::RuntimeException )
-{
- if ( mpDataSet )
- if ( mpDataSet->GetItemState( ATTR_FONT, TRUE, NULL) == SFX_ITEM_DONTCARE )
- return aNULL();
- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) );
-}
-uno::Any
-ScVbaFont::getColor() throw (uno::RuntimeException)
-{
- uno::Any aAny;
- aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) );
- return aAny;
-}
-
-void
-ScVbaFont::setColor( const uno::Any& _color ) throw (uno::RuntimeException)
-{
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color));
-}
-rtl::OUString&
-ScVbaFont::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFont") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaFont::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Font" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbafont.hxx b/scratch/sc-vba/dead-source/vbafont.hxx
deleted file mode 100644
index 05d1ed3d1..000000000
--- a/scratch/sc-vba/dead-source/vbafont.hxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_FONT_HXX
-#define SC_VBA_FONT_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <org/openoffice/excel/XFont.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include "vbahelperinterface.hxx"
-#include "vbapalette.hxx"
-
-class ScTableSheetsObj;
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XFont > ScVbaFont_BASE;
-
-class ScVbaFont : public ScVbaFont_BASE
-{
- css::uno::Reference< css::beans::XPropertySet > mxFont;
- ScVbaPalette mPalette;
- SfxItemSet* mpDataSet;
-public:
- ScVbaFont( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet, SfxItemSet* pDataSet = NULL ) throw ( css::uno::RuntimeException );
- virtual ~ScVbaFont() {}
-
- // Attributes
- virtual css::uno::Any SAL_CALL getSize() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSize( const css::uno::Any& _size ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getStandardFontSize() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setStandardFontSize( const css::uno::Any& _standardfontsize ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getStandardFont() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setStandardFont( const css::uno::Any& _standardfont ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getFontStyle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFontStyle( const css::uno::Any& _fontstyle ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setBold( const css::uno::Any& _bold ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setStrikethrough( const css::uno::Any& _strikethrough ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setShadow( const css::uno::Any& _shadow ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setItalic( const css::uno::Any& _italic ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getSubscript() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getSuperscript() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const css::uno::Any& _name ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ;
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-
-
-
-#endif /* SC_VBA_FONT_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbaformat.cxx b/scratch/sc-vba/dead-source/vbaformat.cxx
deleted file mode 100644
index 051c15109..000000000
--- a/scratch/sc-vba/dead-source/vbaformat.cxx
+++ /dev/null
@@ -1,786 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbaformat.hxx"
-#include <org/openoffice/excel/XStyle.hpp>
-#include <org/openoffice/excel/XlVAlign.hpp>
-#include <org/openoffice/excel/XlHAlign.hpp>
-#include <org/openoffice/excel/XlOrientation.hpp>
-#include <org/openoffice/excel/Constants.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
-#include <com/sun/star/table/CellHoriJustify.hpp>
-#include <com/sun/star/table/CellOrientation.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/text/WritingMode.hpp>
-#include <com/sun/star/util/CellProtection.hpp>
-
-#include <rtl/math.hxx>
-
-#include "vbaborders.hxx"
-#include "vbapalette.hxx"
-#include "vbafont.hxx"
-#include "vbainterior.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-//strings
-static rtl::OUString VERTJUSTIFY( RTL_CONSTASCII_USTRINGPARAM("VertJustify") );
-static rtl::OUString HORIJUSTIFY( RTL_CONSTASCII_USTRINGPARAM("HoriJustify") );
-static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
-static rtl::OUString ROTATEANGLE( RTL_CONSTASCII_USTRINGPARAM("RotateAngle") );
-static rtl::OUString ISTEXTWRAPPED( RTL_CONSTASCII_USTRINGPARAM("IsTextWrapped") );
-static rtl::OUString NUMBERFORMAT( RTL_CONSTASCII_USTRINGPARAM("NumberFormat") );
-static rtl::OUString FORMATSTRING( RTL_CONSTASCII_USTRINGPARAM("FormatString") );
-static rtl::OUString LOCALE( RTL_CONSTASCII_USTRINGPARAM("Locale") );
-static rtl::OUString PARAINDENT( RTL_CONSTASCII_USTRINGPARAM("ParaIndent") );
-static rtl::OUString CELLPROTECTION( RTL_CONSTASCII_USTRINGPARAM("CellProtection") );
-static rtl::OUString SHRINKTOFIT( RTL_CONSTASCII_USTRINGPARAM("ShrinkToFit") );
-static rtl::OUString WRITINGMODE( RTL_CONSTASCII_USTRINGPARAM("WritingMode") );
-
-template< typename Ifc1 >
-ScVbaFormat< Ifc1 >::ScVbaFormat( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, const uno::Reference< frame::XModel >& xModel, bool bCheckAmbiguoity ) throw ( script::BasicErrorException ) : ScVbaFormat_BASE( xParent, xContext ), m_aDefaultLocale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "US") ), rtl::OUString() ), mxPropertySet( _xPropertySet ), mxModel( xModel ), mbCheckAmbiguoity( bCheckAmbiguoity ), mbAddIndent( sal_False )
-{
- try
- {
- mxServiceInfo.set( mxPropertySet, uno::UNO_QUERY_THROW );
- if ( !mxModel.is() )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XModel Interface could not be retrieved") ) );
- mxNumberFormatsSupplier.set( mxModel, uno::UNO_QUERY_THROW );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setVerticalAlignment( const uno::Any& _oAlignment) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Int32 nAlignment = 0;
- if ( !(_oAlignment >>= nAlignment ))
- throw uno::RuntimeException();
- switch (nAlignment)
- {
- case excel::XlVAlign::xlVAlignBottom :
- mxPropertySet->setPropertyValue(VERTJUSTIFY, uno::makeAny( table::CellVertJustify_BOTTOM ) );
- break;
- case excel::XlVAlign::xlVAlignCenter :
- mxPropertySet->setPropertyValue(VERTJUSTIFY, uno::makeAny( table::CellVertJustify_CENTER ) );
- break;
- case excel::XlVAlign::xlVAlignDistributed:
- case excel::XlVAlign::xlVAlignJustify:
- mxPropertySet->setPropertyValue(VERTJUSTIFY, uno::makeAny( table::CellVertJustify_STANDARD ));
- break;
-
- case excel::XlVAlign::xlVAlignTop:
- mxPropertySet->setPropertyValue(VERTJUSTIFY, uno::makeAny( table::CellVertJustify_TOP) );
- break;
- default:
- mxPropertySet->setPropertyValue(VERTJUSTIFY, uno::makeAny( table::CellVertJustify_STANDARD ));
- break;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getVerticalAlignment( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aResult = aNULL();
- try
- {
- if (!isAmbiguous(VERTJUSTIFY))
- {
- table::CellVertJustify aAPIAlignment;
- mxPropertySet->getPropertyValue(VERTJUSTIFY) >>= aAPIAlignment;
- switch( aAPIAlignment )
- {
- case table::CellVertJustify_BOTTOM:
- aResult = uno::makeAny( excel::XlVAlign::xlVAlignBottom );
- break;
- case table::CellVertJustify_CENTER:
- aResult = uno::makeAny( excel::XlVAlign::xlVAlignCenter );
- break;
- case table::CellVertJustify_STANDARD:
- aResult = uno::makeAny( excel::XlVAlign::xlVAlignBottom );
- break;
- case table::CellVertJustify_TOP:
- aResult = uno::makeAny( excel::XlVAlign::xlVAlignTop );
- break;
- default:
- break;
- }
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return aResult;
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setHorizontalAlignment( const uno::Any& HorizontalAlignment ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Int32 nAlignment = 0;
- if ( !( HorizontalAlignment >>= nAlignment ) )
- throw uno::RuntimeException();
- switch ( nAlignment )
- {
- case excel::XlHAlign::xlHAlignJustify:
- mxPropertySet->setPropertyValue(HORIJUSTIFY, uno::makeAny( table::CellHoriJustify_BLOCK) );
- break;
- case excel::XlHAlign::xlHAlignCenter:
- mxPropertySet->setPropertyValue(HORIJUSTIFY, uno::makeAny( table::CellHoriJustify_CENTER ));
- break;
- case excel::XlHAlign::xlHAlignDistributed:
- mxPropertySet->setPropertyValue(HORIJUSTIFY,uno::makeAny( table::CellHoriJustify_BLOCK) );
- break;
- case excel::XlHAlign::xlHAlignLeft:
- mxPropertySet->setPropertyValue( HORIJUSTIFY, uno::makeAny( table::CellHoriJustify_LEFT) );
- break;
- case excel::XlHAlign::xlHAlignRight:
- mxPropertySet->setPropertyValue(HORIJUSTIFY, uno::makeAny( table::CellHoriJustify_RIGHT));
- break;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getHorizontalAlignment( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any NRetAlignment = aNULL();
- try
- {
- if (!isAmbiguous(HORIJUSTIFY))
- {
- table::CellHoriJustify aAPIAlignment = table::CellHoriJustify_BLOCK;
-
- if ( mxPropertySet->getPropertyValue(HORIJUSTIFY) >>= aAPIAlignment )
- {
- switch( aAPIAlignment )
- {
- case table::CellHoriJustify_BLOCK:
- NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignJustify );
- break;
- case table::CellHoriJustify_CENTER:
- NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignCenter );
- break;
- case table::CellHoriJustify_LEFT:
- NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignLeft );
- break;
- case table::CellHoriJustify_RIGHT:
- NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignRight );
- break;
- default: // handle those other cases with a NULL return
- break;
- }
- }
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return NRetAlignment;
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setOrientation( const uno::Any& _aOrientation ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Int32 nOrientation = 0;
- if ( !( _aOrientation >>= nOrientation ) )
- throw uno::RuntimeException();
- switch( nOrientation )
- {
- case excel::XlOrientation::xlDownward:
- mxPropertySet->setPropertyValue(ORIENTATION,uno::makeAny( table::CellOrientation_TOPBOTTOM));
- break;
- case excel::XlOrientation::xlHorizontal:
- mxPropertySet->setPropertyValue(ORIENTATION, uno::makeAny( table::CellOrientation_STANDARD ));
- mxPropertySet->setPropertyValue(ROTATEANGLE, uno::makeAny( sal_Int32(0) ) );
- break;
- case excel::XlOrientation::xlUpward:
- mxPropertySet->setPropertyValue(ORIENTATION, uno::makeAny( table::CellOrientation_BOTTOMTOP));
- break;
- case excel::XlOrientation::xlVertical:
- mxPropertySet->setPropertyValue(ORIENTATION, uno::makeAny( table::CellOrientation_STACKED) );
- break;
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getOrientation( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any NRetOrientation = aNULL();
- try
- {
- if (!isAmbiguous(ORIENTATION))
- {
- table::CellOrientation aOrientation = table::CellOrientation_STANDARD;
- if ( !( mxPropertySet->getPropertyValue(ORIENTATION ) >>= aOrientation ) )
- throw uno::RuntimeException();
-
- switch(aOrientation)
- {
- case table::CellOrientation_STANDARD:
- NRetOrientation = uno::makeAny( excel::XlOrientation::xlHorizontal );
- break;
- case table::CellOrientation_BOTTOMTOP:
- NRetOrientation = uno::makeAny( excel::XlOrientation::xlUpward );
- break;
- case table::CellOrientation_TOPBOTTOM:
- NRetOrientation = uno::makeAny( excel::XlOrientation::xlDownward );
- break;
- case table::CellOrientation_STACKED:
- NRetOrientation = uno::makeAny( excel::XlOrientation::xlVertical );
- break;
- default:
- NRetOrientation = uno::makeAny( excel::XlOrientation::xlHorizontal );
- }
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return NRetOrientation;
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setWrapText( const uno::Any& _aWrapText ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- mxPropertySet->setPropertyValue(ISTEXTWRAPPED, _aWrapText);
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getWrapText( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aWrap = aNULL();
- try
- {
- if (!isAmbiguous(ISTEXTWRAPPED))
- {
- aWrap = mxPropertySet->getPropertyValue(ISTEXTWRAPPED);
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return aWrap;
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::Borders( const uno::Any& Index ) throw (script::BasicErrorException, uno::RuntimeException )
-{
- ScVbaPalette aPalette( getDocShell( mxModel ) );
- uno::Reference< vba::XCollection > xColl = new ScVbaBorders( thisHelperIface(), ScVbaFormat_BASE::mxContext, uno::Reference< table::XCellRange >( mxPropertySet, uno::UNO_QUERY_THROW ), aPalette );
-
- if ( Index.hasValue() )
- {
- return xColl->Item( Index, uno::Any() );
- }
- return uno::makeAny( xColl );
-}
-
-template< typename Ifc1 >
-uno::Reference< excel::XFont > SAL_CALL
-ScVbaFormat<Ifc1>::Font( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- ScVbaPalette aPalette( getDocShell( mxModel ) );
- return new ScVbaFont( thisHelperIface(), ScVbaFormat_BASE::mxContext, aPalette, mxPropertySet );
-}
-
-template< typename Ifc1 >
-uno::Reference< excel::XInterior > SAL_CALL
-ScVbaFormat<Ifc1>::Interior( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return new ScVbaInterior( thisHelperIface(), ScVbaFormat_BASE::mxContext, mxPropertySet );
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getNumberFormatLocal( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aRet = uno::makeAny( rtl::OUString() );
- try
- {
- if (!isAmbiguous(NUMBERFORMAT))
- {
-
- initializeNumberFormats();
-
- sal_Int32 nFormat = 0;
- if ( ! (mxPropertySet->getPropertyValue(NUMBERFORMAT) >>= nFormat ) )
- throw uno::RuntimeException();
-
- rtl::OUString sFormat;
- xNumberFormats->getByKey(nFormat)->getPropertyValue(FORMATSTRING) >>= sFormat;
- aRet = uno::makeAny( sFormat.toAsciiLowerCase() );
-
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return aRet;
-
-}
-
-template< typename Ifc1 >
-void
-ScVbaFormat<Ifc1>::setNumberFormat( lang::Locale _aLocale, const rtl::OUString& _sFormatString) throw( script::BasicErrorException )
-{
- try
- {
- initializeNumberFormats();
- sal_Int32 nFormat = xNumberFormats->queryKey(_sFormatString, _aLocale , sal_True);
- if (nFormat == -1)
- {
- xNumberFormats->addNew(_sFormatString, _aLocale);
- }
- mxPropertySet->setPropertyValue(NUMBERFORMAT, uno::makeAny( nFormat ) );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setNumberFormatLocal( const uno::Any& _oLocalFormatString ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- rtl::OUString sLocalFormatString;
- sal_Int32 nFormat = -1;
- if ( !(_oLocalFormatString >>= sLocalFormatString )
- || !( mxPropertySet->getPropertyValue(NUMBERFORMAT) >>= nFormat ) )
- throw uno::RuntimeException();
-
- sLocalFormatString = sLocalFormatString.toAsciiUpperCase();
- initializeNumberFormats();
- lang::Locale aRangeLocale;
- xNumberFormats->getByKey(nFormat)->getPropertyValue(LOCALE) >>= aRangeLocale;
- sal_Int32 nNewFormat = xNumberFormats->queryKey(sLocalFormatString, aRangeLocale, sal_True);
-
- if (nNewFormat == -1)
- nNewFormat = xNumberFormats->addNew(sLocalFormatString, aRangeLocale);
- mxPropertySet->setPropertyValue(NUMBERFORMAT, uno::makeAny( nNewFormat ));
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setNumberFormat( const uno::Any& _oFormatString ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- rtl::OUString sFormatString;
- if ( !( _oFormatString >>= sFormatString ) )
- throw uno::RuntimeException();
-
- sFormatString = sFormatString.toAsciiUpperCase();
-
- lang::Locale aDefaultLocale = m_aDefaultLocale;
- initializeNumberFormats();
- sal_Int32 nFormat = xNumberFormats->queryKey(sFormatString, aDefaultLocale, sal_True);
-
- if (nFormat == -1)
- nFormat = xNumberFormats->addNew(sFormatString, aDefaultLocale);
-
- lang::Locale aRangeLocale;
- xNumberFormats->getByKey(nFormat)->getPropertyValue(LOCALE) >>= aRangeLocale;
- sal_Int32 nNewFormat = xNumberFormatTypes->getFormatForLocale(nFormat, aRangeLocale);
- mxPropertySet->setPropertyValue(NUMBERFORMAT, uno::makeAny( nNewFormat));
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setIndentLevel( const uno::Any& _aLevel ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Int32 nLevel = 0;
- if ( !(_aLevel >>= nLevel ) )
- throw uno::RuntimeException();
- table::CellHoriJustify aAPIAlignment = table::CellHoriJustify_STANDARD;
- if ( !( mxPropertySet->getPropertyValue(HORIJUSTIFY) >>= aAPIAlignment ) )
- throw uno::RuntimeException();
- if (aAPIAlignment == table::CellHoriJustify_STANDARD)
- mxPropertySet->setPropertyValue( HORIJUSTIFY, uno::makeAny( table::CellHoriJustify_LEFT) ) ;
- mxPropertySet->setPropertyValue(PARAINDENT, uno::makeAny( sal_Int16(nLevel * 352.8) ) );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getIndentLevel( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any NRetIndentLevel = aNULL();
- try
- {
- if (!isAmbiguous(PARAINDENT))
- {
- sal_Int16 IndentLevel = 0;
- if ( ( mxPropertySet->getPropertyValue(PARAINDENT) >>= IndentLevel ) )
- NRetIndentLevel = uno::makeAny( sal_Int32( rtl::math::round(static_cast<double>( IndentLevel ) / 352.8)) );
- else
- NRetIndentLevel = uno::makeAny( sal_Int32(0) );
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return NRetIndentLevel;
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setLocked( const uno::Any& _aLocked ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Bool bIsLocked = sal_False;
- if ( !( _aLocked >>= bIsLocked ) )
- throw uno::RuntimeException();
- util::CellProtection aCellProtection;
- mxPropertySet->getPropertyValue(CELLPROTECTION) >>= aCellProtection;
- aCellProtection.IsLocked = bIsLocked;
- mxPropertySet->setPropertyValue(CELLPROTECTION, uno::makeAny( aCellProtection ) );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setFormulaHidden( const uno::Any& FormulaHidden ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Bool bIsFormulaHidden = sal_False;
- FormulaHidden >>= bIsFormulaHidden;
- util::CellProtection aCellProtection;
- mxPropertySet->getPropertyValue(CELLPROTECTION) >>= aCellProtection;
- aCellProtection.IsFormulaHidden = bIsFormulaHidden;
- mxPropertySet->setPropertyValue(CELLPROTECTION,uno::makeAny(aCellProtection));
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception( SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getLocked( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aCellProtection = aNULL();
- try
- {
- if (!isAmbiguous(CELLPROTECTION))
- {
- util::CellProtection cellProtection;
- mxPropertySet->getPropertyValue(CELLPROTECTION) >>= cellProtection;
-
- aCellProtection = uno::makeAny( cellProtection.IsLocked );
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return aCellProtection;
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getFormulaHidden( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aBoolRet = aNULL();
- try
- {
- if (!isAmbiguous(CELLPROTECTION))
- {
- util::CellProtection aCellProtection;
- mxPropertySet->getPropertyValue(CELLPROTECTION) >>= aCellProtection;
- aBoolRet = uno::makeAny( aCellProtection.IsFormulaHidden );
- }
- }
- catch (uno::Exception e)
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return aBoolRet;
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setShrinkToFit( const uno::Any& ShrinkToFit ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- mxPropertySet->setPropertyValue(SHRINKTOFIT, ShrinkToFit);
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString() );
- }
-
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getShrinkToFit( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aRet = aNULL();
- try
- {
- if (!isAmbiguous(SHRINKTOFIT))
- aRet = mxPropertySet->getPropertyValue(SHRINKTOFIT);
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- }
- return aRet;
-}
-
-template< typename Ifc1 >
-void SAL_CALL
-ScVbaFormat<Ifc1>::setReadingOrder( const uno::Any& ReadingOrder ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Int32 nReadingOrder = 0;
- if ( !(ReadingOrder >>= nReadingOrder ))
- throw uno::RuntimeException();
- switch(nReadingOrder)
- {
- case excel::Constants::xlLTR:
- mxPropertySet->setPropertyValue(WRITINGMODE, uno::makeAny( text::WritingMode_LR_TB ));
- break;
- case excel::Constants::xlRTL:
- mxPropertySet->setPropertyValue(WRITINGMODE, uno::makeAny( text::WritingMode_RL_TB ));
- break;
- case excel::Constants::xlContext:
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- break;
- default:
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat<Ifc1>::getReadingOrder( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any NRetReadingOrder = aNULL();
- try
- {
- if (!isAmbiguous(WRITINGMODE))
- {
- text::WritingMode aWritingMode = text::WritingMode_LR_TB;
- if ( ( mxPropertySet->getPropertyValue(WRITINGMODE) ) >>= aWritingMode )
- switch (aWritingMode){
- case text::WritingMode_LR_TB:
- NRetReadingOrder = uno::makeAny(excel::Constants::xlLTR);
- break;
- case text::WritingMode_RL_TB:
- NRetReadingOrder = uno::makeAny(excel::Constants::xlRTL);
- break;
- default:
- NRetReadingOrder = uno::makeAny(excel::Constants::xlRTL);
- }
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- }
- return NRetReadingOrder;
-
-}
-
-template< typename Ifc1 >
-uno::Any SAL_CALL
-ScVbaFormat< Ifc1 >::getNumberFormat( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aFormat = aNULL();
- try
- {
- sal_Int32 nFormat = -1;
- if (!isAmbiguous(NUMBERFORMAT) &&
- ( mxPropertySet->getPropertyValue(NUMBERFORMAT) >>= nFormat) )
- {
- initializeNumberFormats();
-
- sal_Int32 nNewFormat = xNumberFormatTypes->getFormatForLocale(nFormat, getDefaultLocale() );
- rtl::OUString sFormat;
- xNumberFormats->getByKey(nNewFormat)->getPropertyValue(FORMATSTRING) >>= sFormat;
- aFormat = uno::makeAny( sFormat );
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return aFormat;
-}
-
-template< typename Ifc1 >
-bool
-ScVbaFormat<Ifc1>::isAmbiguous(const rtl::OUString& _sPropertyName) throw ( script::BasicErrorException )
-{
- bool bResult = false;
- try
- {
- if (mbCheckAmbiguoity)
- bResult = ( getXPropertyState()->getPropertyState(_sPropertyName) == beans::PropertyState_AMBIGUOUS_VALUE );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return bResult;
-}
-
-template< typename Ifc1 >
-void
-ScVbaFormat<Ifc1>::initializeNumberFormats() throw ( script::BasicErrorException )
-{
- if ( !xNumberFormats.is() )
- {
- mxNumberFormatsSupplier.set( mxModel, uno::UNO_QUERY_THROW );
- xNumberFormats = mxNumberFormatsSupplier->getNumberFormats();
- xNumberFormatTypes.set( xNumberFormats, uno::UNO_QUERY ); // _THROW?
- }
-}
-
-template< typename Ifc1 >
-uno::Reference< beans::XPropertyState >
-ScVbaFormat<Ifc1>::getXPropertyState() throw ( uno::RuntimeException )
-{
- if ( !xPropertyState.is() )
- xPropertyState.set( mxPropertySet, uno::UNO_QUERY_THROW );
- return xPropertyState;
-}
-
-template< typename Ifc1 >
-rtl::OUString&
-ScVbaFormat<Ifc1>::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFormat") );
- return sImplName;
-}
-
-template< typename Ifc1 >
-uno::Sequence< rtl::OUString >
-ScVbaFormat<Ifc1>::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Format" ) );
- }
- return aServiceNames;
-}
-
-template class ScVbaFormat< excel::XStyle >;
-template class ScVbaFormat< excel::XRange >;
-
-
diff --git a/scratch/sc-vba/dead-source/vbaformat.hxx b/scratch/sc-vba/dead-source/vbaformat.hxx
deleted file mode 100644
index 9990e92dc..000000000
--- a/scratch/sc-vba/dead-source/vbaformat.hxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_FORMAT_HXX
-#define SC_VBA_FORMAT_HXX
-#include <org/openoffice/excel/XFormat.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/util/XNumberFormats.hpp>
-#include <com/sun/star/util/XNumberFormatTypes.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/beans/XPropertyState.hpp>
-#include "vbahelperinterface.hxx"
-
-template< typename Ifc1 >
-class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
-{
-typedef InheritedHelperInterfaceImpl1< Ifc1 > ScVbaFormat_BASE;
- css::lang::Locale m_aDefaultLocale;
-protected:
- css::lang::Locale getDefaultLocale() { return m_aDefaultLocale; }
- css::uno::Reference< css::beans::XPropertySet > mxPropertySet;
- css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
- css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
- css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes;
- css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::lang::XServiceInfo > mxServiceInfo;
- css::uno::Reference< css::beans::XPropertyState > xPropertyState;
- sal_Bool mbCheckAmbiguoity;
- sal_Bool mbAddIndent;
- //NumberFormatter oNumberFormatter = null;
- css::uno::Reference< css::lang::XMultiServiceFactory > xMultiServiceFactory;
- bool isAmbiguous(const rtl::OUString& _sPropertyName) throw ( css::script::BasicErrorException );
- 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 );
-public:
- ScVbaFormat( const css::uno::Reference< oo::vba::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() {}
- virtual css::uno::Reference< oo::vba::XHelperInterface > thisHelperIface() = 0;
- css::uno::Reference< css::lang::XServiceInfo > getXServiceInfo() { return mxServiceInfo; }
- void SAL_CALL setAddIndent( const css::uno::Any& _BAddIndent) throw( css::uno::RuntimeException ) { _BAddIndent >>= mbAddIndent; }
- css::uno::Any SAL_CALL getAddIndent() throw( css::uno::RuntimeException ) { return css::uno::makeAny( mbAddIndent ); }
- // Interface Methods
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Reference< ::org::openoffice::excel::XFont > SAL_CALL Font( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Reference< ::org::openoffice::excel::XInterior > SAL_CALL Interior( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setNumberFormat( const css::uno::Any& NumberFormat ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getNumberFormat( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setNumberFormatLocal( const css::uno::Any& NumberFormatLocal ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getNumberFormatLocal( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setIndentLevel( const css::uno::Any& IndentLevel ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getIndentLevel( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setHorizontalAlignment( const css::uno::Any& HorizontalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getHorizontalAlignment( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setVerticalAlignment( const css::uno::Any& VerticalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getVerticalAlignment( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setOrientation( const css::uno::Any& Orientation ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getOrientation( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setShrinkToFit( const css::uno::Any& ShrinkToFit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getShrinkToFit( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setWrapText( const css::uno::Any& WrapText ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getWrapText( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setLocked( const css::uno::Any& Locked ) 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 setFormulaHidden( const css::uno::Any& FormulaHidden ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getFormulaHidden( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setMergeCells( const css::uno::Any& MergeCells ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
- virtual css::uno::Any SAL_CALL getMergeCells( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
- virtual void SAL_CALL setReadingOrder( const css::uno::Any& ReadingOrder ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getReadingOrder( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif
diff --git a/scratch/sc-vba/dead-source/vbaformatcondition.cxx b/scratch/sc-vba/dead-source/vbaformatcondition.cxx
deleted file mode 100644
index a172db8fc..000000000
--- a/scratch/sc-vba/dead-source/vbaformatcondition.cxx
+++ /dev/null
@@ -1,184 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbaformatcondition.hxx"
-#include "vbaformatconditions.hxx"
-#include <org/openoffice/excel/XlFormatConditionType.hpp>
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-ScVbaFormatConditions*
-lcl_getScVbaFormatConditionsPtr( const uno::Reference< excel::XFormatConditions >& xFormatConditions ) throw ( script::BasicErrorException )
-{
- ScVbaFormatConditions* pFormatConditions = static_cast< ScVbaFormatConditions* >( xFormatConditions.get() );
- if ( !pFormatConditions )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- return pFormatConditions;
-}
-ScVbaFormatCondition::ScVbaFormatCondition( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< sheet::XSheetConditionalEntry >& _xSheetConditionalEntry, const uno::Reference< excel::XStyle >& _xStyle, const uno::Reference< excel::XFormatConditions >& _xFormatConditions, const uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::uno::RuntimeException ) : ScVbaFormatCondition_BASE( xParent, xContext, uno::Reference< sheet::XSheetCondition >( _xSheetConditionalEntry, css::uno::UNO_QUERY_THROW ) ), moFormatConditions( _xFormatConditions ), mxStyle( _xStyle ), mxParentRangePropertySet( _xPropertySet )
-{
- mxSheetConditionalEntries = lcl_getScVbaFormatConditionsPtr( moFormatConditions )->getSheetConditionalEntries();
-
- mxSheetConditionalEntry = _xSheetConditionalEntry;
- msStyleName = mxStyle->getName();
-}
-
-
-void SAL_CALL
-ScVbaFormatCondition::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- ScVbaFormatConditions* pFormatConditions = lcl_getScVbaFormatConditionsPtr( moFormatConditions );
- pFormatConditions->removeFormatCondition(msStyleName, sal_True);
- notifyRange();
-}
-
-void SAL_CALL
-ScVbaFormatCondition::Modify( ::sal_Int32 _nType, const uno::Any& _aOperator, const uno::Any& _aFormula1, const uno::Any& _aFormula2 ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- ScVbaFormatConditions* pFormatConditions = lcl_getScVbaFormatConditionsPtr( moFormatConditions );
- pFormatConditions->removeFormatCondition(msStyleName, sal_False);
- pFormatConditions->Add(_nType, _aOperator, _aFormula1, _aFormula2, mxStyle);
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-uno::Reference< excel::XInterior > SAL_CALL
-ScVbaFormatCondition::Interior( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return mxStyle->Interior();
-}
-
-uno::Reference< excel::XFont > SAL_CALL
-ScVbaFormatCondition::Font( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return mxStyle->Font();
-}
-uno::Any SAL_CALL
-ScVbaFormatCondition::Borders( const uno::Any& Index ) throw (script::BasicErrorException, uno::RuntimeException)
-{ return mxStyle->Borders( Index );
-}
-
-sheet::ConditionOperator
-ScVbaFormatCondition::retrieveAPIType(sal_Int32 _nVBAType, const uno::Reference< sheet::XSheetCondition >& _xSheetCondition ) throw ( script::BasicErrorException )
-{
- sheet::ConditionOperator aAPIType = sheet::ConditionOperator_NONE;
- switch (_nVBAType)
- {
- case excel::XlFormatConditionType::xlExpression:
- aAPIType = sheet::ConditionOperator_FORMULA;
- break;
- case excel::XlFormatConditionType::xlCellValue:
- if ( _xSheetCondition.is() && (_xSheetCondition->getOperator() == sheet::ConditionOperator_FORMULA ) )
- aAPIType = sheet::ConditionOperator_NONE;
- break;
- default:
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return aAPIType;
-}
-
-void
-ScVbaFormatCondition::setFormula1( const uno::Any& _aFormula1) throw ( script::BasicErrorException )
-{
- // getA1Formula *SHOULD* detect whether the formula is r1c1 or A1 syntax
- // and if R1C1 convert to A1
- ScVbaFormatCondition_BASE::setFormula1( uno::makeAny( lcl_getScVbaFormatConditionsPtr( moFormatConditions )->getA1Formula(_aFormula1) ) );
-}
-
-void
-ScVbaFormatCondition::setFormula2( const uno::Any& _aFormula2) throw ( script::BasicErrorException )
-{
- ScVbaFormatCondition_BASE::setFormula1( uno::makeAny( lcl_getScVbaFormatConditionsPtr( moFormatConditions )->getA1Formula(_aFormula2)) );
-}
-
-::sal_Int32 SAL_CALL
-ScVbaFormatCondition::Type( ) throw ( script::BasicErrorException, uno::RuntimeException )
-{
- sal_Int32 nReturnType = 0;
- if ( mxSheetCondition->getOperator() == sheet::ConditionOperator_FORMULA)
- nReturnType = excel::XlFormatConditionType::xlExpression;
- else
- nReturnType = excel::XlFormatConditionType::xlCellValue;
- return nReturnType;
-}
-
-
-::sal_Int32
-ScVbaFormatCondition::Operator( sal_Bool bVal ) throw (script::BasicErrorException )
-{
- return ScVbaFormatCondition_BASE::Operator( bVal );
-}
-::sal_Int32 SAL_CALL
-ScVbaFormatCondition::Operator( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return ScVbaFormatCondition_BASE::Operator( sal_True );
-}
-
-void
-ScVbaFormatCondition::notifyRange() throw ( script::BasicErrorException )
-{
- try
- {
- mxParentRangePropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ConditionalFormat") ), uno::makeAny( mxSheetConditionalEntries) );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
-}
-
-rtl::OUString&
-ScVbaFormatCondition::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFormatCondition") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaFormatCondition::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.FormatCondition" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaformatcondition.hxx b/scratch/sc-vba/dead-source/vbaformatcondition.hxx
deleted file mode 100644
index 88167d8d5..000000000
--- a/scratch/sc-vba/dead-source/vbaformatcondition.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_FORMATCONDITION_HXX
-#define SC_VBA_FORMATCONDITION_HXX
-#include <org/openoffice/excel/XFormatCondition.hpp>
-#include <org/openoffice/excel/XFormatConditions.hpp>
-#include <org/openoffice/excel/XStyle.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
-#include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
-#include <com/sun/star/sheet/XSheetCondition.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include "vbacondition.hxx"
-
-typedef ScVbaCondition< oo::excel::XFormatCondition > ScVbaFormatCondition_BASE;
-class ScVbaFormatCondition : public ScVbaFormatCondition_BASE
-{
-protected:
- rtl::OUString msStyleName;
- css::uno::Reference< css::sheet::XSheetConditionalEntry > mxSheetConditionalEntry;
- css::uno::Reference< css::sheet::XSheetConditionalEntries > mxSheetConditionalEntries;
- css::uno::Reference< oo::excel::XFormatConditions> moFormatConditions;
- css::uno::Reference< oo::excel::XStyle > mxStyle;
- css::uno::Reference< css::beans::XPropertySet > mxParentRangePropertySet;
-public:
- ScVbaFormatCondition( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::sheet::XSheetConditionalEntry >& _xSheetConditionalEntry, const css::uno::Reference< oo::excel::XStyle >&, const css::uno::Reference< oo::excel::XFormatConditions >& _xFormatConditions, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::uno::RuntimeException );
-
- void notifyRange() throw ( css::script::BasicErrorException );
- static css::sheet::ConditionOperator retrieveAPIType(sal_Int32 _nVBAType, const css::uno::Reference< css::sheet::XSheetCondition >& _xSheetCondition ) throw( css::script::BasicErrorException );
-
- //Methods
- virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Modify( ::sal_Int32 Type, const css::uno::Any& Operator, const css::uno::Any& Formula1, const css::uno::Any& Formula2 ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 Operator( sal_Bool ) throw (css::script::BasicErrorException);
- virtual ::sal_Int32 SAL_CALL Operator( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void setFormula1( const css::uno::Any& _aFormula1) throw ( css::script::BasicErrorException );
- virtual void setFormula2( const css::uno::Any& _aFormula2) throw ( css::script::BasicErrorException );
- virtual css::uno::Reference< ::org::openoffice::excel::XInterior > SAL_CALL Interior( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< ::org::openoffice::excel::XFont > SAL_CALL Font( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif
diff --git a/scratch/sc-vba/dead-source/vbaformatconditions.cxx b/scratch/sc-vba/dead-source/vbaformatconditions.cxx
deleted file mode 100644
index e7e96ce2a..000000000
--- a/scratch/sc-vba/dead-source/vbaformatconditions.cxx
+++ /dev/null
@@ -1,308 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-
-#include <org/openoffice/excel/XRange.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
-#include <vector>
-#include "vbaformatconditions.hxx"
-#include "vbaformatcondition.hxx"
-#include "vbaworkbook.hxx"
-#include "vbastyles.hxx"
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-typedef std::vector< beans::PropertyValue > VecPropValues;
-
-static rtl::OUString OPERATOR( RTL_CONSTASCII_USTRINGPARAM("Operator") );
-static rtl::OUString FORMULA1( RTL_CONSTASCII_USTRINGPARAM("Formula1") );
-static rtl::OUString FORMULA2( RTL_CONSTASCII_USTRINGPARAM("Formula2") );
-static rtl::OUString STYLENAME( RTL_CONSTASCII_USTRINGPARAM("StyleName") );
-static rtl::OUString sStyleNamePrefix( RTL_CONSTASCII_USTRINGPARAM("Excel_CondFormat") );
-
-ScVbaFormatConditions::ScVbaFormatConditions( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< sheet::XSheetConditionalEntries >& _xSheetConditionalEntries, const uno::Reference< frame::XModel >& xModel ) : ScVbaFormatConditions_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( _xSheetConditionalEntries, uno::UNO_QUERY_THROW ) ), mxSheetConditionalEntries( _xSheetConditionalEntries )
-{
- mxRangeParent.set( xParent, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XWorkbook > xWorkbook = new ScVbaWorkbook( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel );
- mxStyles.set( xWorkbook->Styles( uno::Any() ), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCellRangeAddressable > xCellRange( mxRangeParent->getCellRange(), uno::UNO_QUERY_THROW );
- mxParentRangePropertySet.set( xCellRange, uno::UNO_QUERY_THROW );
-
- table::CellRangeAddress rangeAddress = xCellRange->getRangeAddress();
- maCellAddress = table::CellAddress( rangeAddress.Sheet, rangeAddress.StartColumn, rangeAddress.StartRow );
-}
-
-void SAL_CALL
-ScVbaFormatConditions::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() );
- if ( !pStyles )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- sal_Int32 nCount = mxSheetConditionalEntries->getCount();
- for (sal_Int32 i = nCount - 1; i >= 0; i--)
- {
- uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry( mxSheetConditionalEntries->getByIndex(i), uno::UNO_QUERY_THROW );
- pStyles->Delete(xSheetConditionalEntry->getStyleName());
- mxSheetConditionalEntries->removeByIndex(i);
- }
- notifyRange();
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-uno::Type SAL_CALL
-ScVbaFormatConditions::getElementType() throw (css::uno::RuntimeException)
-{
- return excel::XFormatCondition::static_type(0);
-}
-
-
-uno::Any xSheetConditionToFormatCondition( const uno::Reference< vba::XHelperInterface >& xRangeParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< excel::XStyles >& xStyles, const uno::Reference< excel::XFormatConditions >& xFormatConditions, const uno::Reference< beans::XPropertySet >& xRangeProps, const uno::Any& aObject )
-{
- uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry;
- aObject >>= xSheetConditionalEntry;
-
- uno::Reference< excel::XStyle > xStyle( xStyles->Item( uno::makeAny( xSheetConditionalEntry->getStyleName() ), uno::Any() ), uno::UNO_QUERY_THROW );
- uno::Reference< excel::XFormatCondition > xCondition = new ScVbaFormatCondition( xRangeParent, xContext, xSheetConditionalEntry, xStyle, xFormatConditions, xRangeProps );
- return uno::makeAny( xCondition );
-}
-
-uno::Any
-ScVbaFormatConditions::createCollectionObject(const uno::Any& aObject )
-{
- return xSheetConditionToFormatCondition( uno::Reference< vba::XHelperInterface >( mxRangeParent, uno::UNO_QUERY_THROW ), mxContext, mxStyles, this, mxParentRangePropertySet, aObject );
-}
-
-class EnumWrapper : public EnumerationHelper_BASE
-{
- uno::Reference<container::XIndexAccess > m_xIndexAccess;
- uno::Reference<excel::XRange > m_xParentRange;
- uno::Reference<uno::XComponentContext > m_xContext;
- uno::Reference<excel::XStyles > m_xStyles;
- uno::Reference<excel::XFormatConditions > m_xParentCollection;
- uno::Reference<beans::XPropertySet > m_xProps;
-
- sal_Int32 nIndex;
-public:
- EnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference<excel::XRange >& xRange, const uno::Reference<uno::XComponentContext >& xContext, const uno::Reference<excel::XStyles >& xStyles, const uno::Reference< excel::XFormatConditions >& xCollection, const uno::Reference<beans::XPropertySet >& xProps ) : m_xIndexAccess( xIndexAccess ), m_xParentRange( xRange ), m_xContext( xContext ), m_xStyles( xStyles ), m_xParentCollection( xCollection ), m_xProps( xProps ), nIndex( 0 ) {}
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( nIndex < m_xIndexAccess->getCount() );
- }
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( nIndex < m_xIndexAccess->getCount() )
- return xSheetConditionToFormatCondition( uno::Reference< vba::XHelperInterface >( m_xParentRange, uno::UNO_QUERY_THROW ), m_xContext, m_xStyles, m_xParentCollection, m_xProps, m_xIndexAccess->getByIndex( nIndex++ ) );
- throw container::NoSuchElementException();
- }
-};
-
-uno::Reference< excel::XFormatCondition > SAL_CALL
-ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, const uno::Any& _aFormula1, const uno::Any& _aFormula2 ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return Add( _nType, _aOperator, _aFormula1, _aFormula2, uno::Reference< excel::XStyle >() );
-}
-
-uno::Reference< excel::XFormatCondition >
-ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, const uno::Any& _aFormula1, const uno::Any& _aFormula2, const css::uno::Reference< excel::XStyle >& _xStyle ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- // #TODO
- // #FIXME
- // This method will NOT handle r1c1 formulas [*]and only assumes that
- // the formulas are _xlA1 based ( need to hook into calc work ths should
- // address this )
- // [*] reason: getA1Formula method below is just a hook and just
- // returns whats it gets ( e.g. doesn't convert anything )
- uno::Reference< excel::XStyle > xStyle( _xStyle );
- uno::Reference< excel::XFormatCondition > xFormatCondition;
- try
- {
- rtl::OUString sStyleName;
- if ( !xStyle.is() )
- {
- sStyleName = getStyleName();
- xStyle = mxStyles->Add(sStyleName, uno::Any() );
- }
- else
- {
- sStyleName = xStyle->getName();
- }
-
- VecPropValues aPropertyValueVector;
- sheet::ConditionOperator aType = ScVbaFormatCondition::retrieveAPIType(_nType, uno::Reference< sheet::XSheetCondition >() );
- uno::Any aValue;
-
- if ( aType == sheet::ConditionOperator_FORMULA)
- aValue = uno::makeAny( sheet::ConditionOperator_FORMULA );
- else
- aValue = uno::makeAny( ScVbaFormatCondition::retrieveAPIOperator(_aOperator) );
-
- beans::PropertyValue aProperty( OPERATOR, 0, aValue, beans::PropertyState_DIRECT_VALUE );
- aPropertyValueVector.push_back( aProperty );
-
- if ( _aFormula1.hasValue() )
- {
- beans::PropertyValue aProp( FORMULA1, 0, uno::makeAny( getA1Formula( _aFormula1 ) ), beans::PropertyState_DIRECT_VALUE );
- aPropertyValueVector.push_back( aProp );
- }
- if ( _aFormula2.hasValue() )
- {
- beans::PropertyValue aProp( FORMULA2, 0, uno::makeAny( getA1Formula( _aFormula2 ) ), beans::PropertyState_DIRECT_VALUE );
- aPropertyValueVector.push_back( aProp );
- }
- aProperty.Name = STYLENAME;
- aProperty.Value = uno::makeAny( sStyleName );
-
- // convert vector to sequence
- uno::Sequence< beans::PropertyValue > aPropertyValueList(aPropertyValueVector.size());
- VecPropValues::iterator it = aPropertyValueVector.begin();
- VecPropValues::iterator it_end = aPropertyValueVector.end();
- for ( sal_Int32 index=0; it != it_end; ++it )
- aPropertyValueList[ index++ ] = *it;
-
- mxSheetConditionalEntries->addNew(aPropertyValueList);
- for (sal_Int32 i = mxSheetConditionalEntries->getCount()-1; i >= 0; i--)
- {
- uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry( mxSheetConditionalEntries->getByIndex(i), uno::UNO_QUERY_THROW );
- if (xSheetConditionalEntry->getStyleName().equals(sStyleName))
- {
- xFormatCondition = new ScVbaFormatCondition(uno::Reference< vba::XHelperInterface >( mxRangeParent, uno::UNO_QUERY_THROW ), mxContext, xSheetConditionalEntry, xStyle, this, mxParentRangePropertySet);
- notifyRange();
- return xFormatCondition;
- }
- }
- }
- catch (uno::Exception& )
- {
- }
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- return xFormatCondition;
-}
-
-
-uno::Reference< container::XEnumeration > SAL_CALL
-ScVbaFormatConditions::createEnumeration() throw (uno::RuntimeException)
-{
- return new EnumWrapper( m_xIndexAccess, mxRangeParent, mxContext, mxStyles, this, mxParentRangePropertySet );
-}
-
-
-void
-ScVbaFormatConditions::notifyRange() throw ( script::BasicErrorException )
-{
- try
- {
- mxParentRangePropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ConditionalFormat")), uno::makeAny( mxSheetConditionalEntries ));
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-rtl::OUString
-ScVbaFormatConditions::getA1Formula(const css::uno::Any& _aFormula) throw ( script::BasicErrorException )
-{
- // #TODO, #FIXME hook-in proper formula conversion detection & logic
- rtl::OUString sFormula;
- if ( !( _aFormula >>= sFormula ) )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- return sFormula;
-}
-
-rtl::OUString
-ScVbaFormatConditions::getStyleName()
-{
- ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() );
- if ( !pStyles )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- uno::Sequence< rtl::OUString > sCellStyleNames = pStyles->getStyleNames();
- return ContainerUtilities::getUniqueName(sCellStyleNames, sStyleNamePrefix, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ));
-}
-
-void
-ScVbaFormatConditions::removeFormatCondition( const rtl::OUString& _sStyleName, sal_Bool _bRemoveStyle) throw ( script::BasicErrorException )
-{
- try
- {
- sal_Int32 nElems = mxSheetConditionalEntries->getCount();
- for (sal_Int32 i = 0; i < nElems; i++)
- {
- uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry( mxSheetConditionalEntries->getByIndex(i), uno::UNO_QUERY_THROW );
- if (_sStyleName.equals(xSheetConditionalEntry->getStyleName()))
- {
- mxSheetConditionalEntries->removeByIndex(i);
- if (_bRemoveStyle)
- {
- ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() );
- if ( !pStyles )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- pStyles->Delete( _sStyleName );
- }
- return;
- }
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-rtl::OUString&
-ScVbaFormatConditions::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFormatConditions") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaFormatConditions::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.FormatConditions" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbaformatconditions.hxx b/scratch/sc-vba/dead-source/vbaformatconditions.hxx
deleted file mode 100644
index 262f113c5..000000000
--- a/scratch/sc-vba/dead-source/vbaformatconditions.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_FORMATCONDITIONS_HXX
-#define SC_VBA_FORMATCONDITIONS_HXX
-#include <org/openoffice/excel/XFormatConditions.hpp>
-#include <org/openoffice/excel/XStyles.hpp>
-#include <org/openoffice/excel/XRange.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
-#include "vbacollectionimpl.hxx"
-
-typedef CollTestImplHelper< oo::excel::XFormatConditions > ScVbaFormatConditions_BASE;
-class ScVbaFormatConditions: public ScVbaFormatConditions_BASE
-{
- css::table::CellAddress maCellAddress;
- css::uno::Reference< css::sheet::XSheetConditionalEntries > mxSheetConditionalEntries;
- css::uno::Reference< oo::excel::XStyles > mxStyles;
- css::uno::Reference< oo::excel::XRange > mxRangeParent;
- css::uno::Reference< css::beans::XPropertySet > mxParentRangePropertySet;
-public:
- ScVbaFormatConditions( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::sheet::XSheetConditionalEntries >&, const css::uno::Reference< css::frame::XModel >& );
- void notifyRange() throw ( css::script::BasicErrorException );
- virtual css::uno::Reference< oo::excel::XFormatCondition > Add( ::sal_Int32 Type, const css::uno::Any& Operator, const css::uno::Any& Formula1, const css::uno::Any& Formula2, const css::uno::Reference< oo::excel::XStyle >& _xCalcStyle ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- rtl::OUString getA1Formula(const css::uno::Any& _aFormula) throw ( css::script::BasicErrorException );
- rtl::OUString getStyleName();
- void removeFormatCondition( const rtl::OUString& _sStyleName, sal_Bool _bRemoveStyle) throw ( css::script::BasicErrorException );
- css::uno::Reference< css::sheet::XSheetConditionalEntries > getSheetConditionalEntries() { return mxSheetConditionalEntries; }
- // XFormatConditions
- virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XFormatCondition > SAL_CALL Add( ::sal_Int32 Type, const css::uno::Any& Operator, const css::uno::Any& Formula1, const css::uno::Any& Formula2 ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- virtual css::uno::Any createCollectionObject(const css::uno::Any&);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_AXES_HXX
diff --git a/scratch/sc-vba/dead-source/vbaglobals.cxx b/scratch/sc-vba/dead-source/vbaglobals.cxx
deleted file mode 100644
index bc6b04f47..000000000
--- a/scratch/sc-vba/dead-source/vbaglobals.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "helperdecl.hxx"
-#include "vbaglobals.hxx"
-
-#include <comphelper/unwrapargs.hxx>
-
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include "vbaapplication.hxx"
-#include "vbaworksheet.hxx"
-#include "vbarange.hxx"
-#include <cppuhelper/bootstrap.hxx>
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::org::openoffice;
-
-
-
-// =============================================================================
-// ScVbaGlobals
-// =============================================================================
-
-ScVbaGlobals::ScVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext )
- :m_xContext( rxContext )
-{
- OSL_TRACE("ScVbaGlobals::ScVbaGlobals()");
- mxApplication = uno::Reference< excel::XApplication > ( new ScVbaApplication( m_xContext) );
-}
-
-ScVbaGlobals::~ScVbaGlobals()
-{
- OSL_TRACE("ScVbaGlobals::~ScVbaGlobals");
-}
-
-// Will throw if singleton can't be accessed
-uno::Reference< vba::XGlobals >
-ScVbaGlobals::getGlobalsImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException )
-{
- uno::Reference< vba::XGlobals > xGlobals(
- xContext->getValueByName( ::rtl::OUString::createFromAscii(
- "/singletons/org.openoffice.vba.theGlobals") ), uno::UNO_QUERY);
-
- if ( !xGlobals.is() )
- {
- throw uno::RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ),
- uno::Reference< XInterface >() );
- }
- return xGlobals;
-}
-
-// =============================================================================
-// XGlobals
-// =============================================================================
-uno::Reference<excel::XApplication >
-ScVbaGlobals::getApplication() throw (uno::RuntimeException)
-{
-// OSL_TRACE("In ScVbaGlobals::getApplication");
- return mxApplication;
-}
-
-uno::Reference< excel::XWorkbook > SAL_CALL
-ScVbaGlobals::getActiveWorkbook() throw (uno::RuntimeException)
-{
-// OSL_TRACE("In ScVbaGlobals::getActiveWorkbook");
- uno::Reference< excel::XWorkbook > xWorkbook( mxApplication->getActiveWorkbook(), uno::UNO_QUERY);
- if ( xWorkbook.is() )
- {
- return xWorkbook;
- }
-// FIXME check if this is correct/desired behavior
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "No activeWorkbook available" ), Reference< uno::XInterface >() );
-}
-
-
-uno::Reference< excel::XWorksheet > SAL_CALL
-ScVbaGlobals::getActiveSheet() throw (uno::RuntimeException)
-{
- return mxApplication->getActiveSheet();
-}
-
-uno::Any SAL_CALL
-ScVbaGlobals::WorkBooks( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- return uno::Any( mxApplication->Workbooks(aIndex) );
-}
-
-uno::Any SAL_CALL
-ScVbaGlobals::WorkSheets(const uno::Any& aIndex) throw (uno::RuntimeException)
-{
- return mxApplication->Worksheets( aIndex );
-}
-uno::Any SAL_CALL
-ScVbaGlobals::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- return WorkSheets( aIndex );
-}
-
-::uno::Sequence< ::uno::Any > SAL_CALL
-ScVbaGlobals::getGlobals( ) throw (::uno::RuntimeException)
-{
- sal_uInt32 nMax = 0;
- uno::Sequence< uno::Any > maGlobals(4);
- maGlobals[ nMax++ ] <<= ScVbaGlobals::getGlobalsImpl(m_xContext);
- maGlobals[ nMax++ ] <<= mxApplication;
-
- uno::Reference< excel::XWorkbook > xWorkbook = mxApplication->getActiveWorkbook();
- if( xWorkbook.is() )
- {
- maGlobals[ nMax++ ] <<= xWorkbook;
- uno::Reference< excel::XWorksheet > xWorksheet = xWorkbook->getActiveSheet();
- if( xWorksheet.is() )
- maGlobals[ nMax++ ] <<= xWorksheet;
- }
- maGlobals.realloc( nMax );
- return maGlobals;
-}
-
-uno::Any SAL_CALL
-ScVbaGlobals::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno::RuntimeException)
-{
- return getApplication()->Range( Cell1, Cell2 );
-}
-
-uno::Any SAL_CALL
-ScVbaGlobals::Names( const css::uno::Any& aIndex ) throw ( uno::RuntimeException )
-{
- return getApplication()->Names( aIndex );
-}
-
-namespace globals
-{
-namespace sdecl = comphelper::service_decl;
-sdecl::class_<ScVbaGlobals, sdecl::with_args<false> > serviceImpl;
-extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaGlobals",
- "org.openoffice.vba.Globals" );
-}
-
diff --git a/scratch/sc-vba/dead-source/vbaglobals.hxx b/scratch/sc-vba/dead-source/vbaglobals.hxx
deleted file mode 100644
index 4e800041c..000000000
--- a/scratch/sc-vba/dead-source/vbaglobals.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_GLOBALS
-#define SC_VBA_GLOBALS
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <org/openoffice/vba/XGlobals.hpp>
-
-#include <cppuhelper/implbase1.hxx>
-#include "vbahelper.hxx"
-
- // =============================================================================
- // class ScVbaGlobals
- // =============================================================================
-
- typedef ::cppu::WeakImplHelper1<
- oo::vba::XGlobals > ScVbaGlobals_BASE;
-
-
- class ScVbaGlobals : public ScVbaGlobals_BASE
- {
- private:
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< oo::excel::XApplication > mxApplication;
- public:
-
- ScVbaGlobals(
- css::uno::Reference< css::uno::XComponentContext >const& rxContext );
- virtual ~ScVbaGlobals();
-
- static css::uno::Reference< oo::vba::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException);
-
- // XGlobals
- virtual css::uno::Reference<
- oo::excel::XApplication > SAL_CALL getApplication()
- throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorkbook > SAL_CALL getActiveWorkbook() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL WorkSheets(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL WorkBooks(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Sequence< css::uno::Any > SAL_CALL getGlobals( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw ( css::uno::RuntimeException );
- };
-#endif //
diff --git a/scratch/sc-vba/dead-source/vbahelper.cxx b/scratch/sc-vba/dead-source/vbahelper.cxx
deleted file mode 100644
index bf6b881b7..000000000
--- a/scratch/sc-vba/dead-source/vbahelper.cxx
+++ /dev/null
@@ -1,773 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbahelper.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <cppuhelper/bootstrap.hxx>
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-#include <sfx2/objsh.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/app.hxx>
-
-#include <docuno.hxx>
-
-#include <basic/sbx.hxx>
-#include <basic/sbstar.hxx>
-#include <rtl/math.hxx>
-
-#include <math.h>
-#include "vbahelper.hxx"
-#include "tabvwsh.hxx"
-#include "transobj.hxx"
-#include "scmod.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-#define POINTTO100THMILLIMETERFACTOR 35.27778
-void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
-
-uno::Any sbxToUnoValue( SbxVariable* pVar );
-
-
-namespace org
-{
-namespace openoffice
-{
-
-const double Millimeter::factor = 35.27778;
-
-uno::Reference< script::XTypeConverter >
-getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
-{
- static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
- return xTypeConv;
-}
-// helper method to determine if the view ( calc ) is in print-preview mode
-bool isInPrintPreview( SfxViewFrame* pView )
-{
- sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
- if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
-nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
- {
- SfxViewFactory &rViewFactory =
- pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
- if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() )
- return true;
- }
- return false;
-}
-const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
-const uno::Any&
-aNULL()
-{
- static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
- return aNULLL;
-}
-
-class PasteCellsWarningReseter
-{
-private:
- bool bInitialWarningState;
- static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
- {
- static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
- static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
- xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
- return xProps;
- }
-
- bool getReplaceCellsWarning() throw ( uno::RuntimeException )
- {
- sal_Bool res = sal_False;
- getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
- return ( res == sal_True );
- }
-
- void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
- {
- getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
- }
-public:
- PasteCellsWarningReseter() throw ( uno::RuntimeException )
- {
- bInitialWarningState = getReplaceCellsWarning();
- if ( bInitialWarningState )
- setReplaceCellsWarning( false );
- }
- ~PasteCellsWarningReseter()
- {
- if ( bInitialWarningState )
- {
- // don't allow dtor to throw
- try
- {
- setReplaceCellsWarning( true );
- }
- catch ( uno::Exception& /*e*/ ){}
- }
- }
-};
-
-void
-dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
-{
-
- util::URL url ;
- url.Complete = aUrl;
- rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
- uno::Reference<frame::XController> xController = xModel->getCurrentController();
- uno::Reference<frame::XFrame> xFrame = xController->getFrame();
- uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
- try
- {
- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
- if ( !xContext.is() )
- {
- return ;
- }
-
- uno::Reference<lang::XMultiComponentFactory > xServiceManager(
- xContext->getServiceManager() );
- if ( !xServiceManager.is() )
- {
- return ;
- }
- uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
- ,xContext), uno::UNO_QUERY_THROW );
- if (!xParser.is())
- return;
- xParser->parseStrict (url);
- }
- catch ( uno::Exception & /*e*/ )
- {
- return ;
- }
-
- uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
-
- uno::Sequence<beans::PropertyValue> dispatchProps(1);
-
- sal_Int32 nProps = sProps.getLength();
- beans::PropertyValue* pDest = dispatchProps.getArray();
- if ( nProps )
- {
- dispatchProps.realloc( nProps + 1 );
- // need to reaccquire pDest after realloc
- pDest = dispatchProps.getArray();
- beans::PropertyValue* pSrc = sProps.getArray();
- for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
- *pDest = *pSrc;
- }
-
- (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
- (*pDest).Value <<= (sal_Bool)sal_True;
-
- if (xDispatcher.is())
- xDispatcher->dispatch( url, dispatchProps );
-}
-
-void
-dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
-{
- uno::Sequence<beans::PropertyValue> dispatchProps;
- dispatchRequests( xModel, aUrl, dispatchProps );
-}
-
-
-void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall)
-{
- ScTabViewShell* pViewShell = getBestViewShell( xModel );
- SfxViewFrame* pViewFrame = NULL;
- if ( pViewShell )
- pViewFrame = pViewShell->GetViewFrame();
- if ( pViewFrame )
- {
- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
- if( pDispatcher )
- {
- pDispatcher->Execute( nSlot , nCall );
- }
- }
-}
-
-void
-implnPaste()
-{
- PasteCellsWarningReseter resetWarningBox;
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if ( pViewShell )
- {
- pViewShell->PasteFromSystem();
- pViewShell->CellContentChanged();
- }
-}
-
-
-void
-implnCopy()
-{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- pViewShell->CopyToClip(NULL,false,false,true);
-}
-
-void
-implnCut()
-{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- pViewShell->CutToClip( NULL, TRUE );
-}
-
-void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
-{
- PasteCellsWarningReseter resetWarningBox;
- sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
- InsCellCmd eMoveMode = INS_NONE;
-
- ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
- if ( !pTabViewShell )
- // none active, try next best
- pTabViewShell = getCurrentBestViewShell();
- if ( pTabViewShell )
- {
- ScViewData* pView = pTabViewShell->GetViewData();
- Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
- if ( pView && pWin )
- {
- if ( bAsLink && bOtherDoc )
- pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
- else
- {
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
- ScDocument* pDoc = NULL;
- if ( pOwnClip )
- pDoc = pOwnClip->GetDocument();
- pTabViewShell->PasteFromClip( nFlags, pDoc,
- nFunction, bSkipEmpty, bTranspose, bAsLink,
- eMoveMode, IDF_NONE, TRUE );
- pTabViewShell->CellContentChanged();
- }
- }
- }
-
-}
-
-bool
-isRangeShortCut( const ::rtl::OUString& sParam )
-{
- // for a ShortCutRange param, I'd expect the first letter to be
- //[A-Z] and the last letter to be a digit 0-9 e.g A10, [A1:A10] etc.
- ::rtl::OString sStr = rtl::OUStringToOString( sParam,
- RTL_TEXTENCODING_UTF8 );
- const sal_Char* pFirst = (const sal_Char*)sStr;
- const sal_Char* pLast = pFirst + ( sStr.getLength() - 1 );
- if ( (( *pFirst >= 'A' && *pFirst <= 'Z' ) || ( *pFirst >= 'a' && *pFirst <= 'Z' ) ) )
- if ( ( *pLast >= '0' ) && ( *pLast <= '9' ) )
- return true;
-
- return false;
-}
-
- uno::Reference< frame::XModel >
-getCurrentDocument() throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel;
- SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
- SbxObject* basicChosen = pBasic ;
- if ( basicChosen == NULL)
- {
- OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
- return xModel;
- }
- SbxObject* p = pBasic;
- SbxObject* pParent = p->GetParent();
- SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
-
- if( pParentParent )
- {
- basicChosen = pParentParent;
- }
- else if( pParent )
- {
- basicChosen = pParent;
- }
-
-
- uno::Any aModel;
- SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
-
- if ( pCompVar )
- {
- aModel = sbxToUnoValue( pCompVar );
- if ( sal_False == ( aModel >>= xModel ) ||
- !xModel.is() )
- {
- // trying last gasp try the current component
- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- // test if vba service is present
- uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
- uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
- xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
- if ( !xModel.is() )
- {
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
- }
- return xModel;
- }
- else
- {
- OSL_TRACE("Have model ThisComponent points to url %s",
- ::rtl::OUStringToOString( xModel->getURL(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- }
- else
- {
- OSL_TRACE("Failed to get ThisComponent");
- throw uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "Can't determine the currently selected document") ),
- uno::Reference< uno::XInterface >() );
- }
- return xModel;
-}
-
-ScDocShell*
-getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
-{
- uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
- ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
- ScDocShell* pDocShell = NULL;
- if ( pModel )
- pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
- return pDocShell;
-
-}
-
-ScTabViewShell*
-getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
-{
- ScDocShell* pDocShell = getDocShell( xModel );
- if ( pDocShell )
- return pDocShell->GetBestViewShell();
- return NULL;
-}
-
-ScTabViewShell*
-getCurrentBestViewShell()
-{
- uno::Reference< frame::XModel > xModel = getCurrentDocument();
- return getBestViewShell( xModel );
-}
-
-SfxViewFrame*
-getCurrentViewFrame()
-{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- return pViewShell->GetViewFrame();
- return NULL;
-}
-
-sal_Int32
-OORGBToXLRGB( sal_Int32 nCol )
-{
- sal_Int32 nRed = nCol;
- nRed &= 0x00FF0000;
- nRed >>= 16;
- sal_Int32 nGreen = nCol;
- nGreen &= 0x0000FF00;
- nGreen >>= 8;
- sal_Int32 nBlue = nCol;
- nBlue &= 0x000000FF;
- sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
- return nRGB;
-}
-sal_Int32
-XLRGBToOORGB( sal_Int32 nCol )
-{
- sal_Int32 nBlue = nCol;
- nBlue &= 0x00FF0000;
- nBlue >>= 16;
- sal_Int32 nGreen = nCol;
- nGreen &= 0x0000FF00;
- nGreen >>= 8;
- sal_Int32 nRed = nCol;
- nRed &= 0x000000FF;
- sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
- return nRGB;
-}
-uno::Any
-OORGBToXLRGB( const uno::Any& aCol )
-{
- sal_Int32 nCol;
- aCol >>= nCol;
- nCol = OORGBToXLRGB( nCol );
- return uno::makeAny( nCol );
-}
-uno::Any
-XLRGBToOORGB( const uno::Any& aCol )
-{
- sal_Int32 nCol;
- aCol >>= nCol;
- nCol = XLRGBToOORGB( nCol );
- return uno::makeAny( nCol );
-}
-
-void PrintOutHelper( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, css::uno::Reference< frame::XModel >& xModel, sal_Bool bUseSelection )
-{
- sal_Int32 nTo = 0;
- sal_Int32 nFrom = 0;
- sal_Int16 nCopies = 1;
- sal_Bool bPreview = sal_False;
- sal_Bool bCollate = sal_False;
- sal_Bool bSelection = bUseSelection;
- From >>= nFrom;
- To >>= nTo;
- Copies >>= nCopies;
- Preview >>= bPreview;
- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
- Collate >>= bCollate;
-
- rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
- rtl::OUString sFileName;
-
- if (( nFrom || nTo ) )
- {
- if ( nFrom )
- sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
- if ( nTo )
- sRange += ::rtl::OUString::valueOf( nTo );
- }
-
- if ( PrToFileName.getValue() )
- {
- PrToFileName >>= sFileName;
- }
- ScTabViewShell* pViewShell = getBestViewShell( xModel );
- SfxViewFrame* pViewFrame = NULL;
- if ( pViewShell )
- pViewFrame = pViewShell->GetViewFrame();
- if ( pViewFrame )
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-
- SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
- aArgs.Put( sfxCollate, sfxCollate.Which() );
- SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
- aArgs.Put( sfxCopies, sfxCopies.Which() );
- if ( sFileName.getLength() )
- {
- SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
- aArgs.Put( sfxFileName, sfxFileName.Which() );
-
- }
- if ( sRange.getLength() )
- {
- SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
- aArgs.Put( sfxRange, sfxRange.Which() );
- }
- SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
- aArgs.Put( sfxSelection, sfxSelection.Which() );
- SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
- aArgs.Put( sfxAsync, sfxAsync.Which() );
- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-
- if ( pDispatcher )
- {
- if ( bPreview )
- {
- if ( !pViewFrame->GetFrame()->IsInPlace() )
- {
- SC_MOD()->InputEnterHandler();
- pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
- while ( isInPrintPreview( pViewFrame ) )
- Application::Yield();
- }
- }
- else
- pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
- }
-
- }
-
- // #FIXME #TODO
- // 1 ActivePrinter ( how/can we switch a printer via API? )
- // 2 PrintToFile ( ms behaviour if this option is specified but no
- // filename supplied 'PrToFileName' then the user will be prompted )
- // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
- // values ) in oOO these options are mutually exclusive
- // 4 There is a pop up to do with transparent objects in the print source
- // should be able to disable that via configuration for the duration
- // of this method
-}
-
- void PrintPreviewHelper( const css::uno::Any& EnableChanges, css::uno::Reference< css::frame::XModel >& xModel )
-{
- dispatchExecute( xModel, SID_VIEWSHELL1 );
-}
-
-rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
-{
- uno::Type aType = pvargItem.getValueType();
- uno::TypeClass eTypeClass = aType.getTypeClass();
- rtl::OUString sString;
- switch ( eTypeClass )
- {
- case uno::TypeClass_BOOLEAN:
- {
- sal_Bool bBool = sal_False;
- pvargItem >>= bBool;
- sString = rtl::OUString::valueOf( bBool );
- break;
- }
- case uno::TypeClass_STRING:
- pvargItem >>= sString;
- break;
- case uno::TypeClass_FLOAT:
- {
- float aFloat = 0;
- pvargItem >>= aFloat;
- sString = rtl::OUString::valueOf( aFloat );
- break;
- }
- case uno::TypeClass_DOUBLE:
- {
- double aDouble = 0;
- pvargItem >>= aDouble;
- sString = rtl::OUString::valueOf( aDouble );
- break;
- }
- case uno::TypeClass_SHORT:
- case uno::TypeClass_LONG:
- case uno::TypeClass_BYTE:
- {
- sal_Int32 aNum = 0;
- pvargItem >>= aNum;
- sString = rtl::OUString::valueOf( aNum );
- break;
- }
-
- case uno::TypeClass_HYPER:
- {
- sal_Int64 aHyper = 0;
- pvargItem >>= aHyper;
- sString = rtl::OUString::valueOf( aHyper );
- break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
- }
- return sString;
-}
-
-
-rtl::OUString
-ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
-{
- return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
-}
-
-rtl::OUString
-ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
-{
- sal_Int32 a = _nStartSuffix;
- rtl::OUString scompname = _sElementName;
- bool bElementexists = true;
- sal_Int32 nLen = _slist.getLength();
- if ( nLen == 0 )
- return _sElementName;
-
- while (bElementexists == true)
- {
- for (sal_Int32 i = 0; i < nLen; i++)
- {
- if (FieldInList(_slist, scompname) == -1)
- {
- return scompname;
- }
- }
- scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
- }
- return rtl::OUString();
-}
-
-sal_Int32
-ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
-{
- sal_Int32 FieldLen = SearchList.getLength();
- sal_Int32 retvalue = -1;
- for (sal_Int32 i = 0; i < FieldLen; i++)
- {
- // I wonder why comparing lexicographically is done
- // when its a match is whats interesting?
- //if (SearchList[i].compareTo(SearchString) == 0)
- if ( SearchList[i].equals( SearchString ) )
- {
- retvalue = i;
- break;
- }
- }
- return retvalue;
-
-}
-bool NeedEsc(sal_Unicode cCode)
-{
- String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
- return (STRING_NOTFOUND != sEsc.Search(cCode));
-}
-
-rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
-{
- rtl::OUStringBuffer sResult;
- const sal_Unicode *start = rIn.getStr();
- const sal_Unicode *end = start + rIn.getLength();
-
- int seenright = 0;
- if ( bForLike )
- sResult.append(static_cast<sal_Unicode>('^'));
-
- while (start < end)
- {
- switch (*start)
- {
- case '?':
- sResult.append(static_cast<sal_Unicode>('.'));
- start++;
- break;
- case '*':
- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
- start++;
- break;
- case '#':
- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
- start++;
- break;
- case '~':
- sResult.append(static_cast<sal_Unicode>('\\'));
- sResult.append(*(++start));
- start++;
- break;
- // dump the ~ and escape the next characture
- case ']':
- sResult.append(static_cast<sal_Unicode>('\\'));
- sResult.append(*start++);
- break;
- case '[':
- sResult.append(*start++);
- seenright = 0;
- while (start < end && !seenright)
- {
- switch (*start)
- {
- case '[':
- case '?':
- case '*':
- sResult.append(static_cast<sal_Unicode>('\\'));
- sResult.append(*start);
- break;
- case ']':
- sResult.append(*start);
- seenright = 1;
- break;
- case '!':
- sResult.append(static_cast<sal_Unicode>('^'));
- break;
- default:
- if (NeedEsc(*start))
- sResult.append(static_cast<sal_Unicode>('\\'));
- sResult.append(*start);
- break;
- }
- start++;
- }
- break;
- default:
- if (NeedEsc(*start))
- sResult.append(static_cast<sal_Unicode>('\\'));
- sResult.append(*start++);
- }
- }
-
- if ( bForLike )
- sResult.append(static_cast<sal_Unicode>('$'));
-
- return sResult.makeStringAndClear( );
-}
-
-double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
-{
- double fConvertFactor = 1.0;
- if( bVertical )
- {
- fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
- }
- else
- {
- fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
- }
- return fConvertFactor;
-}
-
-double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
-{
- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
- return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
-}
-double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
-{
- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
- return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
-}
-
-} // openoffice
-} //org
diff --git a/scratch/sc-vba/dead-source/vbahelper.hxx b/scratch/sc-vba/dead-source/vbahelper.hxx
deleted file mode 100644
index 8b6413452..000000000
--- a/scratch/sc-vba/dead-source/vbahelper.hxx
+++ /dev/null
@@ -1,272 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_HELPER_HXX
-#define SC_VBA_HELPER_HXX
-
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/script/BasicErrorException.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
-#include <basic/sberrors.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <docsh.hxx>
-#include <sfx2/dispatch.hxx>
-
-namespace css = ::com::sun::star;
-
-namespace org
-{
- namespace openoffice
- {
- template < class T >
- css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException)
- {
- if ( args.getLength() < ( nPos + 1) )
- throw css::lang::IllegalArgumentException();
- css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY );
- if ( !bCanBeNull && !aSomething.is() )
- throw css::lang::IllegalArgumentException();
- return aSomething;
- }
- css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-
- void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
- void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
- void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
- void implnCopy();
- void implnPaste();
- void implnCut();
- void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
- bool isRangeShortCut( const ::rtl::OUString& sParam );
- css::uno::Reference< css::frame::XModel >
- getCurrentDocument() throw (css::uno::RuntimeException);
- ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
- ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
- ScTabViewShell* getCurrentBestViewShell();
- SfxViewFrame* getCurrentViewFrame();
- sal_Int32 OORGBToXLRGB( sal_Int32 );
- sal_Int32 XLRGBToOORGB( sal_Int32 );
- css::uno::Any OORGBToXLRGB( const css::uno::Any& );
- css::uno::Any XLRGBToOORGB( const css::uno::Any& );
- // provide a NULL object that can be passed as variant so that
- // the object when passed to IsNull will return true. aNULL
- // contains an empty object reference
- const css::uno::Any& aNULL();
- void PrintOutHelper( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, css::uno::Reference< css::frame::XModel >& xModel, sal_Bool bSelection );
- void PrintPreviewHelper( const css::uno::Any& EnableChanges, css::uno::Reference< css::frame::XModel >& xModel );
-
- rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
- rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
- double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
- double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
- double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
-
-class Millimeter
-{
-//Factor to translate between points and hundredths of millimeters:
-private:
- static const double factor;
-
- double m_nMillimeter;
-
-public:
- Millimeter():m_nMillimeter(0) {}
-
- Millimeter(double mm):m_nMillimeter(mm) {}
-
- void set(double mm) { m_nMillimeter = mm; }
- void setInPoints(double points)
- {
- m_nMillimeter = points * 0.352777778;
- // 25.4mm / 72
- }
-
- void setInHundredthsOfOneMillimeter(double hmm)
- {
- m_nMillimeter = hmm / 100;
- }
-
- double get()
- {
- return m_nMillimeter;
- }
- double getInHundredthsOfOneMillimeter()
- {
- return m_nMillimeter * 100;
- }
- double getInPoints()
- {
- return m_nMillimeter * 2.834645669; // 72 / 25.4mm
- }
-
- static sal_Int32 getInHundredthsOfOneMillimeter(double points)
- {
- sal_Int32 mm = static_cast<sal_Int32>(points * factor);
- return mm;
- }
-
- static double getInPoints(int _hmm)
- {
- double points = double( static_cast<double>(_hmm) / factor);
- return points;
- }
-};
-class ShapeHelper
-{
-protected:
- css::uno::Reference< css::drawing::XShape > xShape;
-public:
- ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
- {
- if( !xShape.is() )
- throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() );
- }
-
- double getHeight()
- {
- return Millimeter::getInPoints(xShape->getSize().Height);
- }
-
-
- void setHeight(double _fheight) throw ( css::script::BasicErrorException )
- {
- try
- {
- css::awt::Size aSize = xShape->getSize();
- aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight);
- xShape->setSize(aSize);
- }
- catch ( css::uno::Exception& /*e*/)
- {
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- }
-
-
- double getWidth()
- {
- return Millimeter::getInPoints(xShape->getSize().Width);
- }
-
- void setWidth(double _fWidth) throw ( css::script::BasicErrorException )
- {
- try
- {
- css::awt::Size aSize = xShape->getSize();
- aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth);
- xShape->setSize(aSize);
- }
- catch (css::uno::Exception& /*e*/)
- {
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- }
-
-
- double getLeft()
- {
- return Millimeter::getInPoints(xShape->getPosition().X);
- }
-
-
- void setLeft(double _fLeft)
- {
- css::awt::Point aPoint = xShape->getPosition();
- aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
- xShape->setPosition(aPoint);
- }
-
-
- double getTop()
- {
- return Millimeter::getInPoints(xShape->getPosition().Y);
- }
-
-
- void setTop(double _fTop)
- {
- css::awt::Point aPoint = xShape->getPosition();
- aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
- xShape->setPosition(aPoint);
- }
-
-};
-
-class ContainerUtilities
-{
-
-public:
- static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator);
- static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix );
-
- static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString );
-};
-
-// really just a a place holder to ease the porting pain
-class DebugHelper
-{
-public:
- static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
- {
- // #TODO #FIXME ( do we want to support additionalArg here )
- throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
- }
-
- static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
- {
- exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
- }
-
- static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
- {
- exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-};
- } // openoffice
-} // org
-
-namespace oo = org::openoffice;
-
-#ifdef DEBUG
-# define SC_VBA_FIXME(a) OSL_TRACE( a )
-# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ ))
-#else
-# define SC_VBA_FIXME(a)
-# define SC_VBA_STUB()
-#endif
-
-#endif
diff --git a/scratch/sc-vba/dead-source/vbahelperinterface.hxx b/scratch/sc-vba/dead-source/vbahelperinterface.hxx
deleted file mode 100644
index 798365fa7..000000000
--- a/scratch/sc-vba/dead-source/vbahelperinterface.hxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_HELPERINTERFACE_HXX
-#define SC_VBA_HELPERINTERFACE_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/vba/XHelperInterface.hpp>
-#include "vbahelper.hxx"
-#include "vbaglobals.hxx"
-
-// use this class when you have an a object like
-// interface XAnInterface which contains XHelperInterface in its inheritance hierarchy
-// interface XAnInterface
-// {
-// interface XHelperInterface;
-// [attribute, string] name;
-// }
-// or
-// interface XAnInterface : XHelperInterface;
-// {
-// [attribute, string] name;
-// }
-//
-// then this class can provide a default implementation of XHelperInterface,
-// you can use it like this
-// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE;
-// class AnInterfaceImpl : public AnInterfaceImpl_BASE
-// {
-// public:
-// AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {}
-// // implement XAnInterface methods only, no need to implement the XHelperInterface
-// // methods
-// virtual void setName( const OUString& );
-// virtual OUString getName();
-// }
-//
-const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.HelperServiceBase" ) );
-
-template< typename Ifc1 >
-class InheritedHelperInterfaceImpl : public Ifc1
-{
-protected:
- css::uno::WeakReference< oo::vba::XHelperInterface > mxParent;
- css::uno::Reference< css::uno::XComponentContext > mxContext;
-public:
- InheritedHelperInterfaceImpl() {}
- InheritedHelperInterfaceImpl( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
- virtual rtl::OUString& getServiceImplName() = 0;
- virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0;
-
- // XHelperInterface Methods
- virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- return 0x53756E4F;
- }
- virtual css::uno::Reference< oo::vba::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; }
-
- virtual css::uno::Any SAL_CALL Application( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return css::uno::makeAny( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication() ); }
-
-
- // XServiceInfo Methods
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException)
- {
- css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames();
- const rtl::OUString* pStart = sServices.getConstArray();
- const rtl::OUString* pEnd = pStart + sServices.getLength();
- for ( ; pStart != pEnd ; ++pStart )
- if ( (*pStart).equals( ServiceName ) )
- return sal_True;
- return sal_False;
- }
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException)
- {
- css::uno::Sequence< rtl::OUString > aNames = getServiceNames();;
- return aNames;
- }
- };
-
-template< typename Ifc1 >
-class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
-
-{
-typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
-public:
- InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
-
-};
-#endif
diff --git a/scratch/sc-vba/dead-source/vbainterior.cxx b/scratch/sc-vba/dead-source/vbainterior.cxx
deleted file mode 100644
index 981efeb28..000000000
--- a/scratch/sc-vba/dead-source/vbainterior.cxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbainterior.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/table/XCell.hpp>
-#include <com/sun/star/table/XColumnRowRange.hpp>
-#include <com/sun/star/beans/XIntrospection.hpp>
-#include <com/sun/star/beans/XIntrospectionAccess.hpp>
-#include <com/sun/star/reflection/XIdlMethod.hpp>
-#include <com/sun/star/beans/MethodConcept.hpp>
-
-#include <org/openoffice/excel/XlColorIndex.hpp>
-
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/queryinterface.hxx>
-
-#include <svx/xtable.hxx>
-
-#include "vbainterior.hxx"
-#include "vbapalette.hxx"
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-static const rtl::OUString BACKCOLOR( RTL_CONSTASCII_USTRINGPARAM( "CellBackColor" ) );
-
-ScVbaInterior::ScVbaInterior( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertySet >& xProps, ScDocument* pScDoc ) throw ( lang::IllegalArgumentException) : ScVbaInterior_BASE( xParent, xContext ), m_xProps(xProps), m_pScDoc( pScDoc )
-{
- if ( !m_xProps.is() )
- throw lang::IllegalArgumentException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "properties") ), uno::Reference< uno::XInterface >(), 2 );
-}
-
-uno::Any
-ScVbaInterior::getColor() throw (uno::RuntimeException)
-{
- uno::Any aAny;
- aAny = OORGBToXLRGB( m_xProps->getPropertyValue( BACKCOLOR ) );
- return aAny;
-}
-
-void
-ScVbaInterior::setColor( const uno::Any& _color ) throw (uno::RuntimeException)
-{
- m_xProps->setPropertyValue( BACKCOLOR , XLRGBToOORGB(_color));
-}
-
-uno::Reference< container::XIndexAccess >
-ScVbaInterior::getPalette()
-{
- if ( !m_pScDoc )
- throw uno::RuntimeException();
- SfxObjectShell* pShell = m_pScDoc->GetDocumentShell();
- ScVbaPalette aPalette( pShell );
- return aPalette.getPalette();
-}
-
-void SAL_CALL
-ScVbaInterior::setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException)
-{
- sal_Int32 nIndex = 0;
- _colorindex >>= nIndex;
- // #FIXME xlColorIndexAutomatic & xlColorIndexNone are not really
- // handled properly here
-
- if ( !nIndex || ( nIndex == excel::XlColorIndex::xlColorIndexAutomatic ) || ( nIndex == excel::XlColorIndex::xlColorIndexNone ) )
- nIndex = 2; // default is white ( this maybe will probably break, e.g. we may at some stage need to know what this interior is, a cell or something else and then pick a default colour based on that )
- --nIndex; // OOo indices are zero bases
- uno::Reference< container::XIndexAccess > xIndex = getPalette();
- // setColor expects colors in XL RGB values
- // #FIXME this is daft we convert OO RGB val to XL RGB val and
- // then back again to OO RGB value
- setColor( OORGBToXLRGB(xIndex->getByIndex( nIndex )) );
-}
-
-uno::Any SAL_CALL
-ScVbaInterior::getColorIndex() throw ( css::uno::RuntimeException )
-{
- sal_Int32 nColor = 0;
- // getColor returns Xl ColorValue, need to convert it to OO val
- // as the palette deals with OO RGB values
- // #FIXME this is daft in getColor we convert OO RGB val to XL RGB val
- // and then back again to OO RGB value
- XLRGBToOORGB( getColor() ) >>= nColor;
- uno::Reference< container::XIndexAccess > xIndex = getPalette();
- sal_Int32 nElems = xIndex->getCount();
- sal_Int32 nIndex = -1;
- for ( sal_Int32 count=0; count<nElems; ++count )
- {
- sal_Int32 nPaletteColor = 0;
- xIndex->getByIndex( count ) >>= nPaletteColor;
- if ( nPaletteColor == nColor )
- {
- nIndex = count + 1; // 1 based
- break;
- }
- }
- return uno::makeAny( nIndex );
-}
-
-rtl::OUString&
-ScVbaInterior::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaInterior") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaInterior::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Interior" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbainterior.hxx b/scratch/sc-vba/dead-source/vbainterior.hxx
deleted file mode 100644
index ead17d84c..000000000
--- a/scratch/sc-vba/dead-source/vbainterior.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_INTERIOR_HXX
-#define SC_VBA_INTERIOR_HXX
-
-#include <org/openoffice/excel/XInterior.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-
-#include <com/sun/star/script/XInvocation.hpp>
-#include "vbahelperinterface.hxx"
-
-class ScDocument;
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XInterior > ScVbaInterior_BASE;
-
-class ScVbaInterior : public ScVbaInterior_BASE
-{
- css::uno::Reference< css::beans::XPropertySet > m_xProps;
- ScDocument* m_pScDoc;
-
- css::uno::Reference< css::container::XIndexAccess > getPalette();
-public:
- ScVbaInterior( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::beans::XPropertySet >& xProps, ScDocument* pScDoc = NULL) throw ( css::lang::IllegalArgumentException);
-
- virtual ~ScVbaInterior(){}
-
- virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ;
-
- virtual css::uno::Any SAL_CALL getColorIndex() throw ( css::uno::RuntimeException);
- virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw ( css::uno::RuntimeException );
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif
-
diff --git a/scratch/sc-vba/dead-source/vbalabel.cxx b/scratch/sc-vba/dead-source/vbalabel.cxx
deleted file mode 100644
index 70046c0e0..000000000
--- a/scratch/sc-vba/dead-source/vbalabel.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbalabel.hxx"
-#include <vector>
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-
-const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-ScVbaLabel::ScVbaLabel( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : LabelImpl_BASE( xContext, xControlShape )
-{
-}
-
-// Attributes
-rtl::OUString SAL_CALL
-ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
-{
- rtl::OUString Label;
- m_xProps->getPropertyValue( LABEL ) >>= Label;
- return Label;
-}
-
-void SAL_CALL
-ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-{
- m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-}
diff --git a/scratch/sc-vba/dead-source/vbalabel.hxx b/scratch/sc-vba/dead-source/vbalabel.hxx
deleted file mode 100644
index 9d6aacff5..000000000
--- a/scratch/sc-vba/dead-source/vbalabel.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_LABEL_HXX
-#define SC_VBA_LABEL_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/msforms/XLabel.hpp>
-
-#include "vbacontrol.hxx"
-#include "vbahelper.hxx"
-
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XLabel > LabelImpl_BASE;
-
-class ScVbaLabel : public LabelImpl_BASE
-{
-public:
- ScVbaLabel( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- // Attributes
- virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
-};
-#endif //SC_VBA_LABEL_HXX
diff --git a/scratch/sc-vba/dead-source/vbalineformat.cxx b/scratch/sc-vba/dead-source/vbalineformat.cxx
deleted file mode 100644
index a257f706c..000000000
--- a/scratch/sc-vba/dead-source/vbalineformat.cxx
+++ /dev/null
@@ -1,464 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbalineformat.cxx,v $
- *
- * $Revision: 1.1.2.5 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 14:46:00 $
- *
- * 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
- *
- ************************************************************************/
-#include <org/openoffice/office/MsoArrowheadStyle.hpp>
-#include <org/openoffice/office/MsoArrowheadLength.hpp>
-#include <org/openoffice/office/MsoArrowheadWidth.hpp>
-#include <org/openoffice/office/MsoLineDashStyle.hpp>
-#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/drawing/LineDash.hpp>
-#include "vbalineformat.hxx"
-#include "vbacolorformat.hxx"
-
-using namespace org::openoffice;
-using namespace com::sun::star;
-
-ScVbaLineFormat::ScVbaLineFormat( const uno::Reference< oo::vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaLineFormat_BASE( xParent, xContext ), m_xShape( xShape )
-{
- m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW );
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid;
- m_nLineWeight = 1;
-}
-
-sal_Int32
-ScVbaLineFormat::calculateArrowheadSize()
-{
- return 0;
-}
-
-sal_Int32
-ScVbaLineFormat::convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName )
-{
- sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone;
- if (sLineName.equals(rtl::OUString::createFromAscii("Small Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowEnd")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Double Arrow")))
- {
- // msoArrowheadTriangle
- nLineType = office::MsoArrowheadStyle::msoArrowheadTriangle;
- }
- else if (sLineName.equals(rtl::OUString::createFromAscii("Square 45")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Square")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowDiamondEnd")))
- {
- // msoArrowheadDiamond
- nLineType = office::MsoArrowheadStyle::msoArrowheadDiamond;
- }
- else if (sLineName.equals(rtl::OUString::createFromAscii("Circle")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowOvalEnd")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Dimension Lines")) )
- {
- // msoArrowheadOval
- nLineType = office::MsoArrowheadStyle::msoArrowheadOval;
- }
- else if (sLineName.equals(rtl::OUString::createFromAscii("Arrow concave")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowStealthEnd")))
- {
- // msoArrowheadStealth
- nLineType = office::MsoArrowheadStyle::msoArrowheadStealth;
- }
- else if (sLineName.equals(rtl::OUString::createFromAscii("Rounded short Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Rounded large Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Symmetric Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowOpenEnd")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Line Arrow")))
- {
- // msoArrowheadOpen
- nLineType = office::MsoArrowheadStyle::msoArrowheadOpen;
- }
- else
- {
- // msoArrowheadNone
- nLineType = office::MsoArrowheadStyle::msoArrowheadNone;
- }
- return nLineType;
-}
-
-rtl::OUString
-ScVbaLineFormat::convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (uno::RuntimeException)
-{
- switch( nArrowheadStyle )
- {
- case office::MsoArrowheadStyle::msoArrowheadNone:
- return rtl::OUString(rtl::OUString::createFromAscii( "" ) );
- case office::MsoArrowheadStyle::msoArrowheadStealth:
- return rtl::OUString::createFromAscii( "Arrow concave" );
- case office::MsoArrowheadStyle::msoArrowheadOpen:
- return rtl::OUString::createFromAscii("Line Arrow" );
- case office::MsoArrowheadStyle::msoArrowheadOval:
- return rtl::OUString::createFromAscii("Circle" );
- case office::MsoArrowheadStyle::msoArrowheadDiamond:
- return rtl::OUString::createFromAscii( "Square 45" );
- case office::MsoArrowheadStyle::msoArrowheadTriangle:
- return rtl::OUString::createFromAscii( "Arrow" );
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Invalid Arrow Style!"), uno::Reference< uno::XInterface >() );
- }
-}
-
-// Attributes
-sal_Int32 SAL_CALL
-ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException)
-{
- sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone;
- rtl::OUString sLineName;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ) ) >>= sLineName;
- if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString::createFromAscii( "msArray" ) ) ) != -1 )
- {
- sal_Int32 nIndex = sLineName.indexOf( rtl::OUString::createFromAscii(" ") );
- rtl::OUString sName = sLineName.copy( 0, nIndex );
- //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32();
- nLineType = convertLineStartEndNameToArrowheadStyle( sName );
- }
- else
- {
- nLineType = convertLineStartEndNameToArrowheadStyle( sLineName );
- }
- return nLineType;
-}
-
-void SAL_CALL
-ScVbaLineFormat::setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (uno::RuntimeException)
-{
- rtl::OUString sArrayName = convertArrowheadStyleToLineStartEndName( _beginarrowheadstyle );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ), uno::makeAny( sArrayName ) );
-}
-
-sal_Int32 SAL_CALL
-ScVbaLineFormat::getBeginArrowheadLength() throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-void SAL_CALL
-ScVbaLineFormat::setBeginArrowheadLength( sal_Int32 /*_beginarrowheadlength*/ ) throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-sal_Int32 SAL_CALL
-ScVbaLineFormat::getBeginArrowheadWidth() throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-void SAL_CALL
-ScVbaLineFormat::setBeginArrowheadWidth( sal_Int32 /*_beginarrowheadwidth*/ ) throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-sal_Int32 SAL_CALL
-ScVbaLineFormat::getEndArrowheadStylel() throw (uno::RuntimeException)
-{
- return 0;
-}
-
-void SAL_CALL
-ScVbaLineFormat::setEndArrowheadStylel( sal_Int32 /*_endarrowheadstylel*/ ) throw (uno::RuntimeException)
-{
-}
-
-sal_Int32 SAL_CALL
-ScVbaLineFormat::getEndArrowheadLength() throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-void SAL_CALL
-ScVbaLineFormat::setEndArrowheadLength( sal_Int32 /*_endarrowheadlength*/ ) throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-sal_Int32 SAL_CALL
-ScVbaLineFormat::getEndArrowheadWidth() throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-void SAL_CALL
-ScVbaLineFormat::setEndArrowheadWidth( sal_Int32 /*_endarrowheadwidth*/ ) throw (uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
-}
-
-double SAL_CALL
-ScVbaLineFormat::getWeight() throw (uno::RuntimeException)
-{
- sal_Int32 nLineWidth=0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineWidth") ) >>= nLineWidth;
- double dLineWidth = Millimeter::getInPoints( nLineWidth );
- return dLineWidth;
-}
-
-void SAL_CALL
-ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException)
-{
- if( _weight < 0 )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter: Must be positv."), uno::Reference< uno::XInterface >() );
- if( _weight == 0 )
- _weight = 0.5;
- m_nLineWeight = _weight;
- Millimeter aMillimeter;
- aMillimeter.setInPoints( _weight );
-
- sal_Int32 nLineWidth = static_cast<sal_Int32>( aMillimeter.getInHundredthsOfOneMillimeter() );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineWidth" ), uno::makeAny( nLineWidth ) );
- setDashStyle( m_nLineDashStyle );
-}
-
-sal_Bool SAL_CALL
-ScVbaLineFormat::getVisible() throw (uno::RuntimeException)
-{
- drawing::LineStyle aLineStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle;
- if( aLineStyle == drawing::LineStyle_NONE )
- {
- return sal_False;
- }
- return sal_True;
-}
-
-void SAL_CALL
-ScVbaLineFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
-{
- drawing::LineStyle aLineStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle;
- if( !_visible )
- {
- aLineStyle = drawing::LineStyle_NONE;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) );
- }
- else
- {
- if( aLineStyle == drawing::LineStyle_NONE )
- {
- setDashStyle( m_nLineDashStyle );
- }
- }
-}
-
-double SAL_CALL
-ScVbaLineFormat::getTransparency() throw (uno::RuntimeException)
-{
- sal_Int16 nTransparency = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ) ) >>= nTransparency;
- double fTransparency = static_cast<double>( nTransparency );
- return fTransparency / 100;
-}
-
-void SAL_CALL
-ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException)
-{
- sal_Int16 nTransparency = static_cast<sal_Int16>( _transparency * 100 );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ), uno::makeAny( nTransparency ) );
-}
-
-sal_Int16 SAL_CALL
-ScVbaLineFormat::getStyle() throw (uno::RuntimeException)
-{
- //OpenOffice.org only supports one LineStyle (other than the DashStyles)
- //Therefore we can only return the SingleLine
- return 1;
-}
-
-void SAL_CALL
-ScVbaLineFormat::setStyle( sal_Int16 /*_style */) throw (uno::RuntimeException)
-{
- //OpenOffice.org only supports one LineStyle (other than the DashStyles)
- //Therefore we do not set the LineStyle, because it maybe is already set
- //to Dashed or Single Line. Setting the 'Visible' or 'DashStyle' properties
- //will be done with the according methods.
-}
-
-sal_Int32 SAL_CALL
-ScVbaLineFormat::getDashStyle() throw (uno::RuntimeException)
-{
- drawing::LineStyle eLineStyle;
- //LineStyle integer in Xray
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= eLineStyle;
- if( eLineStyle == drawing::LineStyle_SOLID )
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid;
- else
- {
- drawing::LineDash aLineDash;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineDash" ) ) >>= aLineDash;
- if( aLineDash.Dots == 0 )
- {
- //LineDash
- //LineLongDash
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineDash;
- if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) )
- {
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDash;
- }
- }
- else if( aLineDash.Dots == 1 )
- {
- // LineDashDot
- // LineLongDashDot
- // LineSquareDot
- // LineRoundDot ! not supported
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDot;
- if( aLineDash.Dashes == 0 )
- {
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineSquareDot;
- }
- else
- {
- if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) )
- {
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDashDot;
- }
- }
- }
- else if( aLineDash.Dots == 2 )
- {
- // LineDashDotDot
- m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDotDot;
- }
- }
-
- return m_nLineDashStyle;
-}
-
-void SAL_CALL
-ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeException)
-{
- m_nLineDashStyle = _dashstyle;
- if( _dashstyle == office::MsoLineDashStyle::msoLineSolid )
- {
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ));
- }
- else
- {
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_DASH ) );
- drawing::LineDash pLineDash;
- Millimeter aMillimeter( m_nLineWeight );
- sal_Int32 nPixel = static_cast< sal_Int32 >( aMillimeter.getInHundredthsOfOneMillimeter() );
- switch( _dashstyle )
- {
- case office::MsoLineDashStyle::msoLineDashDot:
- pLineDash.Dots = 1;
- pLineDash.DotLen = nPixel;
- pLineDash.Dashes = 1;
- pLineDash.DashLen = 5 * nPixel;
- pLineDash.Distance = 4 * nPixel;
- break;
- case office::MsoLineDashStyle::msoLineLongDashDot:
- pLineDash.Dots = 1;
- pLineDash.DotLen = nPixel;
- pLineDash.Dashes = 1;
- pLineDash.DashLen = 10 * nPixel;
- pLineDash.Distance = 4 * nPixel;
- break;
- case office::MsoLineDashStyle::msoLineDash:
- pLineDash.Dots = 0;
- pLineDash.DotLen = 0;
- pLineDash.Dashes = 1;
- pLineDash.DashLen = 6 * nPixel;
- pLineDash.Distance = 4 * nPixel;
- break;
- case office::MsoLineDashStyle::msoLineDashDotDot:
- pLineDash.Dots = 2;
- pLineDash.DotLen = nPixel;
- pLineDash.Dashes = 1;
- pLineDash.DashLen = 10 * nPixel;
- pLineDash.Distance = 3 * nPixel;
- break;
- case office::MsoLineDashStyle::msoLineLongDash:
- pLineDash.Dots = 0;
- pLineDash.DotLen = 0;
- pLineDash.Dashes = 1;
- pLineDash.DashLen = 10 * nPixel;
- pLineDash.Distance = 4 * nPixel;
- break;
- case office::MsoLineDashStyle::msoLineSquareDot:
- pLineDash.Dots = 1;
- pLineDash.DotLen = nPixel;
- pLineDash.Dashes = 0;
- pLineDash.DashLen = 0;
- pLineDash.Distance = nPixel;
- break;
- case office::MsoLineDashStyle::msoLineRoundDot:
- pLineDash.Dots = 1;
- pLineDash.DotLen = nPixel;
- pLineDash.Dashes = 0;
- pLineDash.DashLen = 0;
- pLineDash.Distance = nPixel;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("this MsoLineDashStyle is not supported."), uno::Reference< uno::XInterface >() );
- break;
- }
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineDash" ), uno::makeAny( pLineDash ) );
- }
-}
-
-// Methods
-uno::Reference< msforms::XColorFormat > SAL_CALL
-ScVbaLineFormat::BackColor() throw (uno::RuntimeException)
-{
- return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_BACKCOLOR ) );
-}
-
-uno::Reference< msforms::XColorFormat > SAL_CALL
-ScVbaLineFormat::ForeColor() throw (uno::RuntimeException)
-{
- return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_FORECOLOR ) );
-}
-
-
-rtl::OUString&
-ScVbaLineFormat::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLineFormat") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaLineFormat::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.LineFormat" ) );
- }
- return aServiceNames;
-}
-
-
diff --git a/scratch/sc-vba/dead-source/vbalineformat.hxx b/scratch/sc-vba/dead-source/vbalineformat.hxx
deleted file mode 100644
index f687b0b38..000000000
--- a/scratch/sc-vba/dead-source/vbalineformat.hxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_XLINEFORMAT_HXX
-#define SC_VBA_XLINEFORMAT_HXX
-
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/msforms/XLineFormat.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::msforms::XLineFormat > ScVbaLineFormat_BASE;
-
-class ScVbaLineFormat : public ScVbaLineFormat_BASE
-{
-private:
- css::uno::Reference< css::drawing::XShape > m_xShape;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
- sal_Int32 m_nLineDashStyle;
- double m_nLineWeight;
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- sal_Int32 convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName );
- rtl::OUString convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (css::uno::RuntimeException);
- sal_Int32 calculateArrowheadSize();
-public:
- ScVbaLineFormat( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape );
-
- // Attributes
- virtual sal_Int32 SAL_CALL getBeginArrowheadStyle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getBeginArrowheadLength() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setBeginArrowheadLength( sal_Int32 _beginarrowheadlength ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getBeginArrowheadWidth() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setBeginArrowheadWidth( sal_Int32 _beginarrowheadwidth ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getEndArrowheadStylel() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEndArrowheadStylel( sal_Int32 _endarrowheadstylel ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getEndArrowheadLength() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEndArrowheadLength( sal_Int32 _endarrowheadlength ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getEndArrowheadWidth() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEndArrowheadWidth( sal_Int32 _endarrowheadwidth ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getWeight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setWeight( double _weight ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getStyle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setStyle( sal_Int16 _style ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDashStyle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDashStyle( sal_Int32 _dashstyle ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual css::uno::Reference< oo::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException);
-};
-
-#endif//SC_VBA_XLINEFORMAT_HXX
diff --git a/scratch/sc-vba/dead-source/vbalistbox.cxx b/scratch/sc-vba/dead-source/vbalistbox.cxx
deleted file mode 100644
index 37be050e3..000000000
--- a/scratch/sc-vba/dead-source/vbalistbox.cxx
+++ /dev/null
@@ -1,294 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
-
-#include "vbalistbox.hxx"
-#include "vbapropvalue.hxx"
-#include <vector>
-#include <comphelper/anytostring.hxx>
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") );
-const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-
-
-ScVbaListBox::ScVbaListBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : ListBoxImpl_BASE( xContext, xControlShape )
-{
- // grab the default value property name
- m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
-}
-
-ScVbaListBox::ScVbaListBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertySet >& xPropSet, const css::uno::Reference< css::drawing::XControlShape > xControlShape ) : ListBoxImpl_BASE( xContext, xPropSet, xControlShape )
-{
- m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
-}
-
-
-// Attributes
-uno::Any SAL_CALL
-ScVbaListBox::getValue() throw (uno::RuntimeException)
-{
- if( getMultiSelect() )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
- uno::Reference< form::validation::XValidatableFormComponent > xValidatableFormComponent( m_xProps, uno::UNO_QUERY_THROW );
- return xValidatableFormComponent->getCurrentValue();
-}
-
-void SAL_CALL
-ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
-{
- if( getMultiSelect() )
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
- }
- rtl::OUString sValue = getAnyAsString( _value );
- uno::Sequence< rtl::OUString > sList;
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
- uno::Sequence< sal_Int16 > nList;
- sal_Int16 nLength = static_cast<sal_Int16>( sList.getLength() );
- sal_Int16 nValue = -1;
- sal_Int16 i = 0;
- for( i = 0; i < nLength; i++ )
- {
- if( sList[i].equals( sValue ) )
- {
- nValue = i;
- break;
- }
- }
- if( nValue == -1 )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
-
- nList.realloc( 1 );
- nList[0] = nValue;
-
- m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaListBox::getText() throw (uno::RuntimeException)
-{
- rtl::OUString result;
- uno::Reference< form::validation::XValidatableFormComponent > xValidatableFormComponent( m_xProps, uno::UNO_QUERY_THROW );
- xValidatableFormComponent->getCurrentValue() >>= result;
- return result;
-}
-
-void SAL_CALL
-ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
-{
- setValue( uno::makeAny( _text ) ); // seems the same
-}
-
-sal_Bool SAL_CALL
-ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
-{
- sal_Bool bMultiSelect = sal_False;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect;
- return bMultiSelect;
-}
-
-void SAL_CALL
-ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
-{
- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
-}
-/*
-css::uno::Sequence< sal_Bool > SAL_CALL
-ScVbaListBox::getSelected() throw (css::uno::RuntimeException)
-{
- uno::Sequence< rtl::OUString > sList;
- uno::Sequence< sal_Int16 > nList;
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
- uno::Sequence< sal_Bool > bSelected( sList.getLength() );
- for( sal_Int16 i = 0; i < bSelected.getLength(); i++ )
- bSelected[i] = sal_False;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
- for( sal_Int16 i = 0; i < nList.getLength(); i++ )
- {
- bSelected[nList[i]] = sal_True;
- }
- return bSelected;
-}
-
-void SAL_CALL
-ScVbaListBox::setSelected( const css::uno::Sequence< sal_Bool >& _selected ) throw (css::uno::RuntimeException)
-{
-}
-*/
-css::uno::Any SAL_CALL
-ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
-{
- uno::Sequence< rtl::OUString > sList;
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
- sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
- sal_Int16 nIndex = m_nIndex;
- if( 0 > nIndex && nLength < nIndex )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Error Number." ), uno::Reference< uno::XInterface >() );
- m_nIndex = static_cast< sal_Int16 >( index );
- return uno::makeAny( uno::Reference< vba::XPropValue > ( new ScVbaPropValue( this ) ) );
-}
-
-// Methods
-void SAL_CALL
-ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
-{
- if ( pvargItem.hasValue() )
- {
- uno::Sequence< rtl::OUString > sList;
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
-
- sal_Int32 nIndex = sList.getLength();
-
- if ( pvargIndex.hasValue() )
- pvargIndex >>= nIndex;
-
- rtl::OUString sString = getAnyAsString( pvargItem );
-
- // if no index specified or item is to be appended to end of
- // list just realloc the array and set the last item
- if ( nIndex == sList.getLength() )
- {
- sal_Int32 nOldSize = sList.getLength();
- sList.realloc( nOldSize + 1 );
- sList[ nOldSize ] = sString;
- }
- else
- {
- // just copy those elements above the one to be inserted
- std::vector< rtl::OUString > sVec;
- // reserve just the amount we need to copy
- sVec.reserve( sList.getLength() - nIndex );
-
- // point at first element to copy
- rtl::OUString* pString = sList.getArray() + nIndex;
- const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
- // insert the new element
- sVec.push_back( sString );
- // copy elements
- for ( ; pString != pEndString; ++pString )
- sVec.push_back( *pString );
-
- sList.realloc( sList.getLength() + 1 );
-
- // point at first element to be overwritten
- pString = sList.getArray() + nIndex;
- pEndString = sList.getArray() + sList.getLength();
- std::vector< rtl::OUString >::iterator it = sVec.begin();
- for ( ; pString != pEndString; ++pString, ++it)
- *pString = *it;
- //
- }
-
- m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
-
- }
-}
-
-void SAL_CALL
-ScVbaListBox::Clear( ) throw (uno::RuntimeException)
-{
- // urk, setValue doesn't seem to work !!
- //setValue( uno::makeAny( sal_Int16() ) );
- m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
-}
-//PropListener
-void
-ScVbaListBox::setValueEvent( const uno::Any& value )
-{
- sal_Bool bValue;
- if( !(value >>= bValue) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() );
- uno::Sequence< sal_Int16 > nList;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
- sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
- sal_Int16 nIndex = m_nIndex;
- for( sal_Int16 i = 0; i < nLength; i++ )
- {
- if( nList[i] == nIndex )
- {
- if( bValue )
- return;
- else
- {
- for( ; i < nLength - 1; i++ )
- {
- nList[i] = nList[i + 1];
- }
- nList.realloc( nLength - 1 );
- m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
- return;
- }
- }
- }
- if( bValue )
- {
- if( getMultiSelect() )
- {
- nList.realloc( nLength + 1 );
- nList[nLength] = nIndex;
- }
- else
- {
- nList.realloc( 1 );
- nList[0] = nIndex;
- }
- m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
- }
-}
-
-css::uno::Any
-ScVbaListBox::getValueEvent()
-{
- uno::Sequence< sal_Int16 > nList;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
- sal_Int32 nLength = nList.getLength();
- sal_Int32 nIndex = m_nIndex;
-
- for( sal_Int32 i = 0; i < nLength; i++ )
- {
- if( nList[i] == nIndex )
- return uno::makeAny( sal_True );
- }
-
- return uno::makeAny( sal_False );
-}
diff --git a/scratch/sc-vba/dead-source/vbalistbox.hxx b/scratch/sc-vba/dead-source/vbalistbox.hxx
deleted file mode 100644
index d02f06982..000000000
--- a/scratch/sc-vba/dead-source/vbalistbox.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_LISTBOX_HXX
-#define SC_VBA_LISTBOX_HXX
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/script/XDefaultProperty.hpp>
-#include <org/openoffice/msforms/XListBox.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-#include "vbacontrol.hxx"
-#include "vbapropvalue.hxx"
-#include "vbahelper.hxx"
-
-typedef cppu::ImplInheritanceHelper2<ScVbaControl, oo::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
-class ScVbaListBox : public ListBoxImpl_BASE
- ,public PropListener
-{
- rtl::OUString sSourceName;
- rtl::OUString msDftPropName;
-
- sal_Int16 m_nIndex;
-
-public:
- ScVbaListBox( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- ScVbaListBox( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::beans::XPropertySet >& xProps,
- const css::uno::Reference< css::drawing::XControlShape> xControlShape );
-
-
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
-
-
- // XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-
- //PropListener
- virtual void setValueEvent( const css::uno::Any& value );
- virtual css::uno::Any getValueEvent();
-
-
-};
-
-#endif //
diff --git a/scratch/sc-vba/dead-source/vbaname.cxx b/scratch/sc-vba/dead-source/vbaname.cxx
deleted file mode 100644
index 216e201ca..000000000
--- a/scratch/sc-vba/dead-source/vbaname.cxx
+++ /dev/null
@@ -1,275 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaname.cxx,v $
- *
- * $Revision: 1.1.2.2 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 11:47:24 $
- *
- * 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
- *
- ************************************************************************/
-#include "helperdecl.hxx"
-
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-
-#include "vbaname.hxx"
-#include "vbarange.hxx"
-#include "vbaglobals.hxx"
-#include <vector>
-#include <rangenam.hxx>
-#include <vcl/msgbox.hxx>
-#include "tabvwsh.hxx"
-#include "viewdata.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-ScVbaName::ScVbaName(const css::uno::Reference< oo::vba::XHelperInterface >& xParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::sheet::XNamedRange >& xName,
- const css::uno::Reference< css::sheet::XNamedRanges >& xNames,
- const css::uno::Reference< css::frame::XModel >& xModel ):
- NameImpl_BASE( xParent , xContext ),
- mxModel( xModel ),
- mxNamedRange( xName ),
- mxNames( xNames )
-{
-}
-
-ScVbaName::~ScVbaName()
-{
-}
-
-css::uno::Reference< oo::excel::XWorksheet >
-ScVbaName::getWorkSheet() throw (css::uno::RuntimeException)
-{
- return ScVbaGlobals::getGlobalsImpl( mxContext )->getActiveSheet();
-}
-
-::rtl::OUString
-ScVbaName::getName() throw (css::uno::RuntimeException)
-{
- String sName;
- sName += UniString( getWorkSheet()->getName());
- sName += String::CreateFromAscii("!");
- sName += UniString ( mxNamedRange->getName() );
- return ::rtl::OUString( sName );
-}
-
-void
-ScVbaName::setName( const ::rtl::OUString & rName ) throw (css::uno::RuntimeException)
-{
- mxNamedRange->setName( rName );
-}
-
-::rtl::OUString
-ScVbaName::getNameLocal() throw (css::uno::RuntimeException)
-{
- return getName();
-}
-
-void
-ScVbaName::setNameLocal( const ::rtl::OUString & rName ) throw (css::uno::RuntimeException)
-{
- setName( rName );
-}
-
-sal_Bool
-ScVbaName::getVisible() throw (css::uno::RuntimeException)
-{
- return true;
-}
-
-void
-ScVbaName::setVisible( sal_Bool /*bVisible*/ ) throw (css::uno::RuntimeException)
-{
-}
-
-::rtl::OUString
-ScVbaName::getValue() throw (css::uno::RuntimeException)
-{
- ::rtl::OUString sValue = mxNamedRange->getContent();
- ::rtl::OUString sSheetName = getWorkSheet()->getName();
- ::rtl::OUString sSegmentation = ::rtl::OUString::createFromAscii( ";" );
- ::rtl::OUString sNewSegmentation = ::rtl::OUString::createFromAscii( "," );
- ::rtl::OUString sResult;
- sal_Int32 nFrom = 0;
- sal_Int32 nTo = 0;
- nTo = sValue.indexOf( sSegmentation, nFrom );
- while ( nTo != -1 )
- {
- ::rtl::OUString sTmpValue = sValue.copy( nFrom, nTo - nFrom );
- if ( sTmpValue.toChar() == '$' )
- {
- ::rtl::OUString sTmp = sTmpValue.copy( 1 );
- sTmp = sTmp.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii(".")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("!"));
- sResult += sTmp;
- sResult += sNewSegmentation;
- }
- nFrom = nTo + 1;
- nTo = sValue.indexOf( sSegmentation, nFrom );
- }
- ::rtl::OUString sTmpValue = sValue.copy( nFrom );
- if ( sTmpValue.toChar() == '$' )
- {
- ::rtl::OUString sTmp = sTmpValue.copy(1);
- sTmp = sTmp.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii(".")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("!"));
- sResult += sTmp;
- }
- if (sResult.indexOf('=') != 0)
- {
- sResult = ::rtl::OUString::createFromAscii("=") + sResult;
- }
- return sResult;
-}
-
-void
-ScVbaName::setValue( const ::rtl::OUString & rValue ) throw (css::uno::RuntimeException)
-{
- ::rtl::OUString sSheetName = getWorkSheet()->getName();
- ::rtl::OUString sValue = rValue;
- ::rtl::OUString sSegmentation = ::rtl::OUString::createFromAscii( "," );
- ::rtl::OUString sNewSegmentation = ::rtl::OUString::createFromAscii( ";" );
- ::rtl::OUString sResult;
- sal_Int32 nFrom = 0;
- sal_Int32 nTo = 0;
- if (sValue.indexOf('=') == 0)
- {
- ::rtl::OUString sTmp = sValue.copy(1);
- sValue = sTmp;
- }
- nTo = sValue.indexOf( sSegmentation, nFrom );
- while ( nTo != -1 )
- {
- ::rtl::OUString sTmpValue = sValue.copy( nFrom, nTo - nFrom );
- sTmpValue = sTmpValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii("!")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("."));
- if (sTmpValue.copy(0, sSheetName.getLength()).equals(sSheetName))
- {
- sTmpValue = ::rtl::OUString::createFromAscii("$") + sTmpValue;
- }
- sTmpValue += sNewSegmentation;
- sResult += sTmpValue;
- nFrom = nTo + 1;
- nTo = sValue.indexOf( sSegmentation, nFrom );
- }
- ::rtl::OUString sTmpValue = sValue.copy( nFrom );
- sTmpValue = sTmpValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii("!")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("."));
- if (sTmpValue.copy(0, sSheetName.getLength()).equals(sSheetName))
- {
- sTmpValue = ::rtl::OUString::createFromAscii("$") + sTmpValue;
- }
- sResult += sTmpValue;
- mxNamedRange->setContent(sResult);
-}
-
-::rtl::OUString
-ScVbaName::getRefersTo() throw (css::uno::RuntimeException)
-{
- return getValue();
-}
-
-void
-ScVbaName::setRefersTo( const ::rtl::OUString & rRefersTo ) throw (css::uno::RuntimeException)
-{
- setValue( rRefersTo );
-}
-
-::rtl::OUString
-ScVbaName::getRefersToLocal() throw (css::uno::RuntimeException)
-{
- return getRefersTo();
-}
-
-void
-ScVbaName::setRefersToLocal( const ::rtl::OUString & rRefersTo ) throw (css::uno::RuntimeException)
-{
- setRefersTo( rRefersTo );
-}
-
-::rtl::OUString
-ScVbaName::getRefersToR1C1() throw (css::uno::RuntimeException)
-{
- return getRefersTo();
-}
-
-void
-ScVbaName::setRefersToR1C1( const ::rtl::OUString & rRefersTo ) throw (css::uno::RuntimeException)
-{
- setRefersTo( rRefersTo );
-}
-
-::rtl::OUString
-ScVbaName::getRefersToR1C1Local() throw (css::uno::RuntimeException)
-{
- return getRefersTo();
-}
-
-void
-ScVbaName::setRefersToR1C1Local( const ::rtl::OUString & rRefersTo ) throw (css::uno::RuntimeException)
-{
- setRefersTo( rRefersTo );
-}
-
-css::uno::Reference< oo::excel::XRange >
-ScVbaName::getRefersToRange() throw (css::uno::RuntimeException)
-{
- uno::Reference< oo::excel::XRange > xRange = ScVbaRange::getRangeObjectForName( mxContext, mxNamedRange->getName(), getDocShell( mxModel ), ScAddress::CONV_XL_R1C1 );
- return xRange;
-}
-
-void
-ScVbaName::setRefersToRange( const css::uno::Reference< oo::excel::XRange > /*rRange*/ ) throw (css::uno::RuntimeException)
-{
-}
-
-void
-ScVbaName::Delete() throw (css::uno::RuntimeException)
-{
- mxNames->removeByName( mxNamedRange->getName() );
-}
-
-rtl::OUString&
-ScVbaName::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaName") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaName::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Name" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbaname.hxx b/scratch/sc-vba/dead-source/vbaname.hxx
deleted file mode 100644
index 50be7ab77..000000000
--- a/scratch/sc-vba/dead-source/vbaname.hxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_NAME_HXX
-#define SC_VBA_NAME_HXX
-
-#include <org/openoffice/excel/XName.hpp>
-#include <com/sun/star/sheet/XNamedRange.hpp>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
-
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XName > NameImpl_BASE;
-
-class ScVbaName : public NameImpl_BASE
-{
- css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::sheet::XNamedRange > mxNamedRange;
- css::uno::Reference< css::sheet::XNamedRanges > mxNames;
-
- ScDocument * m_pDoc;
-
-protected:
- virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
- virtual css::uno::Reference< oo::excel::XWorksheet > getWorkSheet() throw (css::uno::RuntimeException);
-
-public:
- ScVbaName( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XNamedRange >& xName , const css::uno::Reference< css::sheet::XNamedRanges >& xNames , const css::uno::Reference< css::frame::XModel >& xModel );
- virtual ~ScVbaName();
-
- // Attributes
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNameLocal() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setNameLocal( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const ::rtl::OUString &rValue ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getRefersTo() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRefersTo( const ::rtl::OUString &rRefersTo ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getRefersToLocal() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRefersToLocal( const ::rtl::OUString &rRefersTo ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getRefersToR1C1() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRefersToR1C1( const ::rtl::OUString &rRefersTo ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getRefersToR1C1Local() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRefersToR1C1Local( const ::rtl::OUString &rRefersTo ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL getRefersToRange() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRefersToRange( const css::uno::Reference< oo::excel::XRange > xRange ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif /* SC_VBA_NAME_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbanames.cxx b/scratch/sc-vba/dead-source/vbanames.cxx
deleted file mode 100644
index 457188037..000000000
--- a/scratch/sc-vba/dead-source/vbanames.cxx
+++ /dev/null
@@ -1,219 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbanames.cxx,v $
- *
- * $Revision: 1.1.2.2 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 11:47:24 $
- *
- * 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
- *
- ************************************************************************/
-#include "helperdecl.hxx"
-
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-
-#include "vbanames.hxx"
-#include "vbaname.hxx"
-#include "vbarange.hxx"
-#include "vbaglobals.hxx"
-#include <vector>
-#include <rangenam.hxx>
-#include <vcl/msgbox.hxx>
-#include "tabvwsh.hxx"
-#include "viewdata.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-class NamesEnumeration : public EnumerationHelperImpl
-{
- uno::Reference< frame::XModel > m_xModel;
- uno::WeakReference< vba::XHelperInterface > m_xParent;
- uno::Reference< sheet::XNamedRanges > m_xNames;
-public:
- NamesEnumeration( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel , const uno::Reference< sheet::XNamedRanges >& xNames ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_xModel( xModel ), m_xParent( xParent ), m_xNames( xNames ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< sheet::XNamedRange > xNamed( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- return uno::makeAny( uno::Reference< excel::XName > ( new ScVbaName( m_xParent, m_xContext, xNamed ,m_xNames , m_xModel ) ) );
- }
-
-};
-
-
-ScVbaNames::ScVbaNames(const css::uno::Reference< oo::vba::XHelperInterface >& xParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::sheet::XNamedRanges >& xNames,
- const css::uno::Reference< css::frame::XModel >& xModel ):
- ScVbaNames_BASE( xParent , xContext , uno::Reference< container::XIndexAccess >( xNames, uno::UNO_QUERY ) ),
- mxModel( xModel ),
- mxNames( xNames )
-{
- m_xNameAccess.set( xNames, uno::UNO_QUERY_THROW );
-}
-
-ScVbaNames::~ScVbaNames()
-{
-}
-
-ScDocument *
-ScVbaNames::getScDocument()
-{
- uno::Reference< frame::XModel > xModel( getModel() , uno::UNO_QUERY_THROW );
- ScTabViewShell * pTabViewShell = getBestViewShell( xModel );
- if ( !pTabViewShell )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() );
- ScViewData* pViewData = pTabViewShell->GetViewData();
- if ( !pViewData )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewData available"), uno::Reference< uno::XInterface >() );
- return pViewData->GetDocument();
-}
-
-css::uno::Any
-ScVbaNames::Add( const css::uno::Any& Name ,
- const css::uno::Any& RefersTo,
- const css::uno::Any& /*Visible*/,
- const css::uno::Any& /*MacroType*/,
- const css::uno::Any& /*ShoutcutKey*/,
- const css::uno::Any& /*Category*/,
- const css::uno::Any& NameLocal,
- const css::uno::Any& /*RefersToLocal*/,
- const css::uno::Any& /*CategoryLocal*/,
- const css::uno::Any& RefersToR1C1,
- const css::uno::Any& RefersToR1C1Local ) throw (css::uno::RuntimeException)
-{
-
- rtl::OUString sName;
- uno::Reference< excel::XRange > xRange;
- if ( Name.hasValue() )
- Name >>= sName;
- else if ( NameLocal.hasValue() )
- NameLocal >>= sName;
- if ( sName.getLength() != 0 )
- {
- if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
- {
- ::rtl::OUString sResult ;
- sal_Int32 nToken = 0;
- sal_Int32 nIndex = 0;
- sResult = sName.getToken( nToken , '!' , nIndex );
- if ( -1 == nIndex )
- sResult = sName;
- else
- sResult = sName.copy( nIndex );
- sName = sResult ;
- if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("This Name is a valid ."), uno::Reference< uno::XInterface >() );
- }
- }
- if ( RefersTo.hasValue() || RefersToR1C1.hasValue() || RefersToR1C1Local.hasValue() )
- {
- if ( RefersTo.hasValue() )
- RefersTo >>= xRange;
- if ( RefersToR1C1.hasValue() )
- RefersToR1C1 >>= xRange;
- if ( RefersToR1C1Local.hasValue() )
- RefersToR1C1Local >>= xRange;
- }
-
- if ( xRange.is() )
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- uno::Reference< table::XCellRange > thisRange ;
- uno::Any xAny = pRange->getCellRange() ;
- if ( xAny.hasValue() )
- xAny >>= thisRange;
- uno::Reference< sheet::XCellRangeAddressable > thisRangeAdd( thisRange, ::uno::UNO_QUERY_THROW);
- table::CellRangeAddress aAddr = thisRangeAdd->getRangeAddress();
- ScAddress aPos( static_cast< SCCOL >( aAddr.StartColumn ) , static_cast< SCROW >( aAddr.StartRow ) , static_cast< SCTAB >(aAddr.Sheet ) );
- uno::Any xAny2 ;
- String sRangeAdd = xRange->Address( xAny2, xAny2 , xAny2 , xAny2, xAny2 );
- String sTmp;
- sTmp += String::CreateFromAscii("$");
- sTmp += UniString(xRange->getWorksheet()->getName());
- sTmp += String::CreateFromAscii(".");
- sTmp += sRangeAdd;
- if ( mxNames.is() )
- {
- RangeType nType = RT_NAME;
- table::CellAddress aCellAddr( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow );
- if ( mxNames->hasByName( sName ) )
- mxNames->removeByName(sName);
- mxNames->addNewByName( sName , rtl::OUString(sTmp) , aCellAddr , (sal_Int32)nType);
- }
- }
- return css::uno::Any();
-}
-
-// XEnumerationAccess
-css::uno::Type
-ScVbaNames::getElementType() throw( css::uno::RuntimeException )
-{
- return oo::excel::XName::static_type(0);
-}
-
-uno::Reference< container::XEnumeration >
-ScVbaNames::createEnumeration() throw (uno::RuntimeException)
-{
- if ( mxNames.is() )
- {
- uno::Reference< container::XEnumerationAccess > xAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
- return xAccess->createEnumeration();
- }
- uno::Reference< container::XEnumerationAccess > xEnumAccess( mxNames, uno::UNO_QUERY_THROW );
- return new NamesEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel , mxNames );
-}
-
-uno::Any
-ScVbaNames::createCollectionObject( const uno::Any& aSource )
-{
- uno::Reference< sheet::XNamedRange > xName( aSource, uno::UNO_QUERY );
- return uno::makeAny( uno::Reference< excel::XName > ( new ScVbaName( getParent(), mxContext, xName, mxNames , mxModel ) ) );
-}
-
-rtl::OUString&
-ScVbaNames::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaNames") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaNames::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.NamedRanges" ) );
- }
- return aServiceNames;
-}
-
-
diff --git a/scratch/sc-vba/dead-source/vbanames.hxx b/scratch/sc-vba/dead-source/vbanames.hxx
deleted file mode 100644
index b512c8824..000000000
--- a/scratch/sc-vba/dead-source/vbanames.hxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbanames.hxx,v $
- *
- * $Revision: 1.1.2.2 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 11:47:24 $
- *
- * 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 SC_VBA_NAMES_HXX
-#define SC_VBA_NAMES_HXX
-
-#include <org/openoffice/excel/XNames.hpp>
-#include <org/openoffice/vba/XCollection.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
-#include "vbacollectionimpl.hxx"
-
-typedef CollTestImplHelper< oo::excel::XNames > ScVbaNames_BASE;
-
-class ScVbaNames : public ScVbaNames_BASE
-{
- css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::sheet::XNamedRanges > mxNames;
-
-protected:
- virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
-
-public:
- ScVbaNames( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XNamedRanges >& xNames , const css::uno::Reference< css::frame::XModel >& xModel );
-
- ScDocument* getScDocument();
- ScDocShell* getScDocShell();
-
- virtual ~ScVbaNames();
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
- // Methods
- virtual css::uno::Any SAL_CALL Add( const css::uno::Any& aName ,
- const css::uno::Any& aRefersTo,
- const css::uno::Any& aVisible,
- const css::uno::Any& aMacroType,
- const css::uno::Any& aShoutcutKey,
- const css::uno::Any& aCategory,
- const css::uno::Any& aNameLocal,
- const css::uno::Any& aRefersToLocal,
- const css::uno::Any& aCategoryLocal,
- const css::uno::Any& aRefersToR1C1,
- const css::uno::Any& aRefersToR1C1Local ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-
- // ScVbaNames_BASE
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-#endif /* SC_VBA_NAMES_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbaoleobject.cxx b/scratch/sc-vba/dead-source/vbaoleobject.cxx
deleted file mode 100644
index 0ad306961..000000000
--- a/scratch/sc-vba/dead-source/vbaoleobject.cxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XWindow2.hpp>
-#include <com/sun/star/view/XControlAccess.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-
-#include "vbaoleobject.hxx"
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-
-sal_Int32 pt2mm( double pt ) //1/100mm
-{
- return static_cast<sal_Int32>(pt * 0.352778);
-}
-
-double mm2pt( sal_Int32 mm )
-{
- return mm * 2.8345;
-}
-
-
-ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
- css::uno::Reference< css::drawing::XControlShape > xControlShape )
-: OLEObjectImpl_BASE( xParent, xContext ), m_xControlShape( xControlShape )
-{
- //init m_xWindowPeer
- uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl(), css::uno::UNO_QUERY_THROW );
- uno::Reference< container::XChild > xChild( xControlModel, uno::UNO_QUERY_THROW );
- xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
- xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW );
- css::uno::Reference< css::frame::XModel > xModel( xChild->getParent(), uno::UNO_QUERY_THROW );
- css::uno::Reference< css::view::XControlAccess > xControlAccess( xModel->getCurrentController(), css::uno::UNO_QUERY_THROW );
- m_xWindowPeer = xControlAccess->getControl( xControlModel )->getPeer();
-}
-
-uno::Reference< uno::XInterface > SAL_CALL
-ScVbaOLEObject::getObject() throw (uno::RuntimeException)
-{
- return uno::Reference< uno::XInterface >( m_xControlShape, uno::UNO_QUERY_THROW );
-}
-
-sal_Bool SAL_CALL
-ScVbaOLEObject::getEnabled() throw (uno::RuntimeException)
-{
- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW );
- return xWindow2->isEnabled();
-}
-
-void SAL_CALL
-ScVbaOLEObject::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
-{
- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW );
- xWindow2->setEnable( _enabled );
-}
-
-sal_Bool SAL_CALL
-ScVbaOLEObject::getVisible() throw (uno::RuntimeException)
-{
- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW );
- return xWindow2->isVisible();
-}
-
-void SAL_CALL
-ScVbaOLEObject::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
-{
- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW );
- xWindow2->setVisible( _visible );
-}
-
-double SAL_CALL
-ScVbaOLEObject::getLeft() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt( xShape->getPosition().X / 100 );
-}
-
-void SAL_CALL
-ScVbaOLEObject::setLeft( double _left ) throw (uno::RuntimeException)
-{
- awt::Point oldPosition;
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- oldPosition = xShape->getPosition();
- oldPosition.X = pt2mm( _left ) * 100;
- xShape->setPosition( oldPosition );
-
-}
-
-double SAL_CALL
-ScVbaOLEObject::getTop() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt( xShape->getPosition().Y / 100 );
-}
-
-void SAL_CALL
-ScVbaOLEObject::setTop( double _top ) throw (uno::RuntimeException)
-{
- awt::Point oldPosition;
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- oldPosition = xShape->getPosition();
- oldPosition.Y = pt2mm( _top ) * 100;;
- xShape->setPosition( oldPosition );
-}
-
-double SAL_CALL
-ScVbaOLEObject::getHeight() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt( xShape->getSize().Height / 100 );//1pt = 1/72in
-}
-
-void SAL_CALL
-ScVbaOLEObject::setHeight( double _height ) throw (uno::RuntimeException)
-{
- awt::Size oldSize;
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- oldSize = xShape->getSize();
- oldSize.Height = pt2mm( _height ) * 100;
- xShape->setSize( oldSize );
-}
-
-double SAL_CALL
-ScVbaOLEObject::getWidth() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- return mm2pt ( xShape->getSize().Width / 100 );
-}
-
-void SAL_CALL
-ScVbaOLEObject::setWidth( double _width ) throw (uno::RuntimeException)
-{
- awt::Size oldSize;
- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW );
- oldSize = xShape->getSize();
- oldSize.Width = pt2mm( _width ) * 100;
- xShape->setSize( oldSize );
-}
-rtl::OUString&
-ScVbaOLEObject::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaOLEObject") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaOLEObject::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.OLEObject" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaoleobject.hxx b/scratch/sc-vba/dead-source/vbaoleobject.hxx
deleted file mode 100644
index 02dfe870b..000000000
--- a/scratch/sc-vba/dead-source/vbaoleobject.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_OLEOBJECT_HXX
-#define SC_VBA_OLEOBJECT_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/drawing/XControlShape.hpp>
-#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <org/openoffice/excel/XOLEObject.hpp>
-
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XOLEObject > OLEObjectImpl_BASE;
-
-class ScVbaOLEObject : public OLEObjectImpl_BASE
-{
- css::uno::Reference< css::awt::XWindowPeer > m_xWindowPeer;
-protected:
- css::uno::Reference< css::drawing::XControlShape > m_xControlShape;
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-public:
- ScVbaOLEObject( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
- css::uno::Reference< css::drawing::XControlShape > xControlShape );
-
- // XOLEObject Attributes
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
-
-};
-#endif //SC_VBA_OLEOBJECT_HXX
-
diff --git a/scratch/sc-vba/dead-source/vbaoleobjects.cxx b/scratch/sc-vba/dead-source/vbaoleobjects.cxx
deleted file mode 100644
index 57932694b..000000000
--- a/scratch/sc-vba/dead-source/vbaoleobjects.cxx
+++ /dev/null
@@ -1,193 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/drawing/XControlShape.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <org/openoffice/excel/XOLEObject.hpp>
-
-#include "vbaoleobject.hxx"
-#include "vbaoleobjects.hxx"
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
-
-class IndexAccessWrapper : public XIndexAccess_BASE
-{
-typedef std::vector< uno::Reference< drawing::XControlShape > > OLEObjects;
- OLEObjects vObjects;
-public:
- IndexAccessWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess )
- {
- sal_Int32 nLen = xIndexAccess->getCount();
- for ( sal_Int32 index = 0; index < nLen; ++index )
- {
- uno::Reference< drawing::XControlShape > xControlShape( xIndexAccess->getByIndex( index), uno::UNO_QUERY);
- if ( xControlShape.is() )
- vObjects.push_back( xControlShape );
- }
- }
-
- virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
- {
- return vObjects.size();
- }
-
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( Index < 0 || Index >= getCount() )
- throw lang::IndexOutOfBoundsException();
- return uno::makeAny( vObjects[ Index ] );
- }
-
- // Methods XElementAcess
- virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
- {
- return drawing::XControlShape::static_type(0);
- }
-
- virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
- {
- return ( getCount() > 0 );
- }
-
-};
-
-class EnumWrapper : public EnumerationHelper_BASE
-{
-
- uno::Reference<vba::XHelperInterface > m_xParent;
- uno::Reference<uno::XComponentContext > m_xContext;
- uno::Reference<container::XIndexAccess > m_xIndexAccess;
- sal_Int32 nIndex;
-public:
- EnumWrapper( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
-
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( nIndex < m_xIndexAccess->getCount() );
- }
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( nIndex < m_xIndexAccess->getCount() )
- {
- uno::Reference< drawing::XControlShape > xControlShape ( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
- return uno::makeAny( uno::Reference< oo::excel::XOLEObject >( new ScVbaOLEObject( m_xParent, m_xContext, xControlShape ) ) );
- }
- throw container::NoSuchElementException();
- }
-};
-
-uno::Reference< container::XIndexAccess > oleObjectIndexWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess )
-{
- return new IndexAccessWrapper( xIndexAccess );
-}
-
-ScVbaOLEObjects::ScVbaOLEObjects( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
- const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess )
- : OLEObjectsImpl_BASE( xParent, xContext, oleObjectIndexWrapper( xIndexAccess ) )
-{
-}
-uno::Reference< container::XEnumeration >
-ScVbaOLEObjects::createEnumeration() throw (uno::RuntimeException)
-{
- return new EnumWrapper( getParent(), mxContext, m_xIndexAccess );
-}
-
-uno::Any
-ScVbaOLEObjects::createCollectionObject( const css::uno::Any& aSource )
-{
- if( aSource.hasValue() )
- {
- uno::Reference< drawing::XControlShape > xControlShape( aSource, uno::UNO_QUERY_THROW );
- // parent of OLEObject is the same parent as the collection ( e.g. the sheet )
- return uno::makeAny( uno::Reference< oo::excel::XOLEObject >( new ScVbaOLEObject( getParent(), mxContext, xControlShape ) ) );
- }
- return uno::Any();
-}
-
-uno::Any
-ScVbaOLEObjects::getItemByStringIndex( const rtl::OUString& sIndex ) throw (uno::RuntimeException)
-{
- try
- {
- return OLEObjectsImpl_BASE::getItemByStringIndex( sIndex );
- }
- catch( uno::RuntimeException )
- {
- uno::Reference< container::XIndexAccess > xIndexAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
- sal_Int32 nCount = xIndexAccess->getCount();
- for( int index = 0; index < nCount; index++ )
- {
- uno::Any aUnoObj = xIndexAccess->getByIndex( index );
- uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY_THROW );
- uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl() );
- uno::Reference< container::XNamed > xNamed( xControlModel, uno::UNO_QUERY_THROW );
- if( sIndex.equals( xNamed->getName() ))
- {
- return createCollectionObject( aUnoObj );
- }
-
- }
- return uno::Any();
- }
-}
-
-uno::Type
-ScVbaOLEObjects::getElementType() throw (uno::RuntimeException)
-{
- return org::openoffice::excel::XOLEObject::static_type(0);
-}
-rtl::OUString&
-ScVbaOLEObjects::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaOLEObjects") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaOLEObjects::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.OLEObjects" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaoleobjects.hxx b/scratch/sc-vba/dead-source/vbaoleobjects.hxx
deleted file mode 100644
index d89db2dfa..000000000
--- a/scratch/sc-vba/dead-source/vbaoleobjects.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_OLEOBJECTS_HXX
-#define SC_VBA_OLEOBJECTS_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/excel/XOLEObjects.hpp>
-
-#include "vbacollectionimpl.hxx"
-#include "vbahelper.hxx"
-
-typedef CollTestImplHelper< oo::excel::XOLEObjects > OLEObjectsImpl_BASE;
-
-class ScVbaOLEObjects : public OLEObjectsImpl_BASE
-{
-protected:
- virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException);
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-public:
- ScVbaOLEObjects( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
- // ScVbaCollectionBaseImpl
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-
-};
-#endif //SC_VBA_OLEOBJECTS_HXX
-
diff --git a/scratch/sc-vba/dead-source/vbaoutline.cxx b/scratch/sc-vba/dead-source/vbaoutline.cxx
deleted file mode 100644
index f78f88605..000000000
--- a/scratch/sc-vba/dead-source/vbaoutline.cxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbaoutline.hxx"
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-void
-ScVbaOutline::ShowLevels( const uno::Any& RowLevels, const uno::Any& ColumnLevels ) throw (uno::RuntimeException)
-{
- sal_Int16 nLevel = 0;
- if (mxOutline.is())
- {
- if (RowLevels >>= nLevel)
- {
- mxOutline->showLevel(nLevel, table::TableOrientation_ROWS);
- }
- if (ColumnLevels >>= nLevel)
- {
- mxOutline->showLevel(nLevel,table::TableOrientation_COLUMNS);
- }
- }
-}
-
-rtl::OUString&
-ScVbaOutline::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaOutline") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaOutline::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Outline" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaoutline.hxx b/scratch/sc-vba/dead-source/vbaoutline.hxx
deleted file mode 100644
index e91988981..000000000
--- a/scratch/sc-vba/dead-source/vbaoutline.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_OUTLINE_HXX
-#define SC_VBA_OUTLINE_HXX
-
-#include <com/sun/star/sheet/XSheetOutline.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/excel/XOutline.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XOutline > ScVbaOutline_BASE;
-
-class ScVbaOutline : public ScVbaOutline_BASE
-{
- css::uno::Reference< css::sheet::XSheetOutline > mxOutline;
-public:
- ScVbaOutline( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
- css::uno::Reference<css::sheet::XSheetOutline> outline): ScVbaOutline_BASE( xParent, xContext) , mxOutline(outline)
- {}
- virtual ~ScVbaOutline(){}
-
- virtual void SAL_CALL ShowLevels( const css::uno::Any& RowLevels, const css::uno::Any& ColumnLevels ) throw (css::uno::RuntimeException) ;
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif
diff --git a/scratch/sc-vba/dead-source/vbapalette.cxx b/scratch/sc-vba/dead-source/vbapalette.cxx
deleted file mode 100644
index 1d1971c34..000000000
--- a/scratch/sc-vba/dead-source/vbapalette.cxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbapalette.hxx"
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-/** Standard EGA colors, bright. */
-#define EXC_PALETTE_EGA_COLORS_LIGHT \
- 0x000000, 0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF
-/** Standard EGA colors, dark. */
-#define EXC_PALETTE_EGA_COLORS_DARK \
- 0x800000, 0x008000, 0x000080, 0x808000, 0x800080, 0x008080, 0xC0C0C0, 0x808080
-
-static const ColorData spnDefColorTable8[] =
-{
-/* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT,
-/* 16 */ EXC_PALETTE_EGA_COLORS_DARK,
-/* 24 */ 0x9999FF, 0x993366, 0xFFFFCC, 0xCCFFFF, 0x660066, 0xFF8080, 0x0066CC, 0xCCCCFF,
-/* 32 */ 0x000080, 0xFF00FF, 0xFFFF00, 0x00FFFF, 0x800080, 0x800000, 0x008080, 0x0000FF,
-/* 40 */ 0x00CCFF, 0xCCFFFF, 0xCCFFCC, 0xFFFF99, 0x99CCFF, 0xFF99CC, 0xCC99FF, 0xFFCC99,
-/* 48 */ 0x3366FF, 0x33CCCC, 0x99CC00, 0xFFCC00, 0xFF9900, 0xFF6600, 0x666699, 0x969696,
-/* 56 */ 0x003366, 0x339966, 0x003300, 0x333300, 0x993300, 0x993366, 0x333399, 0x333333
-};
-
-typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
-
-class DefaultPalette : public XIndexAccess_BASE
-{
-public:
- DefaultPalette(){}
-
- // Methods XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
- {
- return sizeof(spnDefColorTable8) / sizeof(spnDefColorTable8[0]);
- }
-
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( Index < 0 || Index >= getCount() )
- throw lang::IndexOutOfBoundsException();
- return uno::makeAny( sal_Int32( spnDefColorTable8[ Index ] ) );
- }
-
- // Methods XElementAcess
- virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
- {
- return ::getCppuType( (sal_Int32*)0 );
- }
- virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
- {
- return sal_True;
- }
-
-};
-
-uno::Reference< container::XIndexAccess >
-ScVbaPalette::getDefaultPalette()
-{
- return new DefaultPalette();
-}
-
-uno::Reference< container::XIndexAccess >
-ScVbaPalette::getPalette()
-{
- uno::Reference< container::XIndexAccess > xIndex;
- uno::Reference< beans::XPropertySet > xProps;
- if ( m_pShell )
- xProps.set( m_pShell->GetModel(), uno::UNO_QUERY_THROW );
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract palette, no doc shell" ) ), uno::Reference< uno::XInterface >() );
- xIndex.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ColorPalette") ) ), uno::UNO_QUERY );
- if ( !xIndex.is() )
- return new DefaultPalette();
- return xIndex;
-}
diff --git a/scratch/sc-vba/dead-source/vbapalette.hxx b/scratch/sc-vba/dead-source/vbapalette.hxx
deleted file mode 100644
index fa343a7a5..000000000
--- a/scratch/sc-vba/dead-source/vbapalette.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBAPALETTE_HXX
-#define SC_VBAPALETTE_HXX
-
-#include "vbahelper.hxx"
-#include <document.hxx>
-#include <com/sun/star/container/XIndexAccess.hpp>
-
-class ScVbaPalette
-{
-private:
- SfxObjectShell* m_pShell;
-public:
- ScVbaPalette( SfxObjectShell* pShell = NULL ) : m_pShell( pShell ){}
- // if no palette available e.g. because the document doesn't have a
- // palette defined then a default palette will be returned.
- css::uno::Reference< css::container::XIndexAccess > getPalette();
- static css::uno::Reference< css::container::XIndexAccess > getDefaultPalette();
-};
-
-#endif //SC_VBAPALETTE_HXX
-
diff --git a/scratch/sc-vba/dead-source/vbapane.cxx b/scratch/sc-vba/dead-source/vbapane.cxx
deleted file mode 100644
index 3f2b5b17c..000000000
--- a/scratch/sc-vba/dead-source/vbapane.cxx
+++ /dev/null
@@ -1,230 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include<com/sun/star/table/CellRangeAddress.hpp>
-#include<vbapane.hxx>
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-/*
-ScVbaPane::ScVbaPane( uno::Reference< uno::XComponentContext > xContext, uno::Refrence< sheet::XViewPane > xViewPane )
- : m_xContext( xContext ), m_xViewPane( xViewPane )
-{
-}
-*/
-
-sal_Int32 SAL_CALL
-ScVbaPane::getScrollColumn() throw (uno::RuntimeException)
-{
- return ( m_xViewPane->getFirstVisibleColumn() + 1 );
-}
-
-void SAL_CALL
-ScVbaPane::setScrollColumn( sal_Int32 _scrollcolumn ) throw (uno::RuntimeException)
-{
- if( _scrollcolumn < 1 )
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Column number should not less than 1" ),
- uno::Reference< uno::XInterface >() );
- }
- m_xViewPane->setFirstVisibleColumn( _scrollcolumn - 1 );
-}
-
-sal_Int32 SAL_CALL
-ScVbaPane::getScrollRow() throw (uno::RuntimeException)
-{
- return ( m_xViewPane->getFirstVisibleRow() + 1 );
-}
-
-void SAL_CALL
-ScVbaPane::setScrollRow( sal_Int32 _scrollrow ) throw (uno::RuntimeException)
-{
- if( _scrollrow < 1 )
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Row number should not less than 1" ),
- uno::Reference< uno::XInterface >() );
- }
- m_xViewPane->setFirstVisibleRow( _scrollrow - 1 );
-}
-
-//Method
-void SAL_CALL
-ScVbaPane::SmallScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException)
-{
- rtl::OUString messageBuffer;
- sal_Int32 downRows = 0;
- sal_Int32 rightCols = 0;
- table::CellRangeAddress visibleRange = m_xViewPane->getVisibleRange();
-
- if( Down.hasValue() )
- {
- sal_Int32 down = 0;
- try
- {
- Down >>= down;
- downRows += down;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: Down\n" );
- }
- }
- if( Up.hasValue() )
- {
- sal_Int32 up = 0;
- try
- {
- Up >>= up;
- downRows -= up;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: Up\n" );
- }
- }
- if( ToRight.hasValue() )
- {
- sal_Int32 right = 0;
- try
- {
- ToRight >>= right;
- rightCols += right;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: ToRight\n" );
- }
- }
- if( ToLeft.hasValue() )
- {
- sal_Int32 left = 0;
- try
- {
- ToLeft >>= left;
- rightCols -= left;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: ToLeft\n" );
- }
- }
- if( messageBuffer.getLength() > 0 )
- throw(uno::RuntimeException( messageBuffer, uno::Reference< uno::XInterface >() ) );
-
- sal_Int32 newStartRow = visibleRange.StartRow + downRows;
- if( newStartRow < 0 )
- newStartRow = 0;
- sal_Int32 newStartCol = visibleRange.StartColumn + rightCols;
- if( newStartCol < 0 )
- newStartCol = 0;
- m_xViewPane->setFirstVisibleRow( newStartRow );
- m_xViewPane->setFirstVisibleColumn( newStartCol );
-}
-
-void SAL_CALL
-ScVbaPane::LargeScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException)
-{
- rtl::OUString messageBuffer;
- table::CellRangeAddress visibleRange = m_xViewPane->getVisibleRange();
-
- sal_Int32 vertPageSize = 1 + visibleRange.EndRow - visibleRange.StartRow;
- sal_Int32 horizPageSize = 1 + visibleRange.EndColumn - visibleRange.StartColumn;
- sal_Int32 downPages = 0;
- sal_Int32 acrossPages = 0;
- if( Down.hasValue() )
- {
- sal_Int32 down = 0;
- try
- {
- Down >>= down;
- downPages += down;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: Down\n" );
- }
- }
- if( Up.hasValue() )
- {
- sal_Int32 up = 0;
- try
- {
- Up >>= up;
- downPages -= up;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: Up\n" );
- }
- }
- if( ToRight.hasValue() )
- {
- sal_Int32 right = 0;
- try
- {
- ToRight >>= right;
- acrossPages += right;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: ToRight\n" );
- }
- }
- if( ToLeft.hasValue() )
- {
- sal_Int32 left = 0;
- try
- {
- ToLeft >>= left;
- acrossPages -= left;
- }
- catch ( uno::Exception )
- {
- messageBuffer += rtl::OUString::createFromAscii( "Error getting parameter: ToLeft\n" );
- }
- }
-
- if( messageBuffer.getLength() > 0 )
- throw(uno::RuntimeException( messageBuffer, uno::Reference< uno::XInterface >() ) );
-
- sal_Int32 newStartRow = visibleRange.StartRow + (downPages * vertPageSize );
- if( newStartRow < 0 )
- newStartRow = 0;
- sal_Int32 newStartCol = visibleRange.StartColumn + (acrossPages * horizPageSize );
- if( newStartCol < 0 )
- newStartCol = 0;
- m_xViewPane->setFirstVisibleRow( newStartRow );
- m_xViewPane->setFirstVisibleColumn( newStartCol );
-}
diff --git a/scratch/sc-vba/dead-source/vbapane.hxx b/scratch/sc-vba/dead-source/vbapane.hxx
deleted file mode 100644
index 540e33ddb..000000000
--- a/scratch/sc-vba/dead-source/vbapane.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_PANE_HXX
-#define SC_VBA_PANE_HXX
-
-#include<cppuhelper/implbase1.hxx>
-#include<com/sun/star/sheet/XViewPane.hpp>
-#include<org/openoffice/excel/XPane.hpp>
-
-#include"vbahelper.hxx"
-
-typedef cppu::WeakImplHelper1< oo::excel::XPane > PaneImpl_Base;
-
-class ScVbaPane : public PaneImpl_Base
-{
-protected:
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::sheet::XViewPane > m_xViewPane;
-public:
- ScVbaPane( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XViewPane > xViewPane ) : m_xContext( xContext ), m_xViewPane( xViewPane ) {}
-
- css::uno::Reference< css::sheet::XViewPane > getViewPane() { return m_xViewPane; }
-
- //Attribute
- virtual sal_Int32 SAL_CALL getScrollColumn() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setScrollColumn( sal_Int32 _scrollcolumn ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getScrollRow() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setScrollRow( sal_Int32 _scrollrow ) throw (css::uno::RuntimeException);
-
- //Method
- virtual void SAL_CALL SmallScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL LargeScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException);
-
-};
-
-#endif//SC_VBA_PANE_HXX
diff --git a/scratch/sc-vba/dead-source/vbapictureformat.cxx b/scratch/sc-vba/dead-source/vbapictureformat.cxx
deleted file mode 100644
index 42c627acc..000000000
--- a/scratch/sc-vba/dead-source/vbapictureformat.cxx
+++ /dev/null
@@ -1,152 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbapictureformat.hxx"
-
-using namespace org::openoffice;
-using namespace com::sun::star;
-
-ScVbaPictureFormat::ScVbaPictureFormat( const css::uno::Reference< oo::vba::XHelperInterface >& xParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- uno::Reference< drawing::XShape > xShape )
- throw( lang::IllegalArgumentException ) : ScVbaPictureFormat_BASE( xParent, xContext ), m_xShape( xShape )
-{
- m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
-}
-
-void
-ScVbaPictureFormat::checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException)
-{
- if( nRange < nMin )
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too small.") , uno::Reference< uno::XInterface >() );
- }
- if( nRange > nMax )
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too high.") , uno::Reference< uno::XInterface >() );
- }
-}
-
-// Attributes
-double SAL_CALL
-ScVbaPictureFormat::getBrightness() throw (uno::RuntimeException)
-{
- sal_Int16 nLuminance = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance") ) >>= nLuminance;
- double fBrightness = static_cast< double >( nLuminance );
- fBrightness = ( fBrightness +100 ) / 200;
- return fBrightness;
-}
-
-void SAL_CALL
-ScVbaPictureFormat::setBrightness( double _brightness ) throw (uno::RuntimeException)
-{
- checkParameterRangeInDouble( _brightness, 0.0, 1.0 );
- double fLuminance = _brightness * 200 - 100;
- sal_Int16 nLuminance = static_cast< sal_Int16 >( fLuminance );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance"), uno::makeAny( nLuminance ) );
-}
-
-double SAL_CALL
-ScVbaPictureFormat::getContrast() throw (uno::RuntimeException)
-{
- sal_Int16 nContrast = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustContrast") ) >>= nContrast;
- double fContrast = static_cast< double >( nContrast );
- fContrast = ( fContrast + 100 ) / 200;
- return fContrast;
-}
-
-void SAL_CALL
-ScVbaPictureFormat::setContrast( double _contrast ) throw (uno::RuntimeException)
-{
- checkParameterRangeInDouble( _contrast, 0.0, 1.0 );
- double fContrast = _contrast * 200 - 100;
- sal_Int16 nContrast = static_cast< sal_Int16 >( fContrast );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustContrast"), uno::makeAny( nContrast ) );
-}
-
-
-// Methods
-void SAL_CALL
-ScVbaPictureFormat::IncrementBrightness( double increment ) throw (uno::RuntimeException)
-{
- double fBrightness = getBrightness();
- fBrightness += increment;
- if( fBrightness < 0 )
- {
- fBrightness = 0.0;
- }
- if( fBrightness > 1 )
- {
- fBrightness = 1;
- }
- setBrightness( fBrightness );
-}
-
-void SAL_CALL
-ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeException)
-{
- double nContrast = getContrast();
- nContrast += increment;
- if( increment < 0 )
- {
- increment = 0.0;
- }
- if( increment > 1 )
- {
- increment = 1.0;
- }
- setContrast( nContrast );
-}
-
-
-rtl::OUString&
-ScVbaPictureFormat::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPictureFormat") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaPictureFormat::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.PictureFormat" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbapictureformat.hxx b/scratch/sc-vba/dead-source/vbapictureformat.hxx
deleted file mode 100644
index 5cc80324b..000000000
--- a/scratch/sc-vba/dead-source/vbapictureformat.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_PICTUREFORMAT_HXX
-#define SC_VBA_PICTUREFORMAT_HXX
-
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/msforms/XPictureFormat.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::msforms::XPictureFormat > ScVbaPictureFormat_BASE;
-
-class ScVbaPictureFormat : public ScVbaPictureFormat_BASE
-{
-private:
- css::uno::Reference< css::drawing::XShape > m_xShape;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-private:
- void checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException);
-public:
- ScVbaPictureFormat( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XShape > xShape ) throw( css::lang::IllegalArgumentException );
-
- // Attributes
- virtual double SAL_CALL getBrightness() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setBrightness( double _brightness ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getContrast() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setContrast( double _contrast ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL IncrementBrightness( double increment ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL IncrementContrast( double increment ) throw (css::uno::RuntimeException);
-};
-
-#endif//SC_VBA_PICTUREFORMAT_HXX
diff --git a/scratch/sc-vba/dead-source/vbapivotcache.cxx b/scratch/sc-vba/dead-source/vbapivotcache.cxx
deleted file mode 100644
index 98ce81dc3..000000000
--- a/scratch/sc-vba/dead-source/vbapivotcache.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbapivotcache.hxx"
-
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-ScVbaPivotCache::ScVbaPivotCache( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XDataPilotTable >& xTable ) : PivotCacheImpl_BASE( xParent, xContext ), m_xTable( xTable )
-{
-}
-
-void SAL_CALL
-ScVbaPivotCache::Refresh() throw (css::uno::RuntimeException)
-{
- m_xTable->refresh();
-}
-rtl::OUString&
-ScVbaPivotCache::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotCache") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaPivotCache::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotCache" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbapivotcache.hxx b/scratch/sc-vba/dead-source/vbapivotcache.hxx
deleted file mode 100644
index 05bc794ac..000000000
--- a/scratch/sc-vba/dead-source/vbapivotcache.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_PIVOTCACHE_HXX
-#define SC_VBA_PIVOTCACHE_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/sheet/XDataPilotTable.hpp>
-
-#include <org/openoffice/excel/XPivotCache.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1<oo::excel::XPivotCache > PivotCacheImpl_BASE;
-
-class ScVbaPivotCache : public PivotCacheImpl_BASE
-{
- css::uno::Reference< css::sheet::XDataPilotTable > m_xTable;
-public:
- ScVbaPivotCache( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XDataPilotTable >& xTable );
- virtual void SAL_CALL Refresh() throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_PIVOTCACHE_HXX
diff --git a/scratch/sc-vba/dead-source/vbapivottable.cxx b/scratch/sc-vba/dead-source/vbapivottable.cxx
deleted file mode 100644
index 1a4095098..000000000
--- a/scratch/sc-vba/dead-source/vbapivottable.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbapivottable.hxx"
-#include "vbapivotcache.hxx"
-
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-ScVbaPivotTable::ScVbaPivotTable( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XDataPilotTable >& xTable ) : PivotTableImpl_BASE( uno::Reference< vba::XHelperInterface >(), xContext), m_xTable( xTable )
-{
-}
-
-uno::Reference< excel::XPivotCache >
-ScVbaPivotTable::PivotCache() throw (uno::RuntimeException)
-{
- // #FIXME with a quick example failed to determine what the parent
- // should be, leaving as null at the moment
- return new ScVbaPivotCache( uno::Reference< vba::XHelperInterface >(), mxContext, m_xTable );
-}
-
-rtl::OUString&
-ScVbaPivotTable::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotTable") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaPivotTable::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotTable" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbapivottable.hxx b/scratch/sc-vba/dead-source/vbapivottable.hxx
deleted file mode 100644
index fc4e12104..000000000
--- a/scratch/sc-vba/dead-source/vbapivottable.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_PIVOTTABLE_HXX
-#define SC_VBA_PIVOTTABLE_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/sheet/XDataPilotTable.hpp>
-#include <org/openoffice/excel/XPivotTable.hpp>
-#include "vbahelper.hxx"
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XPivotTable > PivotTableImpl_BASE;
-
-class ScVbaPivotTable : public PivotTableImpl_BASE
-{
- css::uno::Reference< css::sheet::XDataPilotTable > m_xTable;
-public:
- ScVbaPivotTable( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XDataPilotTable >& xTable );
- virtual css::uno::Reference< oo::excel::XPivotCache > SAL_CALL PivotCache( ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_PIVOTTABLE_HXX
diff --git a/scratch/sc-vba/dead-source/vbapivottables.cxx b/scratch/sc-vba/dead-source/vbapivottables.cxx
deleted file mode 100644
index a7d602daa..000000000
--- a/scratch/sc-vba/dead-source/vbapivottables.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbapivottables.hxx"
-#include "vbapivottable.hxx"
-#include <com/sun/star/sheet/XDataPilotTable.hpp>
-#include <org/openoffice/excel/XPivotTable.hpp>
-
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-uno::Any DataPilotToPivotTable( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext )
-{
- uno::Reference< sheet::XDataPilotTable > xTable( aSource, uno::UNO_QUERY_THROW );
- return uno::makeAny( uno::Reference< excel::XPivotTable > ( new ScVbaPivotTable( xContext, xTable ) ) );
-}
-
-class PivotTableEnumeration : public EnumerationHelperImpl
-{
-public:
- PivotTableEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- return DataPilotToPivotTable( m_xEnumeration->nextElement(), m_xContext );
- }
-
-};
-
-ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xParent, xContext, xIndexAccess )
-{
-}
-
-uno::Reference< container::XEnumeration >
-ScVbaPivotTables::createEnumeration() throw (uno::RuntimeException)
-{
- uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
- return new PivotTableEnumeration( mxContext, xEnumAccess->createEnumeration() );
-}
-
-uno::Any
-ScVbaPivotTables::createCollectionObject( const css::uno::Any& aSource )
-{
- return DataPilotToPivotTable( aSource, mxContext );
-}
-
-uno::Type
-ScVbaPivotTables::getElementType() throw (uno::RuntimeException)
-{
- return excel::XPivotTable::static_type(0);
-}
-
-rtl::OUString&
-ScVbaPivotTables::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotTables") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaPivotTables::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotTables") );
- }
- return sNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbapivottables.hxx b/scratch/sc-vba/dead-source/vbapivottables.hxx
deleted file mode 100644
index 64ade44e5..000000000
--- a/scratch/sc-vba/dead-source/vbapivottables.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_PIVOTTABLES_HXX
-#define SC_VBA_PIVOTTABLES_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <org/openoffice/excel/XPivotTables.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include "vbahelper.hxx"
-#include "vbahelperinterface.hxx"
-#include "vbacollectionimpl.hxx"
-
-
-typedef CollTestImplHelper< oo::excel::XPivotTables > ScVbaPivotTables_BASE;
-
-class ScVbaPivotTables : public ScVbaPivotTables_BASE
-{
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-public:
- ScVbaPivotTables( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
- virtual ~ScVbaPivotTables() {}
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
-
- // XPivotTables
-
- // ScVbaPivotTables_BASE
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-
- virtual rtl::OUString& getServiceImplName();
-
-};
-
-#endif //SC_VBA_PIVOTTABLES
diff --git a/scratch/sc-vba/dead-source/vbapropvalue.cxx b/scratch/sc-vba/dead-source/vbapropvalue.cxx
deleted file mode 100644
index a6b6b4fee..000000000
--- a/scratch/sc-vba/dead-source/vbapropvalue.cxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbapropvalue.hxx"
-
-using namespace com::sun::star;
-
-ScVbaPropValue::ScVbaPropValue( PropListener* pListener ) : m_pListener( pListener )
-{
-}
-
-css::uno::Any SAL_CALL
-ScVbaPropValue::getValue() throw (css::uno::RuntimeException)
-{
- return m_pListener->getValueEvent();
-}
-
-void SAL_CALL
-ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException)
-{
- m_pListener->setValueEvent( _value );
-}
diff --git a/scratch/sc-vba/dead-source/vbapropvalue.hxx b/scratch/sc-vba/dead-source/vbapropvalue.hxx
deleted file mode 100644
index f5b6be950..000000000
--- a/scratch/sc-vba/dead-source/vbapropvalue.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_PROPVALULE_HXX
-#define SC_VBA_PROPVALULE_HXX
-#include <org/openoffice/vba/XPropValue.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-#include "vbahelper.hxx"
-
-typedef ::cppu::WeakImplHelper1< oo::vba::XPropValue > PropValueImpl_BASE;
-
-class PropListener
-{
-public:
- virtual void setValueEvent( const css::uno::Any& value ) = 0;
- virtual css::uno::Any getValueEvent() = 0;
-};
-
-
-class ScVbaPropValue : public PropValueImpl_BASE
-{
- PropListener* m_pListener;
-public:
- ScVbaPropValue( PropListener* pListener );
-
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-
- rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-
-};
-#endif //SC_VBA_PROPVALULE_HXX
diff --git a/scratch/sc-vba/dead-source/vbaradiobutton.cxx b/scratch/sc-vba/dead-source/vbaradiobutton.cxx
deleted file mode 100644
index 45f622ab2..000000000
--- a/scratch/sc-vba/dead-source/vbaradiobutton.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaradiobutton.cxx,v $
- *
- * $Revision: 1.1.2.4 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 11:47:24 $
- *
- * 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
- *
- ************************************************************************/
-#include "vbaradiobutton.hxx"
-#include <vector>
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-
-const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
-ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : RadioButtonImpl_BASE( xContext, xControlShape )
-{
-}
-
-// Attributes
-rtl::OUString SAL_CALL
-ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException)
-{
- rtl::OUString Label;
- m_xProps->getPropertyValue( LABEL ) >>= Label;
- return Label;
-}
-
-void SAL_CALL
-ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
-{
- m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
-}
-
-sal_Bool SAL_CALL
-ScVbaRadioButton::getValue() throw (css::uno::RuntimeException)
-{
- sal_Bool bValue = sal_False;
- sal_Int16 nValue = -1;
- m_xProps->getPropertyValue( STATE ) >>= nValue;
- if( nValue != 0 )
- bValue = sal_True;
- return bValue;
-}
-
-void SAL_CALL
-ScVbaRadioButton::setValue( sal_Bool _value ) throw (css::uno::RuntimeException)
-{
- sal_Int16 nValue = 0;
- if( _value )
- nValue = 1;
- m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-}
diff --git a/scratch/sc-vba/dead-source/vbaradiobutton.hxx b/scratch/sc-vba/dead-source/vbaradiobutton.hxx
deleted file mode 100644
index 84feab24c..000000000
--- a/scratch/sc-vba/dead-source/vbaradiobutton.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_RADIOBUTTON_HXX
-#define SC_VBA_RADIOBUTTON_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/msforms/XRadioButton.hpp>
-
-#include "vbacontrol.hxx"
-#include "vbahelper.hxx"
-
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XRadioButton > RadioButtonImpl_BASE;
-
-class ScVbaRadioButton : public RadioButtonImpl_BASE
-{
-public:
- ScVbaRadioButton( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- // Attributes
- virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( sal_Bool _value ) throw (css::uno::RuntimeException);
-
-};
-#endif //SC_VBA_RADIOBUTTON_HXX
diff --git a/scratch/sc-vba/dead-source/vbarange.cxx b/scratch/sc-vba/dead-source/vbarange.cxx
deleted file mode 100644
index 4cb7b4d2a..000000000
--- a/scratch/sc-vba/dead-source/vbarange.cxx
+++ /dev/null
@@ -1,5012 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbarange.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "helperdecl.hxx"
-
-#include <comphelper/unwrapargs.hxx>
-#include <comphelper/processfactory.hxx>
-#include <sfx2/objsh.hxx>
-
-#include <com/sun/star/script/ArrayWrapper.hpp>
-#include <com/sun/star/sheet/XDatabaseRange.hpp>
-#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <com/sun/star/sheet/XGoalSeek.hpp>
-#include <com/sun/star/sheet/XSheetOperation.hpp>
-#include <com/sun/star/sheet/CellFlags.hpp>
-#include <com/sun/star/table/XColumnRowRange.hpp>
-#include <com/sun/star/sheet/XCellAddressable.hpp>
-#include <com/sun/star/table/CellContentType.hpp>
-#include <com/sun/star/sheet/XCellSeries.hpp>
-#include <com/sun/star/text/XTextRange.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-#include <com/sun/star/sheet/XSheetCellRange.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XSheetCellCursor.hpp>
-#include <com/sun/star/sheet/XArrayFormulaRange.hpp>
-#include <com/sun/star/sheet/XNamedRange.hpp>
-#include <com/sun/star/sheet/XPrintAreas.hpp>
-#include <com/sun/star/sheet/XCellRangesQuery.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sheet/XFunctionAccess.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/table/XCellCursor.hpp>
-#include <com/sun/star/table/XTableRows.hpp>
-#include <com/sun/star/table/XTableColumns.hpp>
-#include <com/sun/star/table/TableSortField.hpp>
-#include <com/sun/star/util/XMergeable.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/util/XNumberFormats.hpp>
-#include <com/sun/star/util/NumberFormat.hpp>
-#include <com/sun/star/util/XNumberFormatTypes.hpp>
-#include <com/sun/star/util/XReplaceable.hpp>
-#include <com/sun/star/util/XSortable.hpp>
-#include <com/sun/star/sheet/XCellRangeMovement.hpp>
-#include <com/sun/star/sheet/XCellRangeData.hpp>
-#include <com/sun/star/sheet/FormulaResult.hpp>
-#include <com/sun/star/sheet/TableFilterField.hpp>
-#include <com/sun/star/sheet/XSheetFilterable.hpp>
-#include <com/sun/star/sheet/FilterConnection.hpp>
-#include <com/sun/star/util/CellProtection.hpp>
-
-#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
-
-//#include <com/sun/star/sheet/CellDeleteMode.hpp>
-#include <com/sun/star/sheet/XCellRangeMovement.hpp>
-#include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
-#include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hdl>
-
-#include <org/openoffice/excel/XlPasteSpecialOperation.hpp>
-#include <org/openoffice/excel/XlPasteType.hpp>
-#include <org/openoffice/excel/Constants.hpp>
-#include <org/openoffice/excel/XlFindLookIn.hpp>
-#include <org/openoffice/excel/XlLookAt.hpp>
-#include <org/openoffice/excel/XlSearchOrder.hpp>
-#include <org/openoffice/excel/XlSortOrder.hpp>
-#include <org/openoffice/excel/XlYesNoGuess.hpp>
-#include <org/openoffice/excel/XlSortOrientation.hpp>
-#include <org/openoffice/excel/XlSortMethod.hpp>
-#include <org/openoffice/excel/XlDirection.hpp>
-#include <org/openoffice/excel/XlSortDataOption.hpp>
-#include <org/openoffice/excel/XlDeleteShiftDirection.hpp>
-#include <org/openoffice/excel/XlInsertShiftDirection.hpp>
-#include <org/openoffice/excel/XlReferenceStyle.hpp>
-#include <org/openoffice/excel/XlBordersIndex.hpp>
-#include <org/openoffice/excel/XlPageBreak.hpp>
-#include <org/openoffice/excel/XlAutoFilterOperator.hpp>
-#include <org/openoffice/excel/XlAutoFillType.hpp>
-#include <org/openoffice/excel/XlTextParsingType.hpp>
-#include <org/openoffice/excel/XlTextQualifier.hpp>
-#include <org/openoffice/excel/XlCellType.hpp>
-#include <org/openoffice/excel/XlSpecialCellsValue.hpp>
-#include <org/openoffice/excel/XlConsolidationFunction.hpp>
-
-#include <scitems.hxx>
-#include <svx/srchitem.hxx>
-#include <cellsuno.hxx>
-#include <dbcolect.hxx>
-#include "docfunc.hxx"
-
-#include <sfx2/dispatch.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/itemwrapper.hxx>
-#include <sc.hrc>
-#include <globstr.hrc>
-#include <unonames.hxx>
-
-#include "vbarange.hxx"
-#include "vbafont.hxx"
-#include "vbacomment.hxx"
-#include "vbainterior.hxx"
-#include "vbacharacters.hxx"
-#include "vbaborders.hxx"
-#include "vbaworksheet.hxx"
-#include "vbavalidation.hxx"
-
-#include "tabvwsh.hxx"
-#include "rangelst.hxx"
-#include "convuno.hxx"
-#include "compiler.hxx"
-#include "attrib.hxx"
-#include "undodat.hxx"
-#include "dbdocfun.hxx"
-#include "patattr.hxx"
-#include <comphelper/anytostring.hxx>
-
-#include <global.hxx>
-
-#include "vbaglobals.hxx"
-#include "vbastyle.hxx"
-#include <vector>
-#include <vbacollectionimpl.hxx>
-// begin test includes
-#include <com/sun/star/sheet/FunctionArgument.hpp>
-// end test includes
-
-#include <org/openoffice/excel/Range.hpp>
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-
-// * 1 point = 1/72 inch = 20 twips
-// * 1 inch = 72 points = 1440 twips
-// * 1 cm = 567 twips
-double lcl_hmmToPoints( double nVal ) { return ( (double)((nVal /1000 ) * 567 ) / 20 ); }
-double lcl_pointsToHmm( double nVal ) { return (double)( ( nVal * 20 ) / 567 ) * 1000; }
-
-static const sal_Int16 supportedIndexTable[] = { excel::XlBordersIndex::xlEdgeLeft, excel::XlBordersIndex::xlEdgeTop, excel::XlBordersIndex::xlEdgeBottom, excel::XlBordersIndex::xlEdgeRight, excel::XlBordersIndex::xlDiagonalDown, excel::XlBordersIndex::xlDiagonalUp, excel::XlBordersIndex::xlInsideVertical, excel::XlBordersIndex::xlInsideHorizontal };
-
-USHORT lcl_pointsToTwips( double nVal )
-{
- nVal = nVal * static_cast<double>(20);
- short nTwips = static_cast<short>(nVal);
- return nTwips;
-}
-double lcl_TwipsToPoints( USHORT nVal )
-{
- double nPoints = nVal;
- return nPoints / 20;
-}
-
-double lcl_Round2DecPlaces( double nVal )
-{
- nVal = (nVal * (double)100);
- long tmp = static_cast<long>(nVal);
- if ( ( ( nVal - tmp ) >= 0.5 ) )
- ++tmp;
- nVal = tmp;
- nVal = nVal/100;
- return nVal;
-}
-
-uno::Any lcl_makeRange( uno::Reference< uno::XComponentContext >& xContext, const uno::Any aAny, bool bIsRows, bool bIsColumns )
-{
- uno::Reference< table::XCellRange > xCellRange( aAny, uno::UNO_QUERY_THROW );
- // #FIXME need proper (WorkSheet) parent
- return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xCellRange, bIsRows, bIsColumns ) ) );
-}
-
-uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRanges >& xLocSheetCellRanges, ScDocShell* pDoc )
-{
- uno::Reference< excel::XRange > xRange;
- uno::Sequence< table::CellRangeAddress > sAddresses = xLocSheetCellRanges->getRangeAddresses();
- ScRangeList aCellRanges;
- sal_Int32 nLen = sAddresses.getLength();
- for ( sal_Int32 index = 0; index < nLen; ++index )
- {
- ScRange refRange;
- ScUnoConversion::FillScRange( refRange, sAddresses[ index ] );
- aCellRanges.Append( refRange );
- }
- // Single range
- if ( aCellRanges.First() == aCellRanges.Last() )
- {
- uno::Reference< table::XCellRange > xTmpRange( new ScCellRangeObj( pDoc, *aCellRanges.First() ) );
- // #FIXME need proper (WorkSheet) parent
- xRange = new ScVbaRange( xParent, xContext, xTmpRange );
- }
- else
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDoc, aCellRanges ) );
- // #FIXME need proper (WorkSheet) parent
- xRange = new ScVbaRange( xParent, xContext, xRanges );
- }
- return xRange;
-}
-
-SfxItemSet* ScVbaRange::getCurrentDataSet( ) 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() );
- SfxItemSet* pDataSet = pUnoCellRange ? pUnoCellRange->GetCurrentDataSet( true ) : NULL ;
-
- if ( !pDataSet )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't access Itemset for range" ) ), uno::Reference< uno::XInterface >() );
- return pDataSet;
-}
-
-class SingleRangeEnumeration : public EnumerationHelper_BASE
-{
- uno::Reference< table::XCellRange > m_xRange;
- uno::Reference< uno::XComponentContext > mxContext;
- bool bHasMore;
-public:
-
- SingleRangeEnumeration( const uno::Reference< css::uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException ) : m_xRange( xRange ), mxContext( xContext ), bHasMore( true ) { }
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) { return bHasMore; }
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( !bHasMore )
- throw container::NoSuchElementException();
- bHasMore = false;
- return uno::makeAny( m_xRange );
- }
-};
-
-// very simple class to pass to ScVbaCollectionBaseImpl containing
-// just one item
-typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > SingleRange_BASE;
-
-class SingleRangeIndexAccess : public SingleRange_BASE
-{
-private:
- uno::Reference< table::XCellRange > m_xRange;
- uno::Reference< uno::XComponentContext > mxContext;
- SingleRangeIndexAccess(); // not defined
-public:
- SingleRangeIndexAccess( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange ):m_xRange( xRange ), mxContext( xContext ) {}
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount() throw (::uno::RuntimeException) { return 1; }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( Index != 0 )
- throw lang::IndexOutOfBoundsException();
- return uno::makeAny( m_xRange );
- }
- // XElementAccess
- virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException){ return table::XCellRange::static_type(0); }
-
- virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException) { return sal_True; }
- // XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration() throw (uno::RuntimeException) { return new SingleRangeEnumeration( mxContext, m_xRange ); }
-
-};
-
-
-
-class RangesEnumerationImpl : public EnumerationHelperImpl
-{
- bool mbIsRows;
- bool mbIsColumns;
-public:
-
- RangesEnumerationImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, bool bIsRows, bool bIsColumns ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- return lcl_makeRange( m_xContext, m_xEnumeration->nextElement(), mbIsRows, mbIsColumns );
- }
-};
-
-
-class ScVbaRangeAreas : public ScVbaCollectionBaseImpl
-{
- bool mbIsRows;
- bool mbIsColumns;
-public:
- ScVbaRangeAreas( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, bool bIsRows, bool bIsColumns ) : ScVbaCollectionBaseImpl( uno::Reference< vba::XHelperInterface >(), xContext, xIndexAccess ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
-
- // XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration() throw (uno::RuntimeException);
-
- // XElementAccess
- virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException){ return excel::XRange::static_type(0); }
-
- virtual uno::Any createCollectionObject( const uno::Any& aSource );
-
- virtual rtl::OUString& getServiceImplName() { static rtl::OUString sDummy; return sDummy; }
-
- virtual uno::Sequence< rtl::OUString > getServiceNames() { return uno::Sequence< rtl::OUString >(); }
-
-};
-
-uno::Reference< container::XEnumeration > SAL_CALL
-ScVbaRangeAreas::createEnumeration() throw (uno::RuntimeException)
-{
- uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
- return new RangesEnumerationImpl( mxContext, xEnumAccess->createEnumeration(), mbIsRows, mbIsColumns );
-
-}
-
-uno::Any
-ScVbaRangeAreas::createCollectionObject( const uno::Any& aSource )
-{
- return lcl_makeRange( mxContext, aSource, mbIsRows, mbIsColumns );
-}
-
-// assume that xIf is infact a ScCellRangesBase
-ScDocShell*
-getDocShellFromIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
-{
- ScCellRangesBase* pUno= dynamic_cast< ScCellRangesBase* >( xIf.get() );
- if ( !pUno )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying uno range object" ) ), uno::Reference< uno::XInterface >() );
- return pUno->GetDocShell();
-}
-
-ScDocShell*
-getDocShellFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
-{
- // need the ScCellRangesBase to get docshell
- uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
- return getDocShellFromIf(xIf );
-}
-
-uno::Reference< frame::XModel > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
-{
- ScDocShell* pDocShell = getDocShellFromIf(xIf );
- return pDocShell->GetModel();
-}
-
-uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
-{
- uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
- return getModelFromXIf( xIf );
-}
-
-ScDocument*
-getDocumentFromRange( const uno::Reference< table::XCellRange >& xRange )
-{
- ScDocShell* pDocShell = getDocShellFromRange( xRange );
- if ( !pDocShell )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying docshell from uno range object" ) ), uno::Reference< uno::XInterface >() );
- ScDocument* pDoc = pDocShell->GetDocument();
- return pDoc;
-}
-
-
-ScDocument*
-ScVbaRange::getScDocument()
-{
- if ( mxRanges.is() )
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- return getDocumentFromRange( xRange );
- }
- return getDocumentFromRange( mxRange );
-}
-
-ScDocShell*
-ScVbaRange::getScDocShell()
-{
- if ( mxRanges.is() )
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- return getDocShellFromRange( xRange );
- }
- return getDocShellFromRange( mxRange );
-}
-
-class NumFormatHelper
-{
- uno::Reference< util::XNumberFormatsSupplier > mxSupplier;
- uno::Reference< beans::XPropertySet > mxRangeProps;
- uno::Reference< util::XNumberFormats > mxFormats;
-public:
- NumFormatHelper( const uno::Reference< table::XCellRange >& xRange )
- {
- mxSupplier.set( getModelFromRange( xRange ), uno::UNO_QUERY_THROW );
- mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
- mxFormats = mxSupplier->getNumberFormats();
- }
- uno::Reference< beans::XPropertySet > getNumberProps()
- {
- long nIndexKey = 0;
- uno::Any aValue = mxRangeProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberFormat")));
- aValue >>= nIndexKey;
-
- if ( mxFormats.is() )
- return mxFormats->getByKey( nIndexKey );
- return uno::Reference< beans::XPropertySet > ();
- }
-
- bool isBooleanType()
- {
-
- if ( getNumberFormat() & util::NumberFormat::LOGICAL )
- return true;
- return false;
- }
-
- rtl::OUString getNumberFormatString()
- {
- uno::Reference< uno::XInterface > xIf( mxRangeProps, uno::UNO_QUERY_THROW );
- ScCellRangeObj* pUnoCellRange = dynamic_cast< ScCellRangeObj* >( xIf.get() );
- if ( pUnoCellRange )
- {
-
- SfxItemSet* pDataSet = pUnoCellRange->GetCurrentDataSet( true );
- SfxItemState eState = pDataSet->GetItemState( ATTR_VALUE_FORMAT, TRUE, NULL);
- // one of the cells in the range is not like the other ;-)
- // so return a zero length format to indicate that
- if ( eState == SFX_ITEM_DONTCARE )
- return rtl::OUString();
- }
-
-
- uno::Reference< beans::XPropertySet > xNumberProps( getNumberProps(), uno::UNO_QUERY_THROW );
- ::rtl::OUString aFormatString;
- uno::Any aString = xNumberProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FormatString")));
- aString >>= aFormatString;
- return aFormatString;
- }
-
- sal_Int16 getNumberFormat()
- {
- uno::Reference< beans::XPropertySet > xNumberProps = getNumberProps();
- sal_Int16 nType = ::comphelper::getINT16(
- xNumberProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Type" ) ) );
- return nType;
- }
-
- bool setNumberFormat( const rtl::OUString& rFormat )
- {
- lang::Locale aLocale;
- uno::Reference< beans::XPropertySet > xNumProps = getNumberProps();
- xNumProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Locale" ) ) >>= aLocale;
- sal_Int32 nNewIndex = mxFormats->queryKey(rFormat, aLocale, false );
- if ( nNewIndex == -1 ) // format not defined
- {
- nNewIndex = mxFormats->addNew( rFormat, aLocale );
- }
- mxRangeProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberFormat") ), uno::makeAny( nNewIndex ) );
- return true;
- }
-
- bool setNumberFormat( sal_Int16 nType )
- {
- uno::Reference< beans::XPropertySet > xNumberProps = getNumberProps();
- lang::Locale aLocale;
- xNumberProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Locale" ) ) >>= aLocale;
- uno::Reference<util::XNumberFormatTypes> xTypes( mxFormats, uno::UNO_QUERY );
- if ( xTypes.is() )
- {
- sal_Int32 nNewIndex = xTypes->getStandardFormat( nType, aLocale );
- mxRangeProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberFormat") ), uno::makeAny( nNewIndex ) );
- return true;
- }
- return false;
- }
-
-};
-
-struct CellPos
-{
- CellPos():m_nRow(-1), m_nCol(-1), m_nArea(0) {};
- CellPos( sal_Int32 nRow, sal_Int32 nCol, sal_Int32 nArea ):m_nRow(nRow), m_nCol(nCol), m_nArea( nArea ) {};
-sal_Int32 m_nRow;
-sal_Int32 m_nCol;
-sal_Int32 m_nArea;
-};
-
-typedef ::cppu::WeakImplHelper1< container::XEnumeration > CellsEnumeration_BASE;
-typedef vector< CellPos > vCellPos;
-
-class CellsEnumeration : public CellsEnumeration_BASE
-{
- uno::Reference< uno::XComponentContext > mxContext;
- uno::Reference< vba::XCollection > m_xAreas;
- vCellPos m_CellPositions;
- vCellPos::const_iterator m_it;
- uno::Reference< table::XCellRange > getArea( sal_Int32 nVBAIndex ) throw ( uno::RuntimeException )
- {
- if ( nVBAIndex < 1 || nVBAIndex > m_xAreas->getCount() )
- throw uno::RuntimeException();
- uno::Reference< excel::XRange > xRange( m_xAreas->Item( uno::makeAny(nVBAIndex), uno::Any() ), uno::UNO_QUERY_THROW );
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- uno::Reference< table::XCellRange > xCellRange;
- if ( !pRange )
- throw uno::RuntimeException();
- xCellRange.set( pRange->getCellRange(), uno::UNO_QUERY_THROW );;
- return xCellRange;
-
- }
- void populateArea( sal_Int32 nVBAIndex )
- {
- uno::Reference< table::XCellRange > xRange = getArea( nVBAIndex );
- uno::Reference< table::XColumnRowRange > xColumnRowRange(xRange, uno::UNO_QUERY_THROW );
- sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount();
- sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
- for ( sal_Int32 i=0; i<nRowCount; ++i )
- {
- for ( sal_Int32 j=0; j<nColCount; ++j )
- m_CellPositions.push_back( CellPos( i,j,nVBAIndex ) );
- }
- }
-public:
- CellsEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< vba::XCollection >& xAreas ): mxContext( xContext ), m_xAreas( xAreas )
- {
- sal_Int32 nItems = m_xAreas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- populateArea( index );
- }
- m_it = m_CellPositions.begin();
- }
- virtual ::sal_Bool SAL_CALL hasMoreElements() throw (::uno::RuntimeException){ return m_it != m_CellPositions.end(); }
-
- virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( !hasMoreElements() )
- throw container::NoSuchElementException();
- CellPos aPos = *(m_it)++;
-
- uno::Reference< table::XCellRange > xRangeArea = getArea( aPos.m_nArea );
- uno::Reference< table::XCellRange > xCellRange( xRangeArea->getCellByPosition( aPos.m_nCol, aPos.m_nRow ), uno::UNO_QUERY_THROW );
- // #FIXME need proper (WorkSheet) parent
- return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< vba::XHelperInterface >(), mxContext, xCellRange ) ) );
-
- }
-};
-
-
-const static ::rtl::OUString ISVISIBLE( RTL_CONSTASCII_USTRINGPARAM( "IsVisible"));
-const static ::rtl::OUString WIDTH( RTL_CONSTASCII_USTRINGPARAM( "Width"));
-const static ::rtl::OUString HEIGHT( RTL_CONSTASCII_USTRINGPARAM( "Height"));
-const static ::rtl::OUString POSITION( RTL_CONSTASCII_USTRINGPARAM( "Position"));
-const static rtl::OUString EQUALS( RTL_CONSTASCII_USTRINGPARAM("=") );
-const static rtl::OUString NOTEQUALS( RTL_CONSTASCII_USTRINGPARAM("<>") );
-const static rtl::OUString GREATERTHAN( RTL_CONSTASCII_USTRINGPARAM(">") );
-const static rtl::OUString GREATERTHANEQUALS( RTL_CONSTASCII_USTRINGPARAM(">=") );
-const static rtl::OUString LESSTHAN( RTL_CONSTASCII_USTRINGPARAM("<") );
-const static rtl::OUString LESSTHANEQUALS( RTL_CONSTASCII_USTRINGPARAM("<=") );
-const static rtl::OUString CONTS_HEADER( RTL_CONSTASCII_USTRINGPARAM("ContainsHeader" ));
-const static rtl::OUString INSERTPAGEBREAKS( RTL_CONSTASCII_USTRINGPARAM("InsertPageBreaks" ));
-const static rtl::OUString STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY( RTL_CONSTASCII_USTRINGPARAM("The command you chose cannot be performed with multiple selections.\nSelect a single range and click the command again") );
-const static rtl::OUString STR_ERRORMESSAGE_NOCELLSWEREFOUND( RTL_CONSTASCII_USTRINGPARAM("No cells were found") );
-const static rtl::OUString STR_ERRORMESSAGE_APPLIESTOROWCOLUMNSONLY( RTL_CONSTASCII_USTRINGPARAM("Property only applicable for Columns and Rows") );
-const static rtl::OUString CELLSTYLE( RTL_CONSTASCII_USTRINGPARAM("CellStyle") );
-
-class CellValueSetter : public ValueSetter
-{
-protected:
- uno::Any maValue;
- uno::TypeClass mTypeClass;
-public:
- CellValueSetter( const uno::Any& aValue );
- virtual bool processValue( const uno::Any& aValue, const uno::Reference< table::XCell >& xCell );
- virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell );
-
-};
-
-CellValueSetter::CellValueSetter( const uno::Any& aValue ): maValue( aValue ), mTypeClass( aValue.getValueTypeClass() ) {}
-
-void
-CellValueSetter::visitNode( sal_Int32 /*i*/, sal_Int32 /*j*/, const uno::Reference< table::XCell >& xCell )
-{
- processValue( maValue, xCell );
-}
-
-bool
-CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< table::XCell >& xCell )
-{
-
- bool isExtracted = false;
- switch ( aValue.getValueTypeClass() )
- {
- case uno::TypeClass_BOOLEAN:
- {
- sal_Bool bState = sal_False;
- if ( aValue >>= bState )
- {
- uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
- if ( bState )
- xCell->setValue( (double) 1 );
- else
- xCell->setValue( (double) 0 );
- NumFormatHelper cellNumFormat( xRange );
- cellNumFormat.setNumberFormat( util::NumberFormat::LOGICAL );
- }
- break;
- }
- case uno::TypeClass_STRING:
- {
- rtl::OUString aString;
- if ( aValue >>= aString )
- {
- uno::Reference< text::XTextRange > xTextRange( xCell, uno::UNO_QUERY_THROW );
- xTextRange->setString( aString );
- }
- else
- isExtracted = false;
- break;
- }
- default:
- {
- double nDouble = 0.0;
- if ( aValue >>= nDouble )
- xCell->setValue( nDouble );
- else
- isExtracted = false;
- break;
- }
- }
- return isExtracted;
-
-}
-
-
-class CellValueGetter : public ValueGetter
-{
-protected:
- uno::Any maValue;
- uno::TypeClass mTypeClass;
-public:
- CellValueGetter() {}
- virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell );
- virtual void processValue( sal_Int32 x, sal_Int32 y, const uno::Any& aValue );
- const uno::Any& getValue() const { return maValue; }
-
-};
-
-void
-CellValueGetter::processValue( sal_Int32 /*x*/, sal_Int32 /*y*/, const uno::Any& aValue )
-{
- maValue = aValue;
-}
-void CellValueGetter::visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell )
-{
- uno::Any aValue;
- table::CellContentType eType = xCell->getType();
- if( eType == table::CellContentType_VALUE || eType == table::CellContentType_FORMULA )
- {
- if ( eType == table::CellContentType_FORMULA )
- {
-
- rtl::OUString sFormula = xCell->getFormula();
- if ( sFormula.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("=TRUE()") ) ) )
- aValue <<= sal_True;
- else if ( sFormula.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("=FALSE()") ) ) )
- aValue <<= sal_False;
- else
- {
- uno::Reference< beans::XPropertySet > xProp( xCell, uno::UNO_QUERY_THROW );
-
- table::CellContentType eFormulaType = table::CellContentType_VALUE;
- // some formulas give textual results
- xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FormulaResultType" ) ) ) >>= eFormulaType;
-
- if ( eFormulaType == table::CellContentType_TEXT )
- {
- uno::Reference< text::XTextRange > xTextRange(xCell, ::uno::UNO_QUERY_THROW);
- aValue <<= xTextRange->getString();
- }
- else
- aValue <<= xCell->getValue();
- }
- }
- else
- {
- uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
- NumFormatHelper cellFormat( xRange );
- if ( cellFormat.isBooleanType() )
- aValue = uno::makeAny( ( xCell->getValue() != 0.0 ) );
- else
- aValue <<= xCell->getValue();
- }
- }
- if( eType == table::CellContentType_TEXT )
- {
- uno::Reference< text::XTextRange > xTextRange(xCell, ::uno::UNO_QUERY_THROW);
- aValue <<= xTextRange->getString();
- }
- processValue( x,y,aValue );
-}
-
-class CellFormulaValueSetter : public CellValueSetter
-{
-private:
- ScDocument* m_pDoc;
- ScAddress::Convention m_eConv;
-public:
- CellFormulaValueSetter( const uno::Any& aValue, ScDocument* pDoc, ScAddress::Convention eConv ):CellValueSetter( aValue ), m_pDoc( pDoc ), m_eConv( eConv ){}
-protected:
- bool processValue( const uno::Any& aValue, const uno::Reference< table::XCell >& xCell )
- {
- rtl::OUString sFormula;
- if ( aValue >>= sFormula )
- {
- // get current convention
- ScAddress::Convention eConv = m_pDoc->GetAddressConvention();
- // only convert/compile 'real' formulas
- if ( eConv != m_eConv && ( sFormula.trim().indexOf('=') == 0 ) )
- {
- uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
- ScCellRangesBase* pUnoRangesBase = dynamic_cast< ScCellRangesBase* >( xIf.get() );
- if ( pUnoRangesBase )
- {
- ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
- ScCompiler aCompiler( m_pDoc, aCellRanges.First()->aStart );
- // compile the string in the format passed in
- aCompiler.CompileString( sFormula, m_eConv );
- // set desired convention to that of the document
- aCompiler.SetRefConvention( eConv );
- String sConverted;
- aCompiler.CreateStringFromTokenArray(sConverted);
- sFormula = EQUALS + sConverted;
- }
- }
-
- xCell->setFormula( sFormula );
- return true;
- }
- return false;
- }
-
-};
-
-class CellFormulaValueGetter : public CellValueGetter
-{
-private:
- ScDocument* m_pDoc;
- ScAddress::Convention m_eConv;
-public:
- CellFormulaValueGetter(ScDocument* pDoc, ScAddress::Convention eConv ) : CellValueGetter( ), m_pDoc( pDoc ), m_eConv( eConv ) {}
- virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell )
- {
- uno::Any aValue;
- aValue <<= xCell->getFormula();
- rtl::OUString sVal;
- aValue >>= sVal;
- uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
- ScCellRangesBase* pUnoRangesBase = dynamic_cast< ScCellRangesBase* >( xIf.get() );
- if ( ( xCell->getType() == table::CellContentType_FORMULA ) &&
- pUnoRangesBase )
- {
- ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
- ScCompiler aCompiler( m_pDoc, aCellRanges.First()->aStart );
- aCompiler.CompileString( sVal, ScAddress::CONV_OOO );
- // set desired convention
- aCompiler.SetRefConvention( m_eConv );
- String sConverted;
- aCompiler.CreateStringFromTokenArray(sConverted);
- sVal = EQUALS + sConverted;
- aValue <<= sVal;
- }
-
- processValue( x,y,aValue );
- }
-
-};
-
-
-class Dim2ArrayValueGetter : public ArrayVisitor
-{
-protected:
- uno::Any maValue;
- ValueGetter& mValueGetter;
- virtual void processValue( sal_Int32 x, sal_Int32 y, const uno::Any& aValue )
- {
- uno::Sequence< uno::Sequence< uno::Any > >& aMatrix = *( uno::Sequence< uno::Sequence< uno::Any > >* )( maValue.getValue() );
- aMatrix[x][y] = aValue;
- }
-
-public:
- Dim2ArrayValueGetter(sal_Int32 nRowCount, sal_Int32 nColCount, ValueGetter& rValueGetter ): mValueGetter(rValueGetter)
- {
- uno::Sequence< uno::Sequence< uno::Any > > aMatrix;
- aMatrix.realloc( nRowCount );
- for ( sal_Int32 index = 0; index < nRowCount; ++index )
- aMatrix[index].realloc( nColCount );
- maValue <<= aMatrix;
- }
- void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell )
-
- {
- mValueGetter.visitNode( x, y, xCell );
- processValue( x, y, mValueGetter.getValue() );
- }
- const uno::Any& getValue() const { return maValue; }
-
-};
-
-const static rtl::OUString sNA = rtl::OUString::createFromAscii("#N/A");
-
-class Dim1ArrayValueSetter : public ArrayVisitor
-{
- uno::Sequence< uno::Any > aMatrix;
- sal_Int32 nColCount;
- ValueSetter& mCellValueSetter;
-public:
- Dim1ArrayValueSetter( const uno::Any& aValue, ValueSetter& rCellValueSetter ):mCellValueSetter( rCellValueSetter )
- {
- aValue >>= aMatrix;
- nColCount = aMatrix.getLength();
- }
- virtual void visitNode( sal_Int32 /*x*/, sal_Int32 y, const uno::Reference< table::XCell >& xCell )
- {
- if ( y < nColCount )
- mCellValueSetter.processValue( aMatrix[ y ], xCell );
- else
- mCellValueSetter.processValue( uno::makeAny( sNA ), xCell );
- }
-};
-
-
-
-class Dim2ArrayValueSetter : public ArrayVisitor
-{
- uno::Sequence< uno::Sequence< uno::Any > > aMatrix;
- ValueSetter& mCellValueSetter;
- sal_Int32 nRowCount;
- sal_Int32 nColCount;
-public:
- Dim2ArrayValueSetter( const uno::Any& aValue, ValueSetter& rCellValueSetter ) : mCellValueSetter( rCellValueSetter )
- {
- aValue >>= aMatrix;
- nRowCount = aMatrix.getLength();
- nColCount = aMatrix[0].getLength();
- }
-
- virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell )
- {
- if ( x < nRowCount && y < nColCount )
- mCellValueSetter.processValue( aMatrix[ x ][ y ], xCell );
- else
- mCellValueSetter.processValue( uno::makeAny( sNA ), xCell );
-
- }
-};
-
-class RangeProcessor
-{
-public:
- virtual void process( const uno::Reference< excel::XRange >& xRange ) = 0;
-};
-
-class RangeValueProcessor : public RangeProcessor
-{
- const uno::Any& m_aVal;
-public:
- RangeValueProcessor( const uno::Any& rVal ):m_aVal( rVal ) {}
- virtual void process( const uno::Reference< excel::XRange >& xRange )
- {
- xRange->setValue( m_aVal );
- }
-};
-
-class RangeFormulaProcessor : public RangeProcessor
-{
- const uno::Any& m_aVal;
-public:
- RangeFormulaProcessor( const uno::Any& rVal ):m_aVal( rVal ) {}
- virtual void process( const uno::Reference< excel::XRange >& xRange )
- {
- xRange->setFormula( m_aVal );
- }
-};
-
-class RangeCountProcessor : public RangeProcessor
-{
- sal_Int32 nCount;
-public:
- RangeCountProcessor():nCount(0){}
- virtual void process( const uno::Reference< excel::XRange >& xRange )
- {
- nCount = nCount + xRange->getCount();
- }
- sal_Int32 value() { return nCount; }
-};
-class AreasVisitor
-{
-private:
- uno::Reference< vba::XCollection > m_Areas;
-public:
- AreasVisitor( const uno::Reference< vba::XCollection >& rAreas ):m_Areas( rAreas ){}
-
- void visit( RangeProcessor& processor )
- {
- if ( m_Areas.is() )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- processor.process( xRange );
- }
- }
- }
-};
-
-class RangeHelper
-{
- uno::Reference< table::XCellRange > m_xCellRange;
-
-public:
- RangeHelper( const uno::Reference< table::XCellRange >& xCellRange ) throw (uno::RuntimeException) : m_xCellRange( xCellRange )
- {
- if ( !m_xCellRange.is() )
- throw uno::RuntimeException();
- }
- RangeHelper( const uno::Any aCellRange ) throw (uno::RuntimeException)
- {
- m_xCellRange.set( aCellRange, uno::UNO_QUERY_THROW );
- }
- uno::Reference< sheet::XSheetCellRange > getSheetCellRange() throw (uno::RuntimeException)
- {
- return uno::Reference< sheet::XSheetCellRange >(m_xCellRange, uno::UNO_QUERY_THROW);
- }
- uno::Reference< sheet::XSpreadsheet > getSpreadSheet() throw (uno::RuntimeException)
- {
- return getSheetCellRange()->getSpreadsheet();
- }
-
- uno::Reference< table::XCellRange > getCellRangeFromSheet() throw (uno::RuntimeException)
- {
- return uno::Reference< table::XCellRange >(getSpreadSheet(), uno::UNO_QUERY_THROW );
- }
-
- uno::Reference< sheet::XCellRangeAddressable > getCellRangeAddressable() throw (uno::RuntimeException)
- {
- return uno::Reference< sheet::XCellRangeAddressable >(m_xCellRange, ::uno::UNO_QUERY_THROW);
-
- }
-
- uno::Reference< sheet::XSheetCellCursor > getSheetCellCursor() throw ( uno::RuntimeException )
- {
- return uno::Reference< sheet::XSheetCellCursor >( getSpreadSheet()->createCursorByRange( getSheetCellRange() ), uno::UNO_QUERY_THROW );
- }
-
- static uno::Reference< excel::XRange > createRangeFromRange( const uno::Reference<uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, const uno::Reference< sheet::XCellRangeAddressable >& xCellRangeAddressable, sal_Int32 nStartColOffset = 0, sal_Int32 nStartRowOffset = 0,
- sal_Int32 nEndColOffset = 0, sal_Int32 nEndRowOffset = 0 )
- {
- // #FIXME need proper (WorkSheet) parent
- return uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext,
- xRange->getCellRangeByPosition(
- xCellRangeAddressable->getRangeAddress().StartColumn + nStartColOffset,
- xCellRangeAddressable->getRangeAddress().StartRow + nStartRowOffset,
- xCellRangeAddressable->getRangeAddress().EndColumn + nEndColOffset,
- xCellRangeAddressable->getRangeAddress().EndRow + nEndRowOffset ) ) );
- }
-
-};
-
-bool
-getCellRangesForAddress( USHORT& rResFlags, const rtl::OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, ScAddress::Convention& eConv )
-{
-
- ScDocument* pDoc = NULL;
- if ( pDocSh )
- {
- pDoc = pDocSh->GetDocument();
- String aString(sAddress);
- USHORT nMask = SCA_VALID;
- //USHORT nParse = rCellRanges.Parse( sAddress, pDoc, nMask, ScAddress::CONV_XL_A1 );
- rResFlags = rCellRanges.Parse( sAddress, pDoc, nMask, eConv, 0 );
- if ( rResFlags & SCA_VALID )
- {
- return true;
- }
- }
- return false;
-}
-
-bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, ScRange& refRange, ScRangeList& aCellRanges, ScAddress::Convention aConv = ScAddress::CONV_XL_A1 ) throw ( uno::RuntimeException )
-{
- // see if there is a match with a named range
- uno::Reference< beans::XPropertySet > xProps( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xNameAccess( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NamedRanges") ) ), uno::UNO_QUERY_THROW );
- // Strangly enough you can have Range( "namedRange1, namedRange2, etc," )
- // loop around each ',' seperated name
- std::vector< rtl::OUString > vNames;
- sal_Int32 nIndex = 0;
- do
- {
- rtl::OUString aToken = sName.getToken( 0, ',', nIndex );
- vNames.push_back( aToken );
- } while ( nIndex >= 0 );
-
- if ( !vNames.size() )
- vNames.push_back( sName );
-
- std::vector< rtl::OUString >::iterator it = vNames.begin();
- std::vector< rtl::OUString >::iterator it_end = vNames.end();
- for ( ; it != it_end; ++it )
- {
-
- ScAddress::Convention eConv = aConv;
- // spaces are illegal ( but the user of course can enter them )
- rtl::OUString sAddress = (*it).trim();
- if ( xNameAccess->hasByName( sAddress ) )
- {
- uno::Reference< sheet::XNamedRange > xNamed( xNameAccess->getByName( sAddress ), uno::UNO_QUERY_THROW );
- sAddress = xNamed->getContent();
- // As the address comes from OOO, the addressing
- // style is may not be XL_A1
- eConv = pDocSh->GetDocument()->GetAddressConvention();
- }
-
- USHORT nFlags = 0;
- if ( !getCellRangesForAddress( nFlags, sAddress, pDocSh, aCellRanges, eConv ) )
- return false;
-
- bool bTabFromReferrer = !( nFlags & SCA_TAB_3D );
-
- for ( ScRange* pRange = aCellRanges.First() ; pRange; pRange = aCellRanges.Next() )
- {
- pRange->aStart.SetCol( refRange.aStart.Col() + pRange->aStart.Col() );
- pRange->aStart.SetRow( refRange.aStart.Row() + pRange->aStart.Row() );
- pRange->aStart.SetTab( bTabFromReferrer ? refRange.aStart.Tab() : pRange->aStart.Tab() );
- pRange->aEnd.SetCol( refRange.aStart.Col() + pRange->aEnd.Col() );
- pRange->aEnd.SetRow( refRange.aStart.Row() + pRange->aEnd.Row() );
- pRange->aEnd.SetTab( bTabFromReferrer ? refRange.aEnd.Tab() : pRange->aEnd.Tab() );
- }
- }
- return true;
-}
-
-
-ScVbaRange*
-getRangeForName( const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, ScDocShell* pDocSh, table::CellRangeAddress& pAddr, ScAddress::Convention eConv = ScAddress::CONV_XL_A1 ) throw ( uno::RuntimeException )
-{
- ScRangeList aCellRanges;
- ScRange refRange;
- ScUnoConversion::FillScRange( refRange, pAddr );
- if ( !getScRangeListForAddress ( sName, pDocSh, refRange, aCellRanges, eConv ) )
- throw uno::RuntimeException();
- // Single range
- if ( aCellRanges.First() == aCellRanges.Last() )
- {
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pDocSh, *aCellRanges.First() ) );
- // #FIXME need proper (WorkSheet) parent
- return new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xRange );
- }
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocSh, aCellRanges ) );
-
- // #FIXME need proper (WorkSheet) parent
- return new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xRanges );
-}
-
-css::uno::Reference< excel::XRange >
-ScVbaRange::getRangeObjectForName( const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sRangeName, ScDocShell* pDocSh, ScAddress::Convention eConv ) throw ( uno::RuntimeException )
-{
- table::CellRangeAddress refAddr;
- return getRangeForName( xContext, sRangeName, pDocSh, refAddr, eConv );
-}
-
-
-table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam, ScDocShell* pDocSh, ScAddress::Convention aConv = ScAddress::CONV_XL_A1) throw ( uno::RuntimeException )
-{
- uno::Reference< table::XCellRange > xRangeParam;
- switch ( aParam.getValueTypeClass() )
- {
- case uno::TypeClass_STRING:
- {
- rtl::OUString rString;
- aParam >>= rString;
- ScRangeList aCellRanges;
- ScRange refRange;
- if ( getScRangeListForAddress ( rString, pDocSh, refRange, aCellRanges, aConv ) )
- {
- if ( aCellRanges.First() == aCellRanges.Last() )
- {
- table::CellRangeAddress aRangeAddress;
- ScUnoConversion::FillApiRange( aRangeAddress, *aCellRanges.First() );
- return aRangeAddress;
- }
- }
- }
- case uno::TypeClass_INTERFACE:
- {
- uno::Reference< excel::XRange > xRange;
- aParam >>= xRange;
- if ( xRange.is() )
- xRange->getCellRange() >>= xRangeParam;
- break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't extact CellRangeAddress from type" ) ), uno::Reference< uno::XInterface >() );
- }
- uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRangeParam, uno::UNO_QUERY_THROW );
- return xAddressable->getRangeAddress();
-
-}
-
-uno::Reference< vba::XCollection >
-lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno::Reference<uno::XComponentContext>& xContext, const uno::Reference< table::XCellRange >& xRange ) throw( uno::RuntimeException )
-{
- uno::Reference< vba::XHelperInterface > xParent( xParentRange, uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocumentFromRange(xRange);
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
- uno::Reference< vba::XCollection > borders( new ScVbaBorders( xParent, xContext, xRange, aPalette ) );
- return borders;
-}
-
-ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
- uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< vba::XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), getModelFromRange( getXSomethingFromArgs< table::XCellRange >( args, 1 ) ), true ), mbIsRows( sal_False ), mbIsColumns( sal_False )
-{
- mxRange.set( mxPropertySet, uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndex( new SingleRangeIndexAccess( mxContext, mxRange ) );
- m_Areas = new ScVbaRangeAreas( mxContext, xIndex, mbIsRows, mbIsColumns );
-}
-
-ScVbaRange::ScVbaRange( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, sal_Bool bIsRows, sal_Bool bIsColumns ) throw( lang::IllegalArgumentException )
-: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRange, uno::UNO_QUERY_THROW ), getModelFromRange( xRange), true ), mxRange( xRange ),
- mbIsRows( bIsRows ),
- mbIsColumns( bIsColumns )
-{
- if ( !xContext.is() )
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "context is not set " ) ), uno::Reference< uno::XInterface >() , 1 );
- if ( !xRange.is() )
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "range is not set " ) ), uno::Reference< uno::XInterface >() , 1 );
-
- uno::Reference< container::XIndexAccess > xIndex( new SingleRangeIndexAccess( mxContext, xRange ) );
- m_Areas = new ScVbaRangeAreas( mxContext, xIndex, mbIsRows, mbIsColumns );
-
-}
-
-ScVbaRange::ScVbaRange( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges, sal_Bool bIsRows, sal_Bool bIsColumns ) throw ( lang::IllegalArgumentException )
-: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRanges, uno::UNO_QUERY_THROW ), getModelFromXIf( uno::Reference< uno::XInterface >( xRanges, uno::UNO_QUERY_THROW ) ), true ), mxRanges( xRanges ),mbIsRows( bIsRows ), mbIsColumns( bIsColumns )
-
-{
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- m_Areas = new ScVbaRangeAreas( mxContext, xIndex, mbIsRows, mbIsColumns );
-
-}
-
-ScVbaRange::~ScVbaRange()
-{
-}
-
-uno::Reference< vba::XCollection >& ScVbaRange::getBorders()
-{
- if ( !m_Borders.is() )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(1) ), uno::Any() ), uno::UNO_QUERY_THROW );
- m_Borders = lcl_setupBorders( this, mxContext, uno::Reference< table::XCellRange >( xRange->getCellRange(), uno::UNO_QUERY_THROW ) );
- }
- return m_Borders;
-}
-
-void
-ScVbaRange::visitArray( ArrayVisitor& visitor )
-{
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW );
- sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount();
- sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
- for ( sal_Int32 i=0; i<nRowCount; ++i )
- {
- for ( sal_Int32 j=0; j<nColCount; ++j )
- {
- uno::Reference< table::XCell > xCell( mxRange->getCellByPosition( j, i ), uno::UNO_QUERY_THROW );
-
- visitor.visitNode( i, j, xCell );
- }
- }
-}
-
-
-
-uno::Any
-ScVbaRange::getValue( ValueGetter& valueGetter) throw (uno::RuntimeException)
-{
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW );
- // single cell range
- if ( isSingleCellRange() )
- {
- visitArray( valueGetter );
- return valueGetter.getValue();
- }
- sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount();
- sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
- // multi cell range ( return array )
- Dim2ArrayValueGetter arrayGetter( nRowCount, nColCount, valueGetter );
- visitArray( arrayGetter );
- return uno::makeAny( script::ArrayWrapper( sal_False, arrayGetter.getValue() ) );
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getValue() throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->getValue();
- }
-
- CellValueGetter valueGetter;
- return getValue( valueGetter );
-
-}
-
-
-void
-ScVbaRange::setValue( const uno::Any &aValue, ValueSetter& valueSetter ) throw (uno::RuntimeException)
-{
- uno::TypeClass aClass = aValue.getValueTypeClass();
- if ( aClass == uno::TypeClass_SEQUENCE )
- {
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aConverted;
- try
- {
- // test for single dimension, could do
- // with a better test than this
- if ( aValue.getValueTypeName().indexOf('[') == aValue.getValueTypeName().lastIndexOf('[') )
- {
- aConverted = xConverter->convertTo( aValue, getCppuType((uno::Sequence< uno::Any >*)0) );
- Dim1ArrayValueSetter setter( aConverted, valueSetter );
- visitArray( setter );
- }
- else
- {
- aConverted = xConverter->convertTo( aValue, getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) );
- Dim2ArrayValueSetter setter( aConverted, valueSetter );
- visitArray( setter );
- }
- }
- catch ( uno::Exception& e )
- {
- OSL_TRACE("Bahhh, caught exception %s",
- rtl::OUStringToOString( e.Message,
- RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- }
- else
- {
- visitArray( valueSetter );
- }
-}
-
-void SAL_CALL
-ScVbaRange::setValue( const uno::Any &aValue ) throw (uno::RuntimeException)
-{
- // If this is a multiple selection apply setValue over all areas
- if ( m_Areas->getCount() > 1 )
- {
- AreasVisitor aVisitor( m_Areas );
- RangeValueProcessor valueProcessor( aValue );
- aVisitor.visit( valueProcessor );
- return;
- }
- CellValueSetter valueSetter( aValue );
- setValue( aValue, valueSetter );
-}
-
-void
-ScVbaRange::Clear() throw (uno::RuntimeException)
-{
- sal_Int32 nFlags = sheet::CellFlags::VALUE | sheet::CellFlags::STRING | sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR | sheet::CellFlags::FORMULA;
- ClearContents( nFlags );
-}
-
-//helper ClearContent
-void
-ScVbaRange::ClearContents( sal_Int32 nFlags ) throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- if ( pRange )
- pRange->ClearContents( nFlags );
- }
- return;
- }
-
-
- uno::Reference< sheet::XSheetOperation > xSheetOperation(mxRange, uno::UNO_QUERY_THROW);
- xSheetOperation->clearContents( nFlags );
-}
-void
-ScVbaRange::ClearComments() throw (uno::RuntimeException)
-{
- ClearContents( sheet::CellFlags::ANNOTATION );
-}
-
-void
-ScVbaRange::ClearContents() throw (uno::RuntimeException)
-{
- sal_Int32 nClearFlags = ( sheet::CellFlags::VALUE |
- sheet::CellFlags::STRING | sheet::CellFlags::DATETIME |
- sheet::CellFlags::FORMULA );
- ClearContents( nClearFlags );
-}
-
-void
-ScVbaRange::ClearFormats() throw (uno::RuntimeException)
-{
- //FIXME: need to check if we need to combine sheet::CellFlags::FORMATTED
- sal_Int32 nClearFlags = sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR;
- ClearContents( nClearFlags );
-}
-
-void
-ScVbaRange::setFormulaValue( const uno::Any& rFormula, ScAddress::Convention eConv ) throw (uno::RuntimeException)
-{
- // If this is a multiple selection apply setFormula over all areas
- if ( m_Areas->getCount() > 1 )
- {
- AreasVisitor aVisitor( m_Areas );
- RangeFormulaProcessor valueProcessor( rFormula );
- aVisitor.visit( valueProcessor );
- return;
- }
- CellFormulaValueSetter formulaValueSetter( rFormula, getScDocument(), eConv );
- setValue( rFormula, formulaValueSetter );
-}
-
-uno::Any
-ScVbaRange::getFormulaValue( ScAddress::Convention eConv) throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->getFormula();
- }
- CellFormulaValueGetter valueGetter( getScDocument(), eConv );
- return getValue( valueGetter );
-
-}
-
-void
-ScVbaRange::setFormula(const uno::Any &rFormula ) throw (uno::RuntimeException)
-{
- // #FIXME converting "=$a$1" e.g. CONV_XL_A1 -> CONV_OOO // results in "=$a$1:a1", temporalily disable conversion
- //setFormulaValue( rFormula, ScAddress::CONV_XL_A1 );;
- setFormulaValue( rFormula, ScAddress::CONV_OOO );;
-}
-
-uno::Any
-ScVbaRange::getFormulaR1C1() throw (::com::sun::star::uno::RuntimeException)
-{
- return getFormulaValue( ScAddress::CONV_XL_R1C1 );
-}
-
-void
-ScVbaRange::setFormulaR1C1(const uno::Any& rFormula ) throw (uno::RuntimeException)
-{
- setFormulaValue( rFormula, ScAddress::CONV_XL_R1C1 );
-}
-
-uno::Any
-ScVbaRange::getFormula() throw (::com::sun::star::uno::RuntimeException)
-{
- return getFormulaValue( ScAddress::CONV_XL_A1 );
-}
-
-sal_Int32
-ScVbaRange::getCount() throw (uno::RuntimeException)
-{
- // If this is a multiple selection apply setValue over all areas
- if ( m_Areas->getCount() > 1 )
- {
- AreasVisitor aVisitor( m_Areas );
- RangeCountProcessor valueProcessor;
- aVisitor.visit( valueProcessor );
- return valueProcessor.value();
- }
- sal_Int32 rowCount = 0;
- sal_Int32 colCount = 0;
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW );
- rowCount = xColumnRowRange->getRows()->getCount();
- colCount = xColumnRowRange->getColumns()->getCount();
-
- if( IsRows() )
- return rowCount;
- if( IsColumns() )
- return colCount;
- return rowCount * colCount;
-}
-
-sal_Int32
-ScVbaRange::getRow() throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->getRow();
- }
- uno::Reference< sheet::XCellAddressable > xCellAddressable(mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
- return xCellAddressable->getCellAddress().Row + 1; // Zero value indexing
-}
-
-sal_Int32
-ScVbaRange::getColumn() throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->getColumn();
- }
- uno::Reference< sheet::XCellAddressable > xCellAddressable(mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
- return xCellAddressable->getCellAddress().Column + 1; // Zero value indexing
-}
-
-uno::Any
-ScVbaRange::HasFormula() throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- uno::Any aResult = aNULL();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- // if the HasFormula for any area is different to another
- // return null
- if ( index > 1 )
- if ( aResult != xRange->HasFormula() )
- return aNULL();
- aResult = xRange->HasFormula();
- if ( aNULL() == aResult )
- return aNULL();
- }
- return aResult;
- }
- uno::Reference< uno::XInterface > xIf( mxRange, uno::UNO_QUERY_THROW );
- ScCellRangesBase* pThisRanges = dynamic_cast< ScCellRangesBase * > ( xIf.get() );
- if ( pThisRanges )
- {
- uno::Reference<uno::XInterface> xRanges( pThisRanges->queryFormulaCells( ( sheet::FormulaResult::ERROR | sheet::FormulaResult::VALUE | sheet::FormulaResult::STRING ) ), uno::UNO_QUERY_THROW );
- ScCellRangesBase* pFormulaRanges = dynamic_cast< ScCellRangesBase * > ( xRanges.get() );
- // check if there are no formula cell, return false
- if ( pFormulaRanges->GetRangeList().Count() == 0 )
- return uno::makeAny(sal_False);
-
- // chech if there are holes (where some cells are not formulas)
- // or returned range is not equal to this range
- if ( ( pFormulaRanges->GetRangeList().Count() > 1 )
- || ( pFormulaRanges->GetRangeList().GetObject(0)->aStart != pThisRanges->GetRangeList().GetObject(0)->aStart )
- || ( pFormulaRanges->GetRangeList().GetObject(0)->aEnd != pThisRanges->GetRangeList().GetObject(0)->aEnd ) )
- return aNULL(); // should return aNULL;
- }
- return uno::makeAny( sal_True );
-}
-void
-ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFillMode, sheet::FillDateMode nFillDateMode, double fStep, double fEndValue ) throw( uno::RuntimeException )
-{
- if ( m_Areas->getCount() > 1 )
- {
- // Multi-Area Range
- uno::Reference< vba::XCollection > xCollection( m_Areas, uno::UNO_QUERY_THROW );
- for ( sal_Int32 index = 1; index <= xCollection->getCount(); ++index )
- {
- uno::Reference< excel::XRange > xRange( xCollection->Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- ScVbaRange* pThisRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- pThisRange->fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue );
-
- }
- return;
- }
-
- uno::Reference< sheet::XCellSeries > xCellSeries(mxRange, uno::UNO_QUERY_THROW );
- xCellSeries->fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue );
-}
-
-void
-ScVbaRange::FillLeft() throw (uno::RuntimeException)
-{
- fillSeries(sheet::FillDirection_TO_LEFT,
- sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
-}
-
-void
-ScVbaRange::FillRight() throw (uno::RuntimeException)
-{
- fillSeries(sheet::FillDirection_TO_RIGHT,
- sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
-}
-
-void
-ScVbaRange::FillUp() throw (uno::RuntimeException)
-{
- fillSeries(sheet::FillDirection_TO_TOP,
- sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
-}
-
-void
-ScVbaRange::FillDown() throw (uno::RuntimeException)
-{
- fillSeries(sheet::FillDirection_TO_BOTTOM,
- sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
-}
-
-::rtl::OUString
-ScVbaRange::getText() throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->getText();
- }
- uno::Reference< text::XTextRange > xTextRange(mxRange->getCellByPosition(0,0), uno::UNO_QUERY_THROW );
- return xTextRange->getString();
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::Offset( const ::uno::Any &nRowOff, const uno::Any &nColOff ) throw (uno::RuntimeException)
-{
- SCROW nRowOffset = 0;
- SCCOL nColOffset = 0;
- sal_Bool bIsRowOffset = ( nRowOff >>= nRowOffset );
- sal_Bool bIsColumnOffset = ( nColOff >>= nColOffset );
- ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
-
- ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
-
-
- for ( ScRange* pRange = aCellRanges.First() ; pRange; pRange = aCellRanges.Next() )
- {
- if ( bIsColumnOffset )
- {
- pRange->aStart.SetCol( pRange->aStart.Col() + nColOffset );
- pRange->aEnd.SetCol( pRange->aEnd.Col() + nColOffset );
- }
- if ( bIsRowOffset )
- {
- pRange->aStart.SetRow( pRange->aStart.Row() + nRowOffset );
- pRange->aEnd.SetRow( pRange->aEnd.Row() + nRowOffset );
- }
- }
-
- if ( aCellRanges.Count() > 1 ) // Multi-Area
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pUnoRangesBase->GetDocShell(), aCellRanges ) );
- return new ScVbaRange( getParent(), mxContext, xRanges );
- }
- // normal range
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), *aCellRanges.First() ) );
- return new ScVbaRange( getParent(), mxContext, xRange );
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::CurrentRegion() throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->CurrentRegion();
- }
-
- RangeHelper helper( mxRange );
- uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor =
- helper.getSheetCellCursor();
- xSheetCellCursor->collapseToCurrentRegion();
- uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
- return RangeHelper::createRangeFromRange( mxContext, helper.getCellRangeFromSheet(), xCellRangeAddressable );
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::CurrentArray() throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->CurrentArray();
- }
- RangeHelper helper( mxRange );
- uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor =
- helper.getSheetCellCursor();
- xSheetCellCursor->collapseToCurrentArray();
- uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
- return RangeHelper::createRangeFromRange( mxContext, helper.getCellRangeFromSheet(), xCellRangeAddressable );
-}
-
-uno::Any
-ScVbaRange::getFormulaArray() throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->getFormulaArray();
- }
-
- uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aMatrix;
- aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
- return aMatrix;
-}
-
-void
-ScVbaRange::setFormulaArray(const uno::Any& rFormula) throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->setFormulaArray( rFormula );
- }
- // #TODO need to distinguish between getFormula and getFormulaArray e.g. (R1C1)
- // but for the moment its just easier to treat them the same for setting
-
- setFormula( rFormula );
-}
-
-::rtl::OUString
-ScVbaRange::Characters(const uno::Any& Start, const uno::Any& Length) throw (uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->Characters( Start, Length );
- }
-
- long nIndex = 0, nCount = 0;
- ::rtl::OUString rString;
- uno::Reference< text::XTextRange > xTextRange(mxRange, ::uno::UNO_QUERY_THROW );
- rString = xTextRange->getString();
- if( !( Start >>= nIndex ) && !( Length >>= nCount ) )
- return rString;
- if(!( Start >>= nIndex ) )
- nIndex = 1;
- if(!( Length >>= nCount ) )
- nIndex = rString.getLength();
- return rString.copy( --nIndex, nCount ); // Zero value indexing
-}
-
-::rtl::OUString
-ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolute, const uno::Any& ReferenceStyle, const uno::Any& External, const uno::Any& RelativeTo ) throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- // Multi-Area Range
- rtl::OUString sAddress;
- uno::Reference< vba::XCollection > xCollection( m_Areas, uno::UNO_QUERY_THROW );
- uno::Any aExternalCopy = External;
- for ( sal_Int32 index = 1; index <= xCollection->getCount(); ++index )
- {
- uno::Reference< excel::XRange > xRange( xCollection->Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- if ( index > 1 )
- {
- sAddress += rtl::OUString( ',' );
- // force external to be false
- // only first address should have the
- // document and sheet specifications
- aExternalCopy = uno::makeAny(sal_False);
- }
- sAddress += xRange->Address( RowAbsolute, ColumnAbsolute, ReferenceStyle, aExternalCopy, RelativeTo );
- }
- return sAddress;
-
- }
- ScAddress::Details dDetails( ScAddress::CONV_XL_A1, 0, 0 );
- if ( ReferenceStyle.hasValue() )
- {
- sal_Int32 refStyle = excel::XlReferenceStyle::xlA1;
- ReferenceStyle >>= refStyle;
- if ( refStyle == excel::XlReferenceStyle::xlR1C1 )
- dDetails = ScAddress::Details( ScAddress::CONV_XL_R1C1, 0, 0 );
- }
- USHORT nFlags = SCA_VALID;
- ScDocShell* pDocShell = getScDocShell();
- ScDocument* pDoc = pDocShell->GetDocument();
-
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) );
- String sRange;
- USHORT ROW_ABSOLUTE = ( SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE );
- USHORT COL_ABSOLUTE = ( SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE );
- // default
- nFlags |= ( SCA_TAB_ABSOLUTE | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE );
- if ( RowAbsolute.hasValue() )
- {
- sal_Bool bVal = sal_True;
- RowAbsolute >>= bVal;
- if ( !bVal )
- nFlags &= ~ROW_ABSOLUTE;
- }
- if ( ColumnAbsolute.hasValue() )
- {
- sal_Bool bVal = sal_True;
- ColumnAbsolute >>= bVal;
- if ( !bVal )
- nFlags &= ~COL_ABSOLUTE;
- }
- sal_Bool bLocal = sal_False;
- if ( External.hasValue() )
- {
- External >>= bLocal;
- if ( bLocal )
- nFlags |= SCA_TAB_3D | SCA_FORCE_DOC;
- }
- if ( RelativeTo.hasValue() )
- {
- // #TODO should I throw an error if R1C1 is not set?
-
- table::CellRangeAddress refAddress = getCellRangeAddressForVBARange( RelativeTo, pDocShell );
- dDetails = ScAddress::Details( ScAddress::CONV_XL_R1C1, static_cast< SCROW >( refAddress.StartRow ), static_cast< SCCOL >( refAddress.StartColumn ) );
- }
- aRange.Format( sRange, nFlags, pDoc, dDetails );
- return sRange;
-}
-
-uno::Reference < excel::XFont >
-ScVbaRange::Font() throw ( script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY );
- ScDocument* pDoc = getScDocument();
- if ( mxRange.is() )
- xProps.set(mxRange, ::uno::UNO_QUERY );
- else if ( mxRanges.is() )
- xProps.set(mxRanges, ::uno::UNO_QUERY );
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
-
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
- SfxItemSet* pSet = NULL;
- try
- {
- pSet = getCurrentDataSet();
- }
- catch( uno::Exception& )
- {
- }
- return new ScVbaFont( this, mxContext, aPalette, xProps, pSet );
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) throw(uno::RuntimeException)
-{
- // #TODO code within the test below "if ( m_Areas.... " can be removed
- // Test is performed only because m_xRange is NOT set to be
- // the first range in m_Areas ( to force failure while
- // the implementations for each method are being updated )
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->Cells( nRowIndex, nColumnIndex );
- }
-
- sal_Int32 nRow = 0, nColumn = 0;
- sal_Bool bIsIndex = nRowIndex >>= nRow, bIsColumnIndex = nColumnIndex >>= nColumn;
-
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< table::XCellRange > xSheetRange = thisRange.getCellRangeFromSheet();
- if( !bIsIndex && !bIsColumnIndex ) // .Cells
- // #FIXE needs proper parent ( Worksheet )
- return uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< vba::XHelperInterface >(), mxContext, mxRange ) );
-
- sal_Int32 nIndex = --nRow;
- if( bIsIndex && !bIsColumnIndex ) // .Cells(n)
- {
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, ::uno::UNO_QUERY_THROW);
- sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
-
- if ( !nIndex || nIndex < 0 )
- nRow = 0;
- else
- nRow = nIndex / nColCount;
- nColumn = nIndex % nColCount;
- }
- else
- --nColumn;
- nRow = nRow + thisRangeAddress.StartRow;
- nColumn = nColumn + thisRangeAddress.StartColumn;
- return new ScVbaRange( getParent(), mxContext, xSheetRange->getCellRangeByPosition( nColumn, nRow, nColumn, nRow ) );
-}
-
-void
-ScVbaRange::Select() throw (uno::RuntimeException)
-{
- ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
- if ( !pUnoRangesBase )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying uno range object" ) ), uno::Reference< uno::XInterface >() );
- ScDocShell* pShell = pUnoRangesBase->GetDocShell();
- if ( pShell )
- {
- uno::Reference< frame::XModel > xModel( pShell->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- if ( mxRanges.is() )
- xSelection->select( uno::makeAny( mxRanges ) );
- else
- xSelection->select( uno::makeAny( mxRange ) );
- }
-}
-
-bool cellInRange( const table::CellRangeAddress& rAddr, const sal_Int32& nCol, const sal_Int32& nRow )
-{
- if ( nCol >= rAddr.StartColumn && nCol <= rAddr.EndColumn &&
- nRow >= rAddr.StartRow && nRow <= rAddr.EndRow )
- return true;
- return false;
-}
-
-void setCursor( const SCCOL& nCol, const SCROW& nRow, bool bInSel = true )
-{
- ScTabViewShell* pShell = getCurrentBestViewShell();
- if ( pShell )
- {
- if ( bInSel )
- pShell->SetCursor( nCol, nRow );
- else
- pShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_NONE, FALSE, FALSE, TRUE, FALSE );
- }
-}
-
-void
-ScVbaRange::Activate() throw (uno::RuntimeException)
-{
- // get first cell of current range
- uno::Reference< table::XCellRange > xCellRange;
- if ( mxRanges.is() )
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- xCellRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- }
- else
- xCellRange.set( mxRange, uno::UNO_QUERY_THROW );
-
- RangeHelper thisRange( xCellRange );
- uno::Reference< sheet::XCellRangeAddressable > xThisRangeAddress = thisRange.getCellRangeAddressable();
- table::CellRangeAddress thisRangeAddress = xThisRangeAddress->getRangeAddress();
-
- // get current selection
- uno::Reference< sheet::XCellRangeAddressable > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-
- uno::Reference< sheet::XSheetCellRanges > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-
- if ( xRanges.is() )
- {
- uno::Sequence< table::CellRangeAddress > nAddrs = xRanges->getRangeAddresses();
- for ( sal_Int32 index = 0; index < nAddrs.getLength(); ++index )
- {
- if ( cellInRange( nAddrs[index], thisRangeAddress.StartColumn, thisRangeAddress.StartRow ) )
- {
- setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ) );
- return;
- }
-
- }
- }
-
- if ( xRange.is() && cellInRange( xRange->getRangeAddress(), thisRangeAddress.StartColumn, thisRangeAddress.StartRow ) )
- setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ) );
- else
- {
- // if this range is multi cell select the range other
- // wise just position the cell at this single range position
- if ( isSingleCellRange() )
- // This top-leftmost cell of this Range is not in the current
- // selection so just select this range
- setCursor( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), false );
- else
- Select();
- }
-
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- SCROW nStartRow = 0;
- SCROW nEndRow = 0;
-
- sal_Int32 nValue = 0;
- rtl::OUString sAddress;
-
- if ( aIndex.hasValue() )
- {
- ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
- ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
-
- ScRange aRange = *aCellRanges.First();
- if( aIndex >>= nValue )
- {
- aRange.aStart.SetRow( aRange.aStart.Row() + --nValue );
- aRange.aEnd.SetRow( aRange.aStart.Row() );
- }
-
- else if ( aIndex >>= sAddress )
- {
- ScAddress::Details dDetails( ScAddress::CONV_XL_A1, 0, 0 );
- ScRange tmpRange;
- tmpRange.ParseRows( sAddress, getDocumentFromRange( mxRange ), dDetails );
- nStartRow = tmpRange.aStart.Row();
- nEndRow = tmpRange.aEnd.Row();
-
- aRange.aStart.SetRow( aRange.aStart.Row() + nStartRow );
- aRange.aEnd.SetRow( aRange.aStart.Row() + ( nEndRow - nStartRow ));
- }
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Illegal param" ) ), uno::Reference< uno::XInterface >() );
-
- if ( aRange.aStart.Row() < 0 || aRange.aEnd.Row() < 0 )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Internal failure, illegal param"), uno::Reference< uno::XInterface >() );
- // return a normal range ( even for multi-selection
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange ) );
- return new ScVbaRange( getParent(), mxContext, xRange, true );
- }
- // Rows() - no params
- if ( m_Areas->getCount() > 1 )
- return new ScVbaRange( getParent(), mxContext, mxRanges, true );
- return new ScVbaRange( getParent(), mxContext, mxRange, true );
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- SCCOL nStartCol = 0;
- SCCOL nEndCol = 0;
-
- sal_Int32 nValue = 0;
- rtl::OUString sAddress;
-
- ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
- ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
-
- ScRange aRange = *aCellRanges.First();
- if ( aIndex.hasValue() )
- {
- if ( aIndex >>= nValue )
- {
- aRange.aStart.SetCol( aRange.aStart.Col() + static_cast< SCCOL > ( --nValue ) );
- aRange.aEnd.SetCol( aRange.aStart.Col() );
- }
-
- else if ( aIndex >>= sAddress )
- {
- ScAddress::Details dDetails( ScAddress::CONV_XL_A1, 0, 0 );
- ScRange tmpRange;
- tmpRange.ParseCols( sAddress, getDocumentFromRange( mxRange ), dDetails );
- nStartCol = tmpRange.aStart.Col();
- nEndCol = tmpRange.aEnd.Col();
-
- aRange.aStart.SetCol( aRange.aStart.Col() + nStartCol );
- aRange.aEnd.SetCol( aRange.aStart.Col() + ( nEndCol - nStartCol ));
- }
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Illegal param" ) ), uno::Reference< uno::XInterface >() );
-
- if ( aRange.aStart.Col() < 0 || aRange.aEnd.Col() < 0 )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Internal failure, illegal param"), uno::Reference< uno::XInterface >() );
- }
- // Columns() - no params
- //return new ScVbaRange( getParent(), mxContext, mxRange, false, true );
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange ) );
- return new ScVbaRange( getParent(), mxContext, xRange, false, true );
-}
-
-void
-ScVbaRange::setMergeCells( const uno::Any& aIsMerged ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Bool bIsMerged = sal_False;
- aIsMerged >>= bIsMerged;
- uno::Reference< util::XMergeable > xMerge( mxRange, ::uno::UNO_QUERY_THROW );
- //FIXME need to check whether all the cell contents are retained or lost by popping up a dialog
- xMerge->merge( bIsMerged );
-}
-
-uno::Any
-ScVbaRange::getMergeCells() throw (script::BasicErrorException, uno::RuntimeException)
-{
- sal_Int32 nItems = m_Areas->getCount();
-
- if ( nItems > 1 )
- {
- uno::Any aResult = aNULL();
- for ( sal_Int32 index=1; index != nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- if ( index > 1 )
- if ( aResult != xRange->getMergeCells() )
- return aNULL();
- aResult = xRange->getMergeCells();
- if ( aNULL() == aResult )
- return aNULL();
- }
- return aResult;
-
- }
- uno::Reference< util::XMergeable > xMerge( mxRange, ::uno::UNO_QUERY_THROW );
- return uno::makeAny( xMerge->getIsMerged() );
-}
-
-void
-ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("That command cannot be used on multiple selections" ) ), uno::Reference< uno::XInterface >() );
- if ( Destination.hasValue() )
- {
- uno::Reference< excel::XRange > xRange( Destination, uno::UNO_QUERY_THROW );
- uno::Any aRange = xRange->getCellRange();
- uno::Reference< table::XCellRange > xCellRange;
- aRange >>= xCellRange;
- uno::Reference< sheet::XSheetCellRange > xSheetCellRange(xCellRange, ::uno::UNO_QUERY_THROW);
- uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet();
- uno::Reference< table::XCellRange > xDest( xSheet, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCellRangeMovement > xMover( xSheet, uno::UNO_QUERY_THROW);
- uno::Reference< sheet::XCellAddressable > xDestination( xDest->getCellByPosition(
- xRange->getColumn()-1,xRange->getRow()-1), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY);
- xMover->copyRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
- }
- else
- {
- Select();
- implnCopy();
- }
-}
-
-void
-ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("That command cannot be used on multiple selections" ) ), uno::Reference< uno::XInterface >() );
- if (Destination.hasValue())
- {
- uno::Reference< excel::XRange > xRange( Destination, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xCellRange( xRange->getCellRange(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSheetCellRange > xSheetCellRange(xCellRange, ::uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet();
- uno::Reference< table::XCellRange > xDest( xSheet, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCellRangeMovement > xMover( xSheet, uno::UNO_QUERY_THROW);
- uno::Reference< sheet::XCellAddressable > xDestination( xDest->getCellByPosition(
- xRange->getColumn()-1,xRange->getRow()-1), uno::UNO_QUERY);
- uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY);
- xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
- }
- {
- Select();
- implnCut();
- }
-}
-
-void
-ScVbaRange::setNumberFormat( const uno::Any& aFormat ) throw ( script::BasicErrorException, uno::RuntimeException)
-{
- rtl::OUString sFormat;
- aFormat >>= sFormat;
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->setNumberFormat( aFormat );
- }
- return;
- }
- NumFormatHelper numFormat( mxRange );
- numFormat.setNumberFormat( sFormat );
-}
-
-uno::Any
-ScVbaRange::getNumberFormat() throw ( script::BasicErrorException, uno::RuntimeException)
-{
-
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- uno::Any aResult = aNULL();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- // if the numberformat of one area is different to another
- // return null
- if ( index > 1 )
- if ( aResult != xRange->getNumberFormat() )
- return aNULL();
- aResult = xRange->getNumberFormat();
- if ( aNULL() == aResult )
- return aNULL();
- }
- return aResult;
- }
- NumFormatHelper numFormat( mxRange );
- rtl::OUString sFormat = numFormat.getNumberFormatString();
- if ( sFormat.getLength() > 0 )
- return uno::makeAny( sFormat );
- return aNULL();
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::Resize( const uno::Any &RowSize, const uno::Any &ColumnSize ) throw (uno::RuntimeException)
-{
- long nRowSize = 0, nColumnSize = 0;
- sal_Bool bIsRowChanged = ( RowSize >>= nRowSize ), bIsColumnChanged = ( ColumnSize >>= nColumnSize );
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, ::uno::UNO_QUERY_THROW);
- uno::Reference< sheet::XSheetCellRange > xSheetRange(mxRange, ::uno::UNO_QUERY_THROW);
- uno::Reference< sheet::XSheetCellCursor > xCursor( xSheetRange->getSpreadsheet()->createCursorByRange(xSheetRange), ::uno::UNO_QUERY_THROW );
-
- if( !bIsRowChanged )
- nRowSize = xColumnRowRange->getRows()->getCount();
- if( !bIsColumnChanged )
- nColumnSize = xColumnRowRange->getColumns()->getCount();
-
- xCursor->collapseToSize( nColumnSize, nRowSize );
- uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xCursor, ::uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xSheetRange->getSpreadsheet(), ::uno::UNO_QUERY_THROW );
- return new ScVbaRange( getParent(), mxContext,xRange->getCellRangeByPosition(
- xCellRangeAddressable->getRangeAddress().StartColumn,
- xCellRangeAddressable->getRangeAddress().StartRow,
- xCellRangeAddressable->getRangeAddress().EndColumn,
- xCellRangeAddressable->getRangeAddress().EndRow ) );
-}
-
-void
-ScVbaRange::setWrapText( const uno::Any& aIsWrapped ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- uno::Any aResult;
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->setWrapText( aIsWrapped );
- }
- return;
- }
-
- uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY_THROW );
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTextWrapped" ) ), aIsWrapped );
-}
-
-uno::Any
-ScVbaRange::getWrapText() throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- uno::Any aResult;
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- if ( index > 1 )
- if ( aResult != xRange->getWrapText() )
- return aNULL();
- aResult = xRange->getWrapText();
- }
- return aResult;
- }
-
- SfxItemSet* pDataSet = getCurrentDataSet();
-
- SfxItemState eState = pDataSet->GetItemState( ATTR_LINEBREAK, TRUE, NULL);
- if ( eState == SFX_ITEM_DONTCARE )
- return aNULL();
-
- uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY_THROW );
- uno::Any aValue = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTextWrapped" ) ) );
- return aValue;
-}
-
-uno::Reference< excel::XInterior > ScVbaRange::Interior( ) throw ( script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( mxRange, uno::UNO_QUERY_THROW );
- return new ScVbaInterior ( this, mxContext, xProps, getScDocument() );
-}
-uno::Reference< excel::XRange >
-ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2 ) throw (uno::RuntimeException)
-{
- return Range( Cell1, Cell2, false );
-}
-uno::Reference< excel::XRange >
-ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2, bool bForceUseInpuRangeTab ) throw (uno::RuntimeException)
-
-{
- uno::Reference< table::XCellRange > xCellRange = mxRange;
-
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- xCellRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- }
- else
- xCellRange.set( mxRange );
-
- RangeHelper thisRange( xCellRange );
- uno::Reference< table::XCellRange > xRanges = thisRange.getCellRangeFromSheet();
- uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRanges, uno::UNO_QUERY_THROW );
-
- uno::Reference< table::XCellRange > xReferrer =
- xRanges->getCellRangeByPosition( getColumn()-1, getRow()-1,
- xAddressable->getRangeAddress().EndColumn,
- xAddressable->getRangeAddress().EndRow );
- // xAddressable now for this range
- xAddressable.set( xReferrer, uno::UNO_QUERY_THROW );
-
-
- if( !Cell1.hasValue() )
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Invalid Argument " ) ),
- uno::Reference< XInterface >() );
-
- table::CellRangeAddress resultAddress;
- table::CellRangeAddress parentRangeAddress = xAddressable->getRangeAddress();
-
- ScRange aRange;
- // Cell1 defined only
- if ( !Cell2.hasValue() )
- {
- rtl::OUString sName;
- Cell1 >>= sName;
- RangeHelper referRange( xReferrer );
- table::CellRangeAddress referAddress = referRange.getCellRangeAddressable()->getRangeAddress();
- return getRangeForName( mxContext, sName, getScDocShell(), referAddress );
-
- }
- else
- {
- table::CellRangeAddress cell1, cell2;
- cell1 = getCellRangeAddressForVBARange( Cell1, getScDocShell() );
- // Cell1 & Cell2 defined
- // Excel seems to combine the range as the range defined by
- // the combination of Cell1 & Cell2
-
- cell2 = getCellRangeAddressForVBARange( Cell2, getScDocShell() );
-
- resultAddress.StartColumn = ( cell1.StartColumn < cell2.StartColumn ) ? cell1.StartColumn : cell2.StartColumn;
- resultAddress.StartRow = ( cell1.StartRow < cell2.StartRow ) ? cell1.StartRow : cell2.StartRow;
- resultAddress.EndColumn = ( cell1.EndColumn > cell2.EndColumn ) ? cell1.EndColumn : cell2.EndColumn;
- resultAddress.EndRow = ( cell1.EndRow > cell2.EndRow ) ? cell1.EndRow : cell2.EndRow;
- if ( bForceUseInpuRangeTab )
- {
- // this is a call from Application.Range( x,y )
- // its possiblefor x or y to specify a different sheet from
- // the current or active on ( but they must be the same )
- if ( cell1.Sheet != cell2.Sheet )
- throw uno::RuntimeException();
- parentRangeAddress.Sheet = cell1.Sheet;
- }
- else
- {
- // this is not a call from Application.Range( x,y )
- // if a different sheet from this range is specified it's
- // an error
- if ( parentRangeAddress.Sheet != cell1.Sheet
- || parentRangeAddress.Sheet != cell2.Sheet
- )
- throw uno::RuntimeException();
-
- }
- ScUnoConversion::FillScRange( aRange, resultAddress );
- }
- ScRange parentAddress;
- ScUnoConversion::FillScRange( parentAddress, parentRangeAddress);
- if ( aRange.aStart.Col() >= 0 && aRange.aStart.Row() >= 0 && aRange.aEnd.Col() >= 0 && aRange.aEnd.Row() >= 0 )
- {
- sal_Int32 nStartX = parentAddress.aStart.Col() + aRange.aStart.Col();
- sal_Int32 nStartY = parentAddress.aStart.Row() + aRange.aStart.Row();
- sal_Int32 nEndX = parentAddress.aStart.Col() + aRange.aEnd.Col();
- sal_Int32 nEndY = parentAddress.aStart.Row() + aRange.aEnd.Row();
-
- if ( nStartX <= nEndX && nEndX <= parentAddress.aEnd.Col() &&
- nStartY <= nEndY && nEndY <= parentAddress.aEnd.Row() )
- {
- ScRange aNew( (SCCOL)nStartX, (SCROW)nStartY, parentAddress.aStart.Tab(),
- (SCCOL)nEndX, (SCROW)nEndY, parentAddress.aEnd.Tab() );
- xCellRange = new ScCellRangeObj( getScDocShell(), aNew );
- }
- }
-
- return new ScVbaRange( getParent(), mxContext, xCellRange );
-
-}
-
-// Allow access to underlying openoffice uno api ( useful for debugging
-// with openoffice basic )
-::com::sun::star::uno::Any SAL_CALL
-ScVbaRange::getCellRange( ) throw (::com::sun::star::uno::RuntimeException)
-{
- uno::Any aAny;
- if ( mxRanges.is() )
- aAny <<= mxRanges;
- else if ( mxRange.is() )
- aAny <<= mxRange;
- return aAny;
-}
-
-static USHORT
-getPasteFlags (sal_Int32 Paste)
-{
- USHORT nFlags = IDF_NONE;
- switch (Paste) {
- case excel::XlPasteType::xlPasteComments:
- nFlags = IDF_NOTE;break;
- case excel::XlPasteType::xlPasteFormats:
- nFlags = IDF_ATTRIB;break;
- case excel::XlPasteType::xlPasteFormulas:
- nFlags = IDF_FORMULA;break;
- case excel::XlPasteType::xlPasteFormulasAndNumberFormats :
- case excel::XlPasteType::xlPasteValues:
-#ifdef VBA_OOBUILD_HACK
- nFlags = ( IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_SPECIAL_BOOLEAN ); break;
-#else
- nFlags = ( IDF_VALUE | IDF_DATETIME | IDF_STRING ); break;
-#endif
- case excel::XlPasteType::xlPasteValuesAndNumberFormats:
- nFlags = IDF_VALUE | IDF_ATTRIB; break;
- case excel::XlPasteType::xlPasteColumnWidths:
- case excel::XlPasteType::xlPasteValidation:
- nFlags = IDF_NONE;break;
- case excel::XlPasteType::xlPasteAll:
- case excel::XlPasteType::xlPasteAllExceptBorders:
- default:
- nFlags = IDF_ALL;break;
- };
-return nFlags;
-}
-
-static USHORT
-getPasteFormulaBits( sal_Int32 Operation)
-{
- USHORT nFormulaBits = PASTE_NOFUNC ;
- switch (Operation)
- {
- case excel::XlPasteSpecialOperation::xlPasteSpecialOperationAdd:
- nFormulaBits = PASTE_ADD;break;
- case excel::XlPasteSpecialOperation::xlPasteSpecialOperationSubtract:
- nFormulaBits = PASTE_SUB;break;
- case excel::XlPasteSpecialOperation::xlPasteSpecialOperationMultiply:
- nFormulaBits = PASTE_MUL;break;
- case excel::XlPasteSpecialOperation::xlPasteSpecialOperationDivide:
- nFormulaBits = PASTE_DIV;break;
-
- case excel::XlPasteSpecialOperation::xlPasteSpecialOperationNone:
- default:
- nFormulaBits = PASTE_NOFUNC; break;
- };
-
-return nFormulaBits;
-}
-void SAL_CALL
-ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, const uno::Any& SkipBlanks, const uno::Any& Transpose ) throw (::com::sun::star::uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("That command cannot be used on multiple selections" ) ), uno::Reference< uno::XInterface >() );
- uno::Reference< view::XSelectionSupplier > xSelection( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
- // save old selection
- uno::Reference< uno::XInterface > xSel( getCurrentDocument()->getCurrentSelection() );
- // select this range
- xSelection->select( uno::makeAny( mxRange ) );
- // set up defaults
- sal_Int32 nPaste = excel::XlPasteType::xlPasteAll;
- sal_Int32 nOperation = excel::XlPasteSpecialOperation::xlPasteSpecialOperationNone;
- sal_Bool bTranspose = sal_False;
- sal_Bool bSkipBlanks = sal_False;
-
- if ( Paste.hasValue() )
- Paste >>= nPaste;
- if ( Operation.hasValue() )
- Operation >>= nOperation;
- if ( SkipBlanks.hasValue() )
- SkipBlanks >>= bSkipBlanks;
- if ( Transpose.hasValue() )
- Transpose >>= bTranspose;
-
- USHORT nFlags = getPasteFlags(nPaste);
- USHORT nFormulaBits = getPasteFormulaBits(nOperation);
- implnPasteSpecial(nFlags,nFormulaBits,bSkipBlanks,bTranspose);
- // restore selection
- xSelection->select( uno::makeAny( xSel ) );
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::getEntireColumnOrRow( bool bColumn ) throw (uno::RuntimeException)
-{
- ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
- // copy the range list
- ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
-
- for ( ScRange* pRange = aCellRanges.First() ; pRange; pRange = aCellRanges.Next() )
- {
- if ( bColumn )
- {
- pRange->aStart.SetRow( 0 );
- pRange->aEnd.SetRow( MAXROW );
- }
- else
- {
- pRange->aStart.SetCol( 0 );
- pRange->aEnd.SetCol( MAXCOL );
- }
- }
- if ( aCellRanges.Count() > 1 ) // Multi-Area
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pUnoRangesBase->GetDocShell(), aCellRanges ) );
-
- return new ScVbaRange( getParent(), mxContext, xRanges, !bColumn, bColumn );
- }
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), *aCellRanges.First() ) );
- return new ScVbaRange( getParent(), mxContext, xRange, !bColumn, bColumn );
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaRange::getEntireRow() throw (uno::RuntimeException)
-{
- return getEntireColumnOrRow(false);
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaRange::getEntireColumn() throw (uno::RuntimeException)
-{
- return getEntireColumnOrRow();
-}
-
-uno::Reference< excel::XComment > SAL_CALL
-ScVbaRange::AddComment( const uno::Any& Text ) throw (uno::RuntimeException)
-{
-
- uno::Reference< excel::XComment > xComment( new ScVbaComment( this, mxContext, mxRange ) );
- // if you don't pass a valid text or if there is already a comment
- // associated with the range then return NULL
- if ( !xComment->Text( Text, uno::Any(), uno::Any() ).getLength()
- || xComment->Text( uno::Any(), uno::Any(), uno::Any() ).getLength() )
- return NULL;
- return xComment;
-}
-
-uno::Reference< excel::XComment > SAL_CALL
-ScVbaRange::getComment() throw (uno::RuntimeException)
-{
- // intentional behavior to return a null object if no
- // comment defined
- uno::Reference< excel::XComment > xComment( new ScVbaComment( this, mxContext, mxRange ) );
- if ( !xComment->Text( uno::Any(), uno::Any(), uno::Any() ).getLength() )
- return NULL;
- return xComment;
-
-}
-
-uno::Reference< beans::XPropertySet >
-getRowOrColumnProps( const uno::Reference< table::XCellRange >& xCellRange, bool bRows ) throw ( uno::RuntimeException )
-{
- uno::Reference< table::XColumnRowRange > xColRow( xCellRange, uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps;
- if ( bRows )
- xProps.set( xColRow->getRows(), uno::UNO_QUERY_THROW );
- else
- xProps.set( xColRow->getColumns(), uno::UNO_QUERY_THROW );
- return xProps;
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getHidden() throw (uno::RuntimeException)
-{
- // if multi-area result is the result of the
- // first area
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(sal_Int32(1)), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange->getHidden();
- }
- bool bIsVisible = false;
- try
- {
- uno::Reference< beans::XPropertySet > xProps = getRowOrColumnProps( mxRange, mbIsRows );
- if ( !( xProps->getPropertyValue( ISVISIBLE ) >>= bIsVisible ) )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to get IsVisible property")), uno::Reference< uno::XInterface >() );
- }
- catch( uno::Exception& e )
- {
- throw uno::RuntimeException( e.Message, uno::Reference< uno::XInterface >() );
- }
- return uno::makeAny( !bIsVisible );
-}
-
-void SAL_CALL
-ScVbaRange::setHidden( const uno::Any& _hidden ) throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->setHidden( _hidden );
- }
- return;
- }
-
- sal_Bool bHidden = sal_False;
- _hidden >>= bHidden;
-
- try
- {
- uno::Reference< beans::XPropertySet > xProps = getRowOrColumnProps( mxRange, mbIsRows );
- xProps->setPropertyValue( ISVISIBLE, uno::makeAny( !bHidden ) );
- }
- catch( uno::Exception& e )
- {
- throw uno::RuntimeException( e.Message, uno::Reference< uno::XInterface >() );
- }
-}
-
-rtl::OUString lcl_replaceAll( const rtl::OUString& rString, rtl::OUString sWhat, rtl::OUString sWith )
-{
- rtl::OUString sString( rString );
- sal_Int32 offset = 0;
- sal_Int32 nWithLen = sWith.getLength();
- while ((offset = sString.indexOf(sWhat )) >= 0)
- {
- sString = sString.replaceAt(offset, nWithLen, sWith);
- offset += nWithLen;
- }
- return sString;
-}
-
-::sal_Bool SAL_CALL
-ScVbaRange::Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replacement, const uno::Any& LookAt, const uno::Any& SearchOrder, const uno::Any& MatchCase, const uno::Any& MatchByte, const uno::Any& SearchFormat, const uno::Any& ReplaceFormat ) throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- for ( sal_Int32 index = 1; index <= m_Areas->getCount(); ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->Replace( What, Replacement, LookAt, SearchOrder, MatchCase, MatchByte, SearchFormat, ReplaceFormat );
- }
- return sal_True; // seems to return true always ( or at least I haven't found the trick of
- }
-
- // sanity check required params
- if ( !What.getLength() /*|| !Replacement.getLength()*/ )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, missing params" )) , uno::Reference< uno::XInterface >() );
- rtl::OUString sWhat = VBAToRegexp( What);
- // #TODO #FIXME SearchFormat & ReplacesFormat are not processed
- // What do we do about MatchByte.. we don't seem to support that
- const SvxSearchItem& globalSearchOptions = ScGlobal::GetSearchItem();
- SvxSearchItem newOptions( globalSearchOptions );
-
- sal_Int16 nLook = globalSearchOptions.GetWordOnly() ? excel::XlLookAt::xlPart : excel::XlLookAt::xlWhole;
- sal_Int16 nSearchOrder = globalSearchOptions.GetRowDirection() ? excel::XlSearchOrder::xlByRows : excel::XlSearchOrder::xlByColumns;
-
- sal_Bool bMatchCase = sal_False;
- uno::Reference< util::XReplaceable > xReplace( mxRange, uno::UNO_QUERY );
- if ( xReplace.is() )
- {
- uno::Reference< util::XReplaceDescriptor > xDescriptor =
- xReplace->createReplaceDescriptor();
-
- xDescriptor->setSearchString( sWhat);
- xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHREGEXP ) ), uno::makeAny( sal_True ) );
- xDescriptor->setReplaceString( Replacement);
- if ( LookAt.hasValue() )
- {
- // sets SearchWords ( true is Cell match )
- nLook = ::comphelper::getINT16( LookAt );
- sal_Bool bSearchWords = sal_False;
- if ( nLook == excel::XlLookAt::xlPart )
- bSearchWords = sal_False;
- else if ( nLook == excel::XlLookAt::xlWhole )
- bSearchWords = sal_True;
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for LookAt" )) , uno::Reference< uno::XInterface >() );
- // set global search props ( affects the find dialog
- // and of course the defaults for this method
- newOptions.SetWordOnly( bSearchWords );
- xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHWORDS ) ), uno::makeAny( bSearchWords ) );
- }
- // sets SearchByRow ( true for Rows )
- if ( SearchOrder.hasValue() )
- {
- nSearchOrder = ::comphelper::getINT16( SearchOrder );
- sal_Bool bSearchByRow = sal_False;
- if ( nSearchOrder == excel::XlSearchOrder::xlByColumns )
- bSearchByRow = sal_False;
- else if ( nSearchOrder == excel::XlSearchOrder::xlByRows )
- bSearchByRow = sal_True;
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for SearchOrder" )) , uno::Reference< uno::XInterface >() );
-
- newOptions.SetRowDirection( bSearchByRow );
- xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHBYROW ) ), uno::makeAny( bSearchByRow ) );
- }
- if ( MatchCase.hasValue() )
- {
- // SearchCaseSensitive
- MatchCase >>= bMatchCase;
- xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHCASE ) ), uno::makeAny( bMatchCase ) );
- }
-
- ScGlobal::SetSearchItem( newOptions );
- // ignore MatchByte for the moment, its not supported in
- // OOo.org afaik
-
- uno::Reference< util::XSearchDescriptor > xSearch( xDescriptor, uno::UNO_QUERY );
- xReplace->replaceAll( xSearch );
- }
- return sal_True; // always
-}
-
-uno::Reference< table::XCellRange > processKey( const uno::Any& Key, uno::Reference< uno::XComponentContext >& xContext, ScDocShell* pDocSh )
-{
- uno::Reference< excel::XRange > xKeyRange;
- if ( Key.getValueType() == excel::XRange::static_type() )
- {
- xKeyRange.set( Key, uno::UNO_QUERY_THROW );
- }
- else if ( Key.getValueType() == ::getCppuType( static_cast< const rtl::OUString* >(0) ) )
-
- {
- rtl::OUString sRangeName = ::comphelper::getString( Key );
- table::CellRangeAddress aRefAddr;
- if ( !pDocSh )
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Range::Sort no docshell to calculate key param")), uno::Reference< uno::XInterface >() );
- xKeyRange = getRangeForName( xContext, sRangeName, pDocSh, aRefAddr );
- }
- else
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Range::Sort illegal type value for key param")), uno::Reference< uno::XInterface >() );
- uno::Reference< table::XCellRange > xKey;
- xKey.set( xKeyRange->getCellRange(), uno::UNO_QUERY_THROW );
- return xKey;
-}
-
-// helper method for Sort
-sal_Int32 findSortPropertyIndex( const uno::Sequence< beans::PropertyValue >& props,
-const rtl::OUString& sPropName ) throw( uno::RuntimeException )
-{
- const beans::PropertyValue* pProp = props.getConstArray();
- sal_Int32 nItems = props.getLength();
-
- sal_Int32 count=0;
- for ( ; count < nItems; ++count, ++pProp )
- if ( pProp->Name.equals( sPropName ) )
- return count;
- if ( count == nItems )
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Range::Sort unknown sort property")), uno::Reference< uno::XInterface >() );
- return -1; //should never reach here ( satisfy compiler )
-}
-
-// helper method for Sort
-void updateTableSortField( const uno::Reference< table::XCellRange >& xParentRange,
- const uno::Reference< table::XCellRange >& xColRowKey, sal_Int16 nOrder,
- table::TableSortField& aTableField, sal_Bool bIsSortColumn, sal_Bool bMatchCase ) throw ( uno::RuntimeException )
-{
- RangeHelper parentRange( xParentRange );
- RangeHelper colRowRange( xColRowKey );
-
- table::CellRangeAddress parentRangeAddress = parentRange.getCellRangeAddressable()->getRangeAddress();
-
- table::CellRangeAddress colRowKeyAddress = colRowRange.getCellRangeAddressable()->getRangeAddress();
-
- // make sure that upper left poing of key range is within the
- // parent range
- if ( colRowKeyAddress.StartColumn >= parentRangeAddress.StartColumn &&
- colRowKeyAddress.StartColumn <= parentRangeAddress.EndColumn &&
- colRowKeyAddress.StartRow >= parentRangeAddress.StartRow &&
- colRowKeyAddress.StartRow <= parentRangeAddress.EndRow )
- {
- //determine col/row index
- if ( bIsSortColumn )
- aTableField.Field = colRowKeyAddress.StartRow - parentRangeAddress.StartRow;
- else
- aTableField.Field = colRowKeyAddress.StartColumn - parentRangeAddress.StartColumn;
- aTableField.IsCaseSensitive = bMatchCase;
-
- if ( nOrder == excel::XlSortOrder::xlAscending )
- aTableField.IsAscending = sal_True;
- else
- aTableField.IsAscending = sal_False;
- }
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal Key param" ) ), uno::Reference< uno::XInterface >() );
-
-
-}
-
-void SAL_CALL
-ScVbaRange::Sort( const uno::Any& Key1, const uno::Any& Order1, const uno::Any& Key2, const uno::Any& /*Type*/, const uno::Any& Order2, const uno::Any& Key3, const uno::Any& Order3, const uno::Any& Header, const uno::Any& OrderCustom, const uno::Any& MatchCase, const uno::Any& Orientation, const uno::Any& SortMethod, const uno::Any& DataOption1, const uno::Any& DataOption2, const uno::Any& DataOption3 ) throw (uno::RuntimeException)
-{
- // #TODO# #FIXME# can we do something with Type
- if ( m_Areas->getCount() > 1 )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("That command cannot be used on multiple selections" ) ), uno::Reference< uno::XInterface >() );
-
- sal_Int16 nDataOption1 = excel::XlSortDataOption::xlSortNormal;
- sal_Int16 nDataOption2 = excel::XlSortDataOption::xlSortNormal;;
- sal_Int16 nDataOption3 = excel::XlSortDataOption::xlSortNormal;
-
- ScDocument* pDoc = getScDocument();
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
-
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- ScSortParam aSortParam;
- SCTAB nTab = thisRangeAddress.Sheet;
- pDoc->GetSortParam( aSortParam, nTab );
-
- if ( DataOption1.hasValue() )
- DataOption1 >>= nDataOption1;
- if ( DataOption2.hasValue() )
- DataOption2 >>= nDataOption2;
- if ( DataOption3.hasValue() )
- DataOption3 >>= nDataOption3;
-
- // 1) #TODO #FIXME need to process DataOption[1..3] not used currently
- // 2) #TODO #FIXME need to refactor this ( below ) into a IsSingleCell() method
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW );
-
- // 'Fraid I don't remember what I was trying to achieve here ???
-/*
- if ( isSingleCellRange() )
- {
- uno::Reference< vba::XRange > xCurrent = CurrentRegion();
- xCurrent->Sort( Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2, DataOption3 );
- return;
- }
-*/
- // set up defaults
-
- sal_Int16 nOrder1 = aSortParam.bAscending[0] ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending;
- sal_Int16 nOrder2 = aSortParam.bAscending[1] ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending;
- sal_Int16 nOrder3 = aSortParam.bAscending[2] ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending;
-
- sal_Int16 nCustom = aSortParam.nUserIndex;
- sal_Int16 nSortMethod = excel::XlSortMethod::xlPinYin;
- sal_Bool bMatchCase = aSortParam.bCaseSens;
-
- // seems to work opposite to expected, see below
- sal_Int16 nOrientation = aSortParam.bByRow ? excel::XlSortOrientation::xlSortColumns : excel::XlSortOrientation::xlSortRows;
-
- if ( Orientation.hasValue() )
- {
- // Documentation says xlSortRows is default but that doesn't appear to be
- // the case. Also it appears that xlSortColumns is the default which
- // strangely enought sorts by Row
- nOrientation = ::comphelper::getINT16( Orientation );
- // persist new option to be next calls default
- if ( nOrientation == excel::XlSortOrientation::xlSortRows )
- aSortParam.bByRow = FALSE;
- else
- aSortParam.bByRow = TRUE;
-
- }
-
- sal_Bool bIsSortColumns=sal_False; // sort by row
-
- if ( nOrientation == excel::XlSortOrientation::xlSortRows )
- bIsSortColumns = sal_True;
- sal_Int16 nHeader = 0;
-#ifdef VBA_OOBUILD_HACK
- nHeader = aSortParam.nCompatHeader;
-#endif
- sal_Bool bContainsHeader = sal_False;
-
- if ( Header.hasValue() )
- {
- nHeader = ::comphelper::getINT16( Header );
-#ifdef VBA_OOBUILD_HACK
- aSortParam.nCompatHeader = nHeader;
-#endif
- }
-
- if ( nHeader == excel::XlYesNoGuess::xlGuess )
- {
- bool bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), static_cast< SCCOL >( thisRangeAddress.EndColumn ), static_cast< SCROW >( thisRangeAddress.EndRow ), static_cast< SCTAB >( thisRangeAddress.Sheet ));
- bool bHasRowHeader = pDoc->HasRowHeader( static_cast< SCCOL >( thisRangeAddress.StartColumn ), static_cast< SCROW >( thisRangeAddress.StartRow ), static_cast< SCCOL >( thisRangeAddress.EndColumn ), static_cast< SCROW >( thisRangeAddress.EndRow ), static_cast< SCTAB >( thisRangeAddress.Sheet ) );
- if ( bHasColHeader || bHasRowHeader )
- nHeader = excel::XlYesNoGuess::xlYes;
- else
- nHeader = excel::XlYesNoGuess::xlNo;
-#ifdef VBA_OOBUILD_HACK
- aSortParam.nCompatHeader = nHeader;
-#endif
- }
-
- if ( nHeader == excel::XlYesNoGuess::xlYes )
- bContainsHeader = sal_True;
-
- if ( SortMethod.hasValue() )
- {
- nSortMethod = ::comphelper::getINT16( SortMethod );
- }
-
- if ( OrderCustom.hasValue() )
- {
- OrderCustom >>= nCustom;
- --nCustom; // 0-based in OOo
- aSortParam.nUserIndex = nCustom;
- }
-
- if ( MatchCase.hasValue() )
- {
- MatchCase >>= bMatchCase;
- aSortParam.bCaseSens = bMatchCase;
- }
-
- if ( Order1.hasValue() )
- {
- nOrder1 = ::comphelper::getINT16(Order1);
- if ( nOrder1 == excel::XlSortOrder::xlAscending )
- aSortParam.bAscending[0] = TRUE;
- else
- aSortParam.bAscending[0] = FALSE;
-
- }
- if ( Order2.hasValue() )
- {
- nOrder2 = ::comphelper::getINT16(Order2);
- if ( nOrder2 == excel::XlSortOrder::xlAscending )
- aSortParam.bAscending[1] = TRUE;
- else
- aSortParam.bAscending[1] = FALSE;
- }
- if ( Order3.hasValue() )
- {
- nOrder3 = ::comphelper::getINT16(Order3);
- if ( nOrder3 == excel::XlSortOrder::xlAscending )
- aSortParam.bAscending[2] = TRUE;
- else
- aSortParam.bAscending[2] = FALSE;
- }
-
- uno::Reference< table::XCellRange > xKey1;
- uno::Reference< table::XCellRange > xKey2;
- uno::Reference< table::XCellRange > xKey3;
- ScDocShell* pDocShell = getScDocShell();
- xKey1 = processKey( Key1, mxContext, pDocShell );
- if ( !xKey1.is() )
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Range::Sort needs a key1 param")), uno::Reference< uno::XInterface >() );
-
- if ( Key2.hasValue() )
- xKey2 = processKey( Key2, mxContext, pDocShell );
- if ( Key3.hasValue() )
- xKey3 = processKey( Key3, mxContext, pDocShell );
-
- uno::Reference< util::XSortable > xSort( mxRange, uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > sortDescriptor = xSort->createSortDescriptor();
- sal_Int32 nTableSortFieldIndex = findSortPropertyIndex( sortDescriptor, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SortFields") ) );
-
- uno::Sequence< table::TableSortField > sTableFields(1);
- sal_Int32 nTableIndex = 0;
- updateTableSortField( mxRange, xKey1, nOrder1, sTableFields[ nTableIndex++ ], bIsSortColumns, bMatchCase );
-
- if ( xKey2.is() )
- {
- sTableFields.realloc( sTableFields.getLength() + 1 );
- updateTableSortField( mxRange, xKey2, nOrder2, sTableFields[ nTableIndex++ ], bIsSortColumns, bMatchCase );
- }
- if ( xKey3.is() )
- {
- sTableFields.realloc( sTableFields.getLength() + 1 );
- updateTableSortField( mxRange, xKey3, nOrder3, sTableFields[ nTableIndex++ ], bIsSortColumns, bMatchCase );
- }
- sortDescriptor[ nTableSortFieldIndex ].Value <<= sTableFields;
-
- sal_Int32 nIndex = findSortPropertyIndex( sortDescriptor, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSortColumns")) );
- sortDescriptor[ nIndex ].Value <<= bIsSortColumns;
-
- nIndex = findSortPropertyIndex( sortDescriptor, CONTS_HEADER );
- sortDescriptor[ nIndex ].Value <<= bContainsHeader;
-
- pDoc->SetSortParam( aSortParam, nTab );
- xSort->sort( sortDescriptor );
-
- // #FIXME #TODO
- // The SortMethod param is not processed ( not sure what its all about, need to
-
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_QUERY_THROW );
- return xRange->End( Direction );
- }
-
-
- // #FIXME #TODO
- // euch! found my orig implementation sucked, so
- // trying this even suckier one ( really need to use/expose code in
- // around ScTabView::MoveCursorArea(), thats the bit that calcutes
- // where the cursor should go )
- // Main problem with this method is the ultra hacky attempt to preserve
- // the ActiveCell, there should be no need to go to these extreems
-
- // Save ActiveCell pos ( to restore later )
- uno::Any aDft;
- rtl::OUString sActiveCell = ScVbaGlobals::getGlobalsImpl(
- mxContext )->getApplication()->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
-
- // position current cell upper left of this range
- Cells( uno::makeAny( (sal_Int32) 1 ), uno::makeAny( (sal_Int32) 1 ) )->Select();
-
- SfxViewFrame* pViewFrame = getCurrentViewFrame();
- if ( pViewFrame )
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
- // Hoping this will make sure this slot is called
- // synchronously
- SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
- aArgs.Put( sfxAsync, sfxAsync.Which() );
- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-
- USHORT nSID = 0;
-
- switch( Direction )
- {
- case excel::XlDirection::xlDown:
- nSID = SID_CURSORBLKDOWN;
- break;
- case excel::XlDirection::xlUp:
- nSID = SID_CURSORBLKUP;
- break;
- case excel::XlDirection::xlToLeft:
- nSID = SID_CURSORBLKLEFT;
- break;
- case excel::XlDirection::xlToRight:
- nSID = SID_CURSORBLKRIGHT;
- break;
- default:
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Invalid ColumnIndex" ) ), uno::Reference< uno::XInterface >() );
- }
- if ( pDispatcher )
- {
- pDispatcher->Execute( nSID, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
- }
- }
-
- // result is the ActiveCell
- rtl::OUString sMoved = ScVbaGlobals::getGlobalsImpl(
- mxContext )->getApplication()->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
-
- // restore old ActiveCell
- uno::Any aVoid;
- uno::Reference< excel::XRange > xOldActiveCell( ScVbaGlobals::getGlobalsImpl(
- mxContext )->getActiveSheet()->Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW );
- xOldActiveCell->Select();
-
- uno::Reference< excel::XRange > resultCell;
- resultCell.set( ScVbaGlobals::getGlobalsImpl(
- mxContext )->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW );
-
- // return result
-
- return resultCell;
-}
-
-bool
-ScVbaRange::isSingleCellRange()
-{
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY);
- if ( xColumnRowRange.is() && xColumnRowRange->getRows()->getCount() == 1 && xColumnRowRange->getColumns()->getCount() == 1 )
- return true;
- return false;
-}
-
-uno::Reference< excel::XCharacters > SAL_CALL
-ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (uno::RuntimeException)
-{
- if ( !isSingleCellRange() )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't create Characters property for multicell range ") ), uno::Reference< uno::XInterface >() );
- uno::Reference< text::XSimpleText > xSimple(mxRange->getCellByPosition(0,0) , uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocumentFromRange(mxRange);
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
-
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
- return new ScVbaCharacters( this, mxContext, aPalette, xSimple, Start, Length );
-}
-
- void SAL_CALL
-ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException)
-{
-
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->Delete( Shift );
- }
- return;
- }
- sheet::CellDeleteMode mode = sheet::CellDeleteMode_NONE ;
- if ( Shift.hasValue() )
- {
- sal_Int32 nShift = 0;
- Shift >>= nShift;
- switch ( nShift )
- {
- case excel::XlDeleteShiftDirection::xlShiftUp:
- mode = sheet::CellDeleteMode_UP;
- break;
- case excel::XlDeleteShiftDirection::xlShiftToLeft:
- mode = sheet::CellDeleteMode_LEFT;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("Illegal paramater ") ), uno::Reference< uno::XInterface >() );
- }
- }
- else
- if ( getRow() > getColumn() )
- mode = sheet::CellDeleteMode_UP;
- else
- mode = sheet::CellDeleteMode_LEFT;
- RangeHelper thisRange( mxRange );
- uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- xCellRangeMove->removeRange( thisRange.getCellRangeAddressable()->getRangeAddress(), mode );
-
-}
-
-//XElementAccess
-sal_Bool SAL_CALL
-ScVbaRange::hasElements() throw (uno::RuntimeException)
-{
- uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY );
- if ( xColumnRowRange.is() )
- if ( xColumnRowRange->getRows()->getCount() ||
- xColumnRowRange->getColumns()->getCount() )
- return sal_True;
- return sal_False;
-}
-
-// XEnumerationAccess
-uno::Reference< container::XEnumeration > SAL_CALL
-ScVbaRange::createEnumeration() throw (uno::RuntimeException)
-{
- return new CellsEnumeration( mxContext, m_Areas );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaRange::getDefaultMethodName( ) throw (uno::RuntimeException)
-{
- const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Cells") );
- return sName;
-}
-
-
-uno::Reference< awt::XDevice >
-getDeviceFromDoc( const uno::Reference< frame::XModel >& xModel ) throw( uno::RuntimeException )
-{
- uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XFrame> xFrame( xController->getFrame(), uno::UNO_QUERY_THROW );
- uno::Reference< awt::XDevice > xDevice( xFrame->getComponentWindow(), uno::UNO_QUERY_THROW );
- return xDevice;
-}
-
-// returns calc internal col. width ( in points )
-double
-ScVbaRange::getCalcColWidth( const table::CellRangeAddress& rAddress) throw (uno::RuntimeException)
-{
- ScDocument* pDoc = getScDocument();
- USHORT nWidth = pDoc->GetOriginalWidth( static_cast< SCCOL >( rAddress.StartColumn ), static_cast< SCTAB >( rAddress.Sheet ) );
- double nPoints = lcl_TwipsToPoints( nWidth );
- nPoints = lcl_Round2DecPlaces( nPoints );
- return nPoints;
-}
-
-double
-ScVbaRange::getCalcRowHeight( const table::CellRangeAddress& rAddress ) throw (uno::RuntimeException)
-{
- ScDocument* pDoc = getDocumentFromRange( mxRange );
- USHORT nWidth = pDoc->GetOriginalHeight( rAddress.StartRow, rAddress.Sheet );
- double nPoints = lcl_TwipsToPoints( nWidth );
- nPoints = lcl_Round2DecPlaces( nPoints );
- return nPoints;
-}
-
-// return Char Width in points
-double getDefaultCharWidth( const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException )
-{
- const static rtl::OUString sDflt( RTL_CONSTASCII_USTRINGPARAM("Default"));
- const static rtl::OUString sCharFontName( RTL_CONSTASCII_USTRINGPARAM("CharFontName"));
- const static rtl::OUString sPageStyles( RTL_CONSTASCII_USTRINGPARAM("PageStyles"));
- // get the font from the default style
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xNameAccess( xStyleSupplier->getStyleFamilies(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xNameAccess2( xNameAccess->getByName( sPageStyles ), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xNameAccess2->getByName( sDflt ), uno::UNO_QUERY_THROW );
- rtl::OUString sFontName;
- xProps->getPropertyValue( sCharFontName ) >>= sFontName;
-
- uno::Reference< awt::XDevice > xDevice = getDeviceFromDoc( xModel );
- awt::FontDescriptor aDesc;
- aDesc.Name = sFontName;
- uno::Reference< awt::XFont > xFont( xDevice->getFont( aDesc ), uno::UNO_QUERY_THROW );
- double nCharPixelWidth = xFont->getCharWidth( (sal_Int8)'0' );
-
- double nPixelsPerMeter = xDevice->getInfo().PixelPerMeterX;
- double nCharWidth = nCharPixelWidth / nPixelsPerMeter;
- nCharWidth = nCharWidth * (double)56700;// in twips
- return lcl_TwipsToPoints( (USHORT)nCharWidth );
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getColumnWidth() throw (uno::RuntimeException)
-{
- sal_Int32 nLen = m_Areas->getCount();
- if ( nLen > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(1) ), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange->getColumnWidth();
- }
-
- double nColWidth = 0;
- ScDocShell* pShell = getScDocShell();
- if ( pShell )
- {
- uno::Reference< frame::XModel > xModel = pShell->GetModel();
- double defaultCharWidth = getDefaultCharWidth( xModel );
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- sal_Int32 nStartCol = thisAddress.StartColumn;
- sal_Int32 nEndCol = thisAddress.EndColumn;
-
- for( sal_Int32 nCol = nStartCol ; nCol <= nEndCol; ++nCol )
- {
- thisAddress.StartColumn = nCol;
- double nCurWidth = getCalcColWidth(thisAddress);
- if ( nCol == nStartCol )
- nColWidth = nCurWidth;
- if ( nColWidth != nCurWidth )
- return aNULL();
- }
-
- if ( xModel.is() )
- nColWidth = nColWidth / defaultCharWidth;
- }
- nColWidth = lcl_Round2DecPlaces( nColWidth );
- return uno::makeAny( nColWidth );
-}
-
-void SAL_CALL
-ScVbaRange::setColumnWidth( const uno::Any& _columnwidth ) throw (uno::RuntimeException)
-{
- sal_Int32 nLen = m_Areas->getCount();
- if ( nLen > 1 )
- {
- for ( sal_Int32 index = 1; index != nLen; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(index) ), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->setColumnWidth( _columnwidth );
- }
- return;
- }
- double nColWidth = 0;
- _columnwidth >>= nColWidth;
- nColWidth = lcl_Round2DecPlaces( nColWidth );
- ScDocShell* pDocShell = getScDocShell();
- if ( pDocShell )
- {
- uno::Reference< frame::XModel > xModel = pDocShell->GetModel();
- if ( xModel.is() )
- {
-
- nColWidth = ( nColWidth * getDefaultCharWidth( xModel ) );
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- USHORT nTwips = lcl_pointsToTwips( nColWidth );
-
- ScDocFunc aFunc(*pDocShell);
- SCCOLROW nColArr[2];
- nColArr[0] = thisAddress.StartColumn;
- nColArr[1] = thisAddress.EndColumn;
- aFunc.SetWidthOrHeight( TRUE, 1, nColArr, thisAddress.Sheet, SC_SIZE_ORIGINAL,
- nTwips, TRUE, TRUE );
-
- }
- }
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getWidth() throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(1) ), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange->getWidth();
- }
- uno::Reference< table::XColumnRowRange > xColRowRange( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xColRowRange->getColumns(), uno::UNO_QUERY_THROW );
- sal_Int32 nElems = xIndexAccess->getCount();
- double nWidth = 0;
- for ( sal_Int32 index=0; index<nElems; ++index )
- {
- uno::Reference< sheet::XCellRangeAddressable > xAddressable( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
- double nTmpWidth = getCalcColWidth( xAddressable->getRangeAddress() );
- nWidth += nTmpWidth;
- }
- return uno::makeAny( nWidth );
-}
-
-uno::Any SAL_CALL
-ScVbaRange::Areas( const uno::Any& item) throw (uno::RuntimeException)
-{
- if ( !item.hasValue() )
- return uno::makeAny( m_Areas );
- return m_Areas->Item( item, uno::Any() );
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::getArea( sal_Int32 nIndex ) throw( css::uno::RuntimeException )
-{
- if ( !m_Areas.is() )
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No areas available")), uno::Reference< uno::XInterface >() );
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( ++nIndex ), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange;
-}
-
-uno::Any
-ScVbaRange::Borders( const uno::Any& item ) throw( script::BasicErrorException, uno::RuntimeException )
-{
- if ( !item.hasValue() )
- return uno::makeAny( getBorders() );
- return getBorders()->Item( item, uno::Any() );
-}
-
-uno::Any SAL_CALL
-ScVbaRange::BorderAround( const css::uno::Any& LineStyle, const css::uno::Any& Weight,
- const css::uno::Any& ColorIndex, const css::uno::Any& Color ) throw (css::uno::RuntimeException)
-{
- sal_Int32 nCount = getBorders()->getCount();
-
- for( sal_Int32 i = 0; i < nCount; i++ )
- {
- const sal_Int32 nLineType = supportedIndexTable[i];
- switch( nLineType )
- {
- case excel::XlBordersIndex::xlEdgeLeft:
- case excel::XlBordersIndex::xlEdgeTop:
- case excel::XlBordersIndex::xlEdgeBottom:
- case excel::XlBordersIndex::xlEdgeRight:
- {
- uno::Reference< excel::XBorder > xBorder( m_Borders->Item( uno::makeAny( nLineType ), uno::Any() ), uno::UNO_QUERY_THROW );
- if( LineStyle.hasValue() )
- {
- xBorder->setLineStyle( LineStyle );
- }
- if( Weight.hasValue() )
- {
- xBorder->setWeight( Weight );
- }
- if( ColorIndex.hasValue() )
- {
- xBorder->setColorIndex( ColorIndex );
- }
- if( Color.hasValue() )
- {
- xBorder->setColor( Color );
- }
- break;
- }
- case excel::XlBordersIndex::xlInsideVertical:
- case excel::XlBordersIndex::xlInsideHorizontal:
- case excel::XlBordersIndex::xlDiagonalDown:
- case excel::XlBordersIndex::xlDiagonalUp:
- break;
- default:
- return uno::makeAny( sal_False );
- }
- }
- return uno::makeAny( sal_True );
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getRowHeight() throw (uno::RuntimeException)
-{
- sal_Int32 nLen = m_Areas->getCount();
- if ( nLen > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(1) ), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange->getRowHeight();
- }
-
- // if this range is a 'Rows' range, then if any row's RowHeight in the
- // range is different from any other then return NULL
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
-
- sal_Int32 nStartRow = thisAddress.StartRow;
- sal_Int32 nEndRow = thisAddress.EndRow;
- double nHeight = getCalcRowHeight( thisAddress );
- // #TODO probably possible to use the SfxItemSet ( and see if
- // SFX_ITEM_DONTCARE is set ) to improve performance
- if ( mbIsRows )
- {
- for ( sal_Int32 nRow = nStartRow ; nRow <= nEndRow; ++nRow )
- {
- thisAddress.StartRow = nRow;
- double nCurHeight = getCalcRowHeight( thisAddress );
- if ( nHeight != nCurHeight )
- return aNULL();
- }
- }
- return uno::makeAny( nHeight );
-}
-
-void SAL_CALL
-ScVbaRange::setRowHeight( const uno::Any& _rowheight) throw (uno::RuntimeException)
-{
- sal_Int32 nLen = m_Areas->getCount();
- if ( nLen > 1 )
- {
- for ( sal_Int32 index = 1; index != nLen; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(index) ), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->setRowHeight( _rowheight );
- }
- return;
- }
- double nHeight = 0; // Incomming height is in points
- _rowheight >>= nHeight;
- nHeight = lcl_Round2DecPlaces( nHeight );
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- USHORT nTwips = lcl_pointsToTwips( nHeight );
-
- ScDocShell* pDocShell = getDocShellFromRange( mxRange );
- ScDocFunc aFunc(*pDocShell);
- SCCOLROW nRowArr[2];
- nRowArr[0] = thisAddress.StartRow;
- nRowArr[1] = thisAddress.EndRow;
- aFunc.SetWidthOrHeight( FALSE, 1, nRowArr, thisAddress.Sheet, SC_SIZE_ORIGINAL,
- nTwips, TRUE, TRUE );
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getPageBreak() throw (uno::RuntimeException)
-{
- sal_Int32 nPageBreak = excel::XlPageBreak::xlPageBreakNone;
- ScDocShell* pShell = getDocShellFromRange( mxRange );
- if ( pShell )
- {
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- BOOL bColumn = FALSE;
-
- if (thisAddress.StartRow==0)
- bColumn = TRUE;
-
- uno::Reference< frame::XModel > xModel = pShell->GetModel();
- if ( xModel.is() )
- {
- ScDocument* pDoc = getDocumentFromRange( mxRange );
-
- BYTE nFlag = 0;
- if ( !bColumn )
- nFlag = pDoc -> GetRowFlags(thisAddress.StartRow, thisAddress.Sheet);
- else
- nFlag = pDoc -> GetColFlags(static_cast<SCCOL>(thisAddress.StartColumn), thisAddress.Sheet);
-
- if ( nFlag & CR_PAGEBREAK)
- nPageBreak = excel::XlPageBreak::xlPageBreakAutomatic;
-
- if ( nFlag & CR_MANUALBREAK)
- nPageBreak = excel::XlPageBreak::xlPageBreakManual;
- }
- }
-
- return uno::makeAny( nPageBreak );
-}
-
-void SAL_CALL
-ScVbaRange::setPageBreak( const uno::Any& _pagebreak) throw (uno::RuntimeException)
-{
- sal_Int32 nPageBreak = 0;
- _pagebreak >>= nPageBreak;
-
- ScDocShell* pShell = getDocShellFromRange( mxRange );
- if ( pShell )
- {
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- if ((thisAddress.StartColumn==0) && (thisAddress.StartRow==0))
- return;
- BOOL bColumn = FALSE;
-
- if (thisAddress.StartRow==0)
- bColumn = TRUE;
-
- ScAddress aAddr( static_cast<SCCOL>(thisAddress.StartColumn), thisAddress.StartRow, thisAddress.Sheet );
- uno::Reference< frame::XModel > xModel = pShell->GetModel();
- if ( xModel.is() )
- {
- ScTabViewShell* pViewShell = getBestViewShell( xModel );
- if ( nPageBreak == excel::XlPageBreak::xlPageBreakManual )
- pViewShell->InsertPageBreak( bColumn, TRUE, &aAddr);
- else if ( nPageBreak == excel::XlPageBreak::xlPageBreakNone )
- pViewShell->DeletePageBreak( bColumn, TRUE, &aAddr);
- }
- }
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getHeight() throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(1) ), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange->getHeight();
- }
-
- uno::Reference< table::XColumnRowRange > xColRowRange( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xColRowRange->getRows(), uno::UNO_QUERY_THROW );
- sal_Int32 nElems = xIndexAccess->getCount();
- double nHeight = 0;
- for ( sal_Int32 index=0; index<nElems; ++index )
- {
- uno::Reference< sheet::XCellRangeAddressable > xAddressable( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
- nHeight += getCalcRowHeight(xAddressable->getRangeAddress() );
- }
- return uno::makeAny( nHeight );
-}
-
-awt::Point
-ScVbaRange::getPosition() throw ( uno::RuntimeException )
-{
- awt::Point aPoint;
- uno::Reference< beans::XPropertySet > xProps;
- if ( mxRange.is() )
- xProps.set( mxRange, uno::UNO_QUERY_THROW );
- else
- xProps.set( mxRanges, uno::UNO_QUERY_THROW );
- xProps->getPropertyValue(POSITION) >>= aPoint;
- return aPoint;
-}
-uno::Any SAL_CALL
-ScVbaRange::getLeft() throw (uno::RuntimeException)
-{
- // helperapi returns the first ranges left ( and top below )
- if ( m_Areas->getCount() > 1 )
- return getArea( 0 )->getLeft();
- awt::Point aPoint = getPosition();
- return uno::makeAny( lcl_hmmToPoints( aPoint.X ) );
-}
-
-
-uno::Any SAL_CALL
-ScVbaRange::getTop() throw (uno::RuntimeException)
-{
- // helperapi returns the first ranges top
- if ( m_Areas->getCount() > 1 )
- return getArea( 0 )->getTop();
- awt::Point aPoint= getPosition();
- return uno::makeAny( lcl_hmmToPoints( aPoint.Y ) );
-}
-
-uno::Reference< excel::XWorksheet >
-ScVbaRange::getWorksheet() throw (uno::RuntimeException)
-{
- // #TODO #FIXME parent should always be set up ( currently thats not
- // the case )
- uno::Reference< excel::XWorksheet > xSheet( getParent(), uno::UNO_QUERY );
- if ( !xSheet.is() )
- {
- uno::Reference< table::XCellRange > xRange = mxRange;
-
- if ( mxRanges.is() ) // assign xRange to first range
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- xRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- }
- ScDocShell* pDocShell = getDocShellFromRange(xRange);
- RangeHelper rHelper(xRange);
- // parent should be Thisworkbook
- xSheet.set( new ScVbaWorksheet( uno::Reference< vba::XHelperInterface >(), mxContext,rHelper.getSpreadSheet(),pDocShell->GetModel()) );
- }
- 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 >
-ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException)
-{
- // Althought the documentation seems clear that Range without a
- // qualifier then its a shortcut for ActiveSheet.Range
- // however, similarly Application.Range is apparently also a
- // shortcut for ActiveSheet.Range
- // The is however a subtle behavioural difference I've come across
- // wrt to named ranges.
- // If a named range "test" exists { Sheet1!$A1 } and the active sheet
- // is Sheet2 then the following will fail
- // msgbox ActiveSheet.Range("test").Address ' failes
- // msgbox WorkSheets("Sheet2").Range("test").Address
- // but !!!
- // msgbox Range("test").Address ' works
- // msgbox Application.Range("test").Address ' works
-
- // Single param Range
- rtl::OUString sRangeName;
- Cell1 >>= sRangeName;
- if ( Cell1.hasValue() && !Cell2.hasValue() && sRangeName.getLength() )
- {
- const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< beans::XPropertySet > xPropSet( getCurrentDocument(), uno::UNO_QUERY_THROW );
-
- uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCellRangeReferrer > xReferrer;
- try
- {
- xReferrer.set ( xNamed->getByName( sRangeName ), uno::UNO_QUERY );
- }
- catch( uno::Exception& /*e*/ )
- {
- // do nothing
- }
- if ( xReferrer.is() )
- {
- uno::Reference< table::XCellRange > xRange = xReferrer->getReferredCells();
- if ( xRange.is() )
- {
- // #FIXME need proper (WorkSheet) parent
- uno::Reference< excel::XRange > xVbRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xRange );
- return xVbRange;
- }
- }
- }
- uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY );
- uno::Reference< table::XCellRange > xSheetRange( xView->getActiveSheet(), uno::UNO_QUERY_THROW );
- ScVbaRange* pRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xSheetRange );
- uno::Reference< excel::XRange > xVbSheetRange( pRange );
- return pRange->Range( Cell1, Cell2, true );
-}
-
-uno::Reference< sheet::XDatabaseRanges >
-lcl_GetDataBaseRanges( ScDocShell* pShell ) throw ( uno::RuntimeException )
-{
- uno::Reference< frame::XModel > xModel;
- if ( pShell )
- xModel.set( pShell->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XDatabaseRanges > xDBRanges( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges") ) ), uno::UNO_QUERY_THROW );
- return xDBRanges;
-}
-// returns the XDatabaseRange for the autofilter on sheet (nSheet)
-// also populates sName with the name of range
-uno::Reference< sheet::XDatabaseRange >
-lcl_GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName )
-{
- uno::Reference< container::XIndexAccess > xIndexAccess( lcl_GetDataBaseRanges( pShell ), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
- table::CellRangeAddress dbAddress;
- for ( sal_Int32 index=0; index < xIndexAccess->getCount(); ++index )
- {
- uno::Reference< sheet::XDatabaseRange > xDBRange( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNamed > xNamed( xDBRange, uno::UNO_QUERY_THROW );
- // autofilters work weirdly with openoffice, unnamed is the default
- // named range which is used to create an autofilter, but
- // its also possible that another name could be used
- // this also causes problems when an autofilter is created on
- // another sheet
- // ( but.. you can use any named range )
- dbAddress = xDBRange->getDataArea();
- if ( dbAddress.Sheet == nSheet )
- {
- sal_Bool bHasAuto = sal_False;
- uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ) ) >>= bHasAuto;
- if ( bHasAuto )
- {
- sName = xNamed->getName();
- xDataBaseRange=xDBRange;
- break;
- }
- }
- }
- return xDataBaseRange;
-}
-
-// Helper functions for AutoFilter
-ScDBData* lcl_GetDBData_Impl( ScDocShell* pDocShell, sal_Int16 nSheet )
-{
- rtl::OUString sName;
- lcl_GetAutoFiltRange( pDocShell, nSheet, sName );
- OSL_TRACE("lcl_GetDBData_Impl got autofilter range %s for sheet %d",
- rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() , nSheet );
- ScDBData* pRet = NULL;
- if (pDocShell)
- {
- ScDBCollection* pNames = pDocShell->GetDocument()->GetDBCollection();
- if (pNames)
- {
- USHORT nPos = 0;
- if (pNames->SearchName( sName , nPos ))
- pRet = (*pNames)[nPos];
- }
- }
- return pRet;
-}
-
-void lcl_SelectAll( ScDocShell* pDocShell, ScQueryParam& aParam )
-{
- if ( pDocShell )
- {
- ScViewData* pViewData = pDocShell->GetViewData();
- if ( pViewData )
- {
- OSL_TRACE("Pushing out SelectAll query");
- pViewData->GetView()->Query( aParam, NULL, TRUE );
- }
- }
-}
-
-ScQueryParam lcl_GetQueryParam( ScDocShell* pDocShell, sal_Int16 nSheet )
-{
- ScDBData* pDBData = lcl_GetDBData_Impl( pDocShell, nSheet );
- ScQueryParam aParam;
- if (pDBData)
- {
- pDBData->GetQueryParam( aParam );
- }
- return aParam;
-}
-
-void lcl_SetAllQueryForField( ScQueryParam& aParam, SCCOLROW nField )
-{
- bool bFound = false;
- SCSIZE i = 0;
- for (; i<MAXQUERY && !bFound; i++)
- {
- ScQueryEntry& rEntry = aParam.GetEntry(i);
- if ( rEntry.nField == nField)
- {
- OSL_TRACE("found at pos %d", i );
- bFound = true;
- }
- }
- if ( bFound )
- {
- OSL_TRACE("field %d to delete at pos %d", nField, ( i - 1 ) );
- aParam.DeleteQuery(--i);
- }
-}
-
-
-void lcl_SetAllQueryForField( ScDocShell* pDocShell, SCCOLROW nField, sal_Int16 nSheet )
-{
- ScQueryParam aParam = lcl_GetQueryParam( pDocShell, nSheet );
- lcl_SetAllQueryForField( aParam, nField );
- lcl_SelectAll( pDocShell, aParam );
-}
-
-// Modifies sCriteria, and nOp depending on the value of sCriteria
-void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference< beans::XPropertySet >& xDescProps, sheet::TableFilterField& rFilterField )
-{
- // #TODO make this more efficient and cycle through
- // sCriteria1 character by character to pick up <,<>,=, * etc.
- // right now I am more concerned with just getting it to work right
-
- sCriteria1 = sCriteria1.trim();
- // table of translation of criteria text to FilterOperators
- // <>searchtext - NOT_EQUAL
- // =searchtext - EQUAL
- // *searchtext - startwith
- // <>*searchtext - doesn't startwith
- // *searchtext* - contains
- // <>*searchtext* - doesn't contain
- // [>|>=|<=|...]searchtext for GREATER_value, GREATER_EQUAL_value etc.
- sal_Int32 nPos = 0;
- bool bIsNumeric = false;
- if ( ( nPos = sCriteria1.indexOf( EQUALS ) ) == 0 )
- {
- if ( sCriteria1.getLength() == EQUALS.getLength() )
- rFilterField.Operator = sheet::FilterOperator_EMPTY;
- else
- {
- rFilterField.Operator = sheet::FilterOperator_EQUAL;
- sCriteria1 = sCriteria1.copy( EQUALS.getLength() );
- sCriteria1 = VBAToRegexp( sCriteria1 );
- // UseRegularExpressions
- if ( xDescProps.is() )
- xDescProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseRegularExpressions" ) ), uno::Any( sal_True ) );
- }
-
- }
- else if ( ( nPos = sCriteria1.indexOf( NOTEQUALS ) ) == 0 )
- {
- if ( sCriteria1.getLength() == NOTEQUALS.getLength() )
- rFilterField.Operator = sheet::FilterOperator_NOT_EMPTY;
- else
- {
- rFilterField.Operator = sheet::FilterOperator_NOT_EQUAL;
- sCriteria1 = sCriteria1.copy( NOTEQUALS.getLength() );
- sCriteria1 = VBAToRegexp( sCriteria1 );
- // UseRegularExpressions
- if ( xDescProps.is() )
- xDescProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseRegularExpressions" ) ), uno::Any( sal_True ) );
- }
- }
- else if ( ( nPos = sCriteria1.indexOf( GREATERTHAN ) ) == 0 )
- {
- bIsNumeric = true;
- if ( ( nPos = sCriteria1.indexOf( GREATERTHANEQUALS ) ) == 0 )
- {
- sCriteria1 = sCriteria1.copy( GREATERTHANEQUALS.getLength() );
- rFilterField.Operator = sheet::FilterOperator_GREATER_EQUAL;
- }
- else
- {
- sCriteria1 = sCriteria1.copy( GREATERTHAN.getLength() );
- rFilterField.Operator = sheet::FilterOperator_GREATER;
- }
-
- }
- else if ( ( nPos = sCriteria1.indexOf( LESSTHAN ) ) == 0 )
- {
- bIsNumeric = true;
- if ( ( nPos = sCriteria1.indexOf( LESSTHANEQUALS ) ) == 0 )
- {
- sCriteria1 = sCriteria1.copy( LESSTHANEQUALS.getLength() );
- rFilterField.Operator = sheet::FilterOperator_LESS_EQUAL;
- }
- else
- {
- sCriteria1 = sCriteria1.copy( LESSTHAN.getLength() );
- rFilterField.Operator = sheet::FilterOperator_LESS;
- }
-
- }
- else
- rFilterField.Operator = sheet::FilterOperator_EQUAL;
-
- if ( bIsNumeric )
- {
- rFilterField.IsNumeric= sal_True;
- rFilterField.NumericValue = sCriteria1.toDouble();
- }
- rFilterField.StringValue = sCriteria1;
-}
-
-void SAL_CALL
-ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const uno::Any& Operator, const uno::Any& Criteria2, const uno::Any& VisibleDropDown ) throw (uno::RuntimeException)
-{
- // Is there an existing autofilter
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- sal_Int16 nSheet = thisAddress.Sheet;
- ScDocShell* pShell = getScDocShell();
- sal_Bool bHasAuto = sal_False;
- rtl::OUString sAutofiltRangeName;
- uno::Reference< sheet::XDatabaseRange > xDataBaseRange = lcl_GetAutoFiltRange( pShell, nSheet, sAutofiltRangeName );
- if ( xDataBaseRange.is() )
- bHasAuto = true;
-
- uno::Reference< table::XCellRange > xFilterRange;
- if ( !bHasAuto )
- {
- if ( m_Areas->getCount() > 1 )
- throw uno::RuntimeException( STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY, uno::Reference< uno::XInterface >() );
-
- table::CellRangeAddress autoFiltAddress;
- //CurrentRegion()
- if ( isSingleCellRange() )
- {
- uno::Reference< excel::XRange > xCurrent( CurrentRegion() );
- if ( xCurrent.is() )
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xCurrent.get() );
- if ( pRange->isSingleCellRange() )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't create AutoFilter") ), uno::Reference< uno::XInterface >() );
- if ( pRange )
- {
- RangeHelper currentRegion( pRange->mxRange );
- autoFiltAddress = currentRegion.getCellRangeAddressable()->getRangeAddress();
- }
- }
- }
- else // multi-cell range
- {
- RangeHelper multiCellRange( mxRange );
- autoFiltAddress = multiCellRange.getCellRangeAddressable()->getRangeAddress();
- }
-
- uno::Reference< sheet::XDatabaseRanges > xDBRanges = lcl_GetDataBaseRanges( pShell );
- if ( xDBRanges.is() )
- {
- rtl::OUString sGenName( RTL_CONSTASCII_USTRINGPARAM("VBA_Autofilter_") );
- sGenName += rtl::OUString::valueOf( static_cast< sal_Int32 >( nSheet ) );
- OSL_TRACE("Going to add new autofilter range.. name %s",
- rtl::OUStringToOString( sGenName, RTL_TEXTENCODING_UTF8 ).getStr() , nSheet );
- if ( !xDBRanges->hasByName( sGenName ) )
- xDBRanges->addNewByName( sGenName, autoFiltAddress );
- xDataBaseRange.set( xDBRanges->getByName( sGenName ), uno::UNO_QUERY_THROW );
- }
- if ( !xDataBaseRange.is() )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Failed to find the autofilter placeholder range" ) ), uno::Reference< uno::XInterface >() );
-
- uno::Reference< beans::XPropertySet > xDBRangeProps( xDataBaseRange, uno::UNO_QUERY_THROW );
- // set autofilt
- xDBRangeProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ), uno::Any(sal_True) );
- // set header
- uno::Reference< beans::XPropertySet > xFiltProps( xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY_THROW );
- sal_Bool bHasColHeader = sal_False;
- ScDocument* pDoc = pShell ? pShell->GetDocument() : NULL;
-
- bHasColHeader = pDoc->HasColHeader( static_cast< SCCOL >( autoFiltAddress.StartColumn ), static_cast< SCROW >( autoFiltAddress.StartRow ), static_cast< SCCOL >( autoFiltAddress.EndColumn ), static_cast< SCROW >( autoFiltAddress.EndRow ), static_cast< SCTAB >( autoFiltAddress.Sheet ) ) ? sal_True : sal_False;
- xFiltProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ContainsHeader") ), uno::Any( bHasColHeader ) );
- }
-
-
- sal_Int32 nField = 0; // *IS* 1 based
- rtl::OUString sCriteria1;
- sal_Int32 nOperator = excel::XlAutoFilterOperator::xlAnd;
-
- sal_Bool bVisible = sal_True;
- bool bChangeDropDown = false;
- VisibleDropDown >>= bVisible;
-
- if ( bVisible == bHasAuto ) // dropdown is displayed/notdisplayed as
- // required
- bVisible = sal_False;
- else
- bChangeDropDown = true;
- sheet::FilterConnection nConn = sheet::FilterConnection_AND;
- double nCriteria1 = 0;
-
- bool bHasCritValue = Criteria1.hasValue();
- bool bCritHasNumericValue = sal_False; // not sure if a numeric criteria is possible
- if ( bHasCritValue )
- bCritHasNumericValue = ( Criteria1 >>= nCriteria1 );
-
- if ( !Field.hasValue() && ( Criteria1.hasValue() || Operator.hasValue() || Criteria2.hasValue() ) )
- throw uno::RuntimeException();
- // Use the normal uno api, sometimes e.g. when you want to use ALL as the filter
- // we can't use refresh as the uno interface doesn't have a concept of ALL
- // in this case we just call the core calc functionality -
- bool bAll = false;;
- if ( ( Field >>= nField ) )
- {
- uno::Sequence< sheet::TableFilterField > sTabFilts;
- uno::Reference< sheet::XSheetFilterDescriptor > xDesc = xDataBaseRange->getFilterDescriptor();
- uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
- if ( Criteria1.hasValue() )
- {
- sTabFilts.realloc( 1 );
- sTabFilts[0].Operator = sheet::FilterOperator_EQUAL;// sensible default
- if ( !bCritHasNumericValue )
- {
- Criteria1 >>= sCriteria1;
- sTabFilts[0].IsNumeric = bCritHasNumericValue;
- if ( bHasCritValue && sCriteria1.getLength() )
- lcl_setTableFieldsFromCriteria( sCriteria1, xDescProps, sTabFilts[0] );
- else
- bAll = true;
- }
- else // numeric
- {
- sTabFilts[0].IsNumeric = sal_True;
- sTabFilts[0].NumericValue = nCriteria1;
- }
- }
- else // no value specified
- bAll = true;
- // not sure what the relationship between Criteria1 and Operator is,
- // e.g. can you have a Operator without a Criteria ? in openoffice it
- if ( Operator.hasValue() && ( Operator >>= nOperator ) )
- {
- // if its a bottom/top Ten(Percent/Value) and there
- // is no value specified for critera1 set it to 10
- if ( !bCritHasNumericValue && !sCriteria1.getLength() && ( nOperator != excel::XlAutoFilterOperator::xlOr ) && ( nOperator != excel::XlAutoFilterOperator::xlAnd ) )
- {
- sTabFilts[0].IsNumeric = sal_True;
- sTabFilts[0].NumericValue = 10;
- bAll = false;
- }
- switch ( nOperator )
- {
- case excel::XlAutoFilterOperator::xlBottom10Items:
- sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_VALUES;
- break;
- case excel::XlAutoFilterOperator::xlBottom10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_PERCENT;
- break;
- case excel::XlAutoFilterOperator::xlTop10Items:
- sTabFilts[0].Operator = sheet::FilterOperator_TOP_VALUES;
- break;
- case excel::XlAutoFilterOperator::xlTop10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator_TOP_PERCENT;
- break;
- case excel::XlAutoFilterOperator::xlOr:
- nConn = sheet::FilterConnection_OR;
- break;
- case excel::XlAutoFilterOperator::xlAnd:
- nConn = sheet::FilterConnection_AND;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UnknownOption") ), uno::Reference< uno::XInterface >() );
-
- }
-
- }
- if ( !bAll )
- {
- sTabFilts[0].Connection = sheet::FilterConnection_AND;
- sTabFilts[0].Field = (nField - 1);
-
- rtl::OUString sCriteria2;
- if ( Criteria2.hasValue() ) // there is a Criteria2
- {
- sTabFilts.realloc(2);
- sTabFilts[1].Field = sTabFilts[0].Field;
- sTabFilts[1].Connection = nConn;
-
- if ( Criteria2 >>= sCriteria2 )
- {
- if ( sCriteria2.getLength() > 0 )
- {
- uno::Reference< beans::XPropertySet > xProps;
- lcl_setTableFieldsFromCriteria( sCriteria2, xProps, sTabFilts[1] );
- sTabFilts[1].IsNumeric = sal_False;
- }
- }
- else // numeric
- {
- Criteria2 >>= sTabFilts[1].NumericValue;
- sTabFilts[1].IsNumeric = sal_True;
- sTabFilts[1].Operator = sheet::FilterOperator_EQUAL;
- }
- }
- }
-
- xDesc->setFilterFields( sTabFilts );
- if ( !bAll )
- {
- xDataBaseRange->refresh();
- }
- else
- // was 0 based now seems to be 1
- lcl_SetAllQueryForField( pShell, nField, nSheet );
- }
- else
- {
- // this is just to toggle autofilter on and off ( not to be confused with
- // a VisibleDropDown option combined with a field, in that case just the
- // button should be disabled ) - currently we don't support that
- bChangeDropDown = true;
- uno::Reference< beans::XPropertySet > xDBRangeProps( xDataBaseRange, uno::UNO_QUERY_THROW );
- if ( bHasAuto )
- {
- // find the any field with the query and select all
- ScQueryParam aParam = lcl_GetQueryParam( pShell, nSheet );
- SCSIZE i = 0;
- for (; i<MAXQUERY; i++)
- {
- ScQueryEntry& rEntry = aParam.GetEntry(i);
- if ( rEntry.bDoQuery )
- lcl_SetAllQueryForField( pShell, rEntry.nField, nSheet );
- }
- // remove exising filters
- xDataBaseRange->getFilterDescriptor()->setFilterFields( uno::Sequence< sheet::TableFilterField >() );
- }
- xDBRangeProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ), uno::Any(!bHasAuto) );
-
- }
-}
-
-void SAL_CALL
-ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& /*CopyOrigin*/ ) throw (uno::RuntimeException)
-{
- // It appears ( from the web ) that the undocumented CopyOrigin
- // param should contain member of enum XlInsertFormatOrigin
- // which can have values xlFormatFromLeftOrAbove or xlFormatFromRightOrBelow
- // #TODO investigate resultant behaviour using these constants
- // currently just processing Shift
-
- sheet::CellInsertMode mode = sheet::CellInsertMode_NONE;
- if ( Shift.hasValue() )
- {
- sal_Int32 nShift = 0;
- Shift >>= nShift;
- switch ( nShift )
- {
- case excel::XlInsertShiftDirection::xlShiftToRight:
- mode = sheet::CellInsertMode_RIGHT;
- break;
- case excel::XlInsertShiftDirection::xlShiftDown:
- mode = sheet::CellInsertMode_DOWN;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("Illegal paramater ") ), uno::Reference< uno::XInterface >() );
- }
- }
- else
- {
- if ( getRow() >= getColumn() )
- mode = sheet::CellInsertMode_DOWN;
- else
- mode = sheet::CellInsertMode_RIGHT;
- }
- RangeHelper thisRange( mxRange );
- uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- xCellRangeMove->insertCells( thisRange.getCellRangeAddressable()->getRangeAddress(), mode );
-}
-
-void SAL_CALL
-ScVbaRange::Autofit() throw (uno::RuntimeException)
-{
- sal_Int32 nLen = m_Areas->getCount();
- if ( nLen > 1 )
- {
- for ( sal_Int32 index = 1; index != nLen; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(index) ), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->Autofit();
- }
- return;
- }
- // if the range is a not a row or column range autofit will
- // throw an error
-
- if ( !mbIsColumns )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- ScDocShell* pDocShell = getDocShellFromRange( mxRange );
- if ( pDocShell )
- {
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
-
- ScDocFunc aFunc(*pDocShell);
- SCCOLROW nColArr[2];
- nColArr[0] = thisAddress.StartColumn;
- nColArr[1] = thisAddress.EndColumn;
- BOOL bDirection = TRUE;
- if ( mbIsRows )
- {
- bDirection = FALSE;
- nColArr[0] = thisAddress.StartRow;
- nColArr[1] = thisAddress.EndRow;
- }
- aFunc.SetWidthOrHeight( bDirection, 1, nColArr, thisAddress.Sheet, SC_SIZE_OPTIMAL,
- 0, TRUE, TRUE );
-
- }
-}
-
-/***************************************************************************************
- * interface for text:
- * com.sun.star.text.XText, com.sun.star.table.XCell, com.sun.star.container.XEnumerationAccess
- * com.sun.star.text.XTextRange,
- * the main problem is to recognize the numeric and date, which assosiate with DecimalSeparator, ThousandsSeparator,
- * TrailingMinusNumbers and FieldInfo.
-***************************************************************************************/
-void SAL_CALL
-ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
- const css::uno::Any& ConsecutinveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
- const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& /*FieldInfo*/,
- const css::uno::Any& DecimalSeparator, const css::uno::Any& ThousandsSeparator, const css::uno::Any& /*TrailingMinusNumbers*/ ) throw (css::uno::RuntimeException)
-{
- uno::Reference< excel::XRange > xRange;
- if( Destination.hasValue() )
- {
- if( !( Destination >>= xRange ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Destination parameter should be a range" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set range\n");
- }
- else
- {
- //set as current
- xRange = this;
- OSL_TRACE("set range as himself\n");
- }
-
- sal_Int16 xlTextParsingType = excel::XlTextParsingType::xlDelimited;
- if ( DataType.hasValue() )
- {
- if( !( DataType >>= xlTextParsingType ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "DataType parameter should be a short" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Datatype\n" );
- }
- sal_Bool bDilimited = ( xlTextParsingType == excel::XlTextParsingType::xlDelimited );
-
- sal_Int16 xlTextQualifier = excel::XlTextQualifier::xlTextQualifierDoubleQuote;
- if( TextQualifier.hasValue() )
- {
- if( !( TextQualifier >>= xlTextQualifier ))
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "TextQualifier parameter should be a short" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set TextQualifier\n");
- }
-
- sal_Bool bConsecutinveDelimiter = sal_False;
- if( ConsecutinveDelimiter.hasValue() )
- {
- if( !( ConsecutinveDelimiter >>= bConsecutinveDelimiter ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ConsecutinveDelimiter parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set ConsecutinveDelimiter\n");
- }
-
- sal_Bool bTab = sal_False;
- if( Tab.hasValue() && bDilimited )
- {
- if( !( Tab >>= bTab ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Tab parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Tab\n");
- }
-
- sal_Bool bSemicolon = sal_False;
- if( Semicolon.hasValue() && bDilimited )
- {
- if( !( Semicolon >>= bSemicolon ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Semicolon parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Semicolon\n");
- }
- sal_Bool bComma = sal_False;
- if( Comma.hasValue() && bDilimited )
- {
- if( !( Comma >>= bComma ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Comma parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Comma\n");
- }
- sal_Bool bSpace = sal_False;
- if( Space.hasValue() && bDilimited )
- {
- if( !( Space >>= bSpace ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Space parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Space\n");
- }
- sal_Bool bOther = sal_False;
- rtl::OUString sOtherChar;
- if( Other.hasValue() && bDilimited )
- {
- if( Other >>= bOther )
- {
- if( OtherChar.hasValue() )
- if( !( OtherChar >>= sOtherChar ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "OtherChar parameter should be a String" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set OtherChar\n" );
- }
- else if( bOther )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Other parameter should be a True" ),
- uno::Reference< uno::XInterface >() );
- }
- //TODO* FieldInfo Optional Variant. An array containing parse information for the individual columns of data. The interpretation depends on the value of DataType. When the data is delimited, this argument is an array of two-element arrays, with each two-element array specifying the conversion options for a particular column. The first element is the column number (1-based), and the second element is one of the xlColumnDataType constants specifying how the column is parsed.
-
- rtl::OUString sDecimalSeparator;
- if( DecimalSeparator.hasValue() )
- {
- if( !( DecimalSeparator >>= sDecimalSeparator ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "DecimalSeparator parameter should be a String" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set DecimalSeparator\n" );
- }
- rtl::OUString sThousandsSeparator;
- if( ThousandsSeparator.hasValue() )
- {
- if( !( ThousandsSeparator >>= sThousandsSeparator ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ThousandsSeparator parameter should be a String" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set ThousandsSpeparator\n" );
- }
- //TODO* TrailingMinusNumbers Optional Variant. Numbers that begin with a minus character.
-}
-
-css::uno::Reference< excel::XValidation > SAL_CALL
-ScVbaRange::getValidation() throw (css::uno::RuntimeException)
-{
- if ( !m_xValidation.is() )
- m_xValidation = new ScVbaValidation( this, mxContext, mxRange );
- 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));
-}
-
-
-void SAL_CALL
-ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException)
-{
- ScDocShell* pShell = NULL;
-
- sal_Int32 nItems = m_Areas->getCount();
- uno::Sequence< table::CellRangeAddress > printAreas( nItems );
- uno::Reference< sheet::XPrintAreas > xPrintAreas;
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
-
- RangeHelper thisRange( xRange->getCellRange() );
- table::CellRangeAddress rangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- if ( index == 1 )
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- // initialise the doc shell and the printareas
- pShell = getDocShellFromRange( pRange->mxRange );
- xPrintAreas.set( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- }
- printAreas[ index - 1 ] = rangeAddress;
- }
- if ( pShell )
- {
- if ( xPrintAreas.is() )
- {
- xPrintAreas->setPrintAreas( printAreas );
- uno::Reference< frame::XModel > xModel = pShell->GetModel();
- PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, sal_True );
- }
- }
-}
-
-void SAL_CALL
-ScVbaRange::AutoFill( const uno::Reference< excel::XRange >& Destination, const uno::Any& Type ) throw (uno::RuntimeException)
-{
- uno::Reference< excel::XRange > xDest( Destination, uno::UNO_QUERY_THROW );
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xDest.get() );
- RangeHelper destRangeHelper( pRange->mxRange );
- table::CellRangeAddress destAddress = destRangeHelper.getCellRangeAddressable()->getRangeAddress();
-
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- ScRange sourceRange;
- ScRange destRange;
-
- ScUnoConversion::FillScRange( destRange, destAddress );
- ScUnoConversion::FillScRange( sourceRange, thisAddress );
-
-
- // source is valid
-// if ( !sourceRange.In( destRange ) )
-// throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "source not in destination" ) ), uno::Reference< uno::XInterface >() );
-
- FillDir eDir = FILL_TO_BOTTOM;
- double fStep = 1.0;
-
- ScRange aRange( destRange );
- ScRange aSourceRange( destRange );
-
- // default to include the number of Rows in the source range;
- SCCOLROW nSourceCount = ( sourceRange.aEnd.Row() - sourceRange.aStart.Row() ) + 1;
- SCCOLROW nCount = 0;
-
- if ( sourceRange != destRange )
- {
- // Find direction of fill, vertical or horizontal
- if ( sourceRange.aStart == destRange.aStart )
- {
- if ( sourceRange.aEnd.Row() == destRange.aEnd.Row() )
- {
- nSourceCount = ( sourceRange.aEnd.Col() - sourceRange.aStart.Col() + 1 );
- aSourceRange.aEnd.SetCol( static_cast<SCCOL>( aSourceRange.aStart.Col() + nSourceCount - 1 ) );
- eDir = FILL_TO_RIGHT;
- nCount = aRange.aEnd.Col() - aSourceRange.aEnd.Col();
- }
- else if ( sourceRange.aEnd.Col() == destRange.aEnd.Col() )
- {
- aSourceRange.aEnd.SetRow( static_cast<SCROW>( aSourceRange.aStart.Row() + nSourceCount ) - 1 );
- nCount = aRange.aEnd.Row() - aSourceRange.aEnd.Row();
- eDir = FILL_TO_BOTTOM;
- }
- }
-
- else if ( aSourceRange.aEnd == destRange.aEnd )
- {
- if ( sourceRange.aStart.Col() == destRange.aStart.Col() )
- {
- aSourceRange.aStart.SetRow( static_cast<SCROW>( aSourceRange.aEnd.Row() - nSourceCount + 1 ) );
- nCount = aSourceRange.aStart.Row() - aRange.aStart.Row();
- eDir = FILL_TO_TOP;
- fStep = -fStep;
- }
- else if ( sourceRange.aStart.Row() == destRange.aStart.Row() )
- {
- nSourceCount = ( sourceRange.aEnd.Col() - sourceRange.aStart.Col() ) + 1;
- aSourceRange.aStart.SetCol( static_cast<SCCOL>( aSourceRange.aEnd.Col() - nSourceCount + 1 ) );
- nCount = aSourceRange.aStart.Col() - aRange.aStart.Col();
- eDir = FILL_TO_LEFT;
- fStep = -fStep;
- }
- }
- }
- ScDocShell* pDocSh= getDocShellFromRange( mxRange );
-
- FillCmd eCmd = FILL_AUTO;
- FillDateCmd eDateCmd = FILL_DAY;
-
-#ifdef VBA_OOBUILD_HACK
- double fEndValue = MAXDOUBLE;
-#endif
-
- if ( Type.hasValue() )
- {
- sal_Int16 nFillType = excel::XlAutoFillType::xlFillDefault;
- Type >>= nFillType;
- switch ( nFillType )
- {
- case excel::XlAutoFillType::xlFillCopy:
- eCmd = FILL_SIMPLE;
- fStep = 0.0;
- break;
- case excel::XlAutoFillType::xlFillDays:
- eCmd = FILL_DATE;
- break;
- case excel::XlAutoFillType::xlFillMonths:
- eCmd = FILL_DATE;
- eDateCmd = FILL_MONTH;
- break;
- case excel::XlAutoFillType::xlFillWeekdays:
- eCmd = FILL_DATE;
- eDateCmd = FILL_WEEKDAY;
- break;
- case excel::XlAutoFillType::xlFillYears:
- eCmd = FILL_DATE;
- eDateCmd = FILL_YEAR;
- break;
- case excel::XlAutoFillType::xlGrowthTrend:
- eCmd = FILL_GROWTH;
- break;
- case excel::XlAutoFillType::xlFillFormats:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "xlFillFormat not supported for AutoFill" ) ), uno::Reference< uno::XInterface >() );
- break;
- case excel::XlAutoFillType::xlFillValues:
- case excel::XlAutoFillType::xlFillSeries:
- case excel::XlAutoFillType::xlLinearTrend:
- eCmd = FILL_LINEAR;
- break;
- case excel::XlAutoFillType::xlFillDefault:
- default:
- eCmd = FILL_AUTO;
- break;
- }
- }
- ScDocFunc aFunc(*pDocSh);
-#ifdef VBA_OOBUILD_HACK
- aFunc.FillAuto( aSourceRange, NULL, eDir, eCmd, eDateCmd, nCount, fStep, fEndValue, TRUE, TRUE );
-#endif
-}
-sal_Bool SAL_CALL
-ScVbaRange::GoalSeek( const uno::Any& Goal, const uno::Reference< excel::XRange >& ChangingCell ) throw (uno::RuntimeException)
-{
- ScDocShell* pDocShell = getScDocShell();
- sal_Bool bRes = sal_True;
- ScVbaRange* pRange = static_cast< ScVbaRange* >( ChangingCell.get() );
- if ( pDocShell && pRange )
- {
- uno::Reference< sheet::XGoalSeek > xGoalSeek( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- RangeHelper changingCellRange( pRange->mxRange );
- table::CellRangeAddress changingCellAddr = changingCellRange.getCellRangeAddressable()->getRangeAddress();
- rtl::OUString sGoal = getAnyAsString( Goal );
- table::CellAddress thisCell( thisAddress.Sheet, thisAddress.StartColumn, thisAddress.StartRow );
- table::CellAddress changingCell( changingCellAddr.Sheet, changingCellAddr.StartColumn, changingCellAddr.StartRow );
- sheet::GoalResult res = xGoalSeek->seekGoal( thisCell, changingCell, sGoal );
- ChangingCell->setValue( uno::makeAny( res.Result ) );
-
- // openoffice behaves differently, result is 0 if the divergence is too great
- // but... if it detects 0 is the value it requires then it will use that
- // e.g. divergence & result both = 0.0 does NOT mean there is an error
- if ( ( res.Divergence != 0.0 ) && ( res.Result == 0.0 ) )
- bRes = sal_False;
- }
- else
- bRes = sal_False;
- return bRes;
-}
-
-void
-ScVbaRange::Calculate( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- getWorksheet()->Calculate();
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaRange::Item( const uno::Any& row, const uno::Any& column ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( mbIsRows || mbIsColumns )
- {
- if ( column.hasValue() )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- uno::Reference< excel::XRange > xRange;
- if ( mbIsColumns )
- xRange = Columns( row );
- else
- xRange = Rows( row );
- return xRange;
- }
- return Cells( row, column );
-}
-
-void
-ScVbaRange::AutoOutline( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- // #TODO #FIXME needs to check for summary row/col ( whatever they are )
- // not valid for multi Area Addresses
- if ( m_Areas->getCount() )
- DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY);
- // So needs to either span an entire Row or a just be a single cell
- // ( that contains a summary RowColumn )
- // also the Single cell cause doesn't seem to be handled specially in
- // this code ( ported from the helperapi RangeImpl.java,
- // RangeRowsImpl.java, RangesImpl.java, RangeSingleCellImpl.java
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
-
- if ( isSingleCellRange() || mbIsRows )
- {
- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- xSheetOutline->autoOutline( thisAddress );
- }
- else
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-}
-
-void SAL_CALL
-ScVbaRange:: ClearOutline( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->ClearOutline();
- }
- return;
- }
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- xSheetOutline->clearOutline();
-}
-
-void
-ScVbaRange::groupUnGroup( bool bUnGroup ) throw ( script::BasicErrorException, uno::RuntimeException )
-{
- if ( m_Areas->getCount() > 1 )
- DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY);
- table::TableOrientation nOrient = table::TableOrientation_ROWS;
- if ( mbIsColumns )
- nOrient = table::TableOrientation_COLUMNS;
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- if ( bUnGroup )
- xSheetOutline->ungroup( thisAddress, nOrient );
- else
- xSheetOutline->group( thisAddress, nOrient );
-}
-
-void SAL_CALL
-ScVbaRange::Group( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- groupUnGroup();
-}
-void SAL_CALL
-ScVbaRange::Ungroup( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- groupUnGroup(true);
-}
-
-void lcl_mergeCellsOfRange( const uno::Reference< table::XCellRange >& xCellRange, sal_Bool _bMerge = sal_True ) throw ( uno::RuntimeException )
-{
- uno::Reference< util::XMergeable > xMergeable( xCellRange, uno::UNO_QUERY_THROW );
- xMergeable->merge(_bMerge);
-}
-void SAL_CALL
-ScVbaRange::Merge( const uno::Any& Across ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->Merge(Across);
- }
- return;
- }
- uno::Reference< table::XCellRange > oCellRange;
- sal_Bool bAcross = sal_False;
- Across >>= bAcross;
- if ( !bAcross )
- lcl_mergeCellsOfRange( mxRange );
- else
- {
- uno::Reference< excel::XRange > oRangeRowsImpl = Rows( uno::Any() );
- // #TODO #FIXME this seems incredibly lame, this can't be right
- for (sal_Int32 i=1; i <= oRangeRowsImpl->getCount();i++)
- {
- oRangeRowsImpl->Cells( uno::makeAny( i ), uno::Any() )->Merge( uno::makeAny( sal_False ) );
- }
- }
-}
-
-void SAL_CALL
-ScVbaRange::UnMerge( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- sal_Int32 nItems = m_Areas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->UnMerge();
- }
- return;
- }
- lcl_mergeCellsOfRange( mxRange, sal_False);
-}
-
-uno::Any SAL_CALL
-ScVbaRange::getStyle() throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32( 1 ) ), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange->getStyle();
- }
- uno::Reference< beans::XPropertySet > xProps( mxRange, uno::UNO_QUERY_THROW );
- rtl::OUString sStyleName;
- ScDocShell* pShell = getScDocShell();
- uno::Reference< frame::XModel > xModel( pShell->GetModel() );
- uno::Reference< excel::XStyle > xStyle = new ScVbaStyle( this, mxContext, sStyleName, xModel );
- return uno::makeAny( xStyle );
-}
-void SAL_CALL
-ScVbaRange::setStyle( const uno::Any& _style ) throw (uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32( 1 ) ), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange->setStyle( _style );
- return;
- }
- uno::Reference< beans::XPropertySet > xProps( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XStyle > xStyle;
- _style >>= xStyle;
- xProps->setPropertyValue(CELLSTYLE, uno::makeAny(xStyle->getName()));
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::PreviousNext( bool bIsPrevious )
-{
- ScMarkData markedRange;
- ScRange refRange;
- RangeHelper thisRange( mxRange );
-
- ScUnoConversion::FillScRange( refRange, thisRange.getCellRangeAddressable()->getRangeAddress());
- markedRange. SetMarkArea( refRange );
- short nMove = bIsPrevious ? -1 : 1;
-
- SCCOL nNewX = refRange.aStart.Col();
- SCROW nNewY = refRange.aStart.Row();
- SCTAB nTab = refRange.aStart.Tab();
-
- ScDocument* pDoc = getScDocument();
- pDoc->GetNextPos( nNewX,nNewY, nTab, nMove,0, TRUE,TRUE, markedRange );
- refRange.aStart.SetCol( nNewX );
- refRange.aStart.SetRow( nNewY );
- refRange.aStart.SetTab( nTab );
- refRange.aEnd.SetCol( nNewX );
- refRange.aEnd.SetRow( nNewY );
- refRange.aEnd.SetTab( nTab );
-
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell() , refRange ) );
-
- return new ScVbaRange( getParent(), mxContext, xRange );
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaRange::Next() throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32( 1 ) ), uno::Any() ) , uno::UNO_QUERY_THROW );
- return xRange->Next();
- }
- return PreviousNext( false );
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaRange::Previous() throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32( 1 ) ), uno::Any() ), uno::UNO_QUERY_THROW );
- return xRange->Previous();
- }
- return PreviousNext( true );
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaRange::SpecialCells( const uno::Any& _oType, const uno::Any& _oValue) throw ( script::BasicErrorException )
-{
- bool bIsSingleCell = isSingleCellRange();
- bool bIsMultiArea = ( m_Areas->getCount() > 1 );
- ScVbaRange* pRangeToUse = this;
- sal_Int32 nType = 0;
- if ( !( _oType >>= nType ) )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- switch(nType)
- {
- case excel::XlCellType::xlCellTypeSameFormatConditions:
- case excel::XlCellType::xlCellTypeAllValidation:
- case excel::XlCellType::xlCellTypeSameValidation:
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- break;
- case excel::XlCellType::xlCellTypeBlanks:
- case excel::XlCellType::xlCellTypeComments:
- case excel::XlCellType::xlCellTypeConstants:
- case excel::XlCellType::xlCellTypeFormulas:
- case excel::XlCellType::xlCellTypeVisible:
- {
- if ( bIsMultiArea )
- {
- // need to process each area, gather the results and
- // create a new range from those
- std::vector< table::CellRangeAddress > rangeResults;
- sal_Int32 nItems = ( m_Areas->getCount() + 1 );
- for ( sal_Int32 index=1; index <= nItems; ++index )
- {
- uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny(index), uno::Any() ), uno::UNO_QUERY_THROW );
- xRange = xRange->SpecialCells( _oType, _oValue);
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- if ( xRange.is() && pRange )
- {
- sal_Int32 nElems = ( pRange->m_Areas->getCount() + 1 );
- for ( sal_Int32 nArea = 1; nArea < nElems; ++nArea )
- {
- uno::Reference< excel::XRange > xTmpRange( m_Areas->Item( uno::makeAny( nArea ), uno::Any() ), uno::UNO_QUERY_THROW );
- RangeHelper rHelper( xTmpRange->getCellRange() );
- rangeResults.push_back( rHelper.getCellRangeAddressable()->getRangeAddress() );
- }
- }
- }
- ScRangeList aCellRanges;
- std::vector< table::CellRangeAddress >::iterator it = rangeResults.begin();
- std::vector< table::CellRangeAddress >::iterator it_end = rangeResults.end();
- for ( ; it != it_end; ++ it )
- {
- ScRange refRange;
- ScUnoConversion::FillScRange( refRange, *it );
- aCellRanges.Append( refRange );
- }
- // Single range
- if ( aCellRanges.First() == aCellRanges.Last() )
- {
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), *aCellRanges.First() ) );
- // #FIXME need proper (WorkSheet) parent
- return new ScVbaRange( getParent(), mxContext, xRange );
- }
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( getScDocShell(), aCellRanges ) );
-
- // #FIXME need proper (WorkSheet) parent
- return new ScVbaRange( getParent(), mxContext, xRanges );
- }
- else if ( bIsSingleCell )
- {
- uno::Reference< excel::XRange > xUsedRange = getWorksheet()->getUsedRange();
- pRangeToUse = static_cast< ScVbaRange* >( xUsedRange.get() );
- }
-
- break;
- }
- default:
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- break;
- }
- if ( !pRangeToUse )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- return pRangeToUse->SpecialCellsImpl( nType, _oValue );
-}
-
-sal_Int32 lcl_getFormulaResultFlags(const uno::Any& aType) throw ( script::BasicErrorException )
-{
- sal_Int32 nType = excel::XlSpecialCellsValue::xlNumbers;
- aType >>= nType;
- sal_Int32 nRes = sheet::FormulaResult::VALUE;
-
- switch(nType)
- {
- case excel::XlSpecialCellsValue::xlErrors:
- nRes= sheet::FormulaResult::ERROR;
- break;
- case excel::XlSpecialCellsValue::xlLogical:
- //TODO bc93774: ask NN if this is really an appropriate substitute
- nRes = sheet::FormulaResult::VALUE;
- break;
- case excel::XlSpecialCellsValue::xlNumbers:
- nRes = sheet::FormulaResult::VALUE;
- break;
- case excel::XlSpecialCellsValue::xlTextValues:
- nRes = sheet::FormulaResult::STRING;
- break;
- default:
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- }
- return nRes;
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::SpecialCellsImpl( sal_Int32 nType, const uno::Any& _oValue) throw ( script::BasicErrorException )
-{
- uno::Reference< excel::XRange > xRange;
- try
- {
- uno::Reference< sheet::XCellRangesQuery > xQuery( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XRange > oLocRangeImpl;
- uno::Reference< sheet::XSheetCellRanges > xLocSheetCellRanges;
- switch(nType)
- {
- case excel::XlCellType::xlCellTypeAllFormatConditions:
- case excel::XlCellType::xlCellTypeSameFormatConditions:
- case excel::XlCellType::xlCellTypeAllValidation:
- case excel::XlCellType::xlCellTypeSameValidation:
- // Shouldn't get here ( should be filtered out by
- // ScVbaRange::SpecialCells()
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- break;
- case excel::XlCellType::xlCellTypeBlanks:
- xLocSheetCellRanges = xQuery->queryEmptyCells();
- break;
- case excel::XlCellType::xlCellTypeComments:
- xLocSheetCellRanges = xQuery->queryContentCells(sheet::CellFlags::ANNOTATION);
- break;
- case excel::XlCellType::xlCellTypeConstants:
- xLocSheetCellRanges = xQuery->queryContentCells(23);
- break;
- case excel::XlCellType::xlCellTypeFormulas:
- {
- sal_Int32 nFormulaResult = lcl_getFormulaResultFlags(_oValue);
- xLocSheetCellRanges = xQuery->queryFormulaCells(nFormulaResult);
- break;
- }
- case excel::XlCellType::xlCellTypeLastCell:
- xRange = Cells( uno::makeAny( getCount() ), uno::Any() );
- case excel::XlCellType::xlCellTypeVisible:
- xLocSheetCellRanges = xQuery->queryVisibleCells();
- break;
- default:
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- break;
- }
- if (xLocSheetCellRanges.is())
- {
- xRange = lcl_makeXRangeFromSheetCellRanges( getParent(), mxContext, xLocSheetCellRanges, getScDocShell() );
- }
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_NOCELLSWEREFOUND);
- }
- return xRange;
-}
-
-void SAL_CALL
-ScVbaRange::RemoveSubtotal( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< sheet::XSubTotalCalculatable > xSub( mxRange, uno::UNO_QUERY_THROW );
- xSub->removeSubTotals();
-}
-
-void SAL_CALL
-ScVbaRange::Subtotal( ::sal_Int32 _nGroupBy, ::sal_Int32 _nFunction, const uno::Sequence< ::sal_Int32 >& _nTotalList, const uno::Any& aReplace, const uno::Any& PageBreaks, const uno::Any& /*SummaryBelowData*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- sal_Bool bDoReplace = sal_False;
- aReplace >>= bDoReplace;
- sal_Bool bAddPageBreaks = sal_False;
- PageBreaks >>= bAddPageBreaks;
-
- uno::Reference< sheet::XSubTotalCalculatable> xSub;
- uno::Reference< sheet::XSubTotalDescriptor > xSubDesc = xSub->createSubTotalDescriptor(sal_True);
- uno::Reference< beans::XPropertySet > xSubDescPropertySet( xSubDesc, uno::UNO_QUERY_THROW );
- xSubDescPropertySet->setPropertyValue(INSERTPAGEBREAKS, uno::makeAny( bAddPageBreaks));
- sal_Int32 nLen = _nTotalList.getLength();
- uno::Sequence< sheet::SubTotalColumn > aColumns( nLen );
- for (int i = 0; i < nLen; i++)
- {
- aColumns[i].Column = _nTotalList[i] - 1;
- switch (_nFunction)
- {
- case excel::XlConsolidationFunction::xlAverage:
- aColumns[i].Function = sheet::GeneralFunction_AVERAGE;
- break;
- case excel::XlConsolidationFunction::xlCount:
- aColumns[i].Function = sheet::GeneralFunction_COUNT;
- break;
- case excel::XlConsolidationFunction::xlCountNums:
- aColumns[i].Function = sheet::GeneralFunction_COUNTNUMS;
- break;
- case excel::XlConsolidationFunction::xlMax:
- aColumns[i].Function = sheet::GeneralFunction_MAX;
- break;
- case excel::XlConsolidationFunction::xlMin:
- aColumns[i].Function = sheet::GeneralFunction_MIN;
- break;
- case excel::XlConsolidationFunction::xlProduct:
- aColumns[i].Function = sheet::GeneralFunction_PRODUCT;
- break;
- case excel::XlConsolidationFunction::xlStDev:
- aColumns[i].Function = sheet::GeneralFunction_STDEV;
- break;
- case excel::XlConsolidationFunction::xlStDevP:
- aColumns[i].Function = sheet::GeneralFunction_STDEVP;
- break;
- case excel::XlConsolidationFunction::xlSum:
- aColumns[i].Function = sheet::GeneralFunction_SUM;
- break;
- case excel::XlConsolidationFunction::xlUnknown:
- aColumns[i].Function = sheet::GeneralFunction_NONE;
- break;
- case excel::XlConsolidationFunction::xlVar:
- aColumns[i].Function = sheet::GeneralFunction_VAR;
- break;
- case excel::XlConsolidationFunction::xlVarP:
- aColumns[i].Function = sheet::GeneralFunction_VARP;
- break;
- default:
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString()) ;
- return;
- }
- }
- xSubDesc->addNew(aColumns, _nGroupBy - 1);
- xSub->applySubTotals(xSubDesc, bDoReplace);
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-uno::Reference< excel::XRange >
-ScVbaRange::intersect( const css::uno::Reference< oo::excel::XRange >& xRange ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< excel::XRange > xResult;
- try
- {
- uno::Reference< sheet::XCellRangesQuery > xQuery( mxRange, uno::UNO_QUERY_THROW );
- RangeHelper aRange( xRange->getCellRange() );
- table::CellRangeAddress aAddress = aRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< sheet::XSheetCellRanges > xIntersectRanges = xQuery->queryIntersection( aAddress );
- xResult = lcl_makeXRangeFromSheetCellRanges( getParent(), mxContext, xIntersectRanges, getScDocShell() );
-
-
- }
- catch( uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return xResult;
-}
-
-rtl::OUString&
-ScVbaRange::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRange") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaRange::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Range" ) );
- }
- return aServiceNames;
-}
-
-namespace range
-{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaRange, sdecl::with_args<true> > serviceImpl;
-extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "SvVbaRange",
- "org.openoffice.excel.Range" );
-}
diff --git a/scratch/sc-vba/dead-source/vbarange.hxx b/scratch/sc-vba/dead-source/vbarange.hxx
deleted file mode 100644
index 4ff388aaf..000000000
--- a/scratch/sc-vba/dead-source/vbarange.hxx
+++ /dev/null
@@ -1,279 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_RANGE_HXX
-#define SC_VBA_RANGE_HXX
-
-#include <cppuhelper/implbase4.hxx>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-
-#include <org/openoffice/excel/XRange.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <org/openoffice/excel/XFont.hpp>
-#include <org/openoffice/excel/XComment.hpp>
-#include <org/openoffice/vba/XCollection.hpp>
-#include <org/openoffice/excel/XlPasteType.hdl>
-#include <org/openoffice/excel/XlPasteSpecialOperation.hdl>
-
-#include <comphelper/proparrhlp.hxx>
-#include <comphelper/propertycontainer.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/script/XDefaultMethod.hpp>
-#include <com/sun/star/script/XDefaultProperty.hpp>
-#include <com/sun/star/sheet/FillDateMode.hpp>
-#include <com/sun/star/sheet/FillMode.hpp>
-#include <com/sun/star/sheet/FillDirection.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-
-//#include "vbahelperinterface.hxx"
-#include "vbaformat.hxx"
-
-class ScTableSheetsObj;
-class ScCellRangesBase;
-
-//typedef InheritedHelperInterfaceImpl1< oo::excel::XRange > ScVbaRange_BASE;
-typedef ScVbaFormat< oo::excel::XRange > ScVbaRange_BASE;
-
-class ArrayVisitor
-{
-public:
- virtual void visitNode( sal_Int32 x, sal_Int32 y, const css::uno::Reference< css::table::XCell >& xCell ) = 0;
- virtual ~ArrayVisitor(){}
-};
-
-class ValueSetter : public ArrayVisitor
-{
-public:
- virtual bool processValue( const css::uno::Any& aValue, const css::uno::Reference< css::table::XCell >& xCell ) = 0;
-
-
-};
-
-class ValueGetter : public ArrayVisitor
-{
-
-public:
- virtual void processValue( sal_Int32 x, sal_Int32 y, const css::uno::Any& aValue ) = 0;
- virtual const css::uno::Any& getValue() const = 0;
-};
-
-
-
-class ScVbaRange : public ScVbaRange_BASE
-{
- css::uno::Reference< oo::vba::XCollection > m_Areas;
- css::uno::Reference< oo::vba::XCollection > m_Borders;
- css::uno::Reference< css::table::XCellRange > mxRange;
- css::uno::Reference< css::sheet::XSheetCellRangeContainer > mxRanges;
- sal_Bool mbIsRows;
- sal_Bool mbIsColumns;
- css::uno::Reference< oo::excel::XValidation > m_xValidation;
- double getCalcColWidth( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
- double getCalcRowHeight( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
- void visitArray( ArrayVisitor& vistor );
-
- css::uno::Reference< oo::excel::XRange > getEntireColumnOrRow( bool bColumn = true ) throw( css::uno::RuntimeException );
-
- void fillSeries( css::sheet::FillDirection nFillDirection, css::sheet::FillMode nFillMode, css::sheet::FillDateMode nFillDateMode, double fStep, double fEndValue ) throw( css::uno::RuntimeException );
-
- void ClearContents( sal_Int32 nFlags ) throw (css::uno::RuntimeException);
- virtual void setValue( const css::uno::Any& aValue, ValueSetter& setter) throw ( css::uno::RuntimeException);
- virtual css::uno::Any getValue( ValueGetter& rValueGetter ) throw (css::uno::RuntimeException);
- virtual css::uno::Any getFormulaValue( ScAddress::Convention ) throw (css::uno::RuntimeException);
- virtual void setFormulaValue( const css::uno::Any& aValue, ScAddress::Convention ) throw ( css::uno::RuntimeException);
- css::uno::Reference< oo::excel::XRange > getArea( sal_Int32 nIndex ) throw( css::uno::RuntimeException );
- ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException );
- SfxItemSet* getCurrentDataSet( ) throw ( css::uno::RuntimeException );
- css::uno::Reference< oo::vba::XCollection >& getBorders();
- void groupUnGroup( bool bUnGroup = false ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- css::uno::Reference< oo::excel::XRange > PreviousNext( bool bIsPrevious );
- css::uno::Reference< oo::excel::XRange > SpecialCellsImpl( sal_Int32 nType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException );
- css::awt::Point getPosition() throw ( css::uno::RuntimeException );
-public:
- ScVbaRange( const css::uno::Reference< oo::vba::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< oo::vba::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 );
- ScVbaRange( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
-;
- ScDocument* getScDocument();
- ScDocShell* getScDocShell();
-
- virtual ~ScVbaRange();
- virtual css::uno::Reference< oo::vba::XHelperInterface > thisHelperIface() { return this; }
- bool isSingleCellRange();
- css::uno::Reference< oo::excel::XRange > intersect( const css::uno::Reference< oo::excel::XRange >& xRange ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- static css::uno::Reference< oo::excel::XRange > getRangeObjectForName( const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sRangeName, ScDocShell* pDocSh, ScAddress::Convention eConv = ScAddress::CONV_XL_A1 ) throw ( css::uno::RuntimeException );
-
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const css::uno::Any& aValue ) throw ( css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getFormula() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFormula( const css::uno::Any& rFormula ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getFormulaArray() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFormulaArray(const css::uno::Any& rFormula) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getFormulaR1C1() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFormulaR1C1( const css::uno::Any &rFormula ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getRow() throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getColumn() throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setNumberFormat( const css::uno::Any& rNumberFormat ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getNumberFormat() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setMergeCells( const css::uno::Any& bMerge ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getMergeCells() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setWrapText( const css::uno::Any& bIsWrapped ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getWrapText() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL getEntireRow() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL getEntireColumn() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XComment > SAL_CALL getComment() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getHidden() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setHidden( const css::uno::Any& _hidden ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getColumnWidth() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setColumnWidth( const css::uno::Any& _columnwidth ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getRowHeight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRowHeight( const css::uno::Any& _rowheight ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getWidth() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getHeight() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getTop() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getLeft() throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getWorksheet() throw (css::uno::RuntimeException);
- 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< oo::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);
- // Methods
- sal_Bool IsRows() { return mbIsRows; }
- sal_Bool IsColumns() { return mbIsColumns; }
- virtual css::uno::Reference< oo::excel::XComment > SAL_CALL AddComment( const css::uno::Any& Text ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Clear() throw (css::uno::RuntimeException);
- virtual void SAL_CALL ClearComments() throw (css::uno::RuntimeException);
- virtual void SAL_CALL ClearContents() throw (css::uno::RuntimeException);
- virtual void SAL_CALL ClearFormats() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL HasFormula() throw (css::uno::RuntimeException);
- virtual void SAL_CALL FillLeft() throw (css::uno::RuntimeException);
- virtual void SAL_CALL FillRight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL FillUp() throw (css::uno::RuntimeException);
- virtual void SAL_CALL FillDown() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Offset( const css::uno::Any &nRowOffset, const css::uno::Any &nColOffset )
- throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL CurrentRegion() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL CurrentArray() throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL Characters( const css::uno::Any& nIndex, const css::uno::Any& nCount )
- throw (css::uno::RuntimeException);
-
- virtual ::rtl::OUString SAL_CALL Address( const css::uno::Any& RowAbsolute, const css::uno::Any& ColumnAbsolute, const css::uno::Any& ReferenceStyle, const css::uno::Any& External, const css::uno::Any& RelativeTo ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Cells( const css::uno::Any &nRow, const css::uno::Any &nCol )
- throw (css::uno::RuntimeException);
- virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Rows( const css::uno::Any& nIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Columns( const css::uno::Any &nIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Copy( const css::uno::Any& Destination ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Cut( const css::uno::Any& Destination ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Resize( const css::uno::Any& RowSize, const css::uno::Any& ColumnSize )
- throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XFont > SAL_CALL Font() throw ( css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XInterior > SAL_CALL Interior( ) throw ( css::script::BasicErrorException, css::uno::RuntimeException) ;
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Range( const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > Range( const css::uno::Any &Cell1, const css::uno::Any &Cell2, bool bForceUseInpuRangeTab ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getCellRange( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL PasteSpecial( const css::uno::Any& Paste, const css::uno::Any& Operation, const css::uno::Any& SkipBlanks, const css::uno::Any& Transpose ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replacement, const css::uno::Any& LookAt, const css::uno::Any& SearchOrder, const css::uno::Any& MatchCase, const css::uno::Any& MatchByte, const css::uno::Any& SearchFormat, const css::uno::Any& ReplaceFormat ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Sort( const css::uno::Any& Key1, const css::uno::Any& Order1, const css::uno::Any& Key2, const css::uno::Any& Type, const css::uno::Any& Order2, const css::uno::Any& Key3, const css::uno::Any& Order3, const css::uno::Any& Header, const css::uno::Any& OrderCustom, const css::uno::Any& MatchCase, const css::uno::Any& Orientation, const css::uno::Any& SortMethod, const css::uno::Any& DataOption1, const css::uno::Any& DataOption2, const css::uno::Any& DataOption3 ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL End( ::sal_Int32 Direction ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XCharacters > SAL_CALL characters( const css::uno::Any& Start, const css::uno::Any& Length ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Delete( const css::uno::Any& Shift ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Areas( const css::uno::Any& ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL BorderAround( const css::uno::Any& LineStyle,
- const css::uno::Any& Weight, const css::uno::Any& ColorIndex, const css::uno::Any& Color ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
- const css::uno::Any& ConsecutinveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
- const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& FieldInfo,
- const css::uno::Any& DecimalSeparator, const css::uno::Any& ThousandsSeparator, const css::uno::Any& TrailingMinusNumbers ) throw (css::uno::RuntimeException);
-
- virtual void SAL_CALL AutoFilter( const css::uno::Any& Field, const css::uno::Any& Criteria1, const css::uno::Any& Operator, const css::uno::Any& Criteria2, const css::uno::Any& VisibleDropDown ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Insert( const css::uno::Any& Shift, const css::uno::Any& CopyOrigin ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Autofit() throw (css::uno::RuntimeException);
- virtual void SAL_CALL PrintOut( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL AutoFill( const css::uno::Reference< oo::excel::XRange >& Destination, const css::uno::Any& Type ) throw (css::uno::RuntimeException) ;
- void SAL_CALL Calculate( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL AutoOutline( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Item( const ::css::uno::Any& row, const css::uno::Any& column ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL ClearOutline( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Ungroup( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Group( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Merge( const css::uno::Any& Across ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL UnMerge( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setStyle( const css::uno::Any& _style ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Next() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Previous() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL RemoveSubtotal( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Subtotal( ::sal_Int32 GroupBy, ::sal_Int32 Function, const css::uno::Sequence< ::sal_Int32 >& TotalList, const css::uno::Any& Replace, const css::uno::Any& PageBreaks, const css::uno::Any& SummaryBelowData ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XEnumerationAccess
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- // XElementAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException)
- {
- return oo::excel::XRange::static_type(0);
-
- }
- virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
- // XDefaultMethod
- ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException);
- // XDefaultProperty
- ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-
-
-// #TODO completely rewrite ScVbaRange, its become a hackfest
-// it needs to be closer to ScCellRangeBase in that the underlying
-// object model should probably be a ScRangelst.
-// * would be nice to be able to construct a range from an addres only
-// * or a list of address ( multi-area )
-// * object should be a lightweight as possible
-// * we shouldn't need hacks like this below
- static css::uno::Reference< oo::excel::XRange > ApplicationRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL GoalSeek( const css::uno::Any& Goal, const css::uno::Reference< oo::excel::XRange >& ChangingCell ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL SpecialCells( const css::uno::Any& _oType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException );
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-#endif /* SC_VBA_RANGE_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbaseriescollection.cxx b/scratch/sc-vba/dead-source/vbaseriescollection.cxx
deleted file mode 100644
index 44b0ac68e..000000000
--- a/scratch/sc-vba/dead-source/vbaseriescollection.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbaseriescollection.hxx"
-#include <org/openoffice/excel/XSeries.hpp>
-
-#include "vbaglobals.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-ScVbaSeriesCollection::ScVbaSeriesCollection( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SeriesCollection_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() )
-{
-}
-
-// XEnumerationAccess
-
-uno::Reference< container::XEnumeration >
-ScVbaSeriesCollection::createEnumeration() throw (uno::RuntimeException)
-{
- uno::Reference< container::XEnumeration > xEnum;
- return xEnum;
-}
-
-// XElementAccess
-
-uno::Type
-ScVbaSeriesCollection::getElementType() throw (uno::RuntimeException)
-{
- return excel::XSeries::static_type(0);
-}
-
-uno::Any
-ScVbaSeriesCollection::createCollectionObject( const css::uno::Any& rSource )
-{
- return rSource;
-}
-
-rtl::OUString&
-ScVbaSeriesCollection::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSeriesCollection") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaSeriesCollection::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.SeriesCollection") );
- }
- return sNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbaseriescollection.hxx b/scratch/sc-vba/dead-source/vbaseriescollection.hxx
deleted file mode 100644
index a84235c02..000000000
--- a/scratch/sc-vba/dead-source/vbaseriescollection.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_SERIESCOLLECTION_HXX
-#define SC_VBA_SERIESCOLLECTION_HXX
-
-#include <org/openoffice/excel/XSeriesCollection.hpp>
-#include "vbahelperinterface.hxx"
-#include "vbacollectionimpl.hxx"
-#include "vbahelper.hxx"
-
-
-typedef CollTestImplHelper< oo::excel::XSeriesCollection > SeriesCollection_BASE;
-
-class ScVbaSeriesCollection : public SeriesCollection_BASE
-{
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
-public:
- ScVbaSeriesCollection( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
- // SeriesCollection_BASE
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_WINDOW_HXX
diff --git a/scratch/sc-vba/dead-source/vbashape.cxx b/scratch/sc-vba/dead-source/vbashape.cxx
deleted file mode 100644
index d9a36fff5..000000000
--- a/scratch/sc-vba/dead-source/vbashape.cxx
+++ /dev/null
@@ -1,486 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbashape.cxx,v $
- *
- * $Revision: 1.1.2.4 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 11:47:24 $
- *
- * 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
- *
- ************************************************************************/
-#include<org/openoffice/office/MsoZOrderCmd.hpp>
-#include<org/openoffice/office/MsoScaleFrom.hpp>
-#include<com/sun/star/container/XNamed.hpp>
-#include<com/sun/star/drawing/ConnectorType.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include<com/sun/star/drawing/XDrawPagesSupplier.hpp>
-#include<com/sun/star/drawing/XDrawPages.hpp>
-
-#include <vos/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include <svx/unopage.hxx>
-#include <svx/unoshape.hxx>
-
-#include "vbashape.hxx"
-#include "vbatextframe.hxx"
-#include "vbalineformat.hxx"
-#include "vbafillformat.hxx"
-#include "vbapictureformat.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-using namespace ::vos;
-
-ScVbaShape::ScVbaShape( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape, const uno::Reference< drawing::XShapes > xShapes, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType )
-{
- m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
- addListeners();
-}
-
-ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< vba::XHelperInterface >(), xContext ), m_xShape( xShape )
-{
- // add listener
- addListeners();
-}
-
-ScVbaShape::~ScVbaShape()
-{
- // dtor must never ever throw
- try
- {
- removeShapeListener();
- removeShapesListener();
- }
- catch( uno::Exception& )
- {
- }
-}
-
-void SAL_CALL
-ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException )
-{
- uno::Reference< drawing::XShapes > xShapes( rEventObject.Source, uno::UNO_QUERY );
- uno::Reference< drawing::XShape > xShape( rEventObject.Source, uno::UNO_QUERY );
- if ( xShapes.is() )
- removeShapesListener();
- if ( xShape.is() )
- removeShapeListener();
-}
-
-
-void ScVbaShape::addListeners()
-{
- uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY );
- if ( xComponent.is() )
- xComponent->addEventListener( this );
-
- xComponent.set( m_xShapes, uno::UNO_QUERY );
- if ( xComponent.is() )
- xComponent->addEventListener( this );
-}
-
-void
-ScVbaShape::removeShapeListener() throw( uno::RuntimeException )
-{
- if( m_xShape.is() )
- {
- uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY_THROW );
- xComponent->removeEventListener( this );
- }
- m_xShape = NULL;
- m_xPropertySet = NULL;
-}
-
-void
-ScVbaShape::removeShapesListener() throw( uno::RuntimeException )
-{
- if( m_xShapes.is() )
- {
- uno::Reference< lang::XComponent > xComponent( m_xShapes, uno::UNO_QUERY_THROW );
- xComponent->removeEventListener( this );
- }
- m_xShapes = NULL;
-}
-
-sal_Int32
-ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException)
-{
- rtl::OUString sShapeType;
- uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor( xShape, uno::UNO_QUERY_THROW );
- sShapeType = xShapeDescriptor->getShapeType();
- // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape"
- if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) )
- return office::MsoShapeType::msoGroup;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) )
- return office::MsoShapeType::msoPicture;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) )
- return office::MsoShapeType::msoOLEControlObject;
- // OOo don't support office::MsoShapeType::msoComment as a Shape.
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) )
- return office::MsoShapeType::msoChart;
- // Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape"
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) )
- {
- enum drawing::ConnectorType connectorType;
- uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
- xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType;
- if( connectorType == drawing::ConnectorType_CURVE )
- return office::MsoShapeType::msoFreeform;
- else if( connectorType == drawing::ConnectorType_LINE )
- return office::MsoShapeType::msoLine;
- else
- return office::MsoShapeType::msoAutoShape;
- }
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) )
- return office::MsoShapeType::msoLine;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) ||
- sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) )
- return office::MsoShapeType::msoAutoShape;
- else
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be surppored: " ) + sShapeType, uno::Reference< uno::XInterface >() );
-}
-
-// Attributes
-rtl::OUString SAL_CALL
-ScVbaShape::getName() throw (uno::RuntimeException)
-{
- rtl::OUString sName;
- uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW );
- sName = xNamed->getName();
- return sName;
-}
-
-void SAL_CALL
-ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
-{
- uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW );
- xNamed->setName( _name );
-}
-
-double SAL_CALL
-ScVbaShape::getHeight() throw (uno::RuntimeException)
-{
- return Millimeter::getInPoints( m_xShape->getSize().Height );
-}
-
-void SAL_CALL
-ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException)
-{
- awt::Size aSize( m_xShape->getSize() );
- aSize.Height = Millimeter::getInHundredthsOfOneMillimeter( _height );
- m_xShape->setSize( aSize );
-}
-
-double SAL_CALL
-ScVbaShape::getWidth() throw (uno::RuntimeException)
-{
- return Millimeter::getInPoints( m_xShape->getSize().Width );
-}
-
-void SAL_CALL
-ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
-{
- awt::Size aSize( m_xShape->getSize() );
- aSize.Width = Millimeter::getInHundredthsOfOneMillimeter( _width );
- m_xShape->setSize( aSize );
-}
-
-double SAL_CALL
-ScVbaShape::getLeft() throw (uno::RuntimeException)
-{
- return Millimeter::getInPoints( m_xShape->getPosition().X );
-}
-
-void SAL_CALL
-ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
-{
- awt::Point oldPosition;
- oldPosition = m_xShape->getPosition();
- oldPosition.X = Millimeter::getInHundredthsOfOneMillimeter( _left );
- m_xShape->setPosition( oldPosition );
-}
-
-double SAL_CALL
-ScVbaShape::getTop() throw (uno::RuntimeException)
-{
- return Millimeter::getInPoints( m_xShape->getPosition().Y );
-}
-
-void SAL_CALL
-ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
-{
- awt::Point oldPosition;
- oldPosition = m_xShape->getPosition();
- oldPosition.Y = Millimeter::getInHundredthsOfOneMillimeter( _top );
- m_xShape->setPosition( oldPosition );
-}
-
-sal_Bool SAL_CALL
-ScVbaShape::getVisible() throw (uno::RuntimeException)
-{
- //UNO Shapes are always visible
- return sal_True;
-}
-
-void SAL_CALL
-ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
-{
- //UNO Shapes are always visible
-}
-
-sal_Int32 SAL_CALL
-ScVbaShape::getZOrderPosition() throw (uno::RuntimeException)
-{
- sal_Int32 nZOrderPosition = 0;
- uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) );
- aZOrderPosition >>= nZOrderPosition;
- return nZOrderPosition + 1;
-}
-
-sal_Int32 SAL_CALL
-ScVbaShape::getType() throw (uno::RuntimeException)
-{
- return m_nType;
-}
-
-double SAL_CALL
-ScVbaShape::getRotation() throw (uno::RuntimeException)
-{
- double dRotation = 0;
- sal_Int32 nRotation = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation;
- dRotation = static_cast< double >( nRotation /100 );
- return dRotation;
-}
-
-void SAL_CALL
-ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException)
-{
- sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) );
-}
-
-uno::Reference< msforms::XLineFormat > SAL_CALL
-ScVbaShape::getLine() throw (uno::RuntimeException)
-{
- // TODO should ongly return line
- return uno::Reference< msforms::XLineFormat >( new ScVbaLineFormat( this, mxContext, m_xShape ) );
-}
-
-uno::Reference< msforms::XFillFormat > SAL_CALL
-ScVbaShape::getFill() throw (uno::RuntimeException)
-{
- return uno::Reference< msforms::XFillFormat >( new ScVbaFillFormat( this, mxContext, m_xShape ) );
-}
-
-uno::Reference< msforms::XPictureFormat > SAL_CALL
-ScVbaShape::getPictureFormat() throw (uno::RuntimeException)
-{
- return uno::Reference< msforms::XPictureFormat >( new ScVbaPictureFormat( this, mxContext, m_xShape ) );
-}
-
-// Methods
-uno::Reference< excel::XTextFrame > SAL_CALL
-ScVbaShape::TextFrame() throw (uno::RuntimeException)
-{
- return uno::Reference< excel::XTextFrame >(new ScVbaTextFrame( getParent(), mxContext, m_xShape ) );
-}
-
-void SAL_CALL
-ScVbaShape::Delete() throw (uno::RuntimeException)
-{
- OGuard aGuard( Application::GetSolarMutex() );
- m_xShapes->remove( m_xShape );
-}
-
-void SAL_CALL
-ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
-{
- sal_Int32 nOrderPositon;
- uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) );
- aOrderPostion >>= nOrderPositon;
- switch( ZOrderCmd )
- {
- case office::MsoZOrderCmd::msoBringToFront:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) );
- break;
- case office::MsoZOrderCmd::msoSendToBack:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) );
- break;
- case office::MsoZOrderCmd::msoBringForward:
- nOrderPositon += 1;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) );
- break;
- case office::MsoZOrderCmd::msoSendBackward:
- if( nOrderPositon > 0 )
- {
- nOrderPositon -= 1;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) );
- }
- break;
- // below two commands use with Writer for text and image object.
- case office::MsoZOrderCmd::msoBringInFrontOfText:
- case office::MsoZOrderCmd::msoSendBehindText:
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() );
- break;
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() );
- }
-}
-
-void SAL_CALL
-ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException)
-{
- double nCurrentRotation = getRotation();
- nCurrentRotation += Increment;
- setRotation(nCurrentRotation);
-}
-
-void SAL_CALL
-ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException)
-{
- double nCurrentLeft = getLeft();
- nCurrentLeft += Increment;
- setLeft(nCurrentLeft);
-}
-
-void SAL_CALL
-ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException)
-{
- double nCurrentTop = getTop();
- nCurrentTop += Increment;
- setTop(nCurrentTop);
-}
-
-void SAL_CALL
-ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
-{
- double nHeight = getHeight();
- double nNewHeight = nHeight * Factor;
- if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft )
- {
- setHeight(nNewHeight);
- }
- else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight )
- {
- double nDeltaHeight = nNewHeight - nHeight;
- double nNewTop = getTop() - nDeltaHeight;
- setTop(nNewTop);
- setHeight(nNewHeight);
- }
- else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle )
- {
- double nDeltaHeight = (nNewHeight - nHeight) / 2;
- double nNewTop = getTop() - nDeltaHeight;
- setTop(nNewTop);
- setHeight(nNewHeight);
- }
- else
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() );
- }
-}
-
-void SAL_CALL
-ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
-{
- double nWidth = getWidth();
- double nNewWidth = nWidth * Factor;
- if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft )
- {
- setWidth(nNewWidth);
- }
- else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight )
- {
- double nDeltaWidth = nNewWidth - nWidth;
- double nNewLeft = getLeft() - nDeltaWidth;
- setLeft(nNewLeft);
- setWidth(nNewWidth);
- }
- else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle )
- {
- double nDeltaWidth = (nNewWidth - nWidth) / 2;
- double nNewLeft = getLeft() - nDeltaWidth;
- setLeft(nNewLeft);
- setWidth(nNewWidth);
- }
- else
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() );
- }
-}
-
-void SAL_CALL
-ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException )
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- xSelectSupp->select( uno::makeAny( m_xShape ) );
-}
-
-// This method should not be part of Shape, what we reall need to do is...
-// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc.
-// ( e.g. the ones that really do have ShapeRange as an attribute )
-#include "vbashaperange.hxx"
-
-uno::Any SAL_CALL
-ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
-{
- // perhaps we should store a reference to the Shapes Collection
- // in this class
- // but anyway this method should not even be in this class
- // #TODO not sure what the parent of the Shapes collection should be
-
- XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec;
- aVec.push_back( m_xShape );
- uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) );
- uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW );
- // #FIXME for want of a better parent, setting this
- uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ) ) );
- if ( index.hasValue() )
- return xShapeRange->Item( index, uno::Any() );
- return uno::makeAny( xShapeRange );
-}
-
-rtl::OUString&
-ScVbaShape::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaShape::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.Shape" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbashape.hxx b/scratch/sc-vba/dead-source/vbashape.hxx
deleted file mode 100644
index e11ec06a0..000000000
--- a/scratch/sc-vba/dead-source/vbashape.hxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_SHAPE_HXX
-#define SC_VBA_SHAPE_HXX
-
-#include <org/openoffice/office/MsoShapeType.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/msforms/XShape.hpp>
-#include <org/openoffice/msforms/XLineFormat.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-#include "vbahelperinterface.hxx"
-
-typedef ::cppu::WeakImplHelper2< oo::msforms::XShape, css::lang::XEventListener > ListeningShape;
-
-typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
-
-class ScVbaShape : public ScVbaShape_BASE
-{
-private:
- css::uno::Reference< css::drawing::XShape > m_xShape;
- css::uno::Reference< css::drawing::XShapes > m_xShapes;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
- sal_Int32 m_nType;
- css::uno::Any m_aRange;
-protected:
- virtual void addListeners();
- virtual void removeShapeListener() throw( css::uno::RuntimeException );
- virtual void removeShapesListener() throw( css::uno::RuntimeException );
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-public:
- ScVbaShape( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape, const css::uno::Reference< css::drawing::XShapes > xShapes, sal_Int32 nType ) throw ( css::lang::IllegalArgumentException );
- ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ) throw ( css::lang::IllegalArgumentException );
- virtual ~ScVbaShape();
- css::uno::Any getRange() { return m_aRange; };
- void setRange( css::uno::Any aRange ) { m_aRange = aRange; };
-
- static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException);
-
- // Attributes
- virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getZOrderPosition() throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
- virtual double SAL_CALL getRotation() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setRotation( double _rotation ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::msforms::XPictureFormat > SAL_CALL getPictureFormat() throw (css::uno::RuntimeException);
-
- // Methods
- virtual css::uno::Reference< oo::excel::XTextFrame > SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
- virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException);
- // Replace??
- virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
- // XEventListener
- virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException );
-};
-#endif//SC_VBA_SHAPE_HXX
diff --git a/scratch/sc-vba/dead-source/vbashaperange.cxx b/scratch/sc-vba/dead-source/vbashaperange.cxx
deleted file mode 100644
index 4e5227e9d..000000000
--- a/scratch/sc-vba/dead-source/vbashaperange.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/drawing/XShapeGrouper.hpp>
-#include <com/sun/star/drawing/XDrawPage.hpp>
-
-#include "vbashaperange.hxx"
-#include "vbashape.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-class VbShapeRangeEnumHelper : public EnumerationHelper_BASE
-{
- uno::Reference< vba::XCollection > m_xParent;
- uno::Reference<container::XIndexAccess > m_xIndexAccess;
- sal_Int32 nIndex;
-public:
- VbShapeRangeEnumHelper( const uno::Reference< vba::XCollection >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( nIndex < m_xIndexAccess->getCount() );
- }
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- ScVbaShapeRange* pCollectionImpl = dynamic_cast< ScVbaShapeRange* >(m_xParent.get());
- if ( pCollectionImpl && hasMoreElements() )
- return pCollectionImpl->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) );
- throw container::NoSuchElementException();
- }
-
-};
-
-ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xShapes, const uno::Reference< drawing::XDrawPage >& xDrawPage ) : ScVbaShapeRange_BASE( xParent, xContext, xShapes ), m_xDrawPage( xDrawPage ), m_nShapeGroupCount(0)
-{
-}
-
-// Methods
-void SAL_CALL
-ScVbaShapeRange::Select( ) throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- xSelectSupp->select( uno::makeAny( getShapes() ) );
-}
-
-uno::Reference< msforms::XShape > SAL_CALL
-ScVbaShapeRange::Group() throw (uno::RuntimeException)
-{
- uno::Reference< drawing::XShapeGrouper > xShapeGrouper( m_xDrawPage, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShapeGroup > xShapeGroup( xShapeGrouper->group( getShapes() ), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShape > xShape( xShapeGroup, uno::UNO_QUERY_THROW );
- return uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, getShapes(), office::MsoShapeType::msoGroup ) );
-}
-
-uno::Reference< drawing::XShapes >
-ScVbaShapeRange::getShapes() throw (uno::RuntimeException)
-{
- if ( !m_xShapes.is() )
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
- m_xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW );
- sal_Int32 nLen = m_xIndexAccess->getCount();
- for ( sal_Int32 index = 0; index < nLen; ++index )
- m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) );
-
- }
- return m_xShapes;
-}
-
-
-void SAL_CALL
-ScVbaShapeRange::IncrementRotation( double Increment ) throw (uno::RuntimeException)
-{
- sal_Int32 nLen = getCount();
- for ( sal_Int32 index = 1; index <= nLen; ++index )
- {
- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- xShape->IncrementRotation( Increment );
- }
-}
-
-void SAL_CALL
-ScVbaShapeRange::IncrementLeft( double Increment ) throw (uno::RuntimeException)
-{
- sal_Int32 nLen = getCount();
- for ( sal_Int32 index = 1; index <= nLen; ++index )
- {
- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- xShape->IncrementLeft( Increment );
- }
-}
-
-void SAL_CALL
-ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException)
-{
- sal_Int32 nLen = getCount();
- for ( sal_Int32 index = 1; index <= nLen; ++index )
- {
- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- xShape->IncrementTop( Increment );
- }
-}
-
-uno::Type SAL_CALL
-ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
-{
- return msforms::XShape::static_type(0);
-}
-
-uno::Reference< container::XEnumeration > SAL_CALL
-ScVbaShapeRange::createEnumeration() throw (uno::RuntimeException)
-{
- return new VbShapeRangeEnumHelper( this, m_xIndexAccess );
-}
-
-uno::Any
-ScVbaShapeRange:: createCollectionObject( const css::uno::Any& aSource )
-{
- uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW );
- // #TODO #FIXME Shape parent should always be the sheet the shapes belong
- // to
- uno::Reference< msforms::XShape > xVbShape( new ScVbaShape( uno::Reference< vba::XHelperInterface >(), mxContext, xShape, getShapes(), ScVbaShape::getType( xShape ) ) );
- return uno::makeAny( xVbShape );
-}
-
-rtl::OUString&
-ScVbaShapeRange::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapeRange") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaShapeRange::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.ShapeRange" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbashaperange.hxx b/scratch/sc-vba/dead-source/vbashaperange.hxx
deleted file mode 100644
index 49e28f999..000000000
--- a/scratch/sc-vba/dead-source/vbashaperange.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_SHAPERANGE_HXX
-#define SC_VBA_SHAPERANGE_HXX
-
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <org/openoffice/msforms/XShapeRange.hpp>
-
-#include "vbacollectionimpl.hxx"
-
-typedef CollTestImplHelper< oo::msforms::XShapeRange > ScVbaShapeRange_BASE;
-
-class ScVbaShapeRange : public ScVbaShapeRange_BASE
-{
-private:
- css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
- css::uno::Reference< css::drawing::XShapes > m_xShapes;
- sal_Int32 m_nShapeGroupCount;
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- css::uno::Reference< css::drawing::XShapes > getShapes() throw (css::uno::RuntimeException) ;
-public:
- ScVbaShapeRange( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XDrawPage>& xDrawShape );
-
- // Methods
- virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ::org::openoffice::msforms::XShape > SAL_CALL Group() throw (css::uno::RuntimeException);
- virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException);
- //XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- // ScVbaCollectionBaseImpl
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-};
-
-#endif//SC_VBA_SHAPERANGE_HXX
diff --git a/scratch/sc-vba/dead-source/vbashapes.cxx b/scratch/sc-vba/dead-source/vbashapes.cxx
deleted file mode 100644
index 168505d36..000000000
--- a/scratch/sc-vba/dead-source/vbashapes.cxx
+++ /dev/null
@@ -1,396 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/text/WrapTextMode.hpp>
-#include <org/openoffice/msforms/XShapeRange.hpp>
-#include <org/openoffice/office/MsoAutoShapeType.hpp>
-
-#include "vbashapes.hxx"
-#include "vbashape.hxx"
-#include "vbashaperange.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-class VbShapeEnumHelper : public EnumerationHelper_BASE
-{
- uno::Reference<msforms::XShapes > m_xParent;
- uno::Reference<container::XIndexAccess > m_xIndexAccess;
- sal_Int32 nIndex;
-public:
- VbShapeEnumHelper( const uno::Reference< msforms::XShapes >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( nIndex < m_xIndexAccess->getCount() );
- }
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get());
- if ( pShapes && hasMoreElements() )
- return pShapes->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) );
- throw container::NoSuchElementException();
- }
-
-};
-
-void ScVbaShapes::initBaseCollection()
-{
- if ( m_xNameAccess.is() ) // already has NameAccess
- return;
- // no NameAccess then use ShapeCollectionHelper
- XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes;
- sal_Int32 nLen = m_xIndexAccess->getCount();
- mShapes.reserve( nLen );
- for ( sal_Int32 index=0; index<nLen; ++index )
- mShapes.push_back( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY ) );
- uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) );
- m_xIndexAccess.set( xShapes, uno::UNO_QUERY );
- m_xNameAccess.set( xShapes, uno::UNO_QUERY );
-}
-
-ScVbaShapes::ScVbaShapes( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0)
-{
- m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
- m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
- initBaseCollection();
-}
-
-uno::Reference< container::XEnumeration >
-ScVbaShapes::createEnumeration() throw (uno::RuntimeException)
-{
- return new VbShapeEnumHelper( this, m_xIndexAccess );
-}
-
-uno::Any
-ScVbaShapes::createCollectionObject( const css::uno::Any& aSource )
-{
- if( aSource.hasValue() )
- {
- uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW );
- return uno::makeAny( uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ) ) );
- }
- return uno::Any();
-}
-
-uno::Type
-ScVbaShapes::getElementType() throw (uno::RuntimeException)
-{
- return org::openoffice::msforms::XShape::static_type(0);
-}
-rtl::OUString&
-ScVbaShapes::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapes") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaShapes::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.Shapes" ) );
- }
- return aServiceNames;
-}
-
-css::uno::Reference< css::container::XIndexAccess >
-ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index ) throw (uno::RuntimeException)
-{
- if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE )
- throw uno::RuntimeException();
-
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext);
- uno::Any aConverted;
- aConverted = xConverter->convertTo( Index, getCppuType((uno::Sequence< uno::Any >*)0) );
-
- uno::Sequence< uno::Any > sIndices;
- aConverted >>= sIndices;
- XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes;
- sal_Int32 nElems = sIndices.getLength();
- for( sal_Int32 index = 0; index < nElems; ++index )
- {
- uno::Reference< drawing::XShape > xShape;
- if ( sIndices[ index ].getValueTypeClass() == uno::TypeClass_STRING )
- {
- rtl::OUString sName;
- sIndices[ index ] >>= sName;
- xShape.set( m_xNameAccess->getByName( sName ), uno::UNO_QUERY );
- }
- else
- {
- sal_Int32 nIndex = 0;
- sIndices[ index ] >>= nIndex;
- // adjust for 1 based mso indexing
- xShape.set( m_xIndexAccess->getByIndex( nIndex - 1 ), uno::UNO_QUERY );
-
- }
- // populate map with drawing::XShapes
- if ( xShape.is() )
- mShapes.push_back( xShape );
- }
- uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) );
- return xIndexAccess;
-}
-
-uno::Any SAL_CALL
-ScVbaShapes::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException)
-{
- // I don't think we need to support Array of indices for shapes
-/*
- if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE )
- {
- uno::Reference< container::XIndexAccess > xIndexAccess( getShapesByArrayIndices( Index ) );
- // return new collection instance
- uno::Reference< vba::XCollection > xShapesCollection( new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) );
- return uno::makeAny( xShapesCollection );
- }
-*/
- return ScVbaShapes_BASE::Item( Index, Index2 );
-}
-
-uno::Reference< msforms::XShapeRange > SAL_CALL
-ScVbaShapes::Range( const uno::Any& shapes ) throw (css::uno::RuntimeException)
-{
- // shapes, can be an index or an array of indices
- uno::Reference< container::XIndexAccess > xShapes;
- if ( shapes.getValueTypeClass() == uno::TypeClass_SEQUENCE )
- xShapes = getShapesByArrayIndices( shapes );
- else
- {
- // wrap single index into a sequence
- uno::Sequence< uno::Any > sIndices(1);
- sIndices[ 0 ] = shapes;
- uno::Any aIndex;
- aIndex <<= sIndices;
- xShapes = getShapesByArrayIndices( aIndex );
- }
- return new ScVbaShapeRange( getParent(), mxContext, xShapes, m_xDrawPage );
-}
-
-void SAL_CALL
-ScVbaShapes::SelectAll() throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- try
- {
- xSelectSupp->select( uno::makeAny( m_xShapes ) );
- }
- // viewuno.cxx ScTabViewObj::select will throw IllegalArgumentException
- // if one of the shapes is no 'markable' e.g. a button
- // the method still works
- catch( lang::IllegalArgumentException& )
- {
- }
-}
-
-uno::Reference< drawing::XShape >
-ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeException)
-{
- uno::Reference< lang::XMultiServiceFactory > xMSF( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW );
- return xShape;
-}
-
-uno::Any
-ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException)
-{
- rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) );
- sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
- sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
- sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
- sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
-
- uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
- m_xShapes->add( xShape );
-
- rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Rectangle" ) );
- setDefaultShapeProperties( xShape );
- setShape_NameProperty( xShape, sName );
-
- awt::Point aMovePositionIfRange(0, 0);
- awt::Point position;
- position.X = nXPos - aMovePositionIfRange.X;
- position.Y = nYPos - aMovePositionIfRange.Y;
- xShape->setPosition( position );
-
- awt::Size size;
- size.Height = nHeight;
- size.Width = nWidth;
- xShape->setSize( size );
-
- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
- pScVbaShape->setRange( aRange );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
-}
-
-uno::Any
-ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException)
-{
- rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.EllipseShape" ) );
- sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
- sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
- sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
- sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
-
- uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
- m_xShapes->add( xShape );
-
- awt::Point aMovePositionIfRange( 0, 0 );
- //TODO helperapi using a writer document
- /*
- XDocument xDocument = (XDocument)getParent();
- if (AnyConverter.isVoid(_aRange))
- {
- _aRange = xDocument.Range(new Integer(0), new Integer(1));
- // Top&Left in Word is Top&Left of the paper and not the writeable area.
- aMovePositionIfRange = calculateTopLeftMargin((HelperInterfaceAdaptor)xDocument);
- }
-
- setShape_AnchorTypeAndRangeProperty(xShape, _aRange);
- */
- rtl::OUString name = createName( rtl::OUString::createFromAscii( "Oval" ));
- setDefaultShapeProperties(xShape);
- setShape_NameProperty(xShape, name);
-
- awt::Point position;
- position.X = nXPos - aMovePositionIfRange.X;
- position.Y = nYPos - aMovePositionIfRange.Y;
- xShape->setPosition(position);
-
- awt::Size size;
- size.Height = nHeight;
- size.Width = nWidth;
- xShape->setSize(size);
-
- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
- pScVbaShape->setRange( aRange );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
-}
-
-//helpeapi calc
-uno::Any SAL_CALL
-ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (uno::RuntimeException)
-{
- sal_Int32 nLineWidth = endX - StartX;
- sal_Int32 nLineHeight = endY - StartY;
-
- sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
- sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
- sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX );
- sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY );
-
- uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape") ), uno::UNO_QUERY_THROW );
- m_xShapes->add( xShape );
-
- awt::Point aMovePositionIfRange( 0, 0 );
-
- rtl::OUString name = createName( rtl::OUString::createFromAscii( "Line" ) );
- setDefaultShapeProperties(xShape);
- setShape_NameProperty(xShape, name);
-
- awt::Point position;
- position.X = nXPos - aMovePositionIfRange.X;
- position.Y = nYPos - aMovePositionIfRange.Y;
- xShape->setPosition(position);
-
- awt::Size size;
- size.Height = nHeight;
- size.Width = nWidth;
- xShape->setSize(size);
-
- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
-}
-
-uno::Any SAL_CALL
-ScVbaShapes::AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
-{
- uno::Any _aAnchor;
- if (_nType == office::MsoAutoShapeType::msoShapeRectangle)
- {
- return AddRectangle(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor);
- }
- else if (_nType == office::MsoAutoShapeType::msoShapeOval)
- {
- return AddEllipse(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor);
- }
- return uno::Any();
-}
-
-void
-ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillStyle" ), uno::makeAny( rtl::OUString::createFromAscii( "SOLID" ) ) );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor"), uno::makeAny( sal_Int32(0xFFFFFF) ) );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap"), uno::makeAny( text::WrapTextMode_THROUGHT ) );
- //not find in OOo2.3
- //xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Opaque"), uno::makeAny( sal_True ) );
-}
-
-void
-ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName )
-{
- uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
- try
- {
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Name" ), uno::makeAny( sName ) );
- }
- catch( script::BasicErrorException e )
- {
- }
-}
-
-rtl::OUString
-ScVbaShapes::createName( rtl::OUString sName )
-{
- sal_Int32 nActNumber = 1 + m_nNewShapeCount;
- m_nNewShapeCount++;
- sName += rtl::OUString::valueOf( nActNumber );
- return sName;
-}
-
-awt::Point
-calculateTopLeftMargin( uno::Reference< vba::XHelperInterface > xDocument )
-{
- awt::Point aPoint( 0, 0 );
- uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW );
- return awt::Point();
-}
diff --git a/scratch/sc-vba/dead-source/vbashapes.hxx b/scratch/sc-vba/dead-source/vbashapes.hxx
deleted file mode 100644
index c07800996..000000000
--- a/scratch/sc-vba/dead-source/vbashapes.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_SHAPES_HXX
-#define SC_VBA_SHAPES_HXX
-
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/drawing/XDrawPage.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <org/openoffice/msforms/XShapes.hpp>
-
-#include "vbahelperinterface.hxx"
-
-#include "vbacollectionimpl.hxx"
-
-typedef CollTestImplHelper< oo::msforms::XShapes > ScVbaShapes_BASE;
-
-class ScVbaShapes : public ScVbaShapes_BASE
-{
-private:
- css::uno::Reference< css::drawing::XShapes > m_xShapes;
- css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
- sal_Int32 m_nNewShapeCount;
- void initBaseCollection();
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- virtual css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
- css::uno::Reference< css::drawing::XShape > createShape( rtl::OUString service ) throw (css::uno::RuntimeException);
- css::uno::Any AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException);
- css::uno::Any AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException);
- rtl::OUString createName( rtl::OUString sName );
- css::awt::Point calculateTopLeftMargin( css::uno::Reference< oo::vba::XHelperInterface > xDocument );
-
-public:
- ScVbaShapes( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes );
- static void setDefaultShapeProperties( css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException);
- static void setShape_NameProperty( css::uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName );
- //XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
- virtual void SAL_CALL SelectAll() throw (css::uno::RuntimeException);
- //helper::calc
- virtual css::uno::Any SAL_CALL AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::msforms::XShapeRange > SAL_CALL Range( const css::uno::Any& shapes ) throw (css::uno::RuntimeException);
- // ScVbaCollectionBaseImpl
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException);
-};
-
-#endif//SC_VBA_SHAPES_HXX
diff --git a/scratch/sc-vba/dead-source/vbastyle.cxx b/scratch/sc-vba/dead-source/vbastyle.cxx
deleted file mode 100644
index eeae0472b..000000000
--- a/scratch/sc-vba/dead-source/vbastyle.cxx
+++ /dev/null
@@ -1,194 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-
-#include "vbastyle.hxx"
-#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-static rtl::OUString DISPLAYNAME( RTL_CONSTASCII_USTRINGPARAM("DisplayName") );
-
-
-
-uno::Reference< container::XNameAccess >
-ScVbaStyle::getStylesNameContainer( const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException )
-{
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( xModel, uno::UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) ) ), uno::UNO_QUERY_THROW );
- return xStylesAccess;
-}
-
-uno::Reference< beans::XPropertySet >
-lcl_getStyleProps( const rtl::OUString& sStyleName, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException, uno::RuntimeException )
-{
-
- uno::Reference< beans::XPropertySet > xStyleProps( ScVbaStyle::getStylesNameContainer( xModel )->getByName( sStyleName ), uno::UNO_QUERY_THROW );
- return xStyleProps;
-}
-
-
-void ScVbaStyle::initialise() throw ( uno::RuntimeException )
-{
- if (!mxModel.is() )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XModel Interface could not be retrieved")) );
- uno::Reference< lang::XServiceInfo > xServiceInfo( mxPropertySet, uno::UNO_QUERY_THROW );
- if ( !xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CellStyle" ) ) ) )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
- mxStyle.set( mxPropertySet, uno::UNO_QUERY_THROW );
-
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW );
- mxStyleFamilyNameContainer.set( ScVbaStyle::getStylesNameContainer( mxModel ), uno::UNO_QUERY_THROW );
-
-}
-
-ScVbaStyle::ScVbaStyle( const uno::Reference< oo::vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const rtl::OUString& sStyleName, const uno::Reference< frame::XModel >& _xModel ) throw ( script::BasicErrorException, uno::RuntimeException ) : ScVbaStyle_BASE( xParent, xContext, lcl_getStyleProps( sStyleName, _xModel ), _xModel, false )
-{
- try
- {
- initialise();
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-ScVbaStyle::ScVbaStyle( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, const uno::Reference< frame::XModel >& _xModel ) throw ( script::BasicErrorException, uno::RuntimeException ) : ScVbaStyle_BASE( xParent, xContext, _xPropertySet, _xModel, false )
-{
- try
- {
- initialise();
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-
-::sal_Bool SAL_CALL
-ScVbaStyle::BuiltIn() throw (script::BasicErrorException, uno::RuntimeException)
-{
- return !mxStyle->isUserDefined();
-
-}
-void SAL_CALL
-ScVbaStyle::setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- mxStyle->setName(Name);
-}
-
-::rtl::OUString SAL_CALL
-ScVbaStyle::getName() throw (script::BasicErrorException, uno::RuntimeException)
-{
- return mxStyle->getName();
-}
-
-void SAL_CALL
-ScVbaStyle::setNameLocal( const ::rtl::OUString& NameLocal ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- mxPropertySet->setPropertyValue(DISPLAYNAME, uno::makeAny( NameLocal ) );
- }
- catch (uno::Exception& e)
- {
- DebugHelper::exception(e);
- }
-}
-
-::rtl::OUString SAL_CALL
-ScVbaStyle::getNameLocal() throw (script::BasicErrorException, uno::RuntimeException)
-{
- rtl::OUString sName;
- try
- {
- mxPropertySet->getPropertyValue(DISPLAYNAME) >>= sName;
- }
- catch (uno::Exception e)
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return sName;
-}
-
-void SAL_CALL
-ScVbaStyle::Delete() throw (script::BasicErrorException, uno::RuntimeException)
-{
- try
- {
- mxStyleFamilyNameContainer->removeByName(mxStyle->getName());
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-void SAL_CALL
-ScVbaStyle::setMergeCells( const uno::Any& /*MergeCells*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
-}
-
-uno::Any SAL_CALL
-ScVbaStyle::getMergeCells( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
- return uno::Any();
-}
-
-
-rtl::OUString&
-ScVbaStyle::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaStyle") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaStyle::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.XStyle" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbastyle.hxx b/scratch/sc-vba/dead-source/vbastyle.hxx
deleted file mode 100644
index 8488eedb8..000000000
--- a/scratch/sc-vba/dead-source/vbastyle.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_STYLE_HXX
-#define SC_VBA_STYLE_HXX
-#include <org/openoffice/excel/XStyle.hpp>
-#include <com/sun/star/style/XStyle.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include "vbaformat.hxx"
-
-
-typedef ScVbaFormat< oo::excel::XStyle > ScVbaStyle_BASE;
-
-class ScVbaStyle : public ScVbaStyle_BASE
-{
-protected:
- css::uno::Reference< css::style::XStyle > mxStyle;
- css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::container::XNameContainer > mxStyleFamilyNameContainer;
- void initialise() throw ( css::uno::RuntimeException );
-public:
- ScVbaStyle( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const rtl::OUString& sStyleName, const css::uno::Reference< css::frame::XModel >& _xModel ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- ScVbaStyle( const css::uno::Reference< oo::vba::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 ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- virtual ~ScVbaStyle(){}
- static css::uno::Reference< css::container::XNameAccess > getStylesNameContainer( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException );
- virtual css::uno::Reference< oo::vba::XHelperInterface > thisHelperIface() { return this; };
- // XStyle Methods
- virtual ::sal_Bool SAL_CALL BuiltIn() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getName() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setNameLocal( const ::rtl::OUString& NameLocal ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNameLocal() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Delete() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XFormat
- virtual void SAL_CALL setMergeCells( const css::uno::Any& MergeCells ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getMergeCells( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-/*
- // XFormat
- virtual css::uno::Reference< ::org::openoffice::excel::XBorders > SAL_CALL Borders( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Reference< ::org::openoffice::excel::XFont > SAL_CALL Font( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Reference< ::org::openoffice::excel::XInterior > SAL_CALL Interior( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setNumberFormat( const css::uno::Any& NumberFormat ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getNumberFormat( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setNumberFormatLocal( const css::uno::Any& NumberFormatLocal ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getNumberFormatLocal( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setIndentLevel( const css::uno::Any& IndentLevel ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getIndentLevel( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setHorizontalAlignment( const css::uno::Any& HorizontalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getHorizontalAlignment( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setVerticalAlignment( const css::uno::Any& VerticalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getVerticalAlignment( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setOrientation( const css::uno::Any& Orientation ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getOrientation( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setShrinkToFit( const css::uno::Any& ShrinkToFit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getShrinkToFit( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setWrapText( const css::uno::Any& WrapText ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getWrapText( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setLocked( const css::uno::Any& Locked ) 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 setFormulaHidden( const css::uno::Any& FormulaHidden ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
-/ virtual css::uno::Any SAL_CALL getFormulaHidden( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual void SAL_CALL setMergeCells( const css::uno::Any& MergeCells ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
- virtual css::uno::Any SAL_CALL getMergeCells( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
- virtual void SAL_CALL setReadingOrder( const css::uno::Any& ReadingOrder ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
- virtual css::uno::Any SAL_CALL getReadingOrder( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
-*/
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_AXIS_HXX
diff --git a/scratch/sc-vba/dead-source/vbastyles.cxx b/scratch/sc-vba/dead-source/vbastyles.cxx
deleted file mode 100644
index 868de2b47..000000000
--- a/scratch/sc-vba/dead-source/vbastyles.cxx
+++ /dev/null
@@ -1,189 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbastyles.hxx"
-#include "vbastyle.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-static rtl::OUString SDEFAULTCELLSTYLENAME( RTL_CONSTASCII_USTRINGPARAM("Default") );
-css::uno::Any
-lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel )
-{
- uno::Reference< beans::XPropertySet > xStyleProps( aObject, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XStyle > xStyle( new ScVbaStyle( xParent, xContext, xStyleProps, xModel ) );
- return uno::makeAny( xStyle );
-}
-
-
-ScVbaStyles::ScVbaStyles( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException ) : ScVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( ScVbaStyle::getStylesNameContainer( xModel ), uno::UNO_QUERY_THROW ) ), mxModel( xModel ), mxParent( xParent )
-{
- try
- {
- mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
- mxNameContainerCellStyles.set( m_xNameAccess, uno::UNO_QUERY_THROW );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaStyles::getStyleNames() throw ( uno::RuntimeException )
-{
- return mxNameContainerCellStyles->getElementNames();
-}
-
-
-uno::Any
-ScVbaStyles::createCollectionObject(const uno::Any& aObject)
-{
- return lcl_createAPIStyleToVBAObject( aObject, mxParent, mxContext, mxModel );
-}
-
-uno::Type SAL_CALL
-ScVbaStyles::getElementType() throw (uno::RuntimeException)
-{
- return excel::XStyle::static_type(0);
-}
-
-class EnumWrapper : public EnumerationHelper_BASE
-{
- uno::Reference<container::XIndexAccess > m_xIndexAccess;
- uno::Reference<vba::XHelperInterface > m_xParent;
- uno::Reference<uno::XComponentContext > m_xContext;
- uno::Reference<frame::XModel > m_xModel;
-
- sal_Int32 nIndex;
-public:
- EnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference<vba::XHelperInterface >& xParent, const uno::Reference<uno::XComponentContext >& xContext, const uno::Reference<frame::XModel >& xModel ) : m_xIndexAccess( xIndexAccess ), m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel ), nIndex( 0 ) {}
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( nIndex < m_xIndexAccess->getCount() );
- }
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( nIndex < m_xIndexAccess->getCount() )
- return lcl_createAPIStyleToVBAObject( m_xIndexAccess->getByIndex( nIndex++ ), m_xParent, m_xContext, m_xModel );
- throw container::NoSuchElementException();
- }
-};
-
-uno::Reference< container::XEnumeration > SAL_CALL
-ScVbaStyles::createEnumeration() throw (uno::RuntimeException)
-{
- return new EnumWrapper( m_xIndexAccess, mxParent, mxContext, mxModel );
-}
-
-uno::Reference< excel::XStyle > SAL_CALL
-ScVbaStyles::Add( const ::rtl::OUString& _sName, const uno::Any& _aBasedOn ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference< excel::XStyle > aRet;
- try
- {
- rtl::OUString sParentCellStyleName( RTL_CONSTASCII_USTRINGPARAM("Default"));
- if ( _aBasedOn.hasValue() )
- {
- uno::Reference< excel::XRange > oRange;
- if ( _aBasedOn >>= oRange)
- {
- uno::Reference< excel::XStyle > oStyle( oRange->getStyle(), uno::UNO_QUERY_THROW );
- if ( oStyle.is() )
- {
- sParentCellStyleName = oStyle->getName();
- }
- else
- {
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString() );
- }
- }
- else
- {
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
- }
- }
-
- uno::Reference< style::XStyle > xStyle( mxMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CellStyle"))), uno::UNO_QUERY_THROW );
-
- if (!mxNameContainerCellStyles->hasByName(_sName))
- {
- mxNameContainerCellStyles->insertByName(_sName, uno::makeAny( xStyle) );
- }
- if (!sParentCellStyleName.equals(SDEFAULTCELLSTYLENAME))
- {
- xStyle->setParentStyle( sParentCellStyleName );
- }
- aRet.set( Item( uno::makeAny( _sName ), uno::Any() ), uno::UNO_QUERY_THROW );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return aRet;
-}
-
-void
-ScVbaStyles::Delete(const rtl::OUString _sStyleName) throw ( script::BasicErrorException )
-{
- try
- {
- if (mxNameContainerCellStyles->hasByName( _sStyleName ) )
- mxNameContainerCellStyles->removeByName( _sStyleName );
- }
- catch (uno::Exception& )
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-}
-
-rtl::OUString&
-ScVbaStyles::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaStyles") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaStyles::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.XStyles" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbastyles.hxx b/scratch/sc-vba/dead-source/vbastyles.hxx
deleted file mode 100644
index 67f6ab0db..000000000
--- a/scratch/sc-vba/dead-source/vbastyles.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_STYLES_HXX
-#define SC_VBA_STYLES_HXX
-#include <org/openoffice/excel/XStyles.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include "vbacollectionimpl.hxx"
-
-typedef CollTestImplHelper< oo::excel::XStyles > ScVbaStyles_BASE;
-class ScVbaStyles: public ScVbaStyles_BASE
-{
- css::uno::Reference< css::frame::XModel > mxModel;
- // hard ref to parent ( perhaps we should try this in the
- // XHelperInterface itself
- css::uno::Reference< oo::vba::XHelperInterface > mxParent;
- css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
- css::uno::Reference< css::container::XNameContainer > mxNameContainerCellStyles;
-public:
- ScVbaStyles( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::script::BasicErrorException );
- css::uno::Sequence< rtl::OUString > getStyleNames() throw ( css::uno::RuntimeException );
- void Delete(const rtl::OUString _sStyleName) throw ( css::script::BasicErrorException );
- // XStyles
- virtual css::uno::Reference< oo::excel::XStyle > SAL_CALL Add( const ::rtl::OUString& Name, const css::uno::Any& BasedOn ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- virtual css::uno::Any createCollectionObject(const css::uno::Any&);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif
diff --git a/scratch/sc-vba/dead-source/vbatextbox.cxx b/scratch/sc-vba/dead-source/vbatextbox.cxx
deleted file mode 100644
index db3ec25e3..000000000
--- a/scratch/sc-vba/dead-source/vbatextbox.cxx
+++ /dev/null
@@ -1,105 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/text/XTextRange.hpp>
-
-#include "vbatextbox.hxx"
-#include <vector>
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-
-
-ScVbaTextBox::ScVbaTextBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : TextBoxImpl_BASE( xContext, xControlShape )
-{
-}
-
-// Attributes
-//getString() will cause some imfo lose.
-rtl::OUString SAL_CALL
-ScVbaTextBox::getText() throw (css::uno::RuntimeException)
-{
- uno::Any aValue;
- aValue = m_xProps->getPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
- rtl::OUString sString;
- aValue >>= sString;
- return sString;
-}
-
-void SAL_CALL
-ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
-{
- uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
- xTextRange->setString( _text );
-}
-
-sal_Int32 SAL_CALL
-ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
-{
- uno::Any aValue;
- aValue = m_xProps->getPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) );
- sal_Int32 nMaxLength = 0;
- aValue >>= nMaxLength;
- return nMaxLength;
-}
-
-void SAL_CALL
-ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
-{
- uno::Any aValue( _maxlength );
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
-}
-
-sal_Bool SAL_CALL
-ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException)
-{
- uno::Any aValue;
- aValue = m_xProps->getPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) );
- sal_Bool bRet = false;
- aValue >>= bRet;
- return bRet;
-}
-
-void SAL_CALL
-ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException)
-{
- uno::Any aValue( _multiline );
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
-}
diff --git a/scratch/sc-vba/dead-source/vbatextbox.hxx b/scratch/sc-vba/dead-source/vbatextbox.hxx
deleted file mode 100644
index 32da356d5..000000000
--- a/scratch/sc-vba/dead-source/vbatextbox.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_TEXTBOX_HXX
-#define SC_VBA_TEXTBOX_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/msforms/XTextBox.hpp>
-#include "vbacontrol.hxx"
-#include "vbahelper.hxx"
-
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XTextBox > TextBoxImpl_BASE;
-
-class ScVbaTextBox : public TextBoxImpl_BASE
-{
-public:
- ScVbaTextBox( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::drawing::XControlShape >& xControlShape );
- // Attributes
- virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxLength() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException);
-
-};
-#endif //SC_VBA_TEXTBOX_HXX
diff --git a/scratch/sc-vba/dead-source/vbatextframe.cxx b/scratch/sc-vba/dead-source/vbatextframe.cxx
deleted file mode 100644
index 7d1c0afb8..000000000
--- a/scratch/sc-vba/dead-source/vbatextframe.cxx
+++ /dev/null
@@ -1,178 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbatextframe.cxx,v $
- *
- * $Revision: 1.1.2.4 $
- *
- * last change: $Author: npower $ $Date: 2007/07/23 11:47:24 $
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/drawing/TextFitToSizeType.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include "vbatextframe.hxx"
-#include "vbacharacters.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-ScVbaTextFrame::ScVbaTextFrame( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape ) : ScVbaTextFrame_BASE( xParent, xContext ), m_xShape( xShape )
-{
- m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
-}
-
-void
-ScVbaTextFrame::setAsMSObehavior()
-{
- //set property TextWordWrap default as False.
- // TextFitToSize control the text content. it seems we should set the default as False.
- // com.sun.star.drawing.TextFitToSizeType.NONE
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) );
-}
-
-sal_Int32 ScVbaTextFrame::getMargin( rtl::OUString sMarginType )
-{
- sal_Int32 nMargin = 0;
- uno::Any aMargin = m_xPropertySet->getPropertyValue( sMarginType );
- aMargin >>= nMargin;
- return nMargin;
-}
-
-void ScVbaTextFrame::setMargin( rtl::OUString sMarginType, float fMargin )
-{
- sal_Int32 nMargin = Millimeter::getInHundredthsOfOneMillimeter( fMargin );
- m_xPropertySet->setPropertyValue( sMarginType, uno::makeAny( nMargin ) );
-}
-
-// Attributes
-sal_Bool SAL_CALL
-ScVbaTextFrame::getAutoSize() throw (uno::RuntimeException)
-{
- // I don't know why, but in OOo, TextAutoGrowHeight is the property control autosize. not TextFitToSize.
- // TextFitToSize control the text content.
- // and in mso, there isnot option TextWordWrap which means auto wrap. the default is False.
- sal_Bool bAutosize = sal_False;
- uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ) );
- aTextAutoGrowHeight >>= bAutosize;
- return bAutosize;
-}
-
-void SAL_CALL
-ScVbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException)
-{
- setAsMSObehavior();
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) );
-}
-
-float SAL_CALL
-ScVbaTextFrame::getMarginBottom() throw (uno::RuntimeException)
-{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) );
- float fMargin = (float)Millimeter::getInPoints( nMargin );
- return fMargin;
-}
-
-void SAL_CALL
-ScVbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException)
-{
- setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom );
-}
-
-float SAL_CALL
-ScVbaTextFrame::getMarginTop() throw (uno::RuntimeException)
-{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) );
- float fMargin = (float)Millimeter::getInPoints( nMargin );
- return fMargin;
-}
-
-void SAL_CALL
-ScVbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException)
-{
- setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop );
-}
-
-float SAL_CALL
-ScVbaTextFrame::getMarginLeft() throw (uno::RuntimeException)
-{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) );
- float fMargin = (float)Millimeter::getInPoints( nMargin );
- return fMargin;
-}
-
-void SAL_CALL
-ScVbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException)
-{
- setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft );
-}
-
-float SAL_CALL
-ScVbaTextFrame::getMarginRight() throw (uno::RuntimeException)
-{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) );
- float fMargin = (float)Millimeter::getInPoints( nMargin );
- return fMargin;
-}
-
-void SAL_CALL
-ScVbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException)
-{
- setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright );
-}
-
-
-// Methods
-uno::Reference< oo::excel::XCharacters > SAL_CALL
-ScVbaTextFrame::Characters() throw (uno::RuntimeException)
-{
- uno::Reference< text::XSimpleText > xSimpleText( m_xShape, uno::UNO_QUERY_THROW );
- ScVbaPalette aPalette( SfxObjectShell::Current() );
- uno::Any aStart( sal_Int32( 1 ) );
- uno::Any aLength(sal_Int32( -1 ) );
- return uno::Reference< oo::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) );
-}
-
-rtl::OUString&
-ScVbaTextFrame::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextFrame") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaTextFrame::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.TextFrame" ) );
- }
- return aServiceNames;
-}
-
diff --git a/scratch/sc-vba/dead-source/vbatextframe.hxx b/scratch/sc-vba/dead-source/vbatextframe.hxx
deleted file mode 100644
index 293fd9dc8..000000000
--- a/scratch/sc-vba/dead-source/vbatextframe.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_TEXTFRAME_HXX
-#define SC_VBA_TEXTFRAME_HXX
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/excel/XCharacters.hpp>
-#include <org/openoffice/excel/XTextFrame.hpp>
-
-#include "vbahelperinterface.hxx"
-#include "vbapalette.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XTextFrame > ScVbaTextFrame_BASE;
-
-class ScVbaTextFrame : public ScVbaTextFrame_BASE
-{
-private:
- css::uno::Reference< oo::excel::XCharacters > m_xCharacters;
- css::uno::Reference< css::drawing::XShape > m_xShape;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- virtual void setAsMSObehavior();
- sal_Int32 getMargin( rtl::OUString sMarginType );
- void setMargin( rtl::OUString sMarginType, float fMargin );
-public:
- ScVbaTextFrame( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > xShape);
- virtual ~ScVbaTextFrame() {}
- // Attributes
- virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setAutoSize( sal_Bool _autosize ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL getMarginBottom() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMarginBottom( float _marginbottom ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL getMarginTop() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMarginTop( float _margintop ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL getMarginLeft() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMarginLeft( float _marginleft ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL getMarginRight() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMarginRight( float _marginright ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual css::uno::Reference< oo::excel::XCharacters > SAL_CALL Characters( ) throw (css::uno::RuntimeException);
-
-};
-
-#endif//SC_VBA_TEXTFRAME_HXX
diff --git a/scratch/sc-vba/dead-source/vbatitle.hxx b/scratch/sc-vba/dead-source/vbatitle.hxx
deleted file mode 100644
index 39605c58f..000000000
--- a/scratch/sc-vba/dead-source/vbatitle.hxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_TITLE_HXX
-#define SC_VBA_TITLE_HXX
-
-#include "vbahelperinterface.hxx"
-#include "vbahelper.hxx"
-#include "vbainterior.hxx"
-#include "vbafont.hxx"
-#include "vbapalette.hxx"
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/excel/XTitle.hpp>
-#include <basic/sberrors.hxx>
-#include <memory>
-
-template< typename Ifc1 >
-class TitleImpl : public InheritedHelperInterfaceImpl< Ifc1 >
-{
-typedef InheritedHelperInterfaceImpl< Ifc1 > BaseClass;
-
-protected:
- css::uno::Reference< css::drawing::XShape > xTitleShape;
- css::uno::Reference< css::beans::XPropertySet > xShapePropertySet;
- std::auto_ptr<oo::ShapeHelper> oShapeHelper;
- ScVbaPalette m_Palette;
-public:
- TitleImpl( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& _xTitleShape ) : BaseClass( xParent, xContext ), xTitleShape( _xTitleShape )
- {
- xShapePropertySet.set( xTitleShape, css::uno::UNO_QUERY_THROW );
- oShapeHelper.reset( new oo::ShapeHelper(xTitleShape) );
- }
- css::uno::Reference< oo::excel::XInterior > SAL_CALL Interior( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- // #TODO find out what the proper parent should be
- // leaving as set by the helperapi for the moment
- // #TODO we really need the ScDocument to pass to ScVbaInterior
- // otherwise attemps to access the palette will fail
- return new ScVbaInterior( BaseClass::mxParent, BaseClass::mxContext, xShapePropertySet );
- }
- css::uno::Reference< oo::excel::XFont > SAL_CALL Font( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- // #TODO find out what the proper parent should be
- // leaving as set by the helperapi for the moment
- return new ScVbaFont( BaseClass::mxParent, BaseClass::mxContext, m_Palette, xShapePropertySet );
-
- }
- void SAL_CALL setText( const ::rtl::OUString& Text ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- try
- {
- xShapePropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("String") ), css::uno::makeAny( Text ));
- }
- catch ( css::uno::Exception& )
- {
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- }
- ::rtl::OUString SAL_CALL getText( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- ::rtl::OUString sText;
- try
- {
- xShapePropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("String") ) ) >>= sText;
- }
- catch ( css::uno::Exception& )
- {
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return sText;
- }
-
- css::uno::Reference< oo::excel::XCharacters > SAL_CALL Characters( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- // #FIXME #TODO the helperapi Characters implementation doesn't
- // seem to do very much, need to know how the existing Characters
- // impl ( that we use for Range ) can be reused
- return css::uno::Reference< oo::excel::XCharacters > ();
- }
-
- void SAL_CALL setTop( double Top ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- oShapeHelper->setTop( Top );
- }
- double SAL_CALL getTop( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- return oShapeHelper->getTop();
- }
- void SAL_CALL setLeft( double Left ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- oShapeHelper->setLeft( Left );
- }
- double SAL_CALL getLeft( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- return oShapeHelper->getLeft();
- }
- void SAL_CALL setOrientation( ::sal_Int32 _nOrientation ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- try
- {
- xShapePropertySet->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextRotation")), css::uno::makeAny(_nOrientation*100));
- }
- catch (css::uno::Exception& )
- {
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- }
- ::sal_Int32 SAL_CALL getOrientation( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
- sal_Int32 nSOOrientation = 0;
- try
- {
- xShapePropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextRotation"))) >>= nSOOrientation;
- }
- catch (css::uno::Exception& )
- {
- throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
- }
- return static_cast< sal_Int32 >(nSOOrientation / 100) ;
- }
-// XHelperInterface
- rtl::OUString& getServiceImplName()
- {
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("TitleImpl") );
- return sImplName;
- }
- css::uno::Sequence< rtl::OUString > getServiceNames()
- {
- static css::uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.XTitle" ) );
- }
- return aServiceNames;
- }
-};
-#endif
diff --git a/scratch/sc-vba/dead-source/vbavalidation.cxx b/scratch/sc-vba/dead-source/vbavalidation.cxx
deleted file mode 100644
index 0a343aeea..000000000
--- a/scratch/sc-vba/dead-source/vbavalidation.cxx
+++ /dev/null
@@ -1,341 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbavalidation.hxx"
-#include <com/sun/star/sheet/XSheetCondition.hpp>
-#include <com/sun/star/sheet/ValidationType.hpp>
-#include <com/sun/star/sheet/ValidationAlertStyle.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/excel/XlDVType.hpp>
-#include <org/openoffice/excel/XlFormatConditionOperator.hpp>
-#include <org/openoffice/excel/XlDVAlertStyle.hpp>
-
-#include "unonames.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-const static rtl::OUString VALIDATION( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_VALIDAT ) );
-const static rtl::OUString IGNOREBLANK( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_IGNOREBL ) );
-const static rtl::OUString SHOWINPUT( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHOWINP ) );
-const static rtl::OUString SHOWERROR( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHOWERR ) );
-const static rtl::OUString ERRORTITLE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ERRTITLE ) );
-const static rtl::OUString INPUTTITLE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_INPTITLE ) );
-const static rtl::OUString INPUTMESS( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_INPMESS ) );
-const static rtl::OUString ERRORMESS( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ERRMESS ) );
-const static rtl::OUString STYPE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_TYPE ) );
-const static rtl::OUString SHOWLIST( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHOWLIST ) );
-const static rtl::OUString ALERTSTYLE( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ERRALSTY ) );
-
-void
-lcl_setValidationProps( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< beans::XPropertySet >& xProps )
-{
- uno::Reference< beans::XPropertySet > xRangeProps( xRange, uno::UNO_QUERY_THROW );
- xRangeProps->setPropertyValue( VALIDATION , uno::makeAny( xProps ) );
-}
-
-uno::Reference< beans::XPropertySet >
-lcl_getValidationProps( const uno::Reference< table::XCellRange >& xRange )
-{
- uno::Reference< beans::XPropertySet > xProps( xRange, uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xValProps;
- xValProps.set( xProps->getPropertyValue( VALIDATION ), uno::UNO_QUERY_THROW );
- return xValProps;
-}
-
-::sal_Bool SAL_CALL
-ScVbaValidation::getIgnoreBlank() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- sal_Bool bBlank = sal_False;
- xProps->getPropertyValue( IGNOREBLANK ) >>= bBlank;
- return bBlank;
-}
-
-void SAL_CALL
-ScVbaValidation::setIgnoreBlank( ::sal_Bool _ignoreblank ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- xProps->setPropertyValue( IGNOREBLANK, uno::makeAny( _ignoreblank ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::sal_Bool SAL_CALL
-ScVbaValidation::getInCellDropdown() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange );
- sal_Int32 nShowList = 0;
- xProps->getPropertyValue( SHOWLIST ) >>= nShowList;
- return ( nShowList ? sal_True : sal_False );
-}
-
-void SAL_CALL
-ScVbaValidation::setInCellDropdown( ::sal_Bool _incelldropdown ) throw (uno::RuntimeException)
-{
- sal_Int32 nDropDown = sal_False;
- if ( _incelldropdown )
- nDropDown = 1;
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps(m_xRange) );
- xProps->setPropertyValue( SHOWLIST, uno::makeAny( nDropDown ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::sal_Bool SAL_CALL
-ScVbaValidation::getShowInput() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange );
- sal_Bool bShowInput = sal_False;
- xProps->getPropertyValue( SHOWINPUT ) >>= bShowInput;
- return bShowInput;
-}
-
-void SAL_CALL
-ScVbaValidation:: setShowInput( ::sal_Bool _showinput ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps(m_xRange) );
- xProps->setPropertyValue( IGNOREBLANK, uno::makeAny( _showinput ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::sal_Bool SAL_CALL
-ScVbaValidation::getShowError() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange );
- sal_Bool bShowError = sal_False;
- xProps->getPropertyValue( SHOWERROR ) >>= bShowError;
- return bShowError;
-}
-
-void SAL_CALL
-ScVbaValidation::setShowError( ::sal_Bool _showerror ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- xProps->setPropertyValue( SHOWERROR, uno::makeAny( _showerror ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaValidation::getErrorTitle() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange );
- rtl::OUString sErrorTitle;
- xProps->getPropertyValue( ERRORTITLE ) >>= sErrorTitle;
- return sErrorTitle;
-}
-
-void
-ScVbaValidation::setErrorTitle( const rtl::OUString& _errormessage ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- xProps->setPropertyValue( ERRORTITLE, uno::makeAny( _errormessage ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaValidation::getInputMessage() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange );
- rtl::OUString sMsg;
- xProps->getPropertyValue( INPUTMESS ) >>= sMsg;
- return sMsg;
-}
-
-void SAL_CALL
-ScVbaValidation::setInputMessage( const ::rtl::OUString& _inputmessage ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- xProps->setPropertyValue( INPUTMESS, uno::makeAny( _inputmessage ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaValidation::getInputTitle() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange );
- rtl::OUString sString;
- xProps->getPropertyValue( INPUTTITLE ) >>= sString;
- return sString;
-}
-
-void SAL_CALL
-ScVbaValidation::setInputTitle( const ::rtl::OUString& _inputtitle ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- xProps->setPropertyValue( INPUTTITLE, uno::makeAny( _inputtitle ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaValidation::getErrorMessage() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps = lcl_getValidationProps( m_xRange );
- rtl::OUString sString;
- xProps->getPropertyValue( ERRORMESS ) >>= sString;
- return sString;
-}
-
-void SAL_CALL
-ScVbaValidation::setErrorMessage( const ::rtl::OUString& _errormessage ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- xProps->setPropertyValue( ERRORMESS, uno::makeAny( _errormessage ) );
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-
-void SAL_CALL
-ScVbaValidation::Delete( ) throw (uno::RuntimeException)
-{
- rtl::OUString sBlank;
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- uno::Reference< sheet::XSheetCondition > xCond( xProps, uno::UNO_QUERY_THROW );
- xProps->setPropertyValue( IGNOREBLANK, uno::makeAny( sal_True ) );
- xProps->setPropertyValue( SHOWINPUT, uno::makeAny( sal_True ) );
- xProps->setPropertyValue( SHOWERROR, uno::makeAny( sal_True ) );
- xProps->setPropertyValue( ERRORTITLE, uno::makeAny( sBlank ) );
- xProps->setPropertyValue( INPUTMESS, uno::makeAny( sBlank) );
- xProps->setPropertyValue( ALERTSTYLE, uno::makeAny( sheet::ValidationAlertStyle_STOP) );
- xProps->setPropertyValue( STYPE, uno::makeAny( sheet::ValidationType_ANY ) );
- xCond->setFormula1( sBlank );
- xCond->setFormula2( sBlank );
- xCond->setOperator( sheet::ConditionOperator_NONE );
-
- lcl_setValidationProps( m_xRange, xProps );
-}
-void SAL_CALL
-ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& /*Operator*/, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- uno::Reference< sheet::XSheetCondition > xCond( xProps, uno::UNO_QUERY_THROW );
-
- sheet::ValidationType nValType = sheet::ValidationType_ANY;
- xProps->getPropertyValue( STYPE ) >>= nValType;
- if ( nValType != sheet::ValidationType_ANY )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "validation object already exists" ) ), uno::Reference< uno::XInterface >() );
- sal_Int32 nType = -1;
- if ( !Type.hasValue() || !( Type >>= nType ) )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "missing required param" ) ), uno::Reference< uno::XInterface >() );
-
- Delete(); // set up defaults
- rtl::OUString sFormula1;
- Formula1 >>= sFormula1;
- rtl::OUString sFormula2;
- Formula2 >>= sFormula2;
- switch ( nType )
- {
- case excel::XlDVType::xlValidateList:
- {
- // for validate list
- // at least formula1 is required
- if ( !Formula1.hasValue() )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "missing param" ) ), uno::Reference< uno::XInterface >() );
- nValType = sheet::ValidationType_LIST;
- xProps->setPropertyValue( STYPE, uno::makeAny(nValType ));
- // #TODO validate required params
- // #TODO need to correct the ';' delimited formula on get/set
- break;
- }
- case excel::XlDVType::xlValidateWholeNumber:
- nValType = sheet::ValidationType_WHOLE;
- xProps->setPropertyValue( STYPE, uno::makeAny(nValType ));
- break;
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unsupported operation..." ) ), uno::Reference< uno::XInterface >() );
- }
-
- sheet::ValidationAlertStyle eStyle = sheet::ValidationAlertStyle_STOP;
- sal_Int32 nVbaAlertStyle = excel::XlDVAlertStyle::xlValidAlertStop;
- if ( AlertStyle.hasValue() && ( AlertStyle >>= nVbaAlertStyle ) )
- {
- switch( nVbaAlertStyle )
- {
- case excel::XlDVAlertStyle::xlValidAlertStop:
- // yes I know it's already defaulted but safer to assume
- // someone propbably could change the code above
- eStyle = sheet::ValidationAlertStyle_STOP;
- break;
- case excel::XlDVAlertStyle::xlValidAlertWarning:
- eStyle = sheet::ValidationAlertStyle_WARNING;
- break;
- case excel::XlDVAlertStyle::xlValidAlertInformation:
- eStyle = sheet::ValidationAlertStyle_INFO;
- break;
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bad param..." ) ), uno::Reference< uno::XInterface >() );
-
- }
- }
-
- xProps->setPropertyValue( ALERTSTYLE, uno::makeAny( eStyle ) );
-
- if ( sFormula1.getLength() )
- xCond->setFormula1( sFormula1 );
- if ( sFormula2.getLength() )
- xCond->setFormula2( sFormula2 );
-
- lcl_setValidationProps( m_xRange, xProps );
-}
-
-::rtl::OUString SAL_CALL
-ScVbaValidation::getFormula1() throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XSheetCondition > xCond( lcl_getValidationProps( m_xRange ), uno::UNO_QUERY_THROW );
- return xCond->getFormula1();
-}
-
-::rtl::OUString SAL_CALL
-ScVbaValidation::getFormula2() throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XSheetCondition > xCond( lcl_getValidationProps( m_xRange ), uno::UNO_QUERY_THROW );
- return xCond->getFormula2();
-}
-
-rtl::OUString&
-ScVbaValidation::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaValidation") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaValidation::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Validation" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbavalidation.hxx b/scratch/sc-vba/dead-source/vbavalidation.hxx
deleted file mode 100644
index 3a4d0f483..000000000
--- a/scratch/sc-vba/dead-source/vbavalidation.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_VALIDATION_HXX
-#define SC_VBA_VALIDATION_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <org/openoffice/excel/XValidation.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1<oo::excel::XValidation > ValidationImpl_BASE;
-
-class ScVbaValidation : public ValidationImpl_BASE
-{
- css::uno::Reference< css::table::XCellRange > m_xRange;
-
-public:
- ScVbaValidation( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XCellRange >& xRange ) : ValidationImpl_BASE( xParent, xContext ), m_xRange( xRange) {}
- // Attributes
- virtual ::sal_Bool SAL_CALL getIgnoreBlank() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setIgnoreBlank( ::sal_Bool _ignoreblank ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getInCellDropdown() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setInCellDropdown( ::sal_Bool _incelldropdown ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getShowInput() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setShowInput( ::sal_Bool _showinput ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getShowError() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setShowError( ::sal_Bool _showerror ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getInputTitle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setInputTitle( const ::rtl::OUString& _inputtitle ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getErrorTitle() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setErrorTitle( const ::rtl::OUString& _errortitle ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getInputMessage() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setInputMessage( const ::rtl::OUString& _inputmessage ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getErrorMessage() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setErrorMessage( const ::rtl::OUString& _errormessage ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getFormula1() throw (css::uno::RuntimeException) ;
- virtual ::rtl::OUString SAL_CALL getFormula2() throw (css::uno::RuntimeException);
- // Methods
- virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& AlertStyle, const css::uno::Any& Operator, const css::uno::Any& Formula1, const css::uno::Any& Formula2 ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-
-#endif
diff --git a/scratch/sc-vba/dead-source/vbawindow.cxx b/scratch/sc-vba/dead-source/vbawindow.cxx
deleted file mode 100644
index 957b9bd2b..000000000
--- a/scratch/sc-vba/dead-source/vbawindow.cxx
+++ /dev/null
@@ -1,944 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbawindow.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbawindow.hxx"
-#include "vbaworksheets.hxx"
-#include "vbaworksheet.hxx"
-#include "vbapane.hxx"
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/view/DocumentZoomType.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <org/openoffice/excel/XlWindowState.hpp>
-#include <org/openoffice/excel/XlWindowView.hpp>
-#include <org/openoffice/excel/Constants.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/XWindow2.hpp>
-#include <com/sun/star/awt/PosSize.hpp>
-
-#include <docsh.hxx>
-#include <tabvwsh.hxx>
-#include <docuno.hxx>
-#include <sc.hrc>
-#include <hash_map>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/topfrm.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-using namespace ::org::openoffice::excel::XlWindowState;
-#define SHOWGRID "ShowGrid"
-#define HASVERTSCROLLBAR "HasVerticalScrollBar"
-#define HASHORIZSCROLLBAR "HasHorizontalScrollBar"
-
-typedef std::hash_map< rtl::OUString,
-SCTAB, ::rtl::OUStringHash,
-::std::equal_to< ::rtl::OUString > > NameIndexHash;
-
-typedef std::vector < uno::Reference< sheet::XSpreadsheet > > Sheets;
-
-typedef ::cppu::WeakImplHelper1< container::XEnumeration
-
-> Enumeration_BASE;
-
-typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess
- , com::sun::star::container::XIndexAccess
- , com::sun::star::container::XNameAccess
- > SelectedSheets_BASE;
-
-
-class SelectedSheetsEnum : public Enumeration_BASE
-{
-public:
- uno::Reference< uno::XComponentContext > m_xContext;
- Sheets m_sheets;
- uno::Reference< frame::XModel > m_xModel;
- Sheets::const_iterator m_it;
-
- SelectedSheetsEnum( const uno::Reference< uno::XComponentContext >& xContext, const Sheets& sheets, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_sheets( sheets ), m_xModel( xModel )
- {
- m_it = m_sheets.begin();
- }
- // XEnumeration
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return m_it != m_sheets.end();
- }
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( !hasMoreElements() )
- {
- throw container::NoSuchElementException();
- }
- // #FIXME needs ThisWorkbook as parent
- return uno::makeAny( uno::Reference< excel::XWorksheet > ( new ScVbaWorksheet( uno::Reference< vba::XHelperInterface >(), m_xContext, *(m_it++), m_xModel ) ) );
- }
-
-
-};
-
-class SelectedSheetsEnumAccess : public SelectedSheets_BASE
-{
- uno::Reference< uno::XComponentContext > m_xContext;
- NameIndexHash namesToIndices;
- Sheets sheets;
- uno::Reference< frame::XModel > m_xModel;
-public:
- SelectedSheetsEnumAccess( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ):m_xContext( xContext ), m_xModel( xModel )
- {
- ScModelObj* pModel = static_cast< ScModelObj* >( m_xModel.get() );
- if ( !pModel )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain current document" ) ), uno::Reference< uno::XInterface >() );
- ScDocShell* pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
- if ( !pDocShell )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain docshell" ) ), uno::Reference< uno::XInterface >() );
- ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
- if ( !pViewShell )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() );
-
- SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
- uno::Sequence<sal_Int32> aSheets( nTabCount );
- SCTAB nIndex = 0;
- const ScMarkData& rMarkData = pViewShell->GetViewData()->GetMarkData();
- sheets.reserve( nTabCount );
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadSheet( m_xModel, uno::UNO_QUERY_THROW );
- uno::Reference <container::XIndexAccess> xIndex( xSpreadSheet->getSheets(), uno::UNO_QUERY_THROW );
- for ( SCTAB nTab=0; nTab<nTabCount; nTab++ )
- {
- if ( rMarkData.GetTableSelect(nTab) )
- {
- uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex( nTab ), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
- sheets.push_back( xSheet );
- namesToIndices[ xNamed->getName() ] = nIndex++;
- }
- }
-
- }
-
- //XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
- {
- return new SelectedSheetsEnum( m_xContext, sheets, m_xModel );
- }
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
- {
- return sheets.size();
- }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( Index < 0
- || static_cast< Sheets::size_type >( Index ) >= sheets.size() )
- throw lang::IndexOutOfBoundsException();
-
- return uno::makeAny( sheets[ Index ] );
- }
-
- //XElementAccess
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
- {
- return excel::XWorksheet::static_type(0);
- }
-
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
- {
- return (sheets.size() > 0);
- }
-
- //XNameAccess
- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- NameIndexHash::const_iterator it = namesToIndices.find( aName );
- if ( it == namesToIndices.end() )
- throw container::NoSuchElementException();
- return uno::makeAny( sheets[ it->second ] );
-
- }
-
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
- {
- uno::Sequence< ::rtl::OUString > names( namesToIndices.size() );
- ::rtl::OUString* pString = names.getArray();
- NameIndexHash::const_iterator it = namesToIndices.begin();
- NameIndexHash::const_iterator it_end = namesToIndices.end();
- for ( ; it != it_end; ++it, ++pString )
- *pString = it->first;
- return names;
- }
-
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
- {
- NameIndexHash::const_iterator it = namesToIndices.find( aName );
- return (it != namesToIndices.end());
- }
-
-
-};
-
-ScVbaWindow::ScVbaWindow( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext ), m_xModel( xModel )
-{
- uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- m_xViewPane.set( xController, uno::UNO_QUERY_THROW );
- m_xViewFreezable.set( xController, uno::UNO_QUERY_THROW );
- m_xViewSplitable.set( xController, uno::UNO_QUERY_THROW );
- m_xPane.set( ActivePane(), uno::UNO_QUERY_THROW );
- m_xDevice.set( xController->getFrame()->getComponentWindow(), uno::UNO_QUERY_THROW );
-}
-
-
-void
-ScVbaWindow::Scroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft, bool bLargeScroll ) throw (uno::RuntimeException)
-{
- if( bLargeScroll )
- m_xPane->LargeScroll( Down, Up, ToRight, ToLeft );
- else
- m_xPane->SmallScroll( Down, Up, ToRight, ToLeft );
-}
-void SAL_CALL
-ScVbaWindow::SmallScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException)
-{
- Scroll( Down, Up, ToRight, ToLeft );
-}
-void SAL_CALL
-ScVbaWindow::LargeScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException)
-{
- Scroll( Down, Up, ToRight, ToLeft, true );
-}
-
-uno::Any SAL_CALL
-ScVbaWindow::SelectedSheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< container::XEnumerationAccess > xEnumAccess( new SelectedSheetsEnumAccess( mxContext, m_xModel ) );
- // #FIXME needs a workbook as a parent
- uno::Reference< excel::XWorksheets > xSheets( new ScVbaWorksheets( uno::Reference< vba::XHelperInterface >(), mxContext, xEnumAccess, m_xModel ) );
- if ( aIndex.hasValue() )
- {
- uno::Reference< vba::XCollection > xColl( xSheets, uno::UNO_QUERY_THROW );
- return xColl->Item( aIndex, uno::Any() );
- }
- return uno::makeAny( xSheets );
-}
-
-void SAL_CALL
-ScVbaWindow::ScrollWorkbookTabs( const uno::Any& /*Sheets*/, const uno::Any& /*Position*/ ) throw (uno::RuntimeException)
-{
-// #TODO #FIXME need some implementation to scroll through the tabs
-// but where is this done?
-/*
- sal_Int32 nSheets = 0;
- sal_Int32 nPosition = 0;
- throw uno::RuntimeException( rtl::OUString::createFromAscii("No Implemented" ), uno::Reference< uno::XInterface >() );
- sal_Bool bSheets = ( Sheets >>= nSheets );
- sal_Bool bPosition = ( Position >>= nPosition );
- if ( bSheets || bPosition ) // at least one param specified
- if ( bSheets )
- ;// use sheets
- else if ( bPosition )
- ; //use position
-*/
-
-}
-uno::Reference< beans::XPropertySet >
-getPropsFromModel( const uno::Reference< frame::XModel >& xModel )
-{
- uno::Reference< frame::XController > xController = xModel->getCurrentController();
- if ( !xController.is() )
- throw uno::RuntimeException( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM ("No controller for model") ), uno::Reference< uno::XInterface >() );
- return uno::Reference< beans::XPropertySet >( xController->getFrame(), uno::UNO_QUERY );
-}
-
-
-uno::Any SAL_CALL
-ScVbaWindow::getCaption() throw (uno::RuntimeException)
-{
- static rtl::OUString sCrud(RTL_CONSTASCII_USTRINGPARAM(" - OpenOffice.org Calc" ) );
- static sal_Int32 nCrudLen = sCrud.getLength();
-
- uno::Reference< beans::XPropertySet > xProps = getPropsFromModel( m_xModel );
- rtl::OUString sTitle;
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("Title") ) ) >>= sTitle;
- sal_Int32 nCrudIndex = sTitle.indexOf( sCrud );
- // adjust title ( by removing crud )
- // sCrud string present
- if ( nCrudIndex != -1 )
- {
- // and ends with sCrud
- if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() )
- {
- sTitle = sTitle.copy( 0, nCrudIndex );
- ScVbaWorkbook workbook( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
- rtl::OUString sName = workbook.getName();
- // rather bizare hack to make sure the name behavior
- // is like XL
- // if the adjusted title == workbook name, use name
- // if the adjusted title != workbook name but ...
- // name == title + extension ( .csv, ,odt, .xls )
- // etc. then also use the name
-
- if ( !sTitle.equals( sName ) )
- {
- static rtl::OUString sDot( RTL_CONSTASCII_USTRINGPARAM(".") );
- // starts with title
- if ( sName.indexOf( sTitle ) == 0 )
- // extention starts immediately after
- if ( sName.match( sDot, sTitle.getLength() ) )
- sTitle = sName;
- }
- }
- }
- return uno::makeAny( sTitle );
-}
-
-void SAL_CALL
-ScVbaWindow::setCaption( const uno::Any& _caption ) throw (uno::RuntimeException)
-{
-
- uno::Reference< beans::XPropertySet > xProps = getPropsFromModel( m_xModel );
- xProps->setPropertyValue( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM ("Title") ) , _caption );
-}
-
-uno::Any SAL_CALL
-ScVbaWindow::getScrollRow() throw (uno::RuntimeException)
-{
- sal_Int32 nValue = 0;
- ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
- if ( pViewShell )
- {
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- nValue = pViewShell->GetViewData()->GetPosY(WhichV(eWhich));
- }
-
- return uno::makeAny( nValue + 1);
-}
-
-void SAL_CALL
-ScVbaWindow::setScrollRow( const uno::Any& _scrollrow ) throw (uno::RuntimeException)
-{
- ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
- if ( pViewShell )
- {
- sal_Int32 scrollRow = 0;
- _scrollrow >>= scrollRow;
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- sal_Int32 nOldValue = pViewShell->GetViewData()->GetPosY(WhichV(eWhich)) + 1;
- pViewShell->ScrollLines(0, scrollRow - nOldValue);
- }
-}
-
-uno::Any SAL_CALL
-ScVbaWindow::getScrollColumn() throw (uno::RuntimeException)
-{
- sal_Int32 nValue = 0;
- ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
- if ( pViewShell )
- {
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- nValue = pViewShell->GetViewData()->GetPosX(WhichH(eWhich));
- }
-
- return uno::makeAny( nValue + 1);
-}
-
-void SAL_CALL
-ScVbaWindow::setScrollColumn( const uno::Any& _scrollcolumn ) throw (uno::RuntimeException)
-{
- ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
- if ( pViewShell )
- {
- sal_Int32 scrollColumn = 0;
- _scrollcolumn >>= scrollColumn;
- ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
- sal_Int32 nOldValue = pViewShell->GetViewData()->GetPosX(WhichH(eWhich)) + 1;
- pViewShell->ScrollLines(scrollColumn - nOldValue, 0);
- }
-}
-
-uno::Any SAL_CALL
-ScVbaWindow::getWindowState() throw (uno::RuntimeException)
-{
- sal_Int32 nwindowState = xlNormal;
- ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
- SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
- SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
- if ( pTop )
- {
- WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
- if ( pWork )
- {
- if ( pWork -> IsMaximized())
- nwindowState = xlMaximized;
- else if (pWork -> IsMinimized())
- nwindowState = xlMinimized;
- }
- }
- return uno::makeAny( nwindowState );
-}
-
-void SAL_CALL
-ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException)
-{
- sal_Int32 nwindowState = xlMaximized;
- _windowstate >>= nwindowState;
- ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
- SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
- SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
- if ( pTop )
- {
- WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
- if ( pWork )
- {
- if ( nwindowState == xlMaximized)
- pWork -> Maximize();
- else if (nwindowState == xlMinimized)
- pWork -> Minimize();
- else if (nwindowState == xlNormal)
- pWork -> Restore();
- else
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() );
- }
- }
-}
-
-void
-ScVbaWindow::Activate() throw (css::uno::RuntimeException)
-{
- ScVbaWorkbook workbook( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
-
- workbook.Activate();
-}
-
-void
-ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException)
-{
- ScVbaWorkbook workbook( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
- workbook.Close(SaveChanges, FileName, RouteWorkBook );
-}
-
-uno::Reference< excel::XPane > SAL_CALL
-ScVbaWindow::ActivePane() throw (script::BasicErrorException, uno::RuntimeException)
-{
- return new ScVbaPane( mxContext, m_xViewPane );
-}
-
-uno::Reference< excel::XRange > SAL_CALL
-ScVbaWindow::ActiveCell( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->getActiveCell();
-}
-
-uno::Any SAL_CALL
-ScVbaWindow::Selection( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->getSelection();
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getDisplayGridlines() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SHOWGRID ) );
- sal_Bool bGrid = sal_True;
- xProps->getPropertyValue( sName ) >>= bGrid;
- return bGrid;
-}
-
-
-void SAL_CALL
-ScVbaWindow::setDisplayGridlines( ::sal_Bool _displaygridlines ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SHOWGRID ) );
- xProps->setPropertyValue( sName, uno::makeAny( _displaygridlines ));
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getDisplayHeadings() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "HasColumnRowHeaders" ) );
- sal_Bool bHeading = sal_True;
- xProps->getPropertyValue( sName ) >>= bHeading;
- return bHeading;
-}
-
-void SAL_CALL
-ScVbaWindow::setDisplayHeadings( ::sal_Bool _bDisplayHeadings ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "HasColumnRowHeaders" ) );
- xProps->setPropertyValue( sName, uno::makeAny( _bDisplayHeadings ));
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getDisplayHorizontalScrollBar() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( HASHORIZSCROLLBAR ) );
- sal_Bool bHorizontalScrollBar = sal_True;
- xProps->getPropertyValue( sName ) >>= bHorizontalScrollBar;
- return bHorizontalScrollBar;
-}
-
-void SAL_CALL
-ScVbaWindow::setDisplayHorizontalScrollBar( ::sal_Bool _bDisplayHorizontalScrollBar ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( HASHORIZSCROLLBAR ) );
- xProps->setPropertyValue( sName, uno::makeAny( _bDisplayHorizontalScrollBar ));
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getDisplayOutline() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "IsOutlineSymbolsSet" ) );
- sal_Bool bOutline = sal_True;
- xProps->getPropertyValue( sName ) >>= bOutline;
- return bOutline;
-}
-
-void SAL_CALL
-ScVbaWindow::setDisplayOutline( ::sal_Bool _bDisplayOutline ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "IsOutlineSymbolsSet" ) );
- xProps->setPropertyValue( sName, uno::makeAny( _bDisplayOutline ));
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getDisplayVerticalScrollBar() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( HASVERTSCROLLBAR ) );
- sal_Bool bVerticalScrollBar = sal_True;
- xProps->getPropertyValue( sName ) >>= bVerticalScrollBar;
- return bVerticalScrollBar;
-}
-
-void SAL_CALL
-ScVbaWindow::setDisplayVerticalScrollBar( ::sal_Bool _bDisplayVerticalScrollBar ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( HASVERTSCROLLBAR ) );
- xProps->setPropertyValue( sName, uno::makeAny( _bDisplayVerticalScrollBar ));
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getDisplayWorkbookTabs() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "HasSheetTabs" ) );
- sal_Bool bWorkbookTabs = sal_True;
- xProps->getPropertyValue( sName ) >>= bWorkbookTabs;
- return bWorkbookTabs;
-}
-
-void SAL_CALL
-ScVbaWindow::setDisplayWorkbookTabs( ::sal_Bool _bDisplayWorkbookTabs ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "HasSheetTabs" ) );
- xProps->setPropertyValue( sName, uno::makeAny( _bDisplayWorkbookTabs ));
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getFreezePanes() throw (uno::RuntimeException)
-{
- return m_xViewFreezable->hasFrozenPanes();
-}
-
-void SAL_CALL
-ScVbaWindow::setFreezePanes( ::sal_Bool _bFreezePanes ) throw (uno::RuntimeException)
-{
- if( m_xViewSplitable->getIsWindowSplit() )
- {
- // if there is a split we freeze at the split
- sal_Int32 nColumn = getSplitColumn();
- sal_Int32 nRow = getSplitRow();
- m_xViewFreezable->freezeAtPosition( nColumn, nRow );
- }
- else
- {
- // otherwise we freeze in the center of the visible sheet
- table::CellRangeAddress aCellRangeAddress = m_xViewPane->getVisibleRange();
- sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 );
- sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 );
- m_xViewFreezable->freezeAtPosition( nColumn, nRow );
- }
-}
-
-::sal_Bool SAL_CALL
-ScVbaWindow::getSplit() throw (uno::RuntimeException)
-{
- return m_xViewSplitable->getIsWindowSplit();
-}
-
-void SAL_CALL
-ScVbaWindow::setSplit( ::sal_Bool _bSplit ) throw (uno::RuntimeException)
-{
- if( !_bSplit )
- {
- m_xViewSplitable->splitAtPosition(0,0);
- }
- else
- {
- uno::Reference< excel::XRange > xRange = ActiveCell();
- sal_Int32 nRow = xRange->getRow();
- sal_Int32 nColumn = xRange->getColumn();
- m_xViewFreezable->freezeAtPosition( nColumn-1, nRow-1 );
- SplitAtDefinedPosition( sal_True );
- }
-}
-
-sal_Int32 SAL_CALL
-ScVbaWindow::getSplitColumn() throw (uno::RuntimeException)
-{
- return m_xViewSplitable->getSplitColumn();
-}
-
-void SAL_CALL
-ScVbaWindow::setSplitColumn( sal_Int32 _splitcolumn ) throw (uno::RuntimeException)
-{
- if( getSplitColumn() != _splitcolumn )
- {
- sal_Bool bFrozen = getFreezePanes();
- sal_Int32 nRow = getSplitRow();
- m_xViewFreezable->freezeAtPosition( _splitcolumn, nRow );
- SplitAtDefinedPosition( !bFrozen );
- }
-}
-
-double SAL_CALL
-ScVbaWindow::getSplitHorizontal() throw (uno::RuntimeException)
-{
- double fSplitHorizontal = m_xViewSplitable->getSplitHorizontal();
- double fHoriPoints = PixelsToPoints( m_xDevice, fSplitHorizontal, sal_True );
- return fHoriPoints;
-}
-
-void SAL_CALL
-ScVbaWindow::setSplitHorizontal( double _splithorizontal ) throw (uno::RuntimeException)
-{
- double fHoriPixels = PointsToPixels( m_xDevice, _splithorizontal, sal_True );
- m_xViewSplitable->splitAtPosition( (int) fHoriPixels, 0 );
-}
-
-sal_Int32 SAL_CALL
-ScVbaWindow::getSplitRow() throw (uno::RuntimeException)
-{
- return m_xViewSplitable->getSplitRow();
-}
-
-void SAL_CALL
-ScVbaWindow::setSplitRow( sal_Int32 _splitrow ) throw (uno::RuntimeException)
-{
- if( getSplitRow() != _splitrow )
- {
- sal_Bool bFrozen = getFreezePanes();
- sal_Int32 nColumn = getSplitColumn();
- m_xViewFreezable->freezeAtPosition( nColumn , _splitrow );
- SplitAtDefinedPosition( !bFrozen );
- }
-}
-
-double SAL_CALL
-ScVbaWindow::getSplitVertical() throw (uno::RuntimeException)
-{
- double fSplitVertical = m_xViewSplitable->getSplitVertical();
- double fVertiPoints = PixelsToPoints( m_xDevice, fSplitVertical, sal_False );
- return fVertiPoints;
-}
-
-void SAL_CALL
-ScVbaWindow::setSplitVertical(double _splitvertical ) throw (uno::RuntimeException)
-{
- double fVertiPixels = PointsToPixels( m_xDevice, _splitvertical, sal_False );
- m_xViewSplitable->splitAtPosition( 0, (int) fVertiPixels );
-}
-
-void ScVbaWindow::SplitAtDefinedPosition(sal_Bool _bUnFreezePane)
-{
- sal_Int32 nVertSplit = m_xViewSplitable->getSplitVertical();
- sal_Int32 nHoriSplit = m_xViewSplitable->getSplitHorizontal();
- if( _bUnFreezePane )
- {
- m_xViewFreezable->freezeAtPosition(0,0);
- }
- m_xViewSplitable->splitAtPosition(nHoriSplit, nVertSplit);
-}
-
-uno::Any SAL_CALL
-ScVbaWindow::getZoom() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "ZoomType" ) );
- sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH;
- xProps->getPropertyValue( sName ) >>= nZoomType;
- if( nZoomType == view::DocumentZoomType::PAGE_WIDTH )
- {
- return uno::makeAny( sal_True );
- }
- else if( nZoomType == view::DocumentZoomType::BY_VALUE )
- {
- sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomValue"));
- sal_Int16 nZoom = 100;
- xProps->getPropertyValue( sName ) >>= nZoom;
- return uno::makeAny( nZoom );
- }
- return uno::Any();
-}
-
-void SAL_CALL
-ScVbaWindow::setZoom( const uno::Any& _zoom ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- rtl::OUString sZoomType( RTL_CONSTASCII_USTRINGPARAM( "ZoomType" ) );
- sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH;
- if( _zoom.getValueTypeClass() == uno::TypeClass_BOOLEAN )
- {
- //zoom type is PAGE_WIDTH_EXACT in helperapi, it seems that there is a issue for this zoom type in current OOo.
- // so PAGE_WIDTH is used.
- xProps->setPropertyValue(sZoomType, uno::makeAny( nZoomType ));
- }
- else
- {
- nZoomType = view::DocumentZoomType::BY_VALUE;
- rtl::OUString sZoomValue( RTL_CONSTASCII_USTRINGPARAM( "ZoomValue" ));
- sal_Int16 nZoomValue = 100;
- _zoom >>= nZoomValue;
- xProps->setPropertyValue( sZoomType, uno::makeAny( nZoomType ));
- xProps->setPropertyValue( sZoomValue, uno::makeAny( nZoomValue ));
- }
-}
-
-uno::Reference< excel::XWorksheet > SAL_CALL
-ScVbaWindow::ActiveSheet( ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- return ScVbaGlobals::getGlobalsImpl(mxContext)->getApplication()->getActiveSheet();
-}
-
-uno::Any SAL_CALL
-ScVbaWindow::getView() throw (uno::RuntimeException)
-{
- // not supported now
- sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;
- return uno::makeAny( nWindowView );
-}
-
-void SAL_CALL
-ScVbaWindow::setView( const uno::Any& _view) throw (uno::RuntimeException)
-{
- sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;
- _view >>= nWindowView;
- USHORT nSlot = FID_NORMALVIEWMODE;
- switch ( nWindowView )
- {
- case excel::XlWindowView::xlNormalView:
- nSlot = FID_NORMALVIEWMODE;
- break;
- case excel::XlWindowView::xlPageBreakPreview:
- nSlot = FID_PAGEBREAKMODE;
- break;
- default:
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
- }
- dispatchExecute( m_xModel, nSlot );
-}
-
-sal_Bool SAL_CALL
-ScVbaWindow::getVisible() throw (uno::RuntimeException)
-{
- sal_Bool bVisible = sal_True;
- uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow2 > xWindow2 (xWindow, uno::UNO_QUERY_THROW );
- if( xWindow2.is() )
- {
- bVisible = xWindow2->isVisible();
- }
- return bVisible;
-}
-
-void SAL_CALL
-ScVbaWindow::setVisible(sal_Bool _visible) throw (uno::RuntimeException)
-{
- uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- if( xWindow.is() )
- {
- xWindow->setVisible( _visible );
- }
-}
-
-css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel )
-{
- css::awt::Rectangle aRect;
- uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- if( xWindow.is() )
- {
- aRect = xWindow->getPosSize();
- }
- return aRect;
-}
-
-void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, USHORT nFlag )
-{
- uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
- if( xWindow.is() )
- {
- css::awt::Rectangle aRect = xWindow->getPosSize();
- switch( nFlag )
- {
- case css::awt::PosSize::X:
- xWindow->setPosSize( nValue, aRect.Y, 0, 0, css::awt::PosSize::X );
- break;
- case css::awt::PosSize::Y:
- xWindow->setPosSize( aRect.X, nValue, 0, 0, css::awt::PosSize::Y );
- break;
- case css::awt::PosSize::WIDTH:
- xWindow->setPosSize( 0, 0, nValue, aRect.Height, css::awt::PosSize::WIDTH );
- break;
- case css::awt::PosSize::HEIGHT:
- xWindow->setPosSize( 0, 0, aRect.Width, nValue, css::awt::PosSize::HEIGHT );
- break;
- default:
- break;
- }
- }
-}
-
-sal_Int32 SAL_CALL
-ScVbaWindow::getHeight() throw (uno::RuntimeException)
-{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.Height;
-}
-
-void SAL_CALL
-ScVbaWindow::setHeight( sal_Int32 _height ) throw (uno::RuntimeException)
-{
- setPosSize(m_xModel, _height, css::awt::PosSize::HEIGHT);
-}
-
-sal_Int32 SAL_CALL
-ScVbaWindow::getLeft() throw (uno::RuntimeException)
-{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.X;
-}
-
-void SAL_CALL
-ScVbaWindow::setLeft( sal_Int32 _left ) throw (uno::RuntimeException)
-{
- setPosSize(m_xModel, _left, css::awt::PosSize::X);
-}
-sal_Int32 SAL_CALL
-ScVbaWindow::getTop() throw (uno::RuntimeException)
-{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.Y;
-}
-
-void SAL_CALL
-ScVbaWindow::setTop( sal_Int32 _top ) throw (uno::RuntimeException)
-{
- setPosSize(m_xModel, _top, css::awt::PosSize::Y);
-}
-sal_Int32 SAL_CALL
-ScVbaWindow::getWidth() throw (uno::RuntimeException)
-{
- css::awt::Rectangle aRect = getPosSize(m_xModel);
- return aRect.Width;
-}
-
-void SAL_CALL
-ScVbaWindow::setWidth( sal_Int32 _width ) throw (uno::RuntimeException)
-{
- setPosSize(m_xModel, _width, css::awt::PosSize::WIDTH);
-}
-
-sal_Int32 SAL_CALL
-ScVbaWindow::PointsToScreenPixelsX(sal_Int32 _points) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- sal_Int32 nHundredthsofOneMillimeters = Millimeter::getInHundredthsOfOneMillimeter( _points );
- double fConvertFactor = (m_xDevice->getInfo().PixelPerMeterX/100000);
- return static_cast<sal_Int32>(fConvertFactor * nHundredthsofOneMillimeters );
-}
-
-sal_Int32 SAL_CALL
-ScVbaWindow::PointsToScreenPixelsY(sal_Int32 _points) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- sal_Int32 nHundredthsofOneMillimeters = Millimeter::getInHundredthsOfOneMillimeter( _points );
- double fConvertFactor = (m_xDevice->getInfo().PixelPerMeterY/100000);
- return static_cast<sal_Int32>(fConvertFactor * nHundredthsofOneMillimeters );
-}
-
-void SAL_CALL
-ScVbaWindow::PrintOut( const css::uno::Any& From, const css::uno::Any&To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- // need test, print current active sheet
- PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, m_xModel, sal_True );
-}
-
-void SAL_CALL
-ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- // need test, print preview current active sheet
- PrintPreviewHelper( EnableChanges, m_xModel );
-}
-
-rtl::OUString&
-ScVbaWindow::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWindow") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaWindow::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Window" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbawindow.hxx b/scratch/sc-vba/dead-source/vbawindow.hxx
deleted file mode 100644
index d41683fcb..000000000
--- a/scratch/sc-vba/dead-source/vbawindow.hxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbawindow.hxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_WINDOW_HXX
-#define SC_VBA_WINDOW_HXX
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/excel/XWindow.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/sheet/XViewPane.hpp>
-#include <com/sun/star/sheet/XViewFreezable.hpp>
-#include <com/sun/star/sheet/XViewSplitable.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <org/openoffice/excel/XPane.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
-
-#include "vbahelperinterface.hxx"
-#include "vbaworkbook.hxx"
-
-typedef InheritedHelperInterfaceImpl1<oo::excel::XWindow > WindowImpl_BASE;
-
-class ScVbaWindow : public WindowImpl_BASE
-{
-private:
- css::uno::Reference< css::frame::XModel > m_xModel;
- css::uno::Reference< css::sheet::XViewPane > m_xViewPane;
- css::uno::Reference< css::sheet::XViewFreezable > m_xViewFreezable;
- css::uno::Reference< css::sheet::XViewSplitable > m_xViewSplitable;
- css::uno::Reference< oo::excel::XPane > m_xPane;
- css::uno::Reference< css::awt::XDevice > m_xDevice;
-protected:
- void SplitAtDefinedPosition(sal_Bool _bUnFreezePane);
-public:
- void Scroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft, bool bLargeScroll = false ) throw (css::uno::RuntimeException);
-public:
- ScVbaWindow( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-
- // XWindow
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL ActiveCell( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XPane > SAL_CALL ActivePane() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL ActiveSheet( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setCaption( const css::uno::Any& _caption ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getCaption() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getDisplayGridlines() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayGridlines( ::sal_Bool _displaygridlines ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getDisplayHeadings() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayHeadings( ::sal_Bool _bDisplayHeadings ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getDisplayHorizontalScrollBar() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayHorizontalScrollBar( ::sal_Bool _bDisplayHorizontalScrollBar ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getDisplayOutline() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayOutline( ::sal_Bool _bDisplayOutline ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getDisplayVerticalScrollBar() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayVerticalScrollBar( ::sal_Bool _bDisplayVerticalScrollBar ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getDisplayWorkbookTabs() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayWorkbookTabs( ::sal_Bool _bDisplayWorkbookTabs ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getFreezePanes() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFreezePanes( ::sal_Bool _bFreezePanes ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getHeight() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setHeight( sal_Int32 _height ) throw (css::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL getLeft() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setLeft( sal_Int32 _left ) throw (css::uno::RuntimeException) ;
- virtual ::sal_Bool SAL_CALL getSplit() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSplit( ::sal_Bool _bSplit ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getSplitColumn() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setSplitColumn( sal_Int32 _splitcolumn ) throw (css::uno::RuntimeException) ;
- virtual double SAL_CALL getSplitHorizontal() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setSplitHorizontal( double _splithorizontal ) throw (css::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL getSplitRow() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setSplitRow( sal_Int32 _splitrow ) throw (css::uno::RuntimeException) ;
- virtual double SAL_CALL getSplitVertical() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setSplitVertical( double _splitvertical ) throw (css::uno::RuntimeException) ;
- virtual css::uno::Any SAL_CALL getScrollRow() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setScrollRow( const css::uno::Any& _scrollrow ) throw (css::uno::RuntimeException) ;
- virtual css::uno::Any SAL_CALL getScrollColumn() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setScrollColumn( const css::uno::Any& _scrollcolumn ) throw (css::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setTop( sal_Int32 _top ) throw (css::uno::RuntimeException) ;
- virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setView( const css::uno::Any& _view ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException) ;
- virtual css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getZoom() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setZoom( const css::uno::Any& _zoom ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL SmallScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL LargeScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SelectedSheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL ScrollWorkbookTabs( const css::uno::Any& Sheets, const css::uno::Any& Position ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& FileName, const css::uno::Any& RouteWorkBook ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Selection( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL PointsToScreenPixelsX(sal_Int32 _points) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL PointsToScreenPixelsY(sal_Int32 _points) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL PrintOut( const css::uno::Any& From, const css::uno::Any&To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL PrintPreview( const css::uno::Any& EnableChanges ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_WINDOW_HXX
diff --git a/scratch/sc-vba/dead-source/vbawindows.cxx b/scratch/sc-vba/dead-source/vbawindows.cxx
deleted file mode 100644
index 3ca529561..000000000
--- a/scratch/sc-vba/dead-source/vbawindows.cxx
+++ /dev/null
@@ -1,266 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbawindows.hxx"
-
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <cppuhelper/implbase3.hxx>
-
-#include <tools/urlobj.hxx>
-#include "vbawindow.hxx"
-//#include "vbaworkbook.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::org::openoffice;
-
-typedef std::hash_map< rtl::OUString,
-sal_Int32, ::rtl::OUStringHash,
-::std::equal_to< ::rtl::OUString > > NameIndexHash;
-
-
-uno::Reference< vba::XHelperInterface > lcl_createWorkbookHIParent( const uno::Reference< frame::XModel >& xModel, const uno::Reference< uno::XComponentContext >& xContext )
-{
- return new ScVbaWorkbook( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel );
-}
-
-uno::Any ComponentToWindow( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext )
-{
- uno::Reference< frame::XModel > xModel( aSource, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( xModel, xContext ), xContext,xModel ) );
- return uno::makeAny( xWin );
-}
-
-typedef std::vector < uno::Reference< sheet::XSpreadsheetDocument > > Components;
-// #TODO more or less the same as class in workwindows ( code sharing needed )
-class WindowComponentEnumImpl : public EnumerationHelper_BASE
-{
-protected:
- uno::Reference< uno::XComponentContext > m_xContext;
- Components m_components;
- Components::const_iterator m_it;
-
-public:
- WindowComponentEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const Components& components ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_components( components )
- {
- m_it = m_components.begin();
- }
-
- WindowComponentEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext )
- {
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- uno::Reference< frame::XDesktop > xDesktop
- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW );
- uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration();
- while( mxComponents->hasMoreElements() )
- {
- uno::Reference< sheet::XSpreadsheetDocument > xNext( mxComponents->nextElement(), uno::UNO_QUERY );
- if ( xNext.is() )
- m_components.push_back( xNext );
- }
- m_it = m_components.begin();
- }
- // XEnumeration
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return m_it != m_components.end();
- }
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( !hasMoreElements() )
- {
- throw container::NoSuchElementException();
- }
- return makeAny( *(m_it++) );
- }
-};
-
-class WindowEnumImpl : public WindowComponentEnumImpl
-{
-public:
- WindowEnumImpl(const uno::Reference< uno::XComponentContext >& xContext, const Components& components ):WindowComponentEnumImpl( xContext, components ) {}
- WindowEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ): WindowComponentEnumImpl( xContext ) {}
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- return ComponentToWindow( WindowComponentEnumImpl::nextElement(), m_xContext );
- }
-};
-
-typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess
- , com::sun::star::container::XIndexAccess
- , com::sun::star::container::XNameAccess
- > WindowsAccessImpl_BASE;
-
-class WindowsAccessImpl : public WindowsAccessImpl_BASE
-{
- uno::Reference< uno::XComponentContext > m_xContext;
- Components m_windows;
- NameIndexHash namesToIndices;
-public:
- WindowsAccessImpl( const uno::Reference< uno::XComponentContext >& xContext ):m_xContext( xContext )
- {
- uno::Reference< container::XEnumeration > xEnum = new WindowComponentEnumImpl( m_xContext );
- sal_Int32 nIndex=0;
- while( xEnum->hasMoreElements() )
- {
- uno::Reference< sheet::XSpreadsheetDocument > xNext( xEnum->nextElement(), uno::UNO_QUERY );
- if ( xNext.is() )
- {
- m_windows.push_back( xNext );
- uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
- ScVbaWindow window( uno::Reference< vba::XHelperInterface >(), m_xContext, xModel );
- rtl::OUString sCaption;
- window.getCaption() >>= sCaption;
- namesToIndices[ sCaption ] = nIndex++;
- }
- }
-
- }
-
- //XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
- {
- return new WindowComponentEnumImpl( m_xContext, m_windows );
- }
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
- {
- return m_windows.size();
- }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( Index < 0
- || static_cast< Components::size_type >( Index ) >= m_windows.size() )
- throw lang::IndexOutOfBoundsException();
- return makeAny( m_windows[ Index ] ); // returns xspreadsheetdoc
- }
-
- //XElementAccess
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
- {
- return sheet::XSpreadsheetDocument::static_type(0);
- }
-
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
- {
- return (m_windows.size() > 0);
- }
-
- //XNameAccess
- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- NameIndexHash::const_iterator it = namesToIndices.find( aName );
- if ( it == namesToIndices.end() )
- throw container::NoSuchElementException();
- return makeAny( m_windows[ it->second ] );
-
- }
-
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
- {
- uno::Sequence< ::rtl::OUString > names( namesToIndices.size() );
- ::rtl::OUString* pString = names.getArray();
- NameIndexHash::const_iterator it = namesToIndices.begin();
- NameIndexHash::const_iterator it_end = namesToIndices.end();
- for ( ; it != it_end; ++it, ++pString )
- *pString = it->first;
- return names;
- }
-
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
- {
- NameIndexHash::const_iterator it = namesToIndices.find( aName );
- return (it != namesToIndices.end());
- }
-
-};
-
-
-ScVbaWindows::ScVbaWindows( const uno::Reference< oo::vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaWindows_BASE( xParent, xContext, xIndexAccess )
-{
-}
-
-uno::Reference< container::XEnumeration >
-ScVbaWindows::createEnumeration() throw (uno::RuntimeException)
-{
- return new WindowEnumImpl( mxContext );
-}
-
-uno::Any
-ScVbaWindows::createCollectionObject( const css::uno::Any& aSource )
-{
- return ComponentToWindow( aSource, mxContext );
-}
-
-uno::Type
-ScVbaWindows::getElementType() throw (uno::RuntimeException)
-{
- return excel::XWindows::static_type(0);
-}
-
-uno::Reference< vba::XCollection >
-ScVbaWindows::Windows( const css::uno::Reference< css::uno::XComponentContext >& xContext )
-{
- uno::Reference< container::XIndexAccess > xIndex( new WindowsAccessImpl( xContext ) );
- return new ScVbaWindows( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext , xIndex );
-}
-
-void SAL_CALL
-ScVbaWindows::Arrange( ::sal_Int32 /*ArrangeStyle*/, const uno::Any& /*ActiveWorkbook*/, const uno::Any& /*SyncHorizontal*/, const uno::Any& /*SyncVertical*/ ) throw (uno::RuntimeException)
-{
- //#TODO #FIXME see what can be done for an implementation here
-}
-
-
-rtl::OUString&
-ScVbaWindows::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWindows") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaWindows::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Windows") );
- }
- return sNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbawindows.hxx b/scratch/sc-vba/dead-source/vbawindows.hxx
deleted file mode 100644
index 511724a0d..000000000
--- a/scratch/sc-vba/dead-source/vbawindows.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_WINDOWS_HXX
-#define SC_VBA_WINDOWS_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <org/openoffice/excel/XWindows.hpp>
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include "vbahelper.hxx"
-#include "vbacollectionimpl.hxx"
-
-
-typedef CollTestImplHelper< oo::excel::XWindows > ScVbaWindows_BASE;
-
-class ScVbaWindows : public ScVbaWindows_BASE
-{
-public:
- ScVbaWindows( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
- virtual ~ScVbaWindows() {}
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
-
- // XWindows
- virtual void SAL_CALL Arrange( ::sal_Int32 ArrangeStyle, const css::uno::Any& ActiveWorkbook, const css::uno::Any& SyncHorizontal, const css::uno::Any& SyncVertical ) throw (::com::sun::star::uno::RuntimeException);
- // ScVbaCollectionBaseImpl
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-
- static css::uno::Reference< oo::vba::XCollection > Windows( const css::uno::Reference< css::uno::XComponentContext >& xContext );
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif //SC_VBA_WINDOWS_HXX
-
diff --git a/scratch/sc-vba/dead-source/vbaworkbook.cxx b/scratch/sc-vba/dead-source/vbaworkbook.cxx
deleted file mode 100644
index 9794cb0e7..000000000
--- a/scratch/sc-vba/dead-source/vbaworkbook.cxx
+++ /dev/null
@@ -1,509 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaworkbook.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "helperdecl.hxx"
-#include <tools/urlobj.hxx>
-#include <comphelper/unwrapargs.hxx>
-
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/util/XProtectable.hpp>
-#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <org/openoffice/excel/XlFileFormat.hpp>
-
-#include "scextopt.hxx"
-#include "vbaworksheet.hxx"
-#include "vbaworksheets.hxx"
-#include "vbaworkbook.hxx"
-#include "vbawindows.hxx"
-#include "vbastyles.hxx"
-#include "vbahelper.hxx"
-#include "vbapalette.hxx"
-#include <osl/file.hxx>
-#include <stdio.h>
-#include "vbanames.hxx" // Amelia Wang
-#include "nameuno.hxx"
-
-// Much of the impl. for the equivalend UNO module is
-// sc/source/ui/unoobj/docuno.cxx, viewuno.cxx
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-class ActiveSheet : public ScVbaWorksheet
-{
-protected:
- virtual uno::Reference< frame::XModel > getModel()
- {
- return getCurrentDocument();
- }
- virtual uno::Reference< sheet::XSpreadsheet > getSheet()
- {
- uno::Reference< frame::XModel > xModel = getModel();
- uno::Reference< sheet::XSpreadsheet > xSheet;
- if ( xModel.is() )
- {
- uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
- xModel->getCurrentController(), uno::UNO_QUERY );
- if ( xSpreadsheet.is() )
- xSheet = xSpreadsheet->getActiveSheet();
- }
- return xSheet;
- }
-public:
- ActiveSheet( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : ScVbaWorksheet( xParent, xContext ) {}
-
-};
-
-uno::Sequence< sal_Int32 > ScVbaWorkbook::ColorData;
-
-void ScVbaWorkbook::initColorData( const uno::Sequence< sal_Int32 >& sColors )
-{
- const sal_Int32* pSource = sColors.getConstArray();
- sal_Int32* pDest = ColorData.getArray();
- const sal_Int32* pEnd = pSource + sColors.getLength();
- for ( ; pSource != pEnd; ++pSource, ++pDest )
- *pDest = *pSource;
-}
-
-
-void SAL_CALL
-ScVbaWorkbook::ResetColors( ) throw (::script::BasicErrorException, ::uno::RuntimeException)
-{
- uno::Reference< container::XIndexAccess > xIndexAccess( ScVbaPalette::getDefaultPalette(), uno::UNO_QUERY_THROW );
- sal_Int32 nLen = xIndexAccess->getCount();
- ColorData.realloc( nLen );
-
- uno::Sequence< sal_Int32 > dDefaultColors( nLen );
- sal_Int32* pDest = dDefaultColors.getArray();
- for ( sal_Int32 index=0; index < nLen; ++pDest, ++index )
- xIndexAccess->getByIndex( index ) >>= (*pDest);
- initColorData( dDefaultColors );
-}
-
-::uno::Any SAL_CALL
-ScVbaWorkbook::Colors( const ::uno::Any& Index ) throw (::script::BasicErrorException, ::uno::RuntimeException)
-{
- uno::Any aRet;
- if ( Index.getValue() )
- {
- sal_Int32 nIndex = 0;
- Index >>= nIndex;
- aRet = uno::makeAny( XLRGBToOORGB( ColorData[ --nIndex ] ) );
- }
- else
- aRet = uno::makeAny( ColorData );
- return aRet;
-}
-
-::sal_Int32 SAL_CALL
-ScVbaWorkbook::FileFormat( ) throw (::script::BasicErrorException, ::uno::RuntimeException)
-{
- sal_Int32 aFileFormat = 0;
- rtl::OUString aFilterName;
- uno::Sequence< beans::PropertyValue > aArgs = getModel()->getArgs();
-
- // #FIXME - seems suspect should we not walk through the properties
- // to find the FilterName
- if (aArgs[0].Name.equalsAscii( "FilterName")) {
- aArgs[0].Value >>= aFilterName;
- } else {
- aArgs[1].Value >>= aFilterName;
- }
-
- if (aFilterName.equalsAscii("Text - txt - csv (StarCalc)")) {
- aFileFormat = excel::XlFileFormat::xlCSV; //xlFileFormat.
- }
-
- if (aFilterName.equalsAscii("DBF")) {
- aFileFormat = excel::XlFileFormat::xlDBF4;
- }
-
- if (aFilterName.equalsAscii("DIF")) {
- aFileFormat = excel::XlFileFormat::xlDIF;
- }
-
- if (aFilterName.equalsAscii("Lotus")) {
- aFileFormat = excel::XlFileFormat::xlWK3;
- }
-
- if (aFilterName.equalsAscii("MS Excel 4.0")) {
- aFileFormat = excel::XlFileFormat::xlExcel4Workbook;
- }
-
- if (aFilterName.equalsAscii("MS Excel 5.0/95")) {
- aFileFormat = excel::XlFileFormat::xlExcel5;
- }
-
- if (aFilterName.equalsAscii("MS Excel 97")) {
- aFileFormat = excel::XlFileFormat::xlExcel9795;
- }
-
- if (aFilterName.equalsAscii("HTML (StarCalc)")) {
- aFileFormat = excel::XlFileFormat::xlHtml;
- }
-
- if (aFilterName.equalsAscii("calc_StarOffice_XML_Calc_Template")) {
- aFileFormat = excel::XlFileFormat::xlTemplate;
- }
-
- if (aFilterName.equalsAscii("StarOffice XML (Calc)")) {
- aFileFormat = excel::XlFileFormat::xlWorkbookNormal;
- }
- if (aFilterName.equalsAscii("calc8")) {
- aFileFormat = excel::XlFileFormat::xlWorkbookNormal;
- }
-
- return aFileFormat;
-}
-
-void
-ScVbaWorkbook::init()
-{
- if ( !ColorData.getLength() )
- ResetColors();
-}
-ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext) :ScVbaWorkbook_BASE( xParent, xContext ), mxModel(NULL)
-{
- //#FIXME this persists the color data per office instance and
- // not per workbook instance, need to hook the data into XModel
- // ( e.g. we already store the imported palette in there )
- // so we should,
- // a) make the class that does that a service
- // b) make that service implement XIndexContainer
- init();
-}
-
-ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::frame::XModel > xModel ) : ScVbaWorkbook_BASE( xParent, xContext ), mxModel( xModel )
-{
- init();
-}
-
-ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args,
- uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( getXSomethingFromArgs< vba::XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
-
-{
- init();
-}
-
-::rtl::OUString
-ScVbaWorkbook::getName() throw (uno::RuntimeException)
-{
- rtl::OUString sName = getModel()->getURL();
- if ( sName.getLength() )
- {
-
- INetURLObject aURL( getModel()->getURL() );
- ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
- }
- else
- {
- const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) );
- // process "UntitledX - $(PRODUCTNAME)"
- uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
- xProps->getPropertyValue(sTitle ) >>= sName;
- sal_Int32 pos = 0;
- sName = sName.getToken(0,' ',pos);
- }
- return sName;
-}
-::rtl::OUString
-ScVbaWorkbook::getPath() throw (uno::RuntimeException)
-{
- INetURLObject aURL( getModel()->getURL() );
- aURL.CutLastName();
- return aURL.GetURLPath();
-}
-
-::rtl::OUString
-ScVbaWorkbook::getFullName() throw (uno::RuntimeException)
-{
- INetURLObject aURL( getModel()->getURL() );
- return aURL.GetURLPath();
-}
-uno::Reference< excel::XWorksheet >
-ScVbaWorkbook::getActiveSheet() throw (uno::RuntimeException)
-{
- return new ActiveSheet( this, mxContext );
-}
-uno::Any SAL_CALL
-ScVbaWorkbook::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- return Worksheets( aIndex );
-}
-
-
-
-uno::Any SAL_CALL
-ScVbaWorkbook::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getModel() );
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
- uno::Reference<container::XIndexAccess > xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
- uno::Reference< vba::XCollection > xWorkSheets( new ScVbaWorksheets( this, mxContext, xSheets, xModel ) );
- if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
- {
- return uno::Any( xWorkSheets );
- }
- // pass on to collection
- return uno::Any( xWorkSheets->Item( aIndex, uno::Any() ) );
-}
-uno::Any SAL_CALL
-ScVbaWorkbook::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< vba::XCollection > xWindows = ScVbaWindows::Windows( mxContext );
- if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
- return uno::Any( xWindows );
- return uno::Any( xWindows->Item( aIndex, uno::Any() ) );
-}
-void
-ScVbaWorkbook::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- const uno::Any &rRouteArg ) throw (uno::RuntimeException)
-{
- sal_Bool bSaveChanges = sal_False;
- rtl::OUString aFileName;
- sal_Bool bRouteWorkbook = sal_True;
-
- rSaveArg >>= bSaveChanges;
- sal_Bool bFileName = ( rFileArg >>= aFileName );
- rRouteArg >>= bRouteWorkbook;
- uno::Reference< frame::XStorable > xStorable( getModel(), uno::UNO_QUERY_THROW );
- uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
-
- if( bSaveChanges )
- {
- if( xStorable->isReadonly() )
- {
- throw uno::RuntimeException(::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ),
- uno::Reference< XInterface >() );
- }
- if( bFileName )
- xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) );
- else
- xStorable->store();
- }
- else
- xModifiable->setModified( false );
-
- uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY );
-
- if( xCloseable.is() )
- // use close(boolean DeliverOwnership)
-
- // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may
- // assume ownership if they object the closure by throwing a CloseVetoException
- // Here we give up ownership. To be on the safe side, catch possible veto exception anyway.
- xCloseable->close(sal_True);
- // If close is not supported by this model - try to dispose it.
- // But if the model disagree with a reset request for the modify state
- // we shouldn't do so. Otherwhise some strange things can happen.
- else
- {
- uno::Reference< lang::XComponent > xDisposable ( getCurrentDocument(), uno::UNO_QUERY );
- if ( xDisposable.is() )
- xDisposable->dispose();
- }
-}
-
-void
-ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
-{
- rtl::OUString rPassword;
- uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
- SC_VBA_FIXME(("Workbook::Protect stub"));
- if( aPassword >>= rPassword )
- xProt->protect( rPassword );
- else
- xProt->protect( rtl::OUString() );
-}
-
-void
-ScVbaWorkbook::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException)
-{
- rtl::OUString rPassword;
- uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
- if( !getProtectStructure() )
- throw uno::RuntimeException(::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ),
- uno::Reference< XInterface >() );
- else
- {
- if( aPassword >>= rPassword )
- xProt->unprotect( rPassword );
- else
- xProt->unprotect( rtl::OUString() );
- }
-}
-
-::sal_Bool
-ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
-{
- uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
- return xProt->isProtected();
-}
-
-void
-ScVbaWorkbook::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
-{
- uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
- xModifiable->setModified( bSave );
-}
-
-sal_Bool
-ScVbaWorkbook::getSaved() throw (uno::RuntimeException)
-{
- uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
- return xModifiable->isModified();
-}
-
-void
-ScVbaWorkbook::Save() throw (uno::RuntimeException)
-{
- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save"));
- uno::Reference< frame::XModel > xModel = getModel();
- dispatchRequests(xModel,url);
-}
-
-void
-ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::RuntimeException)
-{
- rtl::OUString aURL;
- osl::FileBase::getFileURLFromSystemPath( sFileName, aURL );
- uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > storeProps(1);
- storeProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
- storeProps[0].Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MS Excel 97" ) );
- xStor->storeToURL( aURL, storeProps );
-}
-
-void
-ScVbaWorkbook::Activate() throw (uno::RuntimeException)
-{
- uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
- xFrame->activate();
-}
-
-css::uno::Any SAL_CALL
-ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException)
-{
- // quick look and Styles object doesn't seem to have a valid parent
- // or a least the object browser just shows an object that has no
- // variables ( therefore... leave as NULL for now )
- uno::Reference< vba::XCollection > dStyles = new ScVbaStyles( uno::Reference< vba::XHelperInterface >(), mxContext, getModel() );
- if ( Item.hasValue() )
- return dStyles->Item( Item, uno::Any() );
- return uno::makeAny( dStyles );
-}
-
-// Amelia Wang
-uno::Any SAL_CALL
-ScVbaWorkbook::Names( const css::uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getModel() );
- uno::Reference< beans::XPropertySet > xProps( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XNamedRanges > xNamedRanges( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NamedRanges") ) ), uno::UNO_QUERY_THROW );
- uno::Reference< vba::XCollection > xNames( new ScVbaNames( this , mxContext , xNamedRanges , xModel ));
- if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
- {
- return uno::Any( xNames );
- }
- return uno::Any( xNames->Item( aIndex, uno::Any() ) );
-}
-
-rtl::OUString&
-ScVbaWorkbook::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorkbook") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaWorkbook::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbook" ) );
- }
- return aServiceNames;
-}
-
-::rtl::OUString SAL_CALL
-ScVbaWorkbook::getCodeName() throw (css::uno::RuntimeException)
-{
-#ifdef VBA_OOBUILD_HACK
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
- /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
- ::rtl::OUString sGlobCodeName = pExtSettings.maGlobCodeName; */
- ::rtl::OUString sGlobCodeName = pDoc->GetCodeName();
- return sGlobCodeName;
-#else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-#endif
-}
-#ifdef VBA_OOBUILD_HACK
-void SAL_CALL
-ScVbaWorkbook::setCodeName( const ::rtl::OUString& sGlobCodeName ) throw (css::uno::RuntimeException)
-{
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
- /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
- pExtSettings.maGlobCodeName = sGlobCodeName;*/
- pDoc->SetCodeName( sGlobCodeName );
-#else
-void SAL_CALL
-ScVbaWorkbook::setCodeName( const ::rtl::OUString& ) throw (css::uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-#endif
-}
-
-namespace workbook
-{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaWorkbook, sdecl::with_args<true> > serviceImpl;
-extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaWorkbook",
- "org.openoffice.excel.Workbook" );
-}
diff --git a/scratch/sc-vba/dead-source/vbaworkbook.hxx b/scratch/sc-vba/dead-source/vbaworkbook.hxx
deleted file mode 100644
index 43e97e7fe..000000000
--- a/scratch/sc-vba/dead-source/vbaworkbook.hxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaworkbook.hxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_WORKBOOK_HXX
-#define SC_VBA_WORKBOOK_HXX
-
-#include <com/sun/star/frame/XModel.hpp>
-#include <org/openoffice/excel/XWorkbook.hpp>
-#include "vbahelperinterface.hxx"
-
-class ScModelObj;
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XWorkbook > ScVbaWorkbook_BASE;
-
-class ScVbaWorkbook : public ScVbaWorkbook_BASE
-{
- css::uno::Reference< css::frame::XModel > mxModel;
- static css::uno::Sequence< sal_Int32 > ColorData;
- void initColorData( const css::uno::Sequence< sal_Int32 >& sColors );
- void init();
-protected:
-
- virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
- ScVbaWorkbook( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
-public:
- ScVbaWorkbook( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
- css::uno::Reference< css::frame::XModel > xModel );
- ScVbaWorkbook( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
- virtual ~ScVbaWorkbook() {}
-
- // Attributes
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProtectStructure() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
- const css::uno::Any &aFileName,
- const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Save() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
- // Amelia Wang
- virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& Item ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL ResetColors( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Colors( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL FileFormat( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL SaveCopyAs( const rtl::OUString& Filename ) throw ( css::uno::RuntimeException);
- // code name
- virtual ::rtl::OUString SAL_CALL getCodeName() throw ( css::uno::RuntimeException);
- virtual void SAL_CALL setCodeName( const ::rtl::OUString& sGlobCodeName ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif /* SC_VBA_WORKBOOK_HXX */
diff --git a/scratch/sc-vba/dead-source/vbaworkbooks.cxx b/scratch/sc-vba/dead-source/vbaworkbooks.cxx
deleted file mode 100644
index c0ba6ac00..000000000
--- a/scratch/sc-vba/dead-source/vbaworkbooks.cxx
+++ /dev/null
@@ -1,470 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <comphelper/processfactory.hxx>
-
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase3.hxx>
-
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/beans/PropertyVetoException.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <com/sun/star/document/XTypeDetection.hpp>
-#include <com/sun/star/uri/XUriReference.hpp>
-#include <com/sun/star/uri/XUriReferenceFactory.hpp>
-
-#include <sfx2/objsh.hxx>
-#include <tools/urlobj.hxx>
-
-#include "vbaglobals.hxx"
-#include "vbaworkbook.hxx"
-#include "vbaworkbooks.hxx"
-#include "vbahelper.hxx"
-
-#include <hash_map>
-#include <osl/file.hxx>
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-const sal_Int16 CUSTOM_CHAR = 5;
-
-typedef std::hash_map< rtl::OUString,
-sal_Int32, ::rtl::OUStringHash,
-::std::equal_to< ::rtl::OUString > > NameIndexHash;
-
-typedef std::vector < uno::Reference< sheet::XSpreadsheetDocument > > WorkBooks;
-
-typedef ::cppu::WeakImplHelper1< container::XEnumeration > SpreadSheetDocEnumImpl_BASE;
-
-static uno::Any
-getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc )
-{
- // FIXME: fine as long as ScVbaWorkbook is stateless ...
- uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY );
- if( !xModel.is() )
- return uno::Any();
-
- ScVbaWorkbook *pWb = new ScVbaWorkbook( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel );
- return uno::Any( uno::Reference< excel::XWorkbook > (pWb) );
-}
-
-
-// #FIXME clearly this is a candidate for some sort of helper base class as
-// this is a copy of SelectedSheetsEnum ( vbawindow.cxx )
-
-class SpreadSheetDocEnumImpl : public SpreadSheetDocEnumImpl_BASE
-{
- uno::Reference< uno::XComponentContext > m_xContext;
- WorkBooks m_books;
- WorkBooks::const_iterator m_it;
-
-public:
- SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const WorkBooks& books ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_books( books )
- {
- m_it = m_books.begin();
- }
- SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext )
- {
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- uno::Reference< frame::XDesktop > xDesktop
- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW );
- uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration();
- while( mxComponents->hasMoreElements() )
- {
- uno::Reference< sheet::XSpreadsheetDocument > xNext( mxComponents->nextElement(), uno::UNO_QUERY );
- if ( xNext.is() )
- m_books.push_back( xNext );
- }
- m_it = m_books.begin();
- }
- // XEnumeration
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return m_it != m_books.end();
- }
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( !hasMoreElements() )
- {
- throw container::NoSuchElementException();
- }
- return makeAny( *(m_it++) );
- }
-};
-
-class WorkBookEnumImpl : public EnumerationHelperImpl
-{
-public:
- WorkBookEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ){}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< sheet::XSpreadsheetDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- return getWorkbook( m_xContext, xDoc );
- }
-
-};
-
-// #FIXME clearly this is also a candidate for some sort of helper base class as
-// a very similar one is used in vbawindow ( SelectedSheetsEnumAccess )
-// Maybe a template base class that does all of the operations on the hashmap
-// and vector only, and the sub-class does everything else
-// => ctor, createEnumeration & factory method need be defined ( to be called
-// by getByIndex, getByName )
-typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess
- , com::sun::star::container::XIndexAccess
- , com::sun::star::container::XNameAccess
- > WorkBooksAccessImpl_BASE;
-
-class WorkBooksAccessImpl : public WorkBooksAccessImpl_BASE
-{
- uno::Reference< uno::XComponentContext > m_xContext;
- WorkBooks m_books;
- NameIndexHash namesToIndices;
-public:
- WorkBooksAccessImpl( const uno::Reference< uno::XComponentContext >& xContext ):m_xContext( xContext )
- {
- uno::Reference< container::XEnumeration > xEnum = new SpreadSheetDocEnumImpl( m_xContext );
- sal_Int32 nIndex=0;
- while( xEnum->hasMoreElements() )
- {
- uno::Reference< sheet::XSpreadsheetDocument > xNext( xEnum->nextElement(), uno::UNO_QUERY );
- if ( xNext.is() )
- {
- m_books.push_back( xNext );
- uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
- INetURLObject aURL( xModel->getURL() );
- namesToIndices[ aURL.GetLastName() ] = nIndex++;
- }
- }
-
- }
-
- //XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
- {
- return new SpreadSheetDocEnumImpl( m_xContext, m_books );
- }
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
- {
- return m_books.size();
- }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( Index < 0
- || static_cast< WorkBooks::size_type >(Index) >= m_books.size() )
- throw lang::IndexOutOfBoundsException();
- return makeAny( m_books[ Index ] ); // returns xspreadsheetdoc
- }
-
- //XElementAccess
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
- {
- return sheet::XSpreadsheetDocument::static_type(0);
- }
-
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
- {
- return (m_books.size() > 0);
- }
-
- //XNameAccess
- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- NameIndexHash::const_iterator it = namesToIndices.find( aName );
- if ( it == namesToIndices.end() )
- throw container::NoSuchElementException();
- return makeAny( m_books[ it->second ] );
-
- }
-
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
- {
- uno::Sequence< ::rtl::OUString > names( namesToIndices.size() );
- ::rtl::OUString* pString = names.getArray();
- NameIndexHash::const_iterator it = namesToIndices.begin();
- NameIndexHash::const_iterator it_end = namesToIndices.end();
- for ( ; it != it_end; ++it, ++pString )
- *pString = it->first;
- return names;
- }
-
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
- {
- NameIndexHash::const_iterator it = namesToIndices.find( aName );
- return (it != namesToIndices.end());
- }
-
-};
-
-ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new WorkBooksAccessImpl( xContext ) ) )
-{
-}
-// XEnumerationAccess
-uno::Type
-ScVbaWorkbooks::getElementType() throw (uno::RuntimeException)
-{
- return excel::XWorkbook::static_type(0);
-}
-uno::Reference< container::XEnumeration >
-ScVbaWorkbooks::createEnumeration() throw (uno::RuntimeException)
-{
- // #FIXME its possible the WorkBookEnumImpl here doens't reflect
- // the state of this object ( although it should ) would be
- // safer to create an enumeration based on this objects state
- // rather than one effectively based of the desktop component
- return new WorkBookEnumImpl( mxContext, uno::Reference< container::XEnumeration >( new SpreadSheetDocEnumImpl(mxContext) ) );
-}
-
-uno::Any
-ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource )
-{
- uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY );
- return getWorkbook( mxContext, xDoc );
-}
-
-
-uno::Any SAL_CALL
-ScVbaWorkbooks::Add() throw (uno::RuntimeException)
-{
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- uno::Reference< frame::XComponentLoader > xLoader(
- xSMgr->createInstanceWithContext(
- ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"),
- mxContext), uno::UNO_QUERY_THROW );
- uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0,
- uno::Sequence< beans::PropertyValue >(0) );
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
-
- if( xSpreadDoc.is() )
- return getWorkbook( mxContext, xSpreadDoc );
- return uno::Any();
-}
-
-void
-ScVbaWorkbooks::Close() throw (uno::RuntimeException)
-{
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc"));
- dispatchRequests(xModel,url);
-}
-
-bool
-ScVbaWorkbooks::isTextFile( const rtl::OUString& sType )
-{
- // will return true if the file is
- // a) a variant of a text file
- // b) a csv file
- // c) unknown
- // returning true basically means treat this like a csv file
- const static rtl::OUString txtType( RTL_CONSTASCII_USTRINGPARAM("writer_Text" ) );
- const static rtl::OUString csvType( RTL_CONSTASCII_USTRINGPARAM("calc_Text_txt_csv_StarCalc" ) );
- const static rtl::OUString encodedTxtType( RTL_CONSTASCII_USTRINGPARAM("writer_Text_encoded" ) );
- return sType.equals( txtType ) || sType.equals( csvType ) || ( sType.getLength() == 0 ) || sType.equals( encodedTxtType );
-}
-
-bool
-ScVbaWorkbooks::isSpreadSheetFile( const rtl::OUString& sType )
-{
- // include calc_QPro etc. ? ( not for the moment anyway )
- if ( sType.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("calc_MS"))) == 0
- || sType.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("calc8"))) == 0
- || sType.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("calc_StarOffice"))) == 0 )
- return true;
- return false;
-}
-
-rtl::OUString
-ScVbaWorkbooks::getFileFilterType( const rtl::OUString& rFileName )
-{
- uno::Reference< document::XTypeDetection > xTypeDetect( mxContext->getServiceManager()->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection"), mxContext), uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > aMediaDesc(1);
- aMediaDesc[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("URL" ) );
- aMediaDesc[ 0 ].Value <<= rFileName;
- rtl::OUString sType = xTypeDetect->queryTypeByDescriptor( aMediaDesc, sal_True );
- return sType;
-}
-
-// #TODO# #FIXME# can any of the unused params below be used?
-uno::Any
-ScVbaWorkbooks::Open( const rtl::OUString& rFileName, const uno::Any& /*UpdateLinks*/, const uno::Any& ReadOnly, const uno::Any& Format, const uno::Any& /*Password*/, const uno::Any& /*WriteResPassword*/, const uno::Any& /*IgnoreReadOnlyRecommended*/, const uno::Any& /*Origin*/, const uno::Any& Delimiter, const uno::Any& /*Editable*/, const uno::Any& /*Notify*/, const uno::Any& /*Converter*/, const uno::Any& /*AddToMru*/ ) throw (uno::RuntimeException)
-{
- // we need to detect if this is a URL, if not then assume its a file path
- rtl::OUString aURL;
- INetURLObject aObj;
- aObj.SetURL( rFileName );
- bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
- if ( bIsURL )
- aURL = rFileName;
- else
- osl::FileBase::getFileURLFromSystemPath( rFileName, aURL );
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XDesktop > xDesktop
- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , mxContext),
- uno::UNO_QUERY_THROW );
- uno::Reference< frame::XComponentLoader > xLoader(
- xSMgr->createInstanceWithContext(
- ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"),
- mxContext),
- uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > sProps(0);
- sal_Int32 nIndex = 0;
-
- rtl::OUString sType = getFileFilterType( aURL );
- // A text file means it needs to be processed as a csv file
- if ( isTextFile( sType ) )
- {
- // Values for format
- // 1 Tabs
- // 2 Commas
- // 3 Spaces
- // 4 Semicolons
- // 5 Nothing
- // 6 Custom character (see the Delimiter argument
- // no format means use the current delimiter
- sProps.realloc( 3 );
- sProps[ nIndex ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterOptions" ) );
- sal_Int16 delims[] = { 0 /*default not used*/, 9/*tab*/, 44/*comma*/, 32/*space*/, 59/*semicolon*/ };
- static rtl::OUString sRestOfFormat( RTL_CONSTASCII_USTRINGPARAM(",34,0,1" ) );
-
- rtl::OUString sFormat;
- sal_Int16 nFormat = 0; // default indicator
-
-
- if ( Format.hasValue() )
- {
- Format >>= nFormat; // val of nFormat overwritten if extracted
- // validate param
- if ( nFormat < 1 || nFormat > 6 )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal value for Format" ) ), uno::Reference< uno::XInterface >() );
- }
-
- sal_Int16 nDelim = getCurrentDelim();
-
- if ( nFormat > 0 && nFormat < CUSTOM_CHAR )
- {
- nDelim = delims[ nFormat ];
- }
- else if ( nFormat > CUSTOM_CHAR )
- {
- // Need to check Delimiter param
- if ( !Delimiter.hasValue() )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Expected value for Delimiter" ) ), uno::Reference< uno::XInterface >() );
- rtl::OUString sStr;
- Delimiter >>= sStr;
- String aUniStr( sStr );
- if ( aUniStr.Len() )
- nDelim = aUniStr.GetChar(0);
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Incorrect value for Delimiter" ) ), uno::Reference< uno::XInterface >() );
- }
-
- getCurrentDelim() = nDelim; //set new current
-
- sFormat = rtl::OUString::valueOf( (sal_Int32)nDelim ) + sRestOfFormat;
- sProps[ nIndex++ ].Value <<= sFormat;
- sProps[ nIndex ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") );
- sProps[ nIndex++ ].Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text - txt - csv (StarCalc)") );
- // Ensure WORKAROUND_CSV_TXT_BUG_i60158 gets called in typedetection.cxx so
- // csv is forced for deep detected 'writerxxx' types
- sProps[ nIndex ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentService") );
- sProps[ nIndex ].Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") );
- }
- else if ( !isSpreadSheetFile( sType ) )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Bad Format")), uno::Reference< uno::XInterface >() );
-
- if ( ReadOnly.hasValue() )
- {
- sal_Bool bIsReadOnly = sal_False; ReadOnly >>= bIsReadOnly;
- if ( bIsReadOnly )
- {
- static const rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") );
- sProps.realloc( sProps.getLength() + 1 );
- sProps[ nIndex ].Name = sReadOnly;
- sProps[ nIndex++ ].Value = uno::makeAny( (sal_Bool)sal_True );
- }
- }
-
- uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL,
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_default") ),
- frame::FrameSearchFlag::CREATE,
- sProps);
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
- uno::Any aRet = getWorkbook( mxContext, xSpreadDoc );
- uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
- if ( xWBook.is() )
- xWBook->Activate();
- return aRet;
-}
-
-rtl::OUString&
-ScVbaWorkbooks::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorkbooks") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaWorkbooks::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbooks") );
- }
- return sNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaworkbooks.hxx b/scratch/sc-vba/dead-source/vbaworkbooks.hxx
deleted file mode 100644
index 12ed109fc..000000000
--- a/scratch/sc-vba/dead-source/vbaworkbooks.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_WORKBOOKS_HXX
-#define SC_VBA_WORKBOOKS_HXX
-
-
-#include "vbacollectionimpl.hxx"
-#include <org/openoffice/vba/XGlobals.hpp>
-#include <org/openoffice/excel/XWorkbooks.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include "vbahelper.hxx"
-
-
-class ScModelObj;
-
-typedef CollTestImplHelper< oo::excel::XWorkbooks > ScVbaWorkbooks_BASE;
-
-class ScVbaWorkbooks : public ScVbaWorkbooks_BASE
-{
-private:
- css::uno::Reference< oo::vba::XGlobals > getGlobals() throw (css::uno::RuntimeException);
- rtl::OUString getFileFilterType( const rtl::OUString& rString );
- bool isTextFile( const rtl::OUString& rString );
- bool isSpreadSheetFile( const rtl::OUString& rString );
- static sal_Int16& getCurrentDelim(){ static sal_Int16 nDelim = 44; return nDelim; }
-public:
- ScVbaWorkbooks( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~ScVbaWorkbooks() {}
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
- // ScVbaWorkbooks_BASE
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
- // XWorkbooks
- virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& UpdateLinks, const css::uno::Any& ReadOnly, const css::uno::Any& Format, const css::uno::Any& Password, const css::uno::Any& WriteResPassword, const css::uno::Any& IgnoreReadOnlyRecommended, const css::uno::Any& Origin, const css::uno::Any& Delimiter, const css::uno::Any& Editable, const css::uno::Any& Notify, const css::uno::Any& Converter, const css::uno::Any& AddToMru ) throw (css::uno::RuntimeException);
-
-};
-
-#endif /* SC_VBA_WORKBOOKS_HXX */
diff --git a/scratch/sc-vba/dead-source/vbaworksheet.cxx b/scratch/sc-vba/dead-source/vbaworksheet.cxx
deleted file mode 100644
index 842290a0e..000000000
--- a/scratch/sc-vba/dead-source/vbaworksheet.cxx
+++ /dev/null
@@ -1,899 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaworksheet.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "helperdecl.hxx"
-#include <cppuhelper/queryinterface.hxx>
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XIntrospectionAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/util/XProtectable.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XCalculatable.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XSheetCellRange.hpp>
-#include <com/sun/star/sheet/XSheetCellCursor.hpp>
-#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
-#include <com/sun/star/sheet/XUsedAreaCursor.hpp>
-#include <com/sun/star/sheet/XSpreadsheets.hpp>
-#include <com/sun/star/sheet/XSheetPastable.hpp>
-#include <com/sun/star/sheet/XCellAddressable.hpp>
-#include <com/sun/star/sheet/XSheetOutline.hpp>
-#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/table/XColumnRowRange.hpp>
-#include <com/sun/star/table/XTableChartsSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/drawing/XControlShape.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-#include <tools/string.hxx>
-
-//zhangyun showdataform
-#include <sfx2/sfxdlg.hxx>
-#include <scabstdlg.hxx>
-#include <tabvwsh.hxx>
-#include <scitems.hxx>
-
-#include <svx/svdouno.hxx>
-
-#include "cellsuno.hxx"
-#include "drwlayer.hxx"
-
-#include "scextopt.hxx"
-#include "vbaoutline.hxx"
-#include "vbarange.hxx"
-#include "vbacomments.hxx"
-#include "vbaworksheet.hxx"
-#include "vbachartobjects.hxx"
-#include "vbapivottables.hxx"
-#include "vbacombobox.hxx"
-#include "vbaoleobject.hxx"
-#include "vbaoleobjects.hxx"
-#include "vbashapes.hxx"
-
-#define STANDARDWIDTH 2267
-#define STANDARDHEIGHT 427
-#define DOESNOTEXIST -1
-using namespace com::sun::star;
-using namespace org::openoffice;
-static bool
-nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException )
-{
- if (!xSpreadDoc.is())
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nameExists() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 );
- uno::Reference <sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
- uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
- if ( xIndex.is() )
- {
- SCTAB nCount = static_cast< SCTAB >( xIndex->getCount() );
- for (SCTAB i=0; i < nCount; i++)
- {
- uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(i), uno::UNO_QUERY);
- uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
- if (xNamed->getName() == name)
- {
- nTab = i;
- return true;
- }
- }
- }
- return false;
-}
-
-static void getNewSpreadsheetName (rtl::OUString &aNewName, rtl::OUString aOldName, uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc )
-{
- if (!xSpreadDoc.is())
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getNewSpreadsheetName() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 );
- static rtl::OUString aUnderScre( RTL_CONSTASCII_USTRINGPARAM( "_" ) );
- int currentNum =2;
- aNewName = aOldName + aUnderScre+ String::CreateFromInt32(currentNum) ;
- SCTAB nTab = 0;
- while ( nameExists(xSpreadDoc,aNewName, nTab ) )
- {
- aNewName = aOldName + aUnderScre +
- String::CreateFromInt32(++currentNum) ;
- }
-}
-
-static void removeAllSheets( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, rtl::OUString aSheetName)
-{
- if (!xSpreadDoc.is())
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "removeAllSheets() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 );
- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
- uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
-
- if ( xIndex.is() )
- {
- uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
- for (sal_Int32 i = xIndex->getCount() -1; i>= 1; i--)
- {
- uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(i), uno::UNO_QUERY);
- uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
- if (xNamed.is())
- {
- xNameContainer->removeByName(xNamed->getName());
- }
- }
-
- uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY); uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
- if (xNamed.is())
- {
- xNamed->setName(aSheetName);
- }
- }
-}
-
-static uno::Reference<frame::XModel>
-openNewDoc(rtl::OUString aSheetName )
-{
- uno::Reference<frame::XModel> xModel;
- try
- {
- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
- uno::Reference<lang::XMultiComponentFactory > xServiceManager(
- xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- uno::Reference <frame::XComponentLoader > xComponentLoader(
- xServiceManager->createInstanceWithContext(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ),
- xContext ), uno::UNO_QUERY_THROW );
-
- uno::Reference<lang::XComponent > xComponent( xComponentLoader->loadComponentFromURL(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/scalc" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" ) ), 0,
- uno::Sequence < ::com::sun::star::beans::PropertyValue >() ) );
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
- if ( xSpreadDoc.is() )
- {
- removeAllSheets(xSpreadDoc,aSheetName);
- }
- xModel.set(xSpreadDoc,uno::UNO_QUERY_THROW);
- }
- catch ( uno::Exception & /*e*/ )
- {
- }
- return xModel;
-}
-
-ScVbaWorksheet::ScVbaWorksheet( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : WorksheetImpl_BASE( xParent, xContext )
-{
-}
-ScVbaWorksheet::ScVbaWorksheet(const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
- const uno::Reference< sheet::XSpreadsheet >& xSheet,
- const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : WorksheetImpl_BASE( xParent, xContext ), mxSheet( xSheet ), mxModel(xModel)
-{
-}
-
-ScVbaWorksheet::ScVbaWorksheet( uno::Sequence< uno::Any> const & args,
- uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : WorksheetImpl_BASE( getXSomethingFromArgs< vba::XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
-{
- if ( args.getLength() < 2 )
- throw lang::IllegalArgumentException();
-
- rtl::OUString sSheetName;
- args[2] >>= sSheetName;
-
- uno::Reference< sheet::XSpreadsheetDocument > xSpreadDoc( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xNameAccess( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
- mxSheet.set( xNameAccess->getByName( sSheetName ), uno::UNO_QUERY_THROW );
-}
-
-::rtl::OUString
-ScVbaWorksheet::getName() throw (uno::RuntimeException)
-{
- uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW );
- return xNamed->getName();
-}
-
-void
-ScVbaWorksheet::setName(const ::rtl::OUString &rName ) throw (uno::RuntimeException)
-{
- uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW );
- xNamed->setName( rName );
-}
-
-sal_Bool
-ScVbaWorksheet::getVisible() throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
- uno::Any aValue = xProps->getPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ) );
- sal_Bool bRet = false;
- aValue >>= bRet;
- return bRet;
-}
-
-void
-ScVbaWorksheet::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-{
- uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
- uno::Any aValue( bVisible );
- xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ), aValue);
-}
-
-uno::Reference< excel::XRange >
-ScVbaWorksheet::getUsedRange() throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XSheetCellRange > xSheetCellRange(getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor( getSheet()->createCursorByRange( xSheetCellRange ), uno::UNO_QUERY_THROW );
- uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
- xUsedCursor->gotoStartOfUsedArea( false );
- xUsedCursor->gotoEndOfUsedArea( true );
- uno::Reference< table::XCellRange > xRange( xSheetCellCursor, uno::UNO_QUERY);
- return new ScVbaRange(this, mxContext, xRange);
-}
-
-uno::Reference< excel::XOutline >
-ScVbaWorksheet::Outline( ) throw (uno::RuntimeException)
-{
- uno::Reference<sheet::XSheetOutline> xOutline(getSheet(),uno::UNO_QUERY_THROW);
- return new ScVbaOutline( this, mxContext, xOutline);
-}
-
-sal_Int32
-ScVbaWorksheet::getStandardWidth() throw (uno::RuntimeException)
-{
- return STANDARDWIDTH ;
-}
-
-sal_Int32
-ScVbaWorksheet::getStandardHeight() throw (uno::RuntimeException)
-{
- return STANDARDHEIGHT;
-}
-
-sal_Bool
-ScVbaWorksheet::getProtectionMode() throw (uno::RuntimeException)
-{
- return false;
-}
-
-sal_Bool
-ScVbaWorksheet::getProtectContents()throw (uno::RuntimeException)
-{
- uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
- return xProtectable->isProtected();
-}
-
-sal_Bool
-ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException)
-{
- return false;
-}
-
-void
-ScVbaWorksheet::Activate() throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
- getModel()->getCurrentController(), uno::UNO_QUERY_THROW );
- xSpreadsheet->setActiveSheet(getSheet());
-}
-
-void
-ScVbaWorksheet::Select() throw (uno::RuntimeException)
-{
- Activate();
-}
-
-void
-ScVbaWorksheet::Move( const uno::Any& Before, const uno::Any& After ) throw (uno::RuntimeException)
-{
- rtl::OUString aSheetName;
- uno::Reference<excel::XWorksheet> xSheet;
- rtl::OUString aCurrSheetName =getName();
-
- if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
- {
- uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
- uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
- uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY);
- // #FIXME needs worksheet as parent
- uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
- if (xRange.is())
- xRange->Select();
- implnCopy();
- uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
- if (xModel.is())
- {
- implnPaste();
- Delete();
- }
- return ;
- }
-
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
- SCTAB nDest = 0;
- aSheetName = xSheet->getName();
- bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nDest);
- if ( bSheetExists )
- {
- sal_Bool bAfter = After.hasValue();
- if (bAfter)
- nDest++;
- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
- xSheets->moveByName(aCurrSheetName,nDest);
- }
-}
-
-void
-ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno::RuntimeException)
-{
- rtl::OUString aSheetName;
- uno::Reference<excel::XWorksheet> xSheet;
- rtl::OUString aCurrSheetName =getName();
- if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
- {
- uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
- uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
- uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY);
- uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
- if (xRange.is())
- xRange->Select();
- implnCopy();
- uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
- if (xModel.is())
- {
- implnPaste();
- }
- return;
- }
-
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY );
- SCTAB nDest = 0;
- aSheetName = xSheet->getName();
- bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nDest );
-
- if ( bSheetExists )
- {
- sal_Bool bAfter = After.hasValue();
- if(bAfter)
- nDest++;
- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
- getNewSpreadsheetName(aSheetName,aCurrSheetName,xSpreadDoc);
- xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
- }
-}
-
-
-void
-ScVbaWorksheet::Paste( const uno::Any& Destination, const uno::Any& /*Link*/ ) throw (uno::RuntimeException)
-{
- // #TODO# #FIXME# Link is not used
- uno::Reference<excel::XRange> xRange( Destination, uno::UNO_QUERY );
- if ( xRange.is() )
- xRange->Select();
- implnPaste();
-}
-
-void
-ScVbaWorksheet::Delete() throw (uno::RuntimeException)
-{
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
- rtl::OUString aSheetName = getName();
- if ( xSpreadDoc.is() )
- {
- SCTAB nTab = 0;
- if (!nameExists(xSpreadDoc, aSheetName, nTab ))
- {
- return;
- }
- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
- uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
- xNameContainer->removeByName(aSheetName);
- }
-}
-
-uno::Reference< excel::XWorksheet >
-ScVbaWorksheet::getSheetAtOffset(SCTAB offset) throw (uno::RuntimeException)
-{
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
- uno::Reference <sheet::XSpreadsheets> xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
- uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY_THROW );
-
- rtl::OUString aName = getName();
- SCTAB nIdx = 0;
- bool bSheetExists = nameExists (xSpreadDoc, aName, nIdx );
-
- if ( !bSheetExists )
- return uno::Reference< excel::XWorksheet >();
- nIdx = nIdx + offset;
- uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(nIdx), uno::UNO_QUERY_THROW);
- // parent will be the parent of 'this' worksheet
- return new ScVbaWorksheet (getParent(), mxContext, xSheet, getModel());
-}
-
-uno::Reference< excel::XWorksheet >
-ScVbaWorksheet::getNext() throw (uno::RuntimeException)
-{
- return getSheetAtOffset(static_cast<SCTAB>(1));
-}
-
-uno::Reference< excel::XWorksheet >
-ScVbaWorksheet::getPrevious() throw (uno::RuntimeException)
-{
- return getSheetAtOffset(-1);
-}
-
-
-void
-ScVbaWorksheet::Protect( const uno::Any& Password, const uno::Any& /*DrawingObjects*/, const uno::Any& /*Contents*/, const uno::Any& /*Scenarios*/, const uno::Any& /*UserInterfaceOnly*/ ) throw (uno::RuntimeException)
-{
- // #TODO# #FIXME# is there anything we can do witht the unused param
- // can the implementation use anything else here
- uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
- ::rtl::OUString aPasswd;
- Password >>= aPasswd;
- xProtectable->protect( aPasswd );
-}
-
-void
-ScVbaWorksheet::Unprotect( const uno::Any& Password ) throw (uno::RuntimeException)
-{
- uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
- ::rtl::OUString aPasswd;
- Password >>= aPasswd;
- xProtectable->unprotect( aPasswd );
-}
-
-void
-ScVbaWorksheet::Calculate() throw (uno::RuntimeException)
-{
- uno::Reference <sheet::XCalculatable> xReCalculate(getModel(), uno::UNO_QUERY_THROW);
- xReCalculate->calculate();
-}
-
-uno::Reference< excel::XRange >
-ScVbaWorksheet::Range( const ::uno::Any& Cell1, const ::uno::Any& Cell2 ) throw (uno::RuntimeException)
-{
- uno::Reference< excel::XRange > xSheetRange( new ScVbaRange( this, mxContext
-, uno::Reference< table::XCellRange >( getSheet(), uno::UNO_QUERY_THROW ) ) );
- return xSheetRange->Range( Cell1, Cell2 );
-}
-
-void
-ScVbaWorksheet::CheckSpelling( const uno::Any& /*CustomDictionary*/,const uno::Any& /*IgnoreUppercase*/,const uno::Any& /*AlwaysSuggest*/, const uno::Any& /*SpellingLang*/ ) throw (uno::RuntimeException)
-{
- // #TODO# #FIXME# unused params above, can we do anything with those
- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SpellDialog"));
- uno::Reference< frame::XModel > xModel( getModel() );
- dispatchRequests(xModel,url);
-}
-
-uno::Reference< excel::XRange >
-ScVbaWorksheet::getSheetRange() throw (uno::RuntimeException)
-{
- uno::Reference< table::XCellRange > xRange( getSheet(),uno::UNO_QUERY_THROW );
- return uno::Reference< excel::XRange >( new ScVbaRange( this, mxContext, xRange ) );
-}
-
-// These are hacks - we prolly (somehow) need to inherit
-// the vbarange functionality here ...
-uno::Reference< excel::XRange >
-ScVbaWorksheet::Cells( const ::uno::Any &nRow, const ::uno::Any &nCol )
- throw (uno::RuntimeException)
-{
- return getSheetRange()->Cells( nRow, nCol );
-}
-
-uno::Reference< excel::XRange >
-ScVbaWorksheet::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- return getSheetRange()->Rows( aIndex );
-}
-
-uno::Reference< excel::XRange >
-ScVbaWorksheet::Columns( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- return getSheetRange()->Columns( aIndex );
-}
-
-uno::Any SAL_CALL
-ScVbaWorksheet::ChartObjects( const uno::Any& Index ) throw (uno::RuntimeException)
-{
- if ( !mxCharts.is() )
- {
- uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
-
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
- mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
- }
- if ( Index.hasValue() )
- {
- uno::Reference< vba::XCollection > xColl( mxCharts, uno::UNO_QUERY_THROW );
- return xColl->Item( Index, uno::Any() );
- }
- else
- return uno::makeAny( mxCharts );
-
-}
-
-uno::Any SAL_CALL
-ScVbaWorksheet::PivotTables( const uno::Any& Index ) throw (uno::RuntimeException)
-{
- uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
- uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ;
- uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW );
-
- uno::Reference< vba::XCollection > xColl( new ScVbaPivotTables( this, mxContext, xIndexAccess ) );
- if ( Index.hasValue() )
- return xColl->Item( Index, uno::Any() );
- return uno::makeAny( xColl );
-}
-
-uno::Any SAL_CALL
-ScVbaWorksheet::Comments( const uno::Any& Index ) throw (uno::RuntimeException)
-{
- uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
- uno::Reference< sheet::XSheetAnnotationsSupplier > xAnnosSupp( xSheet, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xAnnos, uno::UNO_QUERY_THROW );
- uno::Reference< vba::XCollection > xColl( new ScVbaComments( this, mxContext, xIndexAccess ) );
- if ( Index.hasValue() )
- return xColl->Item( Index, uno::Any() );
- return uno::makeAny( xColl );
-}
-
-uno::Any SAL_CALL
-ScVbaWorksheet::OLEObjects( const uno::Any& Index ) throw (uno::RuntimeException)
-{
- ScVbaOLEObjects* aOleObjects;
- uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPage, uno::UNO_QUERY_THROW );
- aOleObjects = new ScVbaOLEObjects( this, mxContext, xIndexAccess );
-
- if( Index.hasValue() )
- {
- return aOleObjects->Item( Index, uno::Any() );
- }
- else
- {
- return uno::makeAny( uno::Reference< excel::XOLEObjects> ( aOleObjects ) );
- }
-}
-uno::Any SAL_CALL
-ScVbaWorksheet::Shapes( const uno::Any& aIndex ) throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW );
-
- uno::Reference< msforms::XShapes> xVbaShapes( new ScVbaShapes( this, mxContext, xIndexAccess ) );
- if ( aIndex.hasValue() )
- return xVbaShapes->Item( aIndex, uno::Any() );
- return uno::makeAny( xVbaShapes );
-}
-
-void SAL_CALL
-ScVbaWorksheet::ShowDataForm( ) throw (uno::RuntimeException)
-{
-#ifdef VBA_OOBUILD_HACK
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScTabViewShell* pTabViewShell = getBestViewShell( xModel );
-
- ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
-
- AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg( pTabViewShell->GetDialogParent(),RID_SCDLG_DATAFORM, pTabViewShell);
- DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
-
- pDlg->Execute();
-#else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-#endif
-}
-
-uno::Any SAL_CALL
-ScVbaWorksheet::Evaluate( const ::rtl::OUString& Name ) throw (uno::RuntimeException)
-{
- // #TODO Evaluate allows other things to be evaluated, e.g. functions
- // I think ( like SIN(3) etc. ) need to investigate that
- // named Ranges also? e.g. [MyRange] if so need a list of named ranges
- uno::Any aVoid;
- return uno::Any( Range( uno::Any( Name ), aVoid ) );
-}
-
-
-uno::Reference< beans::XIntrospectionAccess > SAL_CALL
-ScVbaWorksheet::getIntrospection( ) throw (uno::RuntimeException)
-{
- return uno::Reference< beans::XIntrospectionAccess >();
-}
-
-uno::Any SAL_CALL
-ScVbaWorksheet::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
-{
- OSL_TRACE("** ScVbaWorksheet::invoke( %s ), will barf",
- rtl::OUStringToOString( aFunctionName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
- throw uno::RuntimeException(); // unsupported operation
-}
-
-void SAL_CALL
-ScVbaWorksheet::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
-{
- throw uno::RuntimeException(); // unsupported operation
-}
-uno::Any SAL_CALL
-ScVbaWorksheet::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
-{
-/* uno::Any aProp = getControl( aPropertyName );
-
- if ( !aProp.hasValue() )
- throw beans::UnknownPropertyException(); // unsupported operation
- // #TODO we need a factory here when we support
- // more control types
- sal_Int32 nClassId = -1;
- uno::Reference< beans::XPropertySet > xProps( aProp, uno::UNO_QUERY_THROW );
- const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
- xProps->getPropertyValue( sClassId ) >>= nClassId;
- ScVbaControlFactory controlFactory( m_xContext, xProps, xControlShape );
- uno::Reference< vba::XControl > xControl( controlFactory.createControl( nClassId ) );
- if ( nClassId == form::FormComponentType::COMBOBOX )
- {
- uno::Reference< msforms::XComboBox > xCbx( new ScVbaComboBox( m_xContext, xProps ) );
- return uno::makeAny( xCbx );
- }
-*/
- uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
- ScVbaControlFactory controlFactory( mxContext, xControlShape );
- uno::Reference< msforms::XControl > xControl( controlFactory.createControl() );
- return uno::makeAny( xControl );
-// return aProp;
-}
-
-::sal_Bool SAL_CALL
-ScVbaWorksheet::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException)
-{
- return sal_False;
-}
-::sal_Bool SAL_CALL
-ScVbaWorksheet::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-{
- try
- {
- if ( getControl( aName ).hasValue() )
- return sal_True;
- }
- catch( uno::Exception& )
- {
- }
- return sal_False;
-}
-uno::Any
-ScVbaWorksheet::getControl( const ::rtl::OUString& sName )
-{
- uno::Reference< sheet::XScenarioEnhanced > xIf( getSheet(), uno::UNO_QUERY_THROW );
- ScTableSheetObj* pTab= static_cast< ScTableSheetObj* >( xIf.get() );
- ScDocShell* pShell = NULL;
- if ( pTab )
- pShell = pTab->GetDocShell();
- if ( pShell )
- {
- ScDrawLayer* pDrawLayer = pShell->MakeDrawLayer();
- SCTAB nTab = 0;
- // make GetTab_Impl() public or this class a friend
- const ScRangeList& rRanges = pTab->GetRangeList();
- const ScRange* pFirst = rRanges.GetObject(0);
- if (pFirst)
- nTab = pFirst->aStart.Tab();
-
- SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
- if ( pPage )
- {
- ULONG nCount = pPage->GetObjCount();
- for ( ULONG index=0; index<nCount; ++index )
- {
- SdrObject* pObj = pPage->GetObj( index );
- if ( pObj )
- {
-
- SdrUnoObj* pUnoObj = PTR_CAST(SdrUnoObj, pObj);
- if ( pUnoObj )
- {
- uno::Reference< container::XNamed > xNamed( pUnoObj->GetUnoControlModel(), uno::UNO_QUERY_THROW );
- if ( sName.equals( xNamed->getName() ) )
- return uno::makeAny( xNamed );
- }
- }
- }
- }
- }
-
- return uno::Any();
-}
-
-uno::Any
-ScVbaWorksheet::getControlShape( const ::rtl::OUString& sName )
-{
- //uno::Reference< sheet::XScenarioEnhanced > xIf( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPage, uno::UNO_QUERY_THROW );
- sal_Int32 nCount = xIndexAccess->getCount();
- for( int index = 0; index < nCount; index++ )
- {
- uno::Any aUnoObj = xIndexAccess->getByIndex( index );
- uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY_THROW );
- uno::Reference< awt::XControlModel > xControlModel( xControlShape->getControl() );
- uno::Reference< container::XNamed > xNamed( xControlModel, uno::UNO_QUERY_THROW );
- if( sName.equals( xNamed->getName() ))
- {
- return aUnoObj;
- }
-
- }
- return uno::Any();
-}
-
-
-rtl::OUString&
-ScVbaWorksheet::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorksheet") );
- return sImplName;
-}
-void SAL_CALL
-ScVbaWorksheet::setEnableCalculation( ::sal_Bool bEnableCalculation ) throw ( script::BasicErrorException, uno::RuntimeException)
-{
- uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
- xCalculatable->enableAutomaticCalculation( bEnableCalculation);
-}
-::sal_Bool SAL_CALL
-ScVbaWorksheet::getEnableCalculation( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-{
- uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
- return xCalculatable->isAutomaticCalculationEnabled();
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaWorksheet::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet" ) );
- }
- return aServiceNames;
-}
-
-rtl::OUString SAL_CALL
-ScVbaWorksheet::getCodeName() throw (css::uno::RuntimeException)
-{
-#ifdef VBA_OOBUILD_HACK
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
- SCTAB nTab = 0;
- rtl::OUString aSheetName = getName();
- bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab);
- if ( bSheetExists )
- {
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
- /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- rtl::OUString sCodeName = pExtOptions->GetCodeName( nTab );*/
- String sCodeName;
- pDoc->GetCodeName( nTab, sCodeName );
- return sCodeName;
- }
- else
- throw uno::RuntimeException(::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "Sheet Name does not exist. ") ),
- uno::Reference< XInterface >() );
-#else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-#endif
-}
-#ifdef VBA_OOBUILD_HACK
-void SAL_CALL
-ScVbaWorksheet::setCodeName( const rtl::OUString& sCodeName ) throw (css::uno::RuntimeException)
-{
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
- SCTAB nTab = 0;
- rtl::OUString aSheetName = getName();
- bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab);
- if ( bSheetExists )
- {
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
- /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- pExtOptions->SetCodeName( sCodeName, nTab );*/
- String sNewCodeName( sCodeName );
- pDoc->SetCodeName( nTab, sNewCodeName );
- }
- else
- throw uno::RuntimeException(::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "Sheet Name does not exist. ") ),
- uno::Reference< XInterface >() );
-#else
-void SAL_CALL
-ScVbaWorksheet::setCodeName( const rtl::OUString& ) throw (css::uno::RuntimeException)
-{
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-#endif
-}
-
-sal_Int16
-ScVbaWorksheet::getSheetID() throw (uno::RuntimeException)
-{
- uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW );
- return xAddressable->getRangeAddress().Sheet;
-}
-
-void SAL_CALL
-ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName, const uno::Any& IgnorePrintAreas ) throw (uno::RuntimeException)
-{
- sal_Int32 nTo = 0;
- sal_Int32 nFrom = 0;
- sal_Int16 nCopies = 1;
- sal_Bool bCollate = sal_False;
- sal_Bool bSelection = sal_False;
- sal_Bool bIgnorePrintAreas = sal_False;
- From >>= nFrom;
- To >>= nTo;
- Copies >>= nCopies;
- IgnorePrintAreas >>= bIgnorePrintAreas;
- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
- Collate >>= bCollate;
-
- if ( !( nFrom || nTo ) )
- bSelection = sal_True;
-
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, bSelection );
-}
-
-
-namespace worksheet
-{
-namespace sdecl = comphelper::service_decl;
-sdecl::vba_service_class_<ScVbaWorksheet, sdecl::with_args<true> > serviceImpl;
-extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaWorksheet",
- "org.openoffice.excel.Worksheet" );
-}
diff --git a/scratch/sc-vba/dead-source/vbaworksheet.hxx b/scratch/sc-vba/dead-source/vbaworksheet.hxx
deleted file mode 100644
index b74b1616a..000000000
--- a/scratch/sc-vba/dead-source/vbaworksheet.hxx
+++ /dev/null
@@ -1,146 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaworksheet.hxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_WORKSHEET_HXX
-#define SC_VBA_WORKSHEET_HXX
-
-#include <cppuhelper/implbase2.hxx>
-#include <comphelper/unwrapargs.hxx>
-
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/script/XInvocation.hpp>
-#include <org/openoffice/excel/XWorksheet.hpp>
-#include <org/openoffice/excel/XComments.hpp>
-#include <org/openoffice/excel/XRange.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <org/openoffice/excel/XOutline.hpp>
-#include <org/openoffice/excel/XChartObjects.hpp>
-
-#include "vbahelperinterface.hxx"
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XWorksheet > WorksheetImpl_BASE;
-
-class ScVbaWorksheet : public WorksheetImpl_BASE
-{
- css::uno::Reference< css::sheet::XSpreadsheet > mxSheet;
- css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< oo::excel::XChartObjects > mxCharts;
-
- css::uno::Reference< oo::excel::XWorksheet > getSheetAtOffset(SCTAB offset) throw (css::uno::RuntimeException);
- css::uno::Reference< oo::excel::XRange > getSheetRange() throw (css::uno::RuntimeException);
-
- css::uno::Any getControl( const rtl::OUString& sName );
- css::uno::Any getControlShape( const rtl::OUString& sName );
-protected:
-
- ScVbaWorksheet( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
-public:
- ScVbaWorksheet( const css::uno::Reference< oo::vba::XHelperInterface >& xParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::sheet::XSpreadsheet >& xSheet,
- const css::uno::Reference< css::frame::XModel >& xModel )throw (css::uno::RuntimeException) ;
- ScVbaWorksheet( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
-
- virtual ~ScVbaWorksheet() {}
-
- virtual css::uno::Reference< css::frame::XModel > getModel()
- { return mxModel; }
- virtual css::uno::Reference< css::sheet::XSpreadsheet > getSheet()
- { return mxSheet; }
-
- // Attributes
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getStandardWidth() throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getStandardHeight() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProtectionMode() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProtectContents() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProtectDrawingObjects() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL getUsedRange() throw (css::uno::RuntimeException) ;
- virtual css::uno::Any SAL_CALL ChartObjects( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XOutline > SAL_CALL Outline( ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getNext() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getPrevious() throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Move( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL Copy( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Paste( const css::uno::Any& Destination, const css::uno::Any& Link ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Protect( const css::uno::Any& Password, const css::uno::Any& DrawingObjects, const css::uno::Any& Contents, const css::uno::Any& Scenarios, const css::uno::Any& UserInterfaceOnly ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Unprotect( const css::uno::Any& Password ) throw (css::uno::RuntimeException);
-
- virtual void SAL_CALL Calculate( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL CheckSpelling( const css::uno::Any& CustomDictionary,const css::uno::Any& IgnoreUppercase,const css::uno::Any& AlwaysSuggest, const css::uno::Any& SpellingLang ) throw (css::uno::RuntimeException);
- // Hacks (?)
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Cells( const css::uno::Any &nRow, const css::uno::Any &nCol ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Rows(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Columns(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Any SAL_CALL Evaluate( const ::rtl::OUString& Name ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL PivotTables( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Comments( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Any SAL_CALL OLEObjects( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnableCalculation( ::sal_Bool EnableCalculation ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getEnableCalculation( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL ShowDataForm( ) throw (css::uno::RuntimeException);
- // XInvocation
- virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
- // CodeName
- virtual rtl::OUString SAL_CALL getCodeName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCodeName( const rtl::OUString& sCodeName ) throw (css::uno::RuntimeException);
- sal_Int16 getSheetID() throw (css::uno::RuntimeException);
-
- virtual void SAL_CALL PrintOut( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, const css::uno::Any& IgnorePrintAreas ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-};
-
-#endif /* SC_VBA_WORKSHEET_HXX */
-
diff --git a/scratch/sc-vba/dead-source/vbaworksheets.cxx b/scratch/sc-vba/dead-source/vbaworksheets.cxx
deleted file mode 100644
index 0072aeb57..000000000
--- a/scratch/sc-vba/dead-source/vbaworksheets.cxx
+++ /dev/null
@@ -1,432 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaworksheets.cxx,v $
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include "vbaworksheets.hxx"
-
-#include <sfx2/dispatch.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/itemwrapper.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/eitem.hxx>
-
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/implbase3.hxx>
-
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <org/openoffice/excel/XApplication.hpp>
-#include <tools/string.hxx>
-#include "tabvwsh.hxx"
-
-#include "vbaglobals.hxx"
-#include "vbaworksheet.hxx"
-#include "vbaworkbook.hxx"
-
-using namespace ::org::openoffice;
-using namespace ::com::sun::star;
-
-
-typedef ::cppu::WeakImplHelper1< container::XEnumeration > SheetEnumeration_BASE;
-typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > SheetCollectionHelper_BASE;
-// a map ( or hashmap ) wont do as we need also to preserve the order
-// (as added ) of the items
-typedef std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap;
-
-class WorkSheetsEnumeration : public SheetEnumeration_BASE
-{
- SheetMap mSheetMap;
- SheetMap::iterator mIt;
-public:
- WorkSheetsEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
- {
- return ( mIt != mSheetMap.end() );
- }
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( !hasMoreElements() )
- throw container::NoSuchElementException();
- uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
- return uno::makeAny( xSheet ) ;
- }
-};
-
-class SheetCollectionHelper : public SheetCollectionHelper_BASE
-{
- SheetMap mSheetMap;
- SheetMap::iterator cachePos;
-public:
- SheetCollectionHelper( const SheetMap& sMap ) : mSheetMap( sMap ), cachePos(0) {}
- // XElementAccess
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return sheet::XSpreadsheet::static_type(0); }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return ( mSheetMap.size() > 0 ); }
- // XNameAcess
- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if ( !hasByName(aName) )
- throw container::NoSuchElementException();
- return uno::makeAny( *cachePos );
- }
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
- {
- uno::Sequence< rtl::OUString > sNames( mSheetMap.size() );
- rtl::OUString* pString = sNames.getArray();
- SheetMap::iterator it = mSheetMap.begin();
- SheetMap::iterator it_end = mSheetMap.end();
-
- for ( ; it != it_end; ++it, ++pString )
- {
- uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW );
- *pString = xName->getName();
- }
- return sNames;
- }
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
- {
- cachePos = mSheetMap.begin();
- SheetMap::iterator it_end = mSheetMap.end();
- for ( ; cachePos != it_end; ++cachePos )
- {
- uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
- if ( aName.equals( xName->getName() ) )
- break;
- }
- return ( cachePos != it_end );
- }
-
- // XElementAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) { return mSheetMap.size(); }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
- {
- if ( Index < 0 || Index >= getCount() )
- throw lang::IndexOutOfBoundsException();
-
- return uno::makeAny( mSheetMap[ Index ] );
-
- }
- // XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
- {
- return new WorkSheetsEnumeration( mSheetMap );
- }
-};
-
-class SheetsEnumeration : public EnumerationHelperImpl
-{
- uno::Reference< frame::XModel > m_xModel;
- uno::WeakReference< vba::XHelperInterface > m_xParent;
-public:
- SheetsEnumeration( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_xModel( xModel ), m_xParent( xParent ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< sheet::XSpreadsheet > xSheet( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- return uno::makeAny( uno::Reference< excel::XWorksheet > ( new ScVbaWorksheet( m_xParent, m_xContext, xSheet, m_xModel ) ) );
- }
-
-};
-
-ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xSheets, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, xSheets ), mxModel( xModel ), m_xSheets( uno::Reference< sheet::XSpreadsheets >( xSheets, uno::UNO_QUERY ) )
-{
-}
-
-ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XEnumerationAccess >& xEnumAccess, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xEnumAccess, uno::UNO_QUERY ) ), mxModel(xModel)
-{
-}
-
-// XEnumerationAccess
-uno::Type
-ScVbaWorksheets::getElementType() throw (uno::RuntimeException)
-{
- return excel::XWorksheet::static_type(0);
-}
-
-uno::Reference< container::XEnumeration >
-ScVbaWorksheets::createEnumeration() throw (uno::RuntimeException)
-{
- if ( !m_xSheets.is() )
- {
- uno::Reference< container::XEnumerationAccess > xAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
- return xAccess->createEnumeration();
- }
- uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xSheets, uno::UNO_QUERY_THROW );
- return new SheetsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
-}
-
-uno::Any
-ScVbaWorksheets::createCollectionObject( const uno::Any& aSource )
-{
- uno::Reference< sheet::XSpreadsheet > xSheet( aSource, uno::UNO_QUERY );
- return uno::makeAny( uno::Reference< excel::XWorksheet > ( new ScVbaWorksheet( getParent(), mxContext, xSheet, mxModel ) ) );
-}
-
-// XWorksheets
-uno::Any
-ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After,
- const uno::Any& Count, const uno::Any& Type ) throw (uno::RuntimeException)
-{
- if ( isSelectedSheets() )
- return uno::Any(); // or should we throw?
-
- rtl::OUString aStringSheet;
- sal_Bool bBefore(sal_True);
- SCTAB nSheetIndex = 0;
- SCTAB nNewSheets = 1, nType = 0;
- Count >>= nNewSheets;
- Type >>= nType;
- SCTAB nCount = 0;
- Before >>= aStringSheet;
- if (!aStringSheet.getLength())
- {
- After >>= aStringSheet;
- bBefore = sal_False;
- }
- if (!aStringSheet.getLength())
- {
- aStringSheet = ScVbaGlobals::getGlobalsImpl(
- mxContext )->getApplication()->getActiveWorkbook()->getActiveSheet()->getName();
- bBefore = sal_True;
- }
- nCount = static_cast< SCTAB >( m_xIndexAccess->getCount() );
- for (SCTAB i=0; i < nCount; i++)
- {
- uno::Reference< sheet::XSpreadsheet > xSheet(m_xIndexAccess->getByIndex(i), uno::UNO_QUERY);
- uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
- if (xNamed->getName() == aStringSheet)
- {
- nSheetIndex = i;
- break;
- }
- }
-
- if(!bBefore)
- nSheetIndex++;
-
- SCTAB nSheetName = nCount + 1L;
- String aStringBase( RTL_CONSTASCII_USTRINGPARAM("Sheet") );
- uno::Any result;
- for (SCTAB i=0; i < nNewSheets; i++, nSheetName++)
- {
- String aStringName = aStringBase;
- aStringName += String::CreateFromInt32(nSheetName);
- while (m_xNameAccess->hasByName(aStringName))
- {
- nSheetName++;
- aStringName = aStringBase;
- aStringName += String::CreateFromInt32(nSheetName);
- }
- m_xSheets->insertNewByName(aStringName, nSheetIndex + i);
- result = getItemByStringIndex( aStringName );
- }
-
- return result;
-}
-
-void
-ScVbaWorksheets::Delete() throw (uno::RuntimeException)
-{
- // #TODO #INVESTIGATE
- // mmm this method could be trouble if the underlying
- // uno objects ( the m_xIndexAccess etc ) aren't aware of the
- // contents that are deleted
- sal_Int32 nElems = getCount();
- for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem )
- {
- uno::Reference< excel::XWorksheet > xSheet( Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW );
- xSheet->Delete();
- }
-}
-
-bool
-ScVbaWorksheets::isSelectedSheets()
-{
- return !m_xSheets.is();
-}
-
-void SAL_CALL
-ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException)
-{
- sal_Int32 nTo = 0;
- sal_Int32 nFrom = 0;
- sal_Int16 nCopies = 1;
- sal_Bool bCollate = sal_False;
- sal_Bool bSelection = sal_False;
- From >>= nFrom;
- To >>= nTo;
- Copies >>= nCopies;
- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
- Collate >>= bCollate;
-
- if ( !( nFrom || nTo ) )
- if ( isSelectedSheets() )
- bSelection = sal_True;
-
- PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, mxModel, bSelection );
-}
-
-uno::Any SAL_CALL
-ScVbaWorksheets::getVisible() throw (uno::RuntimeException)
-{
- sal_Bool bVisible = sal_True;
- uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_QUERY_THROW );
- while ( xEnum->hasMoreElements() )
- {
- uno::Reference< excel::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW );
- if ( xSheet->getVisible() == sal_False )
- {
- bVisible = sal_False;
- break;
- }
- }
- return uno::makeAny( bVisible );
-}
-
-void SAL_CALL
-ScVbaWorksheets::setVisible( const uno::Any& _visible ) throw (uno::RuntimeException)
-{
- sal_Bool bState = sal_False;
- if ( _visible >>= bState )
- {
- uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_QUERY_THROW );
- while ( xEnum->hasMoreElements() )
- {
- uno::Reference< excel::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW );
- xSheet->setVisible( bState );
- }
- }
- else
- throw uno::RuntimeException( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "Visible property doesn't support non boolean #FIXME" ) ), uno::Reference< uno::XInterface >() );
-}
-
-void SAL_CALL
-ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException)
-{
- ScTabViewShell* pViewShell = getBestViewShell( mxModel );
- if ( !pViewShell )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() );
-
- ScMarkData& rMarkData = pViewShell->GetViewData()->GetMarkData();
- sal_Bool bReplace = sal_True;
- Replace >>= bReplace;
- // Replace is defaulted to True, meanining this current collection
- // becomes the Selection, if it were false then the current selection would
- // be extended
- bool bSelectSingle = bReplace;
- sal_Int32 nElems = getCount();
- for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem )
- {
- uno::Reference< excel::XWorksheet > xSheet( Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW );
- ScVbaWorksheet* pSheet = dynamic_cast< ScVbaWorksheet* >( xSheet.get() );
- if ( pSheet )
- {
- if ( bSelectSingle )
- {
- rMarkData.SelectOneTable( static_cast< SCTAB >( pSheet->getSheetID() ) );
- bSelectSingle = false;
- }
- else
- rMarkData.SelectTable( static_cast< SCTAB >( pSheet->getSheetID() ), TRUE );
-
- }
- }
-
-
-}
-
-//ScVbaCollectionBaseImpl
-uno::Any SAL_CALL
-ScVbaWorksheets::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException)
-{
- if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE )
- {
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext);
- uno::Any aConverted;
- aConverted = xConverter->convertTo( Index, getCppuType((uno::Sequence< uno::Any >*)0) );
- SheetMap mSheets;
- uno::Sequence< uno::Any > sIndices;
- aConverted >>= sIndices;
- sal_Int32 nElems = sIndices.getLength();
- for( sal_Int32 index = 0; index < nElems; ++index )
- {
- uno::Reference< excel::XWorksheet > xWorkSheet( ScVbaWorksheets_BASE::Item( sIndices[ index ], Index2 ), uno::UNO_QUERY_THROW );
- ScVbaWorksheet* pWorkSheet = dynamic_cast< ScVbaWorksheet* >( xWorkSheet.get() );
- if ( pWorkSheet )
- {
- uno::Reference< sheet::XSpreadsheet > xSheet( pWorkSheet->getSheet() , uno::UNO_QUERY_THROW );
- uno::Reference< container::XNamed > xName( xSheet, uno::UNO_QUERY_THROW );
- mSheets.push_back( xSheet );
- }
- }
- uno::Reference< container::XIndexAccess > xIndexAccess = new SheetCollectionHelper( mSheets );
- uno::Reference< vba::XCollection > xSelectedSheets( new ScVbaWorksheets( this->getParent(), mxContext, xIndexAccess, mxModel ) );
- return uno::makeAny( xSelectedSheets );
- }
- return ScVbaWorksheets_BASE::Item( Index, Index2 );
-}
-
-uno::Any
-ScVbaWorksheets::getItemByStringIndex( const rtl::OUString& sIndex ) throw (uno::RuntimeException)
-{
- String sScIndex = sIndex;
- ScDocument::ConvertToValidTabName( sScIndex, '_' );
- return ScVbaWorksheets_BASE::getItemByStringIndex( sScIndex );
-}
-
-rtl::OUString&
-ScVbaWorksheets::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorksheets") );
- return sImplName;
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaWorksheets::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > sNames;
- if ( sNames.getLength() == 0 )
- {
- sNames.realloc( 1 );
- sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheets") );
- }
- return sNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbaworksheets.hxx b/scratch/sc-vba/dead-source/vbaworksheets.hxx
deleted file mode 100644
index 74500a5e9..000000000
--- a/scratch/sc-vba/dead-source/vbaworksheets.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_WORKSHEETS_HXX
-#define SC_VBA_WORKSHEETS_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <org/openoffice/excel/XWorksheets.hpp>
-#include <com/sun/star/sheet/XSpreadsheets.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <org/openoffice/vba/XGlobals.hpp>
-
-#include "vbacollectionimpl.hxx"
-
-class ScModelObj;
-
-
-typedef CollTestImplHelper< oo::excel::XWorksheets > ScVbaWorksheets_BASE;
-
-class ScVbaWorksheets : public ScVbaWorksheets_BASE
-{
- css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::sheet::XSpreadsheets > m_xSheets;
-protected:
- // ScVbaWorksheets_BASE
- virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException);
-public:
- ScVbaWorksheets( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xSheets, const css::uno::Reference< css::frame::XModel >& xModel );
- ScVbaWorksheets( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XEnumerationAccess >& xEnum, const css::uno::Reference< css::frame::XModel >& xModel );
- virtual ~ScVbaWorksheets() {}
-
- bool isSelectedSheets();
-
- // XEnumerationAccess
- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-
-
- // XWorksheets
- virtual css::uno::Any SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( const css::uno::Any& _visible ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Before, const css::uno::Any& After, const css::uno::Any& Count, const css::uno::Any& Type ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL PrintOut( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::uno::RuntimeException);
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException);
- // ScVbaWorksheets_BASE
- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw
-(css::uno::RuntimeException);
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-
-#endif /* SC_VBA_WORKSHEETS_HXX */
diff --git a/scratch/sc-vba/dead-source/vbawsfunction.cxx b/scratch/sc-vba/dead-source/vbawsfunction.cxx
deleted file mode 100644
index d8443d3ff..000000000
--- a/scratch/sc-vba/dead-source/vbawsfunction.cxx
+++ /dev/null
@@ -1,157 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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
- *
- ************************************************************************/
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/table/XCell.hpp>
-#include <com/sun/star/table/XColumnRowRange.hpp>
-#include <com/sun/star/beans/XIntrospection.hpp>
-#include <com/sun/star/beans/XIntrospectionAccess.hpp>
-#include <com/sun/star/sheet/XFunctionAccess.hpp>
-#include <com/sun/star/sheet/XCellRangesQuery.hpp>
-#include <com/sun/star/sheet/CellFlags.hpp>
-#include <com/sun/star/reflection/XIdlMethod.hpp>
-#include <com/sun/star/beans/MethodConcept.hpp>
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <comphelper/anytostring.hxx>
-
-#include "vbawsfunction.hxx"
-
-using namespace com::sun::star;
-using namespace org::openoffice;
-
-ScVbaWSFunction::ScVbaWSFunction( const uno::Reference< vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext): ScVbaWSFunction_BASE( xParent, xContext )
-{
- m_xNameAccess.set( mxContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.FunctionDescriptions") ), mxContext ), uno::UNO_QUERY_THROW );
-}
-
-
-uno::Reference< beans::XIntrospectionAccess >
-ScVbaWSFunction::getIntrospection(void) throw(uno::RuntimeException)
-{
- return uno::Reference<beans::XIntrospectionAccess>();
-}
-
-uno::Any SAL_CALL
-ScVbaWSFunction::invoke(const rtl::OUString& FunctionName, const uno::Sequence< uno::Any >& Params, uno::Sequence< sal_Int16 >& /*OutParamIndex*/, uno::Sequence< uno::Any >& /*OutParam*/) throw(lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
-{
- uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XFunctionAccess > xFunctionAccess(
- xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii(
- "com.sun.star.sheet.FunctionAccess"), mxContext),
- ::uno::UNO_QUERY_THROW);
- uno::Sequence< uno::Any > aParamTemp;
- sal_Int32 nParamCount = Params.getLength();
- aParamTemp.realloc(nParamCount);
- const uno::Any* aArray = Params.getConstArray();
- uno::Any* aArrayTemp = aParamTemp.getArray();
-
- for (int i=0; i < Params.getLength();i++)
- {
- uno::Reference<excel::XRange> myRange( aArray[ i ], uno::UNO_QUERY );
- if ( myRange.is() )
- {
- aArrayTemp[i] = myRange->getCellRange();
- continue;
- }
- aArrayTemp[i]= aArray[i];
- }
-
- for ( int count=0; count < aParamTemp.getLength(); ++count )
- OSL_TRACE("Param[%d] is %s",
- count, rtl::OUStringToOString( comphelper::anyToString( aParamTemp[count] ), RTL_TEXTENCODING_UTF8 ).getStr() );
- return xFunctionAccess->callFunction(FunctionName,aParamTemp);
-}
-
-void SAL_CALL
-ScVbaWSFunction::setValue(const rtl::OUString& /*PropertyName*/, const uno::Any& /*Value*/) throw(beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
-{
- throw beans::UnknownPropertyException();
-}
-
-uno::Any SAL_CALL
-ScVbaWSFunction::getValue(const rtl::OUString& /*PropertyName*/) throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- throw beans::UnknownPropertyException();
-}
-
-sal_Bool SAL_CALL
-ScVbaWSFunction::hasMethod(const rtl::OUString& Name) throw(uno::RuntimeException)
-{
- sal_Bool bIsFound = sal_False;
- try
- {
- if ( m_xNameAccess->hasByName( Name ) )
- bIsFound = sal_True;
- }
- catch( uno::Exception& /*e*/ )
- {
- // failed to find name
- }
- return bIsFound;
-}
-
-sal_Bool SAL_CALL
-ScVbaWSFunction::hasProperty(const rtl::OUString& /*Name*/) throw(uno::RuntimeException)
-{
- return sal_False;
-}
-
-::rtl::OUString SAL_CALL
-ScVbaWSFunction::getExactName( const ::rtl::OUString& aApproximateName ) throw (css::uno::RuntimeException)
-{
- rtl::OUString sName = aApproximateName.toAsciiUpperCase();
- if ( !hasMethod( sName ) )
- return rtl::OUString();
- return sName;
-}
-
-rtl::OUString&
-ScVbaWSFunction::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWSFunction") );
- return sImplName;
-}
-
-uno::Sequence< rtl::OUString >
-ScVbaWSFunction::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.WorksheetFunction" ) );
- }
- return aServiceNames;
-}
diff --git a/scratch/sc-vba/dead-source/vbawsfunction.hxx b/scratch/sc-vba/dead-source/vbawsfunction.hxx
deleted file mode 100644
index ff3d35d8d..000000000
--- a/scratch/sc-vba/dead-source/vbawsfunction.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile$
- *
- * $Revision$
- *
- * last change: $Author$ $Date$
- *
- * 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 SC_VBA_INTERIOR_HXX
-#define SC_VBA_INTERIOR_HXX
-
-#include <org/openoffice/excel/XWorksheetFunction.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include "vbarange.hxx"
-
-#include <com/sun/star/beans/XExactName.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-
-typedef InheritedHelperInterfaceImpl1< oo::excel::XWorksheetFunction > ScVbaWSFunction_BASE;
-
-class ScVbaWSFunction : public ScVbaWSFunction_BASE
-{
- css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
-public:
- ScVbaWSFunction( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
- virtual ~ScVbaWSFunction(){}
-
- virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection(void) throw(css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL invoke(const rtl::OUString& FunctionName, const css::uno::Sequence< css::uno::Any >& Params, css::uno::Sequence< sal_Int16 >& OutParamIndex, css::uno::Sequence< css::uno::Any >& OutParam) throw(css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
- virtual void SAL_CALL setValue(const rtl::OUString& PropertyName, const css::uno::Any& Value) throw(css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getValue(const rtl::OUString& PropertyName) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasMethod(const rtl::OUString& Name) throw(css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasProperty(const rtl::OUString& Name) throw(css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getExactName( const ::rtl::OUString& aApproximateName ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
-};
-#endif
-
diff --git a/scratch/sc-vba/makefile.mk b/scratch/sc-vba/makefile.mk
deleted file mode 100644
index e31dfe9a8..000000000
--- a/scratch/sc-vba/makefile.mk
+++ /dev/null
@@ -1,133 +0,0 @@
-#*************************************************************************
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.4 $
-#
-# last change: $Author: rt $ $Date: 2007/04/27 09:25:06 $
-#
-# 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
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-
-PRJNAME=sc
-TARGET=vbaobj
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-DLLPRE =
-
-.IF "$(ENABLE_VBA)"!="YES"
-dummy:
- @echo "not building vba..."
-.ENDIF
-
-INCPRE=$(INCCOM)$/$(TARGET)
-CDEFS+=-DVBA_OOBUILD_HACK
-# ------------------------------------------------------------------
-
-SLOFILES= \
- $(SLO)$/vbaglobals.obj \
- $(SLO)$/vbaworkbook.obj \
- $(SLO)$/vbaworksheets.obj \
- $(SLO)$/vbaapplication.obj \
- $(SLO)$/vbarange.obj \
- $(SLO)$/vbaname.obj \
- $(SLO)$/vbanames.obj \
- $(SLO)$/vbacomment.obj \
- $(SLO)$/vbacomments.obj \
- $(SLO)$/vbaworkbooks.obj \
- $(SLO)$/vbaworksheet.obj \
- $(SLO)$/vbaoutline.obj \
- $(SLO)$/vbafont.obj\
- $(SLO)$/vbahelper.obj\
- $(SLO)$/vbainterior.obj\
- $(SLO)$/vbawsfunction.obj\
- $(SLO)$/vbawindow.obj\
- $(SLO)$/vbachart.obj\
- $(SLO)$/vbachartobject.obj\
- $(SLO)$/vbachartobjects.obj\
- $(SLO)$/vbaseriescollection.obj\
- $(SLO)$/vbadialogs.obj \
- $(SLO)$/vbadialog.obj \
- $(SLO)$/vbapivottable.obj \
- $(SLO)$/vbapivotcache.obj \
- $(SLO)$/vbapivottables.obj \
- $(SLO)$/vbawindows.obj \
- $(SLO)$/vbapalette.obj \
- $(SLO)$/vbaborders.obj \
- $(SLO)$/vbacharacters.obj \
- $(SLO)$/vbacombobox.obj \
- $(SLO)$/vbavalidation.obj \
- $(SLO)$/vbacontrol.obj \
- $(SLO)$/vbaoleobject.obj \
- $(SLO)$/vbaoleobjects.obj \
- $(SLO)$/vbabutton.obj \
- $(SLO)$/vbalabel.obj \
- $(SLO)$/vbatextbox.obj \
- $(SLO)$/vbaradiobutton.obj \
- $(SLO)$/vbalistbox.obj \
- $(SLO)$/vbapropvalue.obj \
- $(SLO)$/vbapane.obj \
- $(SLO)$/vbashape.obj \
- $(SLO)$/vbacolorformat.obj \
- $(SLO)$/vbashapes.obj \
- $(SLO)$/vbalineformat.obj \
- $(SLO)$/vbafillformat.obj \
- $(SLO)$/vbapictureformat.obj \
- $(SLO)$/vbashaperange.obj \
- $(SLO)$/vbatextframe.obj \
- $(SLO)$/vbacharttitle.obj \
- $(SLO)$/vbacharts.obj \
- $(SLO)$/vbaaxistitle.obj \
- $(SLO)$/vbaaxes.obj \
- $(SLO)$/vbaaxis.obj \
- $(SLO)$/vbaformat.obj \
- $(SLO)$/vbacondition.obj \
- $(SLO)$/vbaformatcondition.obj \
- $(SLO)$/vbaformatconditions.obj \
- $(SLO)$/vbastyle.obj \
- $(SLO)$/vbastyles.obj \
- $(SLO)$/service.obj \
-
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-
-ALLTAR : \
- $(MISC)$/$(TARGET).don \
-
-$(SLOFILES) : $(MISC)$/$(TARGET).don
-
-$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
- +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
- echo $@
-
diff --git a/scratch/sc-vba/testvba/README b/scratch/sc-vba/testvba/README
deleted file mode 100644
index 06f878d78..000000000
--- a/scratch/sc-vba/testvba/README
+++ /dev/null
@@ -1,37 +0,0 @@
-to run the tests
-
-build
-=====
- dmake
-
-windows
-=======
- a) you can download a cygwin bash shell environment and install perl ( http://cygwin.com/setup.exe )
- from the cmdline './runTests.pl $(OFFICE_PROGRAM_PATH)' should run the testclient and compare the logs
- b) use ordinary windows perl [1], but additionally you will need the 'diff' program for window ( download from http://gnuwin32.sourceforge.net/packages/diffutils.htm )
-
-[1] for the testclient the perl ( all inclusive ) bundle from ActivePerl is mor e than adeqate ( download from http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.822-MSWin32-x86-280952.msi )
-
- to run all test cases type
- 'perl ./runTests.pl $(OFFICE_PROGRAM_PATH)'
- to run a test case type
- 'perl ./runTests.pl $(OFFICE_PROGRAM_PATH) testfilename'
-
-unix
-====
-
-assuming perl is installed
- './runTests.pl $(OFFICE_PROGRAM_PATH)'
- or './runTests.pl $(OFFICE_PROGRAM_PATH) testfilename' for one file test.
-
-
-Note: For either windows or unix all of the tests should pass ( and you should get a result like )
-Note Also: If you meat a problem that stop running test after serveral test documents have been run. please clean your .ooo-2.0 or .oooxxx first, and then re-run.
-
-========>
-
-skipped 0 test-cases(s)
-compared 9 test-case documents
- 9 tests passedTests
-
-Note also: the testclient will attempt to connect to an existing instance of open-office, when the testClient exits the soffice process may still be running, if you wish to repeat tests you may want to kill the office instance before re-running.
diff --git a/scratch/sc-vba/testvba/TestDocuments/ApplicationRunTest.xls b/scratch/sc-vba/testvba/TestDocuments/ApplicationRunTest.xls
deleted file mode 100644
index a5a591c1f..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/ApplicationRunTest.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/AutoFilter.xls b/scratch/sc-vba/testvba/TestDocuments/AutoFilter.xls
deleted file mode 100644
index 9b3a1043c..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/AutoFilter.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/CalcFont.xls b/scratch/sc-vba/testvba/TestDocuments/CalcFont.xls
deleted file mode 100644
index 9ddb69600..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/CalcFont.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/CalcZoom.xls b/scratch/sc-vba/testvba/TestDocuments/CalcZoom.xls
deleted file mode 100644
index 5db47c76d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/CalcZoom.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/FinancialFuncTests.xls b/scratch/sc-vba/testvba/TestDocuments/FinancialFuncTests.xls
deleted file mode 100644
index d4776b98f..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/FinancialFuncTests.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls b/scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls
deleted file mode 100644
index cc4f157a8..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/MiscOperatorTests.xls b/scratch/sc-vba/testvba/TestDocuments/MiscOperatorTests.xls
deleted file mode 100644
index 23227ae37..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/MiscOperatorTests.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/MiscRangeTests.xls b/scratch/sc-vba/testvba/TestDocuments/MiscRangeTests.xls
deleted file mode 100644
index ebd9e91b5..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/MiscRangeTests.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/MiscRegressionTests.xls b/scratch/sc-vba/testvba/TestDocuments/MiscRegressionTests.xls
deleted file mode 100644
index d87fe067f..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/MiscRegressionTests.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/PageBreaks.xls b/scratch/sc-vba/testvba/TestDocuments/PageBreaks.xls
deleted file mode 100644
index b6651fa5d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/PageBreaks.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/Ranges-2.xls b/scratch/sc-vba/testvba/TestDocuments/Ranges-2.xls
deleted file mode 100644
index f6e81cf93..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/Ranges-2.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/Ranges-3.xls b/scratch/sc-vba/testvba/TestDocuments/Ranges-3.xls
deleted file mode 100644
index 8722f6d30..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/Ranges-3.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/Ranges.xls b/scratch/sc-vba/testvba/TestDocuments/Ranges.xls
deleted file mode 100644
index 1c1d74d37..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/Ranges.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/Shapes.xls b/scratch/sc-vba/testvba/TestDocuments/Shapes.xls
deleted file mode 100644
index 254f3c977..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/Shapes.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/StrConv-test.xls b/scratch/sc-vba/testvba/TestDocuments/StrConv-test.xls
deleted file mode 100644
index 198abbec5..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/StrConv-test.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/Template.xls b/scratch/sc-vba/testvba/TestDocuments/Template.xls
deleted file mode 100644
index 4387231fe..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/Template.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/TestAddress.xls b/scratch/sc-vba/testvba/TestDocuments/TestAddress.xls
deleted file mode 100644
index 48d30cbe2..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/TestAddress.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest.xls b/scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest.xls
deleted file mode 100644
index a497d4f10..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest2.xls b/scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest2.xls
deleted file mode 100644
index 34c606fc2..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/TestCalc_Rangetest2.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/TestIntersection.xls b/scratch/sc-vba/testvba/TestDocuments/TestIntersection.xls
deleted file mode 100644
index 24f88db87..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/TestIntersection.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/TestUnion.xls b/scratch/sc-vba/testvba/TestDocuments/TestUnion.xls
deleted file mode 100644
index 5b8f0968c..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/TestUnion.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/VariantTest.xls b/scratch/sc-vba/testvba/TestDocuments/VariantTest.xls
deleted file mode 100644
index f604cfbe3..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/VariantTest.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/Window.xls b/scratch/sc-vba/testvba/TestDocuments/Window.xls
deleted file mode 100644
index 6fb6963c2..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/Window.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/bytearraystring.xls b/scratch/sc-vba/testvba/TestDocuments/bytearraystring.xls
deleted file mode 100644
index 471bbc349..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/bytearraystring.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/dateserial.xls b/scratch/sc-vba/testvba/TestDocuments/dateserial.xls
deleted file mode 100644
index 768fb513e..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/dateserial.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/datevalue.xls b/scratch/sc-vba/testvba/TestDocuments/datevalue.xls
deleted file mode 100644
index 852a51d10..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/datevalue.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/format.xls b/scratch/sc-vba/testvba/TestDocuments/format.xls
deleted file mode 100644
index 99ed64d38..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/format.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/AutoFilter.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/AutoFilter.log
deleted file mode 100644
index 1fe0cbd01..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/AutoFilter.log
+++ /dev/null
@@ -1,20 +0,0 @@
-Test run started : 17/07/2007 17:36:22
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1 'starts with' string criteria
- ITEM Assertion OK : test2 'not equal to' string criteria
- ITEM Assertion OK : test3 'ends with' string criteria
- ITEM Assertion OK : test4 field 'all'
- ITEM Assertion OK : test5 numeric '<15'
- ITEM Assertion OK : test6 numeric '>=15'
- ITEM Assertion OK : test7 numeric '<=12'
-Test Results
-============
-
-Tests passed: 7
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 17/07/2007 17:36:23
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/MiscRangeTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/MiscRangeTests.log
deleted file mode 100644
index 260465386..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/MiscRangeTests.log
+++ /dev/null
@@ -1,45 +0,0 @@
-Test run started : 17/07/2007 15:01:37
-----------------------------------------------------------------
-MiscRangeTests
- TEST START : MiscRangeTests
- ITEM Assertion OK : test 1
- ITEM Assertion OK : test 2
- ITEM Assertion OK : test 3
- ITEM Assertion OK : test 4
- ITEM Assertion OK : test 5
- ITEM Assertion OK : test 6
- ITEM Assertion OK : test 7
- ITEM Assertion OK : test 8
- ITEM Assertion OK : test 9
- ITEM Assertion OK : test 10
- ITEM Assertion OK : test 11
- ITEM Assertion OK : test 12
- ITEM Assertion OK : test 13
- ITEM Assertion OK : test 14
- ITEM Assertion OK : test 15
- ITEM Assertion OK : test 16
- ITEM Assertion OK : test 17
- ITEM Assertion OK : test 18
- ITEM Assertion OK : test 19
- ITEM Assertion OK : test 20
- ITEM Assertion OK : test 21
- ITEM Assertion OK : test 22
- ITEM Assertion OK : test 23
- ITEM Assertion OK : test 24
- ITEM Assertion OK : test 25
- ITEM Assertion OK : test 26
- ITEM Assertion OK : test 27
- ITEM Assertion OK : test 28
- ITEM Assertion OK : test 29
- ITEM Assertion OK : test 30
- ITEM Assertion OK : test 31
-No. tests: 31
-Summary
-=======
-Run: 31
-Passed: 31
-Failed: 0
-
-END 'MiscRangeTests
- TEST OK : MiscRangeTests
-Test run finished : 17/07/2007 15:01:39
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-2.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-2.log
deleted file mode 100644
index 736d5bbc4..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-2.log
+++ /dev/null
@@ -1,68 +0,0 @@
-Test run started : 18/06/2007 17:50:04
-----------------------------------------------------------------
-ClearFormtsIssue
- TEST START : ClearFormtsIssue
- ITEM Assertion OK : Range.Font.Bold is: True
- ITEM Assertion OK : Range.Font.Bold is: False
-END 'ClearFormtsIssue' Symbol
- TEST OK : ClearFormtsIssue
-----------------------------------------------------------------
-VerticalAlignment-Issue
- TEST START : VerticalAlignment-Issue
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : Range.VeritcalAlignment is Null
-END 'VerticalAlignment-Issue' Symbol
- TEST OK : VerticalAlignment-Issue
-----------------------------------------------------------------
-HorizontalAlignment-Issue
- TEST START : HorizontalAlignment-Issue
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : Range.HorizontalAlignment is Null
-END 'HorizontalAlignment-Issue' Symbol
- TEST OK : HorizontalAlignment-Issue
-----------------------------------------------------------------
-WrapText-Issue
- TEST START : WrapText-Issue
- ITEM Assertion OK : - Range.WrapText (get)
- ITEM Assertion OK : - Range.WrapText (get)
- ITEM Assertion OK : Range.WrapText is Null
-END 'WrapText-Issue' Symbol
- TEST OK : WrapText-Issue
-----------------------------------------------------------------
-FontBorderIssues
- TEST START : FontBorderIssues
- ITEM Assertion OK : - = Borders.Color (getColor)
- ITEM Assertion OK : - = Font.Color (getColor)
-END 'FontBorderIssues' Symbol
- TEST OK : FontBorderIssues
-----------------------------------------------------------------
-RangeSizeIssues
- TEST START : RangeSizeIssues
- ITEM Assertion OK : Range.Left is: 114
- ITEM Assertion OK : Range.Top is: 95.25
- ITEM Assertion OK : Range.Width is: 216
- ITEM Assertion OK : Range.Height is: 271.5
-END 'RangeSizeIssues' Symbol
- TEST OK : RangeSizeIssues
-----------------------------------------------------------------
-ApplicationIssues
- TEST START : ApplicationIssues
- ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Application.ActiveSheet.Name: Sheet1
-END 'ApplicationIssues' Symbol
- TEST OK : ApplicationIssues
-Test run finished : 18/06/2007 17:50:04
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-3.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-3.log
deleted file mode 100644
index a7de979d5..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges-3.log
+++ /dev/null
@@ -1,8 +0,0 @@
-Test run started : 19/06/2007 11:21:42
-----------------------------------------------------------------
-MyGoalseek-Issue
- TEST START : MyGoalseek-Issue
- ITEM Assertion OK : Variable Range value: 15
-END 'MyGoalseek-Issue' Symbol
- TEST OK : MyGoalseek-Issue
-Test run finished : 19/06/2007 11:21:42
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges.log
deleted file mode 100644
index 8c9644aac..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/Ranges.log
+++ /dev/null
@@ -1,280 +0,0 @@
-Test run started : 01/06/2007 11:28:58
-----------------------------------------------------------------
-ApplicationMethods
- TEST START : ApplicationMethods
- ITEM Assertion OK : Name of Workbook is: Ranges.xls
- ITEM Assertion OK : Address of Application.Columns is: $A:$A
- ITEM Assertion OK : Address of Application.Rows is: $1:$1
- ITEM Assertion OK : Address of Application.Range is: $1:$1,$5:$7
- ITEM Assertion OK : Please check manually: DefaultFilePath is: C:\Documents and Settings\vituosity\My Documents
- ITEM Assertion OK : Please check manually: Library Path is: C:\Program Files\Microsoft Office\OFFICE11\LIBRARY
- ITEM Assertion OK : Please check manually: Template Path is: C:\Documents and Settings\vituosity\Application Data\Microsoft\Templates\
- ITEM Assertion OK : FileSeparator is \
- ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls
-END 'ApplicationMethods' Symbol
- TEST OK : ApplicationMethods
-----------------------------------------------------------------
-Insert-Issue
- TEST START : Insert-Issue
- ITEM Assertion OK : Insert with xlShiftToRight: 10
-END 'Insert-Issue' Symbol
- TEST OK : Insert-Issue
-----------------------------------------------------------------
-MergeCells-Issue
- TEST START : MergeCells-Issue
- ITEM Assertion OK : Range.MergeCells is True
- ITEM Assertion OK : MergeCells is null: True
- ITEM Assertion OK : RowCount after Merge: 6
- ITEM Assertion OK : Range.MergeCells is False
- ITEM Assertion OK : MergeCells is null: False
- ITEM Assertion OK : MergeCells of Second Area is null : True
- ITEM Assertion OK : MergeCells of Ranges is Null: True
- ITEM Assertion OK : RowCount after Merge: 7
- ITEM Assertion OK : Range.MergeCells is False
- ITEM Assertion OK : MergeCells is null: False
- ITEM Assertion OK : RowCount after Merge: 7
-END 'MergeCells-Issue' Symbol
- TEST OK : MergeCells-Issue
-----------------------------------------------------------------
-Areas-Issue
- TEST START : Areas-Issue
- ITEM Assertion OK : Range Areas Count is2
- ITEM Assertion OK : First Range Address is: $E$8:$G$13
- ITEM Assertion OK : First Row is: 8
- ITEM Assertion OK : First Column is: 5
- ITEM Assertion OK : EntireRow Address is: $8:$13,$13:$19
- ITEM Assertion OK : EntireColumn Address is: $E:$G,$G:$K
- ITEM Assertion OK : Range Count:53
-END 'Areas-Issue' Symbol
- TEST OK : Areas-Issue
-----------------------------------------------------------------
-Fill-Methods-Issue
- TEST START : Fill-Methods-Issue
- ITEM Assertion OK : Range Value after FillDown: MyFillValue
- ITEM Assertion OK : Range Value after FillDown: MyFillValue
- ITEM Assertion OK : Range Value after FillDown: MyRightFillValue
- ITEM Assertion OK : Range Value after FillDown: MyBottomFillValue
-END 'Fill-Methods-Issue' Symbol
- TEST OK : Fill-Methods-Issue
-----------------------------------------------------------------
-Range/Item-Method-Issue
- TEST START : Range/Item-Method-Issue
- ITEM Assertion OK : Range of multiple columns is: $A:$A,$C:$C
- ITEM Assertion OK : Range of multiple rows is: $1:$1,$5:$7
- ITEM Assertion OK : Range of several columns is: $C:$E,$D:$D
- ITEM Assertion OK : Range of several rows is: $5:$8,$6:$10
- ITEM Assertion OK : Range of several single cells is: $C$5,$E$8
- ITEM Assertion OK : Range of several named ranges is: $L$1:$M$6,$E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range of a single Item Cell is: $E$21
- ITEM Assertion OK : Range of a single Item Cell is: $F$21
- ITEM Assertion OK : Range of a single Item Cell is: $F$10
-END 'Range/Item-Method-Issue' Symbol
- TEST OK : Range/Item-Method-Issue
-----------------------------------------------------------------
-R1C1-Formulas-Issue
- TEST START : R1C1-Formulas-Issue
- ITEM Assertion OK : R1C1 Range.Formula is: =IF(OR(R[-2]C[1]=0,RC[2]="YES"),"")
- ITEM Assertion OK : Range.Formula is: =IF(OR(J8=0,K10="YES"),"")
-END 'R1C1-Formulas-Issue' Symbol
- TEST OK : R1C1-Formulas-Issue
-----------------------------------------------------------------
-Verify_Delete
- TEST START : Verify_Delete
- ITEM Assertion OK : Ranges are intersecting: $G$13
- ITEM Assertion OK : Delete with Default: $AJ$4
- ITEM Assertion OK : Delete with ShifttoLeft: $AJ$4
- ITEM Assertion OK : Delete with ShiftUp: $M$22
-END 'Verify_Delete' Symbol
- TEST OK : Verify_Delete
-----------------------------------------------------------------
-Value-Issue
- TEST START : Value-Issue
- ITEM Assertion OK : Value of Range is: 12.3
- ITEM Assertion OK : Text of Range is: 12.3
- ITEM Assertion OK : Range has Formula: False
- ITEM Assertion OK : Cell has Formula: False
- ITEM Assertion OK : Text of Range is null: True
- ITEM Assertion OK : Range has Formula: True
- ITEM Assertion OK : Cell has Formula: True
- ITEM Assertion OK : Value of Cell is: 12
- ITEM Assertion OK : Application.Calculation is : -4135
- ITEM Assertion OK : Calculation is automated: True
- ITEM Assertion OK : Range has Formula: True
- ITEM Assertion OK : Value of Cell is: 16
- ITEM Assertion OK : Text of Cell is: 16
- ITEM Assertion OK : Text of Cell is: 16
- ITEM Assertion OK : Range has Formula after 'ClearContents: False
- ITEM Assertion OK : Text of Cell is:
- ITEM Assertion OK : Text of Cell is:
-END 'Value-Issue' Symbol
- TEST OK : Value-Issue
-----------------------------------------------------------------
-AutoFit issue
- TEST START : AutoFit issue
- ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 673
- ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 612
-END 'AutoFit issue' Symbol
- TEST OK : AutoFit issue
-----------------------------------------------------------------
-Selections
- TEST START : Selections
- ITEM Assertion OK : ActiveCell is : $E$8
- ITEM Assertion OK : Active Cell is : $E$8
- ITEM Assertion OK : Number of Cells in Range: 53
- ITEM Assertion OK : Number of Cells in Range: 53
- ITEM Assertion OK : Number of Cells in Range: 53
-END 'Selections' Symbol
- TEST OK : Selections
-----------------------------------------------------------------
-Offset-Resize
- TEST START : Offset-Resize
- ITEM Assertion OK : Offset is : $G$10:$I$15,$I$15:$M$21
- ITEM Assertion OK : Offset is : $G$7:$I$12,$I$12:$M$18
- ITEM Assertion OK : Resized Range is : $A$20:$D$23
-END 'Offset-Resize' Symbol
- TEST OK : Offset-Resize
-----------------------------------------------------------------
-Ranges-Address
- TEST START : Ranges-Address
- ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range Address is: $E8:$G13,$G13:$K19
- ITEM Assertion OK : Range Address is: E$8:G$13,G$13:K$19
- ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5],R[11]C[5]:R[17]C[9]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13,$G$13:$K$19
-END 'Ranges-Address' Symbol
- TEST OK : Ranges-Address
-----------------------------------------------------------------
-Range-Address
- TEST START : Range-Address
- ITEM Assertion OK : Range Address is: $E$8:$G$13
- ITEM Assertion OK : Range Address is: $E8:$G13
- ITEM Assertion OK : Range Address is: E$8:G$13
- ITEM Assertion OK : Range Address is: R8C5:R13C7
- ITEM Assertion OK : Range Address is: $E$8:$G$13
- ITEM Assertion OK : Range Address is: R8C5:R13C7
- ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13
-END 'Range-Address' Symbol
- TEST OK : Range-Address
-----------------------------------------------------------------
-Column-Address
- TEST START : Column-Address
- ITEM Assertion OK : Range Address is: $F$8:$F$13
- ITEM Assertion OK : Range Address is: $F8:$F13
- ITEM Assertion OK : Range Address is: F$8:F$13
- ITEM Assertion OK : Range Address is: R8C6:R13C6
- ITEM Assertion OK : Range Address is: $F$8:$F$13
- ITEM Assertion OK : Range Address is: R8C6:R13C6
- ITEM Assertion OK : Range Address is: R[6]C[4]:R[11]C[4]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$8:$F$13
-END 'Column-Address' Symbol
- TEST OK : Column-Address
-----------------------------------------------------------------
-Row-Address
- TEST START : Row-Address
- ITEM Assertion OK : Range Address is: $E$9:$G$9
- ITEM Assertion OK : Range Address is: $E9:$G9
- ITEM Assertion OK : Range Address is: E$9:G$9
- ITEM Assertion OK : Range Address is: R9C5:R9C7
- ITEM Assertion OK : Range Address is: $E$9:$G$9
- ITEM Assertion OK : Range Address is: R9C5:R9C7
- ITEM Assertion OK : Range Address is: R[7]C[3]:R[7]C[5]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$9:$G$9
-END 'Row-Address' Symbol
- TEST OK : Row-Address
-----------------------------------------------------------------
-SingleCell-Address
- TEST START : SingleCell-Address
- ITEM Assertion OK : Range Address is: $F$9
- ITEM Assertion OK : Range Address is: $F9
- ITEM Assertion OK : Range Address is: F$9
- ITEM Assertion OK : Range Address is: R9C6
- ITEM Assertion OK : Range Address is: $F$9
- ITEM Assertion OK : Range Address is: R9C6
- ITEM Assertion OK : Range Address is: R[7]C[4]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$9
-END 'SingleCell-Address' Symbol
- TEST OK : SingleCell-Address
-----------------------------------------------------------------
-Heights and Widths
- TEST START : Heights and Widths
- ITEM Assertion OK : Range RowHeight is 40
- ITEM Assertion OK : Range ColumnWidth is 50
- ITEM Assertion OK : Range Height is 238
- ITEM Assertion OK : Range Width is 798.75
- ITEM Assertion OK : Range RowHeight is 50
- ITEM Assertion OK : Range ColumnWidth is 50
- ITEM Assertion OK : Range Height is 297
- ITEM Assertion OK : Range Width is 798.75
- ITEM Assertion OK : RowHeight is null: True
- ITEM Assertion OK : ColumnWidth is null: True
-END 'Heights and Widths' Symbol
- TEST OK : Heights and Widths
-----------------------------------------------------------------
-RangeRowColumn-Issue
- TEST START : RangeRowColumn-Issue
- ITEM Assertion OK : Row is: 8
- ITEM Assertion OK : Column is: 5
- ITEM Assertion OK : EntireRow.Columns.Count = 256
- ITEM Assertion OK : EntireColumn.Rows.Count = 65536
-END 'RangeRowColumn-Issue' Symbol
- TEST OK : RangeRowColumn-Issue
-----------------------------------------------------------------
-Replace-Issue
- TEST START : Replace-Issue
- ITEM Assertion OK : Value after Replace: YourValue
- ITEM Assertion OK : Value after Replace: YourValue
- ITEM Assertion OK : Value after Replace: ReplaceValue
- ITEM Assertion OK : Value after Replace: New ReplaceValue
- ITEM Assertion OK : Value after Replace: New ReplaceValue
- ITEM Assertion OK : Value after Replace: New Replace
- ITEM Assertion OK : Value after Replace:
-END 'Replace-Issue' Symbol
- TEST OK : Replace-Issue
-----------------------------------------------------------------
-Hidden-Issue
- TEST START : Hidden-Issue
- ITEM Assertion OK : - Range.Rows.Hidden (set)
- ITEM Assertion OK : - Range.Rows.Hidden (get)
- ITEM Assertion OK : - Range.Rows.Item(1).Hidden (set)
- ITEM Assertion OK : - Range.Rows.Item(1).Hidden (get)
- ITEM Assertion OK : - Range.Columns.Hidden (set)
- ITEM Assertion OK : - Range.Columns.Hidden (get)
- ITEM Assertion OK : - Range.Columns.Item(1).Hidden (set)
- ITEM Assertion OK : - Range.Columns.Item(1).Hidden (get)
-END 'Hidden-Issue' Symbol
- TEST OK : Hidden-Issue
-----------------------------------------------------------------
-End issue
- TEST START : End issue
- ITEM Assertion OK : - = $E$48
- ITEM Assertion OK : - = $E$1
- ITEM Assertion OK : - = $E$3
- ITEM Assertion OK : - = $A$8
- ITEM Assertion OK : - = $B$8
- ITEM Assertion OK : - = $IV$8
- ITEM Assertion OK : - = $Z$8
-END 'End issue' Symbol
- TEST OK : End issue
-----------------------------------------------------------------
-Outline issue
- TEST START : Outline issue
- ITEM Assertion OK : - Range.clearOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
-END 'Outline issue' Symbol
- TEST OK : Outline issue
-----------------------------------------------------------------
-Validation
- TEST START : Validation
- ITEM Assertion OK : Validation Input Message is : Attention!
- ITEM Assertion OK : Validation Input Message is : Enter an integer from five to ten
- ITEM Assertion OK : Validation Error Title is : You must enter a number from five to ten
- ITEM Assertion OK : Validation Error Message is : An Error occured
- ITEM Assertion OK : Validation Error Title is : Microsoft Excel
-END 'Validation' Symbol
- TEST OK : Validation
-Test run finished : 01/06/2007 11:29:00
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestAddress.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestAddress.log
deleted file mode 100644
index 01e5503a7..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestAddress.log
+++ /dev/null
@@ -1,62 +0,0 @@
-Test run started : 17/07/2007 15:25:17
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1 Range('e3:f3') A1 style addressing
- ITEM Assertion OK : test2 Range('e3:f3') R1C1 style addressing
- ITEM Assertion OK : test3 Range ('e:f') A1 style addressing
- ITEM Assertion OK : test4 Range ('e:f') R1C1 style addressing
- ITEM Assertion OK : test5 Columns A1 style addressing
- ITEM Assertion OK : test6 Columns R1C1 style addressing
- ITEM Assertion OK : test7 Columns(3) A1 style addressing
- ITEM Assertion OK : test8 Columns(3) R1C1 style addressing
- ITEM Assertion OK : test9 Columns('e') A1 style addressing
- ITEM Assertion OK : test10 Columns('e') R1C1 style addressing
- ITEM Assertion OK : test11 Columns('b:d') A1 style addressing
- ITEM Assertion OK : test12 Columns('b:d') R1C1 style addressing
- ITEM Assertion OK : test13 Range('c1:g10').Columns A1 style addressing
- ITEM Assertion OK : test14 Range('c1:g10').Columns R1C1 style addressing
- ITEM Assertion OK : test15 Range('c1:g10').Columns(1) A1 style addressing
- ITEM Assertion OK : test16 Range('c1:g10').Columns(1) R1C1 style addressing
- ITEM Assertion OK : test17 Range('c1:g10').Columns('a') A1 style addressing
- ITEM Assertion OK : test18 Range('c1:g10').Columns('a') R1C1 style addressing
- ITEM Assertion OK : test19 Range('c1:g10').Columns('c') A1 style addressing
- ITEM Assertion OK : test20 Range('c1:g10').Columns('c') R1C1 style addressing
- ITEM Assertion OK : test21 Range('c1:g10').Columns('x:z') A1 style addressing
- ITEM Assertion OK : test22 Range('c1:g10').Columns('x:z') R1C1 style addressing
- ITEM Assertion OK : test23 Range('c1:g10').Columns(30) A1 style addressing
- ITEM Assertion OK : test24 Range('c1:g10').Columns(30) R1C1 style addressing
- ITEM Assertion OK : test25 Worksheets('Sheet2').Cells(1, 1) A1 style addressing
- ITEM Assertion OK : test26 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, RowAddressAbsolute is false
- ITEM Assertion OK : test27 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, ColAddressAbsolute is false
- ITEM Assertion OK : test28 Worksheets('Sheet2').Cells(1, 1) R1C1 style addressing
- ITEM Assertion OK : test29 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing
- ITEM Assertion OK : test30 Worksheets('Sheet2').Range('A1').EntireColumn A1 style addressing
- ITEM Assertion OK : test31 Worksheets('Sheet2').Range('A1:E5').EntireRow A1 style addressing
- ITEM Assertion OK : test32 Worksheets('Sheet2').Range('A1') A1 style addressing
- ITEM Assertion OK : test33 Worksheets('Sheet2').Range('IV65536').EntireRow A1 style addressing
- ITEM Assertion OK : test34 Worksheets('Sheet2').Range('IU2:IV65536') A1 style addressing
- ITEM Assertion OK : test35 Range('c1:g10').Columns('x:z') R1C1 style addressing
- ITEM Assertion OK : test36 Worksheets('Sheet2').Range('A1') A1 style addressing
- ITEM Assertion OK : test37 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing
- ITEM Assertion OK : test38 Worksheets('Sheet2').Range('10:12') A1 style addressing
- ITEM Assertion OK : test39 Worksheets('Sheet2').Range('10:12') R1C1 style addressing
- ITEM Assertion OK : test40 Range('Sheet3!A1:B4') A1 style addressing
- ITEM Assertion OK : test41 Range('Sheet3!A1,B1,D4:F20') A1 style addressing
- ITEM Assertion OK : test42 Range('g20:h40').Columns('c:c')
- ITEM Assertion OK : test43 Range('g20:h40').Columns('c:f')
- ITEM Assertion OK : test44 Range('g20:h40').Columns(-1)
- ITEM Assertion OK : test45 Range('c4:g10').Rows(-1)
- ITEM Assertion OK : test46 Range('a2:b4').Rows('1:1')
- ITEM Assertion OK : test47 Range('a2:b4').Rows('1:2')
- ITEM Assertion OK : test48 Range('a2:b4').Rows('2:2')
- ITEM Assertion OK : test49 Range('a2:b4').Rows('2:3')
-Test Results
-============
-
-Tests passed: 49
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 17/07/2007 15:25:19
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest.log
deleted file mode 100644
index f055279ec..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest.log
+++ /dev/null
@@ -1,60 +0,0 @@
-Test run started : 30/05/2007 11:33:13
-BEGIN TestCalc
- TEST START : RangeTest2
- ITEM Assertion OK : - Range("D15").Row
- ITEM Assertion OK : - WorkSheet("D15").Range.Row
- ITEM Assertion OK : - Range("D15").Column
- ITEM Assertion OK : - Worksheet.Range("D15").Column
- ITEM Assertion OK : - Range("D1").EntireRow.Valuer
- ITEM Assertion OK : - Range("D1").EntireRow.Valuer
- ITEM Assertion OK : - Range("D1").EntireRow.Columns.Count
- ITEM Assertion OK : - Range("D1").EntireColumn.Rows.Count
- ITEM Assertion OK : - Range("D15").ClearContent
- ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (get)
- ITEM Assertion OK : - Range("B38").Orientation (get)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlDownward)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlUpward)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical)
- ITEM Assertion OK : - Range("B39").WrapText (get)
- ITEM Assertion OK : - Range("B39").WrapText (set)
- ITEM Assertion OK : - Range("B39").WrapText (set)
- ITEM Assertion OK : - Range("E39").MergeCells (get)
- ITEM Assertion OK : - Range("F39").MergeCells (get)
- ITEM Assertion OK : - Range("E39").MergeCells (set)
- ITEM Assertion OK : - Range("F39").MergeCells (set)
- ITEM Assertion OK : - Range("E39").MergeCells (set)
- ITEM Assertion OK : - Range("F39").MergeCells (set)
- ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True
- ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True
- ITEM Assertion OK : - Range("D41:D42").Replace MatchCase:=False
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM OK (RangeTest2)
- TEST succesfully completed : RangeTest2
-END TestCalc
-Test run finished : 30/05/2007 11:33:14
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest2.log b/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest2.log
deleted file mode 100644
index 19a5ba96b..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest2.log
+++ /dev/null
@@ -1,64 +0,0 @@
-Test run started : 31/05/2007 11:02:10
-BEGIN TestCalc
- TEST START : RangeTest3
- ITEM Assertion OK : - setFormulaR1C1
- ITEM Assertion OK : - getFormulaR1C1
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy(Range("I10"))
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteValues
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormulas
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormats
- ITEM Assertion OK : PasteSpecial
- ITEM Assertion OK : PasteSpecial SkipBlanks:=True
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationAdd
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationSubtract
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationMultiply
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationDivide
- ITEM Assertion OK : PasteSpecial Transpose:=True
- ITEM Assertion OK : ActiveWorkbook.Name
- ITEM Assertion OK : ActiveWorkbook.FullName und ActiveWorkbook.Path
- ITEM Assertion OK : - = Range("K22").End (xlDown)
- ITEM Assertion OK : - = Range("K22").End (xlUo)
- ITEM Assertion OK : - = Range("K22").End (xlToLeft)
- ITEM Assertion OK : - = Range("K22").End (xlRight)
- ITEM Assertion OK : - ActiveSpreadsheet.Next
- ITEM Assertion OK : - ActiveSpreadsheet.Next
- ITEM Assertion OK : - ActiveSpreadsheet.Previous
- ITEM Assertion OK : - ActiveSpreadsheet.Previous
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="x"
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="<>"
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="="
- ITEM Assertion OK : - Range("J4:J11").AutoFilter
- ITEM Assertion OK : - ActiveSheet.Resize.Select
- ITEM Assertion OK : - Application.GoTo Reference:="R8C2"
- ITEM Assertion OK : - Application.GoTo Reference:="R[8]C[2]"
- ITEM Assertion OK : - Application.GoTo Reference:="R8C2"
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Ungroup- please check visually
- ITEM Assertion OK : - Range.Ungroup - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.clearOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - ActiveSheet.UsedRange.Select
- ITEM Assertion FAIL : - Range("A13").AddIndent
- ITEM Assertion OK : - Range("A13").IndentLevel set
- ITEM Assertion OK : - Range("A13").IndentLevel get
- ITEM Assertion OK : - Range("A13").IndentLevel get
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Calculate
- ITEM Assertion OK : Worksheet.Calculate
- ITEM Assertion OK : - Application.Calculate
- ITEM Assertion OK : Global.Calculate
- ITEM Assertion OK : Calculation set
- ITEM Assertion OK : - = ActiveWorkbook.Colors(3) set
- ITEM Assertion OK : - = ActiveWorkbook.ResetColors
- ITEM Assertion OK : - = ActiveWorkbook.Colors(3) get
- ITEM FAIL (RangeTest3)
- TEST Not succesfully completed : RangeTest3
-END TestCalc
-Test run finished : 31/05/2007 11:02:12
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/format.log b/scratch/sc-vba/testvba/TestDocuments/logs/format.log
deleted file mode 100644
index 5226a161c..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/format.log
+++ /dev/null
@@ -1,36 +0,0 @@
-Test run started : 08/10/2008 13:08:40
-BEGIN Format
- TEST START : Test Predefined_Number_Format_Sample function
- ITEM Assertion OK : General Number: 562486.2356
- ITEM Assertion OK : Fixed: 0.20
- ITEM Assertion OK : Standard: 562,486.24
- ITEM Assertion OK : Percent: 75.21%
- ITEM Assertion OK : Scientific: 5.62E+05
- ITEM Assertion OK : Scientific: -3.46E+03
- ITEM Assertion OK : Yes/No: No
- ITEM Assertion OK : Yes/No: Yes
- ITEM Assertion OK : True/False: False
- ITEM Assertion OK : True/False: True
- ITEM Assertion OK : On/Off: Off
- ITEM Assertion OK : On/Off: On
- TEST OK : Test Predefined_Number_Format_Sample function
- TEST START : Test Custom_Number_Format_Sample function
- ITEM Assertion OK : 00.0000: 23.6750
- ITEM Assertion OK : 00.00: 23.68
- ITEM Assertion OK : 00000: 02658
- ITEM Assertion OK : 00.00: 2658.00
- ITEM Assertion OK : ##.####: 23.675
- ITEM Assertion OK : ##.##: 23.68
- ITEM Assertion OK : #,###.##: 12,345.25
- ITEM Assertion OK : ##.00%: 25.00%
- ITEM Assertion OK : #,###: 1,000,000
- ITEM Assertion OK : ######E-###: 109838E-5
- ITEM Assertion OK : $#,###.##: $2,345.25
- ITEM Assertion OK : ##.###\%: .25%
- TEST OK : Test Custom_Number_Format_Sample function
- TEST START : Test Custom_Text_Format_Sample function
- ITEM Assertion OK : <: vba
- ITEM Assertion OK : >: VBA
- TEST OK : Test Custom_Text_Format_Sample function
-END Format
-Test run finished : 08/10/2008 13:08:40
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/AutoFilter.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/AutoFilter.log
deleted file mode 100644
index 55f5d9526..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/AutoFilter.log
+++ /dev/null
@@ -1,20 +0,0 @@
-Test run started : 18/07/2007 10:56:38
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1 'starts with' string criteria
- ITEM Assertion OK : test2 'not equal to' string criteria
- ITEM Assertion OK : test3 'ends with' string criteria
- ITEM Assertion OK : test4 field 'all'
- ITEM Assertion OK : test5 numeric '<15'
- ITEM Assertion OK : test6 numeric '>=15'
- ITEM Assertion OK : test7 numeric '<=12'
-Test Results
-============
-
-Tests passed: 7
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 18/07/2007 10:56:44
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcFont.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcFont.log
deleted file mode 100644
index f3583e4cb..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcFont.log
+++ /dev/null
@@ -1,17 +0,0 @@
-Test run started : 10/09/2008 02:40:17 PM
-CalcFont_Format
- TEST START : Font_Format
- ITEM Assertion OK : correctly set font to Bold
- ITEM Assertion OK : correctly set font to Italic
- ITEM Assertion OK : correctly read FontStyle
- ITEM Assertion OK : correctly set font to Shadow
- ITEM Assertion OK : correctly set font color
- ITEM Assertion OK : correctly set font color index
- ITEM Assertion OK : correctly set font name
- ITEM Assertion OK : correctly set font outline
- ITEM Assertion OK : correctly set font size
- ITEM Assertion OK : correctly set font strikethrough
- ITEM Assertion OK : correctly set font underline
- TEST Success. : Font_Format
-CalcFont_Format
-Test run finished : 10/09/2008 02:40:17 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcZoom.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcZoom.log
deleted file mode 100644
index f8c83531a..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/CalcZoom.log
+++ /dev/null
@@ -1,18 +0,0 @@
-Test run started : 15/06/2009 12:49:35
-CalcZoom
- TEST START : CalcZoom
- ITEM Assertion OK : test1 read window.zoom activesheet = sheet1
- ITEM Assertion OK : test2 read window.zoom activesheet = sheet2
- ITEM Assertion OK : test3 read window.zoom activesheet = sheet3
- ITEM Assertion OK : test4 read window.zoom activesheet = sheet3
- ITEM Assertion OK : test4 read window.zoom activesheet = sheet2
- ITEM Assertion OK : test4 read window.zoom activesheet = sheet1
- TEST Success. : CalcZoom
-CalcZoom
-Test Results
-============
-
-Tests passed: 6
-Tests failed: 0
-
-Test run finished : 15/06/2009 12:49:37
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/FinancialFuncTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/FinancialFuncTests.log
deleted file mode 100644
index 5633a8100..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/FinancialFuncTests.log
+++ /dev/null
@@ -1,31 +0,0 @@
-Test run started : 04/08/2009 12:42:26
-----------------------------------------------------------------
-FinancialFuncs
- TEST START : FinancialFuncs
- ITEM Assertion OK : DDB test
- ITEM Assertion OK : FV test
- ITEM Assertion OK : IPmt test
- ITEM Assertion FAIL : IRR test
- ITEM Assertion OK : MIRR test
- ITEM Assertion FAIL : NPer test
- ITEM Assertion FAIL : NPV test
- ITEM Assertion FAIL : Pmt test
- ITEM Assertion OK : PPmt test
- ITEM Assertion OK : PV test
- ITEM Assertion FAIL : Rate test
- ITEM Assertion OK : SLN test
- ITEM Assertion OK : SYD test
-Test Results
-============
-
-IRR test Failed: expected 35.8625323270733 got 35.8625323273411
-NPer test Failed: expected 21.5365977313406 got 21.5365977313408
-NPV test Failed: expected 3874.42183648785 got 3874.42183648784
-Pmt test Failed: expected 20276.3942884139 got 20276.3942884138
-Rate test Failed: expected 4.67819164224935E-02 got 4.67819164225E-02
-Tests passed: 8
-Tests failed: 5
-
-END 'FinancialFuncs
- TEST OK : FinancialFuncs
-Test run finished : 04/08/2009 12:42:36
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOnErrorTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOnErrorTests.log
deleted file mode 100644
index 6fd51a55e..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOnErrorTests.log
+++ /dev/null
@@ -1,16 +0,0 @@
-Test run started : 28/09/2009 17:35:02
-----------------------------------------------------------------
-MiscOnErrorTests
- TEST START : MiscOnErrorTests
- ITEM Assertion OK : test1: testing error handler clearing error
- ITEM Assertion OK : test2: testing error handler clearing error ( mixed On Error Goto/Resume handling )
- ITEM Assertion OK : test3: testing error handler clearing error when next resume ( resumes in the same procedure )
-Test Results
-============
-
-Tests passed: 3
-Tests failed: 0
-
-END 'MiscOnErrorTests
- TEST OK : MiscOnErrorTests
-Test run finished : 28/09/2009 17:35:04
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOperatorTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOperatorTests.log
deleted file mode 100644
index 116f9f98c..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscOperatorTests.log
+++ /dev/null
@@ -1,30 +0,0 @@
-Test run started : 12/05/2009 12:36:15
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1: res = Not ( A > B )
- ITEM Assertion OK : test2: res = Not ( B > A )
- ITEM Assertion OK : test3: res = Not ( D )
- ITEM Assertion OK : test4: res = Not A
- ITEM Assertion OK : test5: res = ( A > D )
- ITEM Assertion OK : test6: res = ( D > A )
- ITEM Assertion OK : test7: res = ( A < D )
- ITEM Assertion OK : test8: res = ( D < A )
- ITEM Assertion OK : test9: res = ( A >= D )
- ITEM Assertion OK : test10: res = ( D >= A )
- ITEM Assertion OK : test11: res = ( A <= D )
- ITEM Assertion OK : test12: res = ( D <= A )
- ITEM Assertion OK : test13: res = ( D = A )
- ITEM Assertion OK : test14: res = ( A = D )
- ITEM Assertion OK : test15: res = ( D <> A )
- ITEM Assertion OK : test16: res = ( A <> D )
- ITEM Assertion OK : test17: ( A = D ) = True
-Test Results
-============
-
-Tests passed: 17
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 12/05/2009 12:36:15
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRangeTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRangeTests.log
deleted file mode 100644
index 215842f9a..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRangeTests.log
+++ /dev/null
@@ -1,45 +0,0 @@
-Test run started : 17/07/2007 20:54:56
-----------------------------------------------------------------
-MiscRangeTests
- TEST START : MiscRangeTests
- ITEM Assertion OK : test 1
- ITEM Assertion OK : test 2
- ITEM Assertion OK : test 3
- ITEM Assertion OK : test 4
- ITEM Assertion OK : test 5
- ITEM Assertion OK : test 6
- ITEM Assertion OK : test 7
- ITEM Assertion OK : test 8
- ITEM Assertion OK : test 9
- ITEM Assertion OK : test 10
- ITEM Assertion OK : test 11
- ITEM Assertion OK : test 12
- ITEM Assertion OK : test 13
- ITEM Assertion OK : test 14
- ITEM Assertion OK : test 15
- ITEM Assertion OK : test 16
- ITEM Assertion OK : test 17
- ITEM Assertion OK : test 18
- ITEM Assertion OK : test 19
- ITEM Assertion OK : test 20
- ITEM Assertion OK : test 21
- ITEM Assertion OK : test 22
- ITEM Assertion OK : test 23
- ITEM Assertion OK : test 24
- ITEM Assertion OK : test 25
- ITEM Assertion OK : test 26
- ITEM Assertion OK : test 27
- ITEM Assertion OK : test 28
- ITEM Assertion OK : test 29
- ITEM Assertion OK : test 30
- ITEM Assertion OK : test 31
-No. tests: 31
-Summary
-=======
-Run: 31
-Passed: 31
-Failed: 0
-
-END 'MiscRangeTests
- TEST OK : MiscRangeTests
-Test run finished : 17/07/2007 20:55:03
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRegressionTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRegressionTests.log
deleted file mode 100644
index 197014a93..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/MiscRegressionTests.log
+++ /dev/null
@@ -1,16 +0,0 @@
-Test run started : 24/09/2009 12:54:22
-----------------------------------------------------------------
-TestMiscRegressions
- TEST START : TestMiscRegressions
- ITEM Assertion OK : test1: IsEmpty( string )
- ITEM Assertion OK : test2: Check passing boolean to worksheet function
- ITEM Assertion OK : test2: Check if errorobject number is cleared when entering new stack frame
-Test Results
-============
-
-Tests passed: 3
-Tests failed: 0
-
-END 'TestMiscRegressions
- TEST OK : TestMiscRegressions
-Test run finished : 24/09/2009 12:54:25
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/PageBreaks.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/PageBreaks.log
deleted file mode 100644
index 0ff400d49..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/PageBreaks.log
+++ /dev/null
@@ -1,10 +0,0 @@
-Test run started : 07/24/2008 05:06:12 PM
-----------------------------------------------------------------
- TEST START : PageBreaks-Issue
- ITEM Assertion OK : HPageBreaks.Count is 3
- ITEM Assertion OK : HPageBreak.Type is -4135
- ITEM Assertion OK : HPageBreak.Location: Range.Row is 5
- ITEM Assertion OK : HPageBreak.Delete: HPageBreaks.Count is 2
-END 'PageBreaks-Issue' Symbol
- TEST OK : PageBreaks-Issue
-Test run finished : 07/24/2008 05:06:13 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-2.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-2.log
deleted file mode 100644
index 8b7076efa..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-2.log
+++ /dev/null
@@ -1,68 +0,0 @@
-Test run started : 19/06/2007 11:14:01
-----------------------------------------------------------------
-ClearFormtsIssue
- TEST START : ClearFormtsIssue
- ITEM Assertion OK : Range.Font.Bold is: True
- ITEM Assertion OK : Range.Font.Bold is: False
-END 'ClearFormtsIssue' Symbol
- TEST OK : ClearFormtsIssue
-----------------------------------------------------------------
-VerticalAlignment-Issue
- TEST START : VerticalAlignment-Issue
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : Range.VeritcalAlignment is Null
-END 'VerticalAlignment-Issue' Symbol
- TEST OK : VerticalAlignment-Issue
-----------------------------------------------------------------
-HorizontalAlignment-Issue
- TEST START : HorizontalAlignment-Issue
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : Range.HorizontalAlignment is Null
-END 'HorizontalAlignment-Issue' Symbol
- TEST OK : HorizontalAlignment-Issue
-----------------------------------------------------------------
-WrapText-Issue
- TEST START : WrapText-Issue
- ITEM Assertion OK : - Range.WrapText (get)
- ITEM Assertion OK : - Range.WrapText (get)
- ITEM Assertion OK : Range.WrapText is Null
-END 'WrapText-Issue' Symbol
- TEST OK : WrapText-Issue
-----------------------------------------------------------------
-FontBorderIssues
- TEST START : FontBorderIssues
- ITEM Assertion OK : - = Borders.Color (getColor)
- ITEM Assertion OK : - = Font.Color (getColor)
-END 'FontBorderIssues' Symbol
- TEST OK : FontBorderIssues
-----------------------------------------------------------------
-RangeSizeIssues
- TEST START : RangeSizeIssues
- ITEM Assertion OK : Range.Left is: 118.8432
- ITEM Assertion OK : Range.Top is: 92.16585
- ITEM Assertion OK : Range.Width is: 226.2
- ITEM Assertion OK : Range.Height is: 271.5
-END 'RangeSizeIssues' Symbol
- TEST OK : RangeSizeIssues
-----------------------------------------------------------------
-ApplicationIssues
- TEST START : ApplicationIssues
- ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Application.ActiveSheet.Name: Sheet1
-END 'ApplicationIssues' Symbol
- TEST OK : ApplicationIssues
-Test run finished : 19/06/2007 11:14:02
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-3.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-3.log
deleted file mode 100644
index a130737ce..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges-3.log
+++ /dev/null
@@ -1,8 +0,0 @@
-Test run started : 19/06/2007 11:26:09
-----------------------------------------------------------------
-MyGoalseek-Issue
- TEST START : MyGoalseek-Issue
- ITEM Assertion OK : Variable Range value: 15
-END 'MyGoalseek-Issue' Symbol
- TEST OK : MyGoalseek-Issue
-Test run finished : 19/06/2007 11:26:10
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges.log
deleted file mode 100644
index cdd18685e..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Ranges.log
+++ /dev/null
@@ -1,280 +0,0 @@
-Test run started : 10/03/2008 15:15:11
-----------------------------------------------------------------
-ApplicationMethods
- TEST START : ApplicationMethods
- ITEM Assertion OK : Name of Workbook is: Ranges.xls
- ITEM Assertion OK : Address of Application.Columns is: $A:$A
- ITEM Assertion OK : Address of Application.Rows is: $1:$1
- ITEM Assertion OK : Address of Application.Range is: $1:$1,$5:$7
- ITEM Assertion OK : Please check manually: DefaultFilePath is: /data4/home/npower/Documents
- ITEM Assertion OK : Please check manually: Library Path is: /data4/home/npower/.ooo-2.0/user/basic
- ITEM Assertion OK : Please check manually: Template Path is: /data4/home/npower/.ooo-2.0/user/template
- ITEM Assertion OK : FileSeparator is /
- ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls
-END 'ApplicationMethods' Symbol
- TEST OK : ApplicationMethods
-----------------------------------------------------------------
-Insert-Issue
- TEST START : Insert-Issue
- ITEM Assertion OK : Insert with xlShiftToRight: 10
-END 'Insert-Issue' Symbol
- TEST OK : Insert-Issue
-----------------------------------------------------------------
-MergeCells-Issue
- TEST START : MergeCells-Issue
- ITEM Assertion OK : Range.MergeCells is True
- ITEM Assertion FAIL : MergeCells is null: False
- ITEM Assertion OK : RowCount after Merge: 13
- ITEM Assertion OK : Range.MergeCells is False
- ITEM Assertion OK : MergeCells is null: False
- ITEM Assertion FAIL : MergeCells of Second Area is null : False
- ITEM Assertion FAIL : MergeCells of Ranges is Null: False
- ITEM Assertion OK : RowCount after Merge: 7
- ITEM Assertion OK : Range.MergeCells is False
- ITEM Assertion OK : MergeCells is null: False
- ITEM Assertion OK : RowCount after Merge: 7
-END 'MergeCells-Issue' Symbol
- TEST OK : MergeCells-Issue
-----------------------------------------------------------------
-Areas-Issue
- TEST START : Areas-Issue
- ITEM Assertion OK : Range Areas Count is2
- ITEM Assertion OK : First Range Address is: $E$8:$G$13
- ITEM Assertion OK : First Row is: 8
- ITEM Assertion OK : First Column is: 5
- ITEM Assertion OK : EntireRow Address is: $8:$13,$13:$19
- ITEM Assertion OK : EntireColumn Address is: $E:$G,$G:$K
- ITEM Assertion OK : Range Count:53
-END 'Areas-Issue' Symbol
- TEST OK : Areas-Issue
-----------------------------------------------------------------
-Fill-Methods-Issue
- TEST START : Fill-Methods-Issue
- ITEM Assertion OK : Range Value after FillDown: MyFillValue
- ITEM Assertion OK : Range Value after FillDown: MyFillValue
- ITEM Assertion OK : Range Value after FillDown: MyRightFillValue
- ITEM Assertion OK : Range Value after FillDown: MyBottomFillValue
-END 'Fill-Methods-Issue' Symbol
- TEST OK : Fill-Methods-Issue
-----------------------------------------------------------------
-Range/Item-Method-Issue
- TEST START : Range/Item-Method-Issue
- ITEM Assertion OK : Range of multiple columns is: $A:$A,$C:$C
- ITEM Assertion OK : Range of multiple rows is: $1:$1,$5:$7
- ITEM Assertion OK : Range of several columns is: $C:$E,$D:$D
- ITEM Assertion OK : Range of several rows is: $5:$8,$6:$10
- ITEM Assertion OK : Range of several single cells is: $C$5,$E$8
- ITEM Assertion OK : Range of several named ranges is: $L$1:$M$6,$E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range of a single Item Cell is: $E$21
- ITEM Assertion OK : Range of a single Item Cell is: $F$21
- ITEM Assertion OK : Range of a single Item Cell is: $F$10
-END 'Range/Item-Method-Issue' Symbol
- TEST OK : Range/Item-Method-Issue
-----------------------------------------------------------------
-R1C1-Formulas-Issue
- TEST START : R1C1-Formulas-Issue
- ITEM Assertion OK : R1C1 Range.Formula is: =IF(OR(R[-2]C[1]=0,RC[2]="YES"),"")
- ITEM Assertion OK : Range.Formula is: =IF(OR(J8=0,K10="YES"),"")
-END 'R1C1-Formulas-Issue' Symbol
- TEST OK : R1C1-Formulas-Issue
-----------------------------------------------------------------
-Verify_Delete
- TEST START : Verify_Delete
- ITEM Assertion OK : Ranges are intersecting: $G$13
- ITEM Assertion OK : Delete with Default: $AJ$4
- ITEM Assertion OK : Delete with ShifttoLeft: $AJ$4
- ITEM Assertion OK : Delete with ShiftUp: $M$22
-END 'Verify_Delete' Symbol
- TEST OK : Verify_Delete
-----------------------------------------------------------------
-Value-Issue
- TEST START : Value-Issue
- ITEM Assertion OK : Value of Range is: 12.3
- ITEM Assertion OK : Text of Range is: 12.3
- ITEM Assertion OK : Range has Formula: False
- ITEM Assertion OK : Cell has Formula: False
- ITEM Assertion FAIL : Text of Range is null: False
- ITEM Assertion OK : Range has Formula: True
- ITEM Assertion OK : Cell has Formula: True
- ITEM Assertion OK : Value of Cell is: 12
- ITEM Assertion OK : Application.Calculation is : -4135
- ITEM Assertion OK : Calculation is automated: True
- ITEM Assertion OK : Range has Formula: True
- ITEM Assertion OK : Value of Cell is: 16
- ITEM Assertion OK : Text of Cell is: 16
- ITEM Assertion OK : Text of Cell is: 16
- ITEM Assertion OK : Range has Formula after 'ClearContents: False
- ITEM Assertion OK : Text of Cell is:
- ITEM Assertion OK : Text of Cell is:
-END 'Value-Issue' Symbol
- TEST OK : Value-Issue
-----------------------------------------------------------------
-AutoFit issue
- TEST START : AutoFit issue
- ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 680
- ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 554
-END 'AutoFit issue' Symbol
- TEST OK : AutoFit issue
-----------------------------------------------------------------
-Selections
- TEST START : Selections
- ITEM Assertion OK : ActiveCell is : $E$8
- ITEM Assertion OK : Active Cell is : $E$8
- ITEM Assertion OK : Number of Cells in Range: 52
- ITEM Assertion OK : Number of Cells in Range: 52
- ITEM Assertion OK : Number of Cells in Range: 52
-END 'Selections' Symbol
- TEST OK : Selections
-----------------------------------------------------------------
-Offset-Resize
- TEST START : Offset-Resize
- ITEM Assertion OK : Offset is : $G$10:$I$15,$I$15:$M$21
- ITEM Assertion OK : Offset is : $G$7:$I$12,$I$12:$M$18
- ITEM Assertion OK : Resized Range is : $A$20:$D$23
-END 'Offset-Resize' Symbol
- TEST OK : Offset-Resize
-----------------------------------------------------------------
-Ranges-Address
- TEST START : Ranges-Address
- ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range Address is: $E8:$G13,$G13:$K19
- ITEM Assertion OK : Range Address is: E$8:G$13,G$13:K$19
- ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion FAIL : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5],R[11]C[5]:R[17]C[9]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13,$G$13:$K$19
-END 'Ranges-Address' Symbol
- TEST OK : Ranges-Address
-----------------------------------------------------------------
-Range-Address
- TEST START : Range-Address
- ITEM Assertion OK : Range Address is: $E$8:$G$13
- ITEM Assertion OK : Range Address is: $E8:$G13
- ITEM Assertion OK : Range Address is: E$8:G$13
- ITEM Assertion OK : Range Address is: R8C5:R13C7
- ITEM Assertion FAIL : Range Address is: R8C5:R13C7
- ITEM Assertion OK : Range Address is: R8C5:R13C7
- ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13
-END 'Range-Address' Symbol
- TEST OK : Range-Address
-----------------------------------------------------------------
-Column-Address
- TEST START : Column-Address
- ITEM Assertion OK : Range Address is: $F$8:$F$13
- ITEM Assertion OK : Range Address is: $F8:$F13
- ITEM Assertion OK : Range Address is: F$8:F$13
- ITEM Assertion OK : Range Address is: R8C6:R13C6
- ITEM Assertion FAIL : Range Address is: R8C6:R13C6
- ITEM Assertion OK : Range Address is: R8C6:R13C6
- ITEM Assertion OK : Range Address is: R[6]C[4]:R[11]C[4]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$8:$F$13
-END 'Column-Address' Symbol
- TEST OK : Column-Address
-----------------------------------------------------------------
-Row-Address
- TEST START : Row-Address
- ITEM Assertion OK : Range Address is: $E$9:$G$9
- ITEM Assertion OK : Range Address is: $E9:$G9
- ITEM Assertion OK : Range Address is: E$9:G$9
- ITEM Assertion OK : Range Address is: R9C5:R9C7
- ITEM Assertion FAIL : Range Address is: R9C5:R9C7
- ITEM Assertion OK : Range Address is: R9C5:R9C7
- ITEM Assertion OK : Range Address is: R[7]C[3]:R[7]C[5]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$9:$G$9
-END 'Row-Address' Symbol
- TEST OK : Row-Address
-----------------------------------------------------------------
-SingleCell-Address
- TEST START : SingleCell-Address
- ITEM Assertion OK : Range Address is: $F$9
- ITEM Assertion OK : Range Address is: $F9
- ITEM Assertion OK : Range Address is: F$9
- ITEM Assertion OK : Range Address is: R9C6
- ITEM Assertion FAIL : Range Address is: R9C6
- ITEM Assertion OK : Range Address is: R9C6
- ITEM Assertion OK : Range Address is: R[7]C[4]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$9
-END 'SingleCell-Address' Symbol
- TEST OK : SingleCell-Address
-----------------------------------------------------------------
-Heights and Widths
- TEST START : Heights and Widths
- ITEM Assertion OK : Range RowHeight is 40
- ITEM Assertion OK : Range ColumnWidth is 50
- ITEM Assertion OK : Range Height is 240
- ITEM Assertion OK : Range Width is 795
- ITEM Assertion OK : Range RowHeight is 50
- ITEM Assertion OK : Range ColumnWidth is 50
- ITEM Assertion OK : Range Height is 300
- ITEM Assertion OK : Range Width is 795
- ITEM Assertion OK : RowHeight is null: True
- ITEM Assertion OK : ColumnWidth is null: True
-END 'Heights and Widths' Symbol
- TEST OK : Heights and Widths
-----------------------------------------------------------------
-RangeRowColumn-Issue
- TEST START : RangeRowColumn-Issue
- ITEM Assertion OK : Row is: 8
- ITEM Assertion OK : Column is: 5
- ITEM Assertion OK : EntireRow.Columns.Count = 256
- ITEM Assertion OK : EntireColumn.Rows.Count = 131072
-END 'RangeRowColumn-Issue' Symbol
- TEST OK : RangeRowColumn-Issue
-----------------------------------------------------------------
-Replace-Issue
- TEST START : Replace-Issue
- ITEM Assertion OK : Value after Replace: YourValue
- ITEM Assertion OK : Value after Replace: YourValue
- ITEM Assertion OK : Value after Replace: ReplaceValue
- ITEM Assertion OK : Value after Replace: New ReplaceValue
- ITEM Assertion OK : Value after Replace: New ReplaceValue
- ITEM Assertion OK : Value after Replace: New Replace
- ITEM Assertion OK : Value after Replace:
-END 'Replace-Issue' Symbol
- TEST OK : Replace-Issue
-----------------------------------------------------------------
-Hidden-Issue
- TEST START : Hidden-Issue
- ITEM Assertion OK : - Range.Rows.Hidden (set)
- ITEM Assertion OK : - Range.Rows.Hidden (get)
- ITEM Assertion OK : - Range.Rows.Item(1).Hidden (set)
- ITEM Assertion OK : - Range.Rows.Item(1).Hidden (get)
- ITEM Assertion OK : - Range.Columns.Hidden (set)
- ITEM Assertion OK : - Range.Columns.Hidden (get)
- ITEM Assertion OK : - Range.Columns.Item(1).Hidden (set)
- ITEM Assertion OK : - Range.Columns.Item(1).Hidden (get)
-END 'Hidden-Issue' Symbol
- TEST OK : Hidden-Issue
-----------------------------------------------------------------
-End issue
- TEST START : End issue
- ITEM Assertion OK : - = $E$48
- ITEM Assertion OK : - = $E$1
- ITEM Assertion OK : - = $E$3
- ITEM Assertion OK : - = $A$8
- ITEM Assertion OK : - = $B$8
- ITEM Assertion OK : - = $IV$8
- ITEM Assertion OK : - = $Z$8
-END 'End issue' Symbol
- TEST OK : End issue
-----------------------------------------------------------------
-Outline issue
- TEST START : Outline issue
- ITEM Assertion OK : - Range.clearOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
-END 'Outline issue' Symbol
- TEST OK : Outline issue
-----------------------------------------------------------------
-Validation
- TEST START : Validation
- ITEM Assertion OK : Validation Input Message is : Attention!
- ITEM Assertion OK : Validation Input Message is : Enter an integer from five to ten
- ITEM Assertion OK : Validation Error Title is : You must enter a number from five to ten
- ITEM Assertion OK : Validation Error Message is : An Error occured
- ITEM Assertion OK : Validation Error Title is : Microsoft Excel
-END 'Validation' Symbol
- TEST OK : Validation
-Test run finished : 10/03/2008 15:15:13
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Shapes.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/Shapes.log
deleted file mode 100644
index 3193a0b10..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Shapes.log
+++ /dev/null
@@ -1,77 +0,0 @@
-Test run started : 10/16/2007 05:25:21 PM
-BEGIN Shapes_Collection_Behaviour
- TEST START : Shapes_Collection_Behaviour
- ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape1'
- ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape2'
- TEST Success. : Shapes_Collection_Behaviour
-END Shapes_Collection_Behaviour
-BEGIN Shapes_Select_Item
- TEST START : Shapes_Select_Item
- ITEM Assertion OK : Correctly selected shape through Range
- ITEM Assertion OK : Correctly selected shape through Item
- ITEM Assertion OK : Needs to be visually checked. Is there a line on the document?
- ITEM Assertion OK : Needs to be visually checked. Are All Shapes Selected?
- TEST Success. : Shapes_Select_Item
-END Shapes_Select_Item
-BEGIN Shapes_Fill
- TEST START : Shapes_Fill
- ITEM Assertion OK : correctly set visibility of shape fill
- ITEM Assertion OK : correctly set transparency of shape line
- ITEM Assertion OK : correctly set forecolor of shape fill
- ITEM Assertion FAIL : correctly set backcolor of shape fill
- ITEM Assertion OK : the success of the TwoColorGradient method needs to be verified visually!
- ITEM Assertion OK : correctly set forecolor of shape fill
- ITEM Assertion FAIL : correctly set forecolor of shape fill
- TEST Success. : Shapes_Fill
-END Shapes_Fill
-BEGIN Shapes_Line
- TEST START : Shapes_Line
- ITEM Assertion FAIL : correctly set weight of shape line
- ITEM Assertion OK : correctly set visibility of shape line
- ITEM Assertion OK : correctly set transparency of shape line
- ITEM Assertion OK : correctly set dash style of shape line
- ITEM Assertion OK : correctly set dash style of shape line
- ITEM Assertion OK : correctly set forecolor of shape line
- ITEM Assertion FAIL : correctly set backcolor of shape line
- TEST Success. : Shapes_Line
-END Shapes_Line
-BEGIN Shapes_TextFrame
- TEST START : Shapes_TextFrame
- ITEM Assertion OK : correctly set Autosize of Shape TextFrame
- TEST Success. : Shapes_TextFrame
-END Shapes_TextFrame
-BEGIN Shapes_SimpleGeometry
- TEST START : Shapes_SimpleGeometery
- ITEM Assertion OK : shape height should be 47.0425168477155 and got 46.9984222363199
- ITEM Assertion OK : shape width should be 101.467710269751 and got 101.423615658355
- ITEM Assertion OK : shape left should be 68.5574761223637 and got 68.5417279658754
- ITEM Assertion OK : shape top should be 42.0251943291216 and got 42.0094461726333
- ITEM Assertion OK : shape rotation should be 0 and got 0
- ITEM Assertion OK : shape rotation should be 25 and got 25
- ITEM Assertion OK : shape incrementrotation should be 50 and got 50
- ITEM Assertion OK : shape incrementleft should be 70.6834602404119 and got 70.6677120839236
- ITEM Assertion OK : shape incrementtop should be 91.262986503119 and got 91.2472383466307
- TEST Success. : Shapes_SimpleGeometery
-END Shapes_SimpleGeometry
-BEGIN Shapes_Range
- TEST START : Shapes_Range
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to contain 1 element, it contains 1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to return Sheet2Shape1 got Sheet2Shape1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to contain 1 element, it contains 1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to return Sheet2Shape3 got Sheet2Shape3
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to contain 2 elements, it contains 2
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to return concated element/shape names Sheet2Shape3Sheet2Shape1 and got Sheet2Shape3Sheet2Shape1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to contain 3 elements, it contains 3
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to return concated element/shape names Sheet2Shape3Sheet2Shape1Sheet2Shape2 and got Sheet2Shape3Sheet2Shape1Sheet2Shape2
- TEST Success. : Shapes_Range
-END Shapes_Range
-BEGIN Shapes_ShapeRange
- TEST START : Shapes_ShapeRange
- ITEM Assertion OK : ShapeRange.IncrementLeft shp1.left should be 90.6677120839236 and got 90.6519627935771
- ITEM Assertion OK : ShapeRange.IncrementLeft shp2.left should be 240.02518299054 and got 240.009433700193
- ITEM Assertion OK : ShapeRange.IncrementTop shp1.Top should be 111.247238346631 and got 111.231489056284
- ITEM Assertion OK : ShapeRange.IncrementTop shp2.Top should be 65.0708633026228 and got 65.0551140122763
- ITEM Assertion OK : ShapeRange.IncrementRotation shp1.Rotation should be 70 and got 70
- ITEM Assertion OK : ShapeRange.IncrementRotation shp2.Rotation should be 20 and got 20
-END Shapes_ShapeRange
-Test run finished : 10/16/2007 05:25:22 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/StrConv-test.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/StrConv-test.log
deleted file mode 100644
index c7a7d8750..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/StrConv-test.log
+++ /dev/null
@@ -1,9 +0,0 @@
-Test run started : 05/29/2008 02:51:03 PM
-BEGIN StrConv
- TEST START : Test StrConv function
- ITEM Assertion OK : Converts the string to uppercase characters:ABC EFG HIJ
- ITEM Assertion OK : Converts the string to lowercase characters:abc efg hij
- ITEM Assertion OK : Converts the first letter of every word in string to uppercase:Abc Efg Hij
- TEST OK : Test StrConv function
-END StrConv
-Test run finished : 05/29/2008 02:51:03 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Template.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/Template.log
deleted file mode 100644
index c6376c5b3..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Template.log
+++ /dev/null
@@ -1,14 +0,0 @@
-Test run started : 2008/07/10 11:57:05
-----------------------------------------------------------------
-TestCaseName
- TEST START : TestCaseName
- ITEM Assertion OK : Something has been done.
-Test Results
-============
-
-Tests passed: 1
-Tests failed: 0
-
-END 'TestCaseName
- TEST OK : TestCaseName
-Test run finished : 2008/07/10 11:57:05
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestAddress.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestAddress.log
deleted file mode 100644
index 4fa4bc820..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestAddress.log
+++ /dev/null
@@ -1,67 +0,0 @@
-Test run started : 12/05/2009 11:23:35
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1 Range('e3:f3') A1 style addressing
- ITEM Assertion OK : test2 Range('e3:f3') R1C1 style addressing
- ITEM Assertion OK : test3 Range ('e:f') A1 style addressing
- ITEM Assertion OK : test4 Range ('e:f') R1C1 style addressing
- ITEM Assertion OK : test5 Columns A1 style addressing
- ITEM Assertion OK : test6 Columns R1C1 style addressing
- ITEM Assertion OK : test7 Columns(3) A1 style addressing
- ITEM Assertion OK : test8 Columns(3) R1C1 style addressing
- ITEM Assertion OK : test9 Columns('e') A1 style addressing
- ITEM Assertion OK : test10 Columns('e') R1C1 style addressing
- ITEM Assertion OK : test11 Columns('b:d') A1 style addressing
- ITEM Assertion OK : test12 Columns('b:d') R1C1 style addressing
- ITEM Assertion OK : test13 Range('c1:g10').Columns A1 style addressing
- ITEM Assertion OK : test14 Range('c1:g10').Columns R1C1 style addressing
- ITEM Assertion OK : test15 Range('c1:g10').Columns(1) A1 style addressing
- ITEM Assertion OK : test16 Range('c1:g10').Columns(1) R1C1 style addressing
- ITEM Assertion OK : test17 Range('c1:g10').Columns('a') A1 style addressing
- ITEM Assertion OK : test18 Range('c1:g10').Columns('a') R1C1 style addressing
- ITEM Assertion OK : test19 Range('c1:g10').Columns('c') A1 style addressing
- ITEM Assertion OK : test20 Range('c1:g10').Columns('c') R1C1 style addressing
- ITEM Assertion OK : test21 Range('c1:g10').Columns('x:z') A1 style addressing
- ITEM Assertion OK : test22 Range('c1:g10').Columns('x:z') R1C1 style addressing
- ITEM Assertion OK : test23 Range('c1:g10').Columns(30) A1 style addressing
- ITEM Assertion OK : test24 Range('c1:g10').Columns(30) R1C1 style addressing
- ITEM Assertion OK : test25 Worksheets('Sheet2').Cells(1, 1) A1 style addressing
- ITEM Assertion OK : test26 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, RowAddressAbsolute is false
- ITEM Assertion OK : test27 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, ColAddressAbsolute is false
- ITEM Assertion OK : test28 Worksheets('Sheet2').Cells(1, 1) R1C1 style addressing
- ITEM Assertion OK : test29 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing
- ITEM Assertion OK : test30 Worksheets('Sheet2').Range('A1').EntireColumn A1 style addressing
- ITEM Assertion OK : test31 Worksheets('Sheet2').Range('A1:E5').EntireRow A1 style addressing
- ITEM Assertion OK : test32 Worksheets('Sheet2').Range('A1') A1 style addressing
- ITEM Assertion OK : test33 Worksheets('Sheet2').Range('IV65536').EntireRow A1 style addressing
- ITEM Assertion OK : test34 Worksheets('Sheet2').Range('IU2:IV65536') A1 style addressing
- ITEM Assertion OK : test35 Range('c1:g10').Columns('x:z') R1C1 style addressing
- ITEM Assertion OK : test36 Worksheets('Sheet2').Range('A1') A1 style addressing
- ITEM Assertion OK : test37 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing
- ITEM Assertion OK : test38 Worksheets('Sheet2').Range('10:12') A1 style addressing
- ITEM Assertion OK : test39 Worksheets('Sheet2').Range('10:12') R1C1 style addressing
- ITEM Assertion OK : test40 Range('Sheet3!A1:B4') A1 style addressing
- ITEM Assertion OK : test41 Range('Sheet3!A1,B1,D4:F20') A1 style addressing
- ITEM Assertion OK : test42 Range('g20:h40').Columns('c:c')
- ITEM Assertion OK : test43 Range('g20:h40').Columns('c:f')
- ITEM Assertion OK : test44 Range('g20:h40').Columns(-1)
- ITEM Assertion OK : test45 Range('c4:g10').Rows(-1)
- ITEM Assertion OK : test46 Range('a2:b4').Rows('1:1')
- ITEM Assertion OK : test47 Range('a2:b4').Rows('1:2')
- ITEM Assertion OK : test48 Range('a2:b4').Rows('2:2')
- ITEM Assertion OK : test49 Range('a2:b4').Rows('2:3')
- ITEM Assertion OK : test50 Range(' A2:B4 ')
- ITEM Assertion OK : test51 Range('A 2:B 4')
- ITEM Assertion OK : test52 Range('A2 : B4 ')
- ITEM Assertion OK : test53 Range('Sheet1 !A2 : B4 ')
- ITEM Assertion OK : test54 Range('Sheet1! A2 : B4 ')
-Test Results
-============
-
-Tests passed: 54
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 12/05/2009 11:23:35
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest.log
deleted file mode 100644
index 083819d4b..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest.log
+++ /dev/null
@@ -1,60 +0,0 @@
-Test run started : 30/05/2007 15:59:40
-BEGIN TestCalc
- TEST START : RangeTest2
- ITEM Assertion OK : - Range("D15").Row
- ITEM Assertion OK : - WorkSheet("D15").Range.Row
- ITEM Assertion OK : - Range("D15").Column
- ITEM Assertion OK : - Worksheet.Range("D15").Column
- ITEM Assertion OK : - Range("D1").EntireRow.Valuer
- ITEM Assertion OK : - Range("D1").EntireRow.Valuer
- ITEM Assertion OK : - Range("D1").EntireRow.Columns.Count
- ITEM Assertion OK : - Range("D1").EntireColumn.Rows.Count
- ITEM Assertion OK : - Range("D15").ClearContent
- ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (get)
- ITEM Assertion OK : - Range("B38").Orientation (get)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlDownward)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlUpward)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical)
- ITEM Assertion OK : - Range("B39").WrapText (get)
- ITEM Assertion OK : - Range("B39").WrapText (set)
- ITEM Assertion OK : - Range("B39").WrapText (set)
- ITEM Assertion OK : - Range("E39").MergeCells (get)
- ITEM Assertion OK : - Range("F39").MergeCells (get)
- ITEM Assertion OK : - Range("E39").MergeCells (set)
- ITEM Assertion FAIL : - Range("F39").MergeCells (set)
- ITEM Assertion OK : - Range("E39").MergeCells (set)
- ITEM Assertion OK : - Range("F39").MergeCells (set)
- ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True
- ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True
- ITEM Assertion OK : - Range("D41:D42").Replace MatchCase:=False
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM FAIL (RangeTest2)
- TEST Not succesfully completed : RangeTest2
-END TestCalc
-Test run finished : 30/05/2007 15:59:42
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest2.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest2.log
deleted file mode 100644
index b1573c06d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest2.log
+++ /dev/null
@@ -1,65 +0,0 @@
-Test run started : 10/03/2008 15:15:19
-BEGIN TestCalc
- TEST START : RangeTest3
- ITEM Assertion OK : - setFormulaR1C1
- ITEM Assertion OK : - getFormulaR1C1
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy(Range("I10"))
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteValues
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormulas
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormats
- ITEM Assertion OK : PasteSpecial
- ITEM Assertion OK : PasteSpecial SkipBlanks:=True
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationAdd
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationSubtract
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationMultiply
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationDivide
- ITEM Assertion OK : PasteSpecial Transpose:=True
- ITEM Assertion FAIL : ActiveWorkbook.FileFormat
- ITEM Assertion OK : ActiveWorkbook.Name
- ITEM Assertion OK : ActiveWorkbook.FullName und ActiveWorkbook.Path
- ITEM Assertion FAIL : - = ActiveWorkbook.Colors(3) set
- ITEM Assertion OK : - = ActiveWorkbook.ResetColors
- ITEM Assertion OK : - = ActiveWorkbook.Colors(3) get
- ITEM Assertion OK : - = Range("K22").End (xlDown)
- ITEM Assertion OK : - = Range("K22").End (xlUo)
- ITEM Assertion OK : - = Range("K22").End (xlToLeft)
- ITEM Assertion OK : - = Range("K22").End (xlRight)
- ITEM Assertion OK : - ActiveSpreadsheet.Next
- ITEM Assertion OK : - ActiveSpreadsheet.Next
- ITEM Assertion OK : - ActiveSpreadsheet.Previous
- ITEM Assertion OK : - ActiveSpreadsheet.Previous
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="x"
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="<>"
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="="
- ITEM Assertion OK : - Range("J4:J11").AutoFilter
- ITEM Assertion OK : - ActiveSheet.Resize.Select
- ITEM Assertion OK : - Application.GoTo Reference:="R8C2"
- ITEM Assertion FAIL : - Application.GoTo Reference:="R[8]C[2]"
- ITEM Assertion OK : - Application.GoTo Reference:="R8C2"
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Ungroup- please check visually
- ITEM Assertion OK : - Range.Ungroup - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.clearOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - ActiveSheet.UsedRange.Select
- ITEM Assertion OK : - Range("A13").AddIndent
- ITEM Assertion OK : - Range("A13").IndentLevel set
- ITEM Assertion OK : - Range("A13").IndentLevel get
- ITEM Assertion OK : - Range("A13").IndentLevel get
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Calculate
- ITEM Assertion OK : Worksheet.Calculate
- ITEM Assertion OK : - Application.Calculate
- ITEM Assertion OK : Global.Calculate
- ITEM Assertion OK : Calculation set
- ITEM FAIL (RangeTest3)
- TEST Not succesfully completed : RangeTest3
-END TestCalc
-Test run finished : 10/03/2008 15:15:21
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestIntersection.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestIntersection.log
deleted file mode 100644
index ea686a830..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestIntersection.log
+++ /dev/null
@@ -1,26 +0,0 @@
-Test run started : 13/01/2009 14:31:43
-----------------------------------------------------------------
-TestIntersection
- TEST START : TestIntersection
- ITEM Assertion OK : test1 Application.Intersect( Range('A2:D10'), Range('C4:E6'))
- ITEM Assertion OK : test2 Application.Intersect( Range('A2:D10'), Range('A4:G10'))
- ITEM Assertion OK : test3 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('A4:G10'))
- ITEM Assertion OK : test4 Application.Intersect( Range('A4:G10'), Range('A2:c8,d2:f8,g2:i8'))
- ITEM Assertion OK : test5 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('g4:i10,A4:G10'))
- ITEM Assertion OK : test6 Application.Intersect( Range('g4:i10,A4:G10'), Range('A2:c8,d2:f8,g2:i8'))
- ITEM Assertion OK : test7 Application.Intersect( Range('a2:d10,b5:e10'), Range('a5:i10'))
- ITEM Assertion OK : test8 Application.Intersect( Range('a2:c8,d2:f8'), Range('b6:e9,a6:f9'))
- ITEM Assertion OK : test9 Application.Intersect( Range('a2:c8,e2:f8'), Range('b6:e9,a6:f9'))
- ITEM Assertion OK : test10 Application.Intersect( Range('a1:a3,c1:c3'), Range('a2:c3'))
- ITEM Assertion OK : test11 Application.Intersect( Range('a1:a3,b1:b3'), Range('a2:c3'))
- ITEM Assertion OK : test12 Application.Intersect( Range('a2:d5,b3:f7,c1:g4'), Range('b2:e6'))
- ITEM Assertion OK : test13 Range(" a2:d10,b5:e10,g13:j32 "), Range(" a5:i10,b6:e9 "), Range("b2:r5,f10:h19")
-Test Results
-============
-
-Tests passed: 13
-Tests failed: 0
-
-END 'TestIntersection
- TEST OK : TestIntersection
-Test run finished : 13/01/2009 14:31:43
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestUnion.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestUnion.log
deleted file mode 100644
index da3cb35de..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/TestUnion.log
+++ /dev/null
@@ -1,17 +0,0 @@
-Test run started : 13/01/2009 14:32:16
-----------------------------------------------------------------
-TestUnion
- TEST START : TestUnion
- ITEM Assertion OK : test1Application.Range('A2:D10'), Range('C4:E6')
- ITEM Assertion OK : test2Application.Range('A2:D5,a3:d4'), Range('A4:G10')
- ITEM Assertion OK : test3Application.Range('A4:G10,A1:B6'), Range('A2:D5,A3:D4')
- ITEM Assertion OK : test4Application.Range('A5:D10'), Range('B5:E10')
-Test Results
-============
-
-Tests passed: 4
-Tests failed: 0
-
-END 'TestUnion
- TEST OK : TestUnion
-Test run finished : 13/01/2009 14:32:16
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/VariantTest.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/VariantTest.log
deleted file mode 100644
index a916ac4a3..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/VariantTest.log
+++ /dev/null
@@ -1,47 +0,0 @@
-Test run started : 24/09/2008 10:58:18
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1: res = (aboo = '')
- ITEM Assertion OK : test 2: res = (aboo = 'fiddlesticks')
- ITEM Assertion OK : test 3: res = ('' = aboo)
- ITEM Assertion OK : test 4: res = ('fiddlesticks' = aboo )
- ITEM Assertion OK : test 5: res = (testString = '')
- ITEM Assertion OK : test 6: res = (testString = 'fiddlesticks')
- ITEM Assertion OK : test 7: res = ('' = testString)
- ITEM Assertion OK : test 8: res = ('fiddlesticks' = testString )
- ITEM Assertion OK : test 9: res = ( aboo < " )
- ITEM Assertion OK : test 10: res = ( testString < " )
- ITEM Assertion OK : test 11: res = ( aboo > " )
- ITEM Assertion OK : test 12: res = ( testString > " )
- ITEM Assertion OK : test 13: res = ( aboo <> '' )
- ITEM Assertion OK : test 14: res = ( testString <> '' )
- ITEM Assertion OK : test 15: res = (aboo = something/14)
- ITEM Assertion OK : test 16: res = something + 'string'
- ITEM Assertion OK : test 17: res = something & 'string'
- ITEM Assertion OK : test 18: res = something MOD 10 )
- ITEM Assertion OK : test 19: res = something AND 1 )
- ITEM Assertion OK : test 20: res = something AND 0 )
- ITEM Assertion OK : test 21: res = something OR 12)
- ITEM Assertion OK : test 22: res = something OR 0 )
- ITEM Assertion OK : test 23: res = something XOR 0 )
- ITEM Assertion OK : test 24: res = something XOR 1 )
- ITEM Assertion OK : test 25: res = something EQV 0 )
- ITEM Assertion OK : test 26: res = something EQV 1 )
- ITEM Assertion OK : test 27: res = something IMP 0 )
- ITEM Assertion OK : test 28: res = something IMP 1 )
- ITEM Assertion OK : test 29: res = something IMP 14 )
- ITEM Assertion OK : test 30: res = NOT something )
- ITEM Assertion OK : test 31: res = something + 12 )
- ITEM Assertion OK : test 32: res = something - 12 )
- ITEM Assertion OK : test 33: res = -something )
- ITEM Assertion OK : test 34: res = something * 12 )
-Test Results
-============
-
-Tests passed: 34
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 24/09/2008 10:58:20
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Window.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/Window.log
deleted file mode 100644
index ec9a66561..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/Window.log
+++ /dev/null
@@ -1,46 +0,0 @@
-Test run started : 05/29/2008 02:55:00 PM
-----------------------------------------------------------------
- TEST START : Window-Issue
- ITEM Assertion OK : Window.Left is: 0 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.Top is: 21 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.Width is: 1280 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.Height is: 752 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.ScrollColumn is: 100
- ITEM Assertion OK : Window.ScrollColumn is: 1
- ITEM Assertion OK : Window.ScrollRow is: 100
- ITEM Assertion OK : Window.ScrollRow is: 1
- ITEM Assertion OK : Window.LargeScroll(Down): ScrollRow is: 94 (Test may only apply to maximized Window)
- ITEM Assertion OK : Window.LargeScroll(Up): ScrollRow is: 1
- ITEM Assertion OK : Window.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window)
- ITEM Assertion OK : Window.LargeScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Window.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window)
- ITEM Assertion OK : Window.SmallScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Window.DisplayWorkBookTabs is: False
- ITEM Assertion OK : Window.DisplayWorkBookTabs is: True
- ITEM Assertion OK : Window.DisplayVerticalScrollBar is: True
- ITEM Assertion OK : Window.DisplayVerticalScrollBar is: False
- ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: False
- ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: True
- ITEM Assertion OK : Window.DisplayHeadings is: False
- ITEM Assertion OK : Window.DisplayHeadings is: True
- ITEM Assertion OK : Window.DisplayOutline is: False
- ITEM Assertion OK : Window.DisplayOutline is: True
- ITEM Assertion OK : Window.Visible is: False
- ITEM Assertion OK : Window.Visible is: True
- ITEM Assertion OK : Window.Caption is: MyCaption
- ITEM Assertion OK : Pane.ScrollColumn is: 100
- ITEM Assertion OK : Pane.ScrollColumn is: 1
- ITEM Assertion OK : Pane.ScrollRow is: 100
- ITEM Assertion OK : Pane.ScrollRow is: 1
- ITEM Assertion OK : Pane.LargeScroll(Down): ScrollRow is: 94 (Test may only apply to maximized Window)
- ITEM Assertion OK : Pane.LargeScroll(Up): ScrollRow is: 1
- ITEM Assertion OK : Pane.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window)
- ITEM Assertion OK : Pane.LargeScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Pane.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window)
- ITEM Assertion OK : Pane.SmallScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Window Selection: $A$2:$D$5
- ITEM Assertion OK : ActiveSheet name of Window: Sheet1
- ITEM Assertion OK : Window ActiveCell: $A$1
-END 'Window-Issue' Symbol
- TEST OK : Window-Issue
-Test run finished : 05/29/2008 02:55:01 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/bytearraystring.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/bytearraystring.log
deleted file mode 100644
index bd243283d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/bytearraystring.log
+++ /dev/null
@@ -1,8 +0,0 @@
-Test run started : 05/29/2008 02:25:58 PM
-BEGIN Bytearray To String
- TEST START : Test the conversion between bytearray and string
- ITEM Assertion OK : The number of byte is:6
- ITEM Assertion OK : the return string is: abc
- TEST OK : Test the conversion between bytearray and string
-END Bytearray To String
-Test run finished : 05/29/2008 02:25:58 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/dateserial.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/dateserial.log
deleted file mode 100644
index 4dd5f5316..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/dateserial.log
+++ /dev/null
@@ -1,9 +0,0 @@
-Test run started : 01/24/2008 01:24:50 PM
-BEGIN DateSerial
- TEST START : Test DateSerial function
- ITEM Assertion OK : the return date is: 06/15/1999
- ITEM Assertion OK : the return date is: 06/15/1999
- ITEM Assertion OK : the return date is: 06/15/1999
- TEST OK : Test DateSerial function
-END DateSerial
-Test run finished : 01/24/2008 01:24:50 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/datevalue.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/datevalue.log
deleted file mode 100644
index 830d5e7b6..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/datevalue.log
+++ /dev/null
@@ -1,8 +0,0 @@
-Test run started : 01/24/2008 01:24:41 PM
-BEGIN DateValue
- TEST START : Test DateValue function
- ITEM Assertion OK : the return date is: 02/12/1969
- ITEM Assertion OK : the return date is: 01/21/2008
- TEST OK : Test DateValue function
-END DateValue
-Test run finished : 01/24/2008 01:24:41 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/format.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/format.log
deleted file mode 100644
index 96725bf7d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/format.log
+++ /dev/null
@@ -1,36 +0,0 @@
-Test run started : 2008/09/18 11:35:34
-BEGIN Format
- TEST START : Test Predefined_Number_Format_Sample function
- ITEM Assertion OK : General Number: 562486.2356
- ITEM Assertion OK : Fixed: 0.20
- ITEM Assertion OK : Standard: 562,486.24
- ITEM Assertion OK : Percent: 75.21%
- ITEM Assertion OK : Scientific: 5.62E+05
- ITEM Assertion OK : Scientific: -3.46E+03
- ITEM Assertion OK : Yes/No: No
- ITEM Assertion OK : Yes/No: Yes
- ITEM Assertion OK : True/False: False
- ITEM Assertion OK : True/False: True
- ITEM Assertion OK : On/Off: Off
- ITEM Assertion OK : On/Off: On
- TEST OK : Test Predefined_Number_Format_Sample function
- TEST START : Test Custom_Number_Format_Sample function
- ITEM Assertion OK : 00.0000: 23.6750
- ITEM Assertion OK : 00.00: 23.68
- ITEM Assertion OK : 00000: 02658
- ITEM Assertion OK : 00.00: 2658.00
- ITEM Assertion OK : ##.####: 23.675
- ITEM Assertion OK : ##.##: 23.68
- ITEM Assertion OK : #,###.##: 12,345.25
- ITEM Assertion OK : ##.00%: 25.00%
- ITEM Assertion OK : #,###: 1,000,000
- ITEM Assertion OK : ######E-###: 109838E-5
- ITEM Assertion OK : $#,###.##: $2,345.25
- ITEM Assertion OK : ##.###\%: .25%
- TEST OK : Test Custom_Number_Format_Sample function
- TEST START : Test Custom_Text_Format_Sample function
- ITEM Assertion OK : <: vba
- ITEM Assertion OK : >: VBA
- TEST OK : Test Custom_Text_Format_Sample function
-END Format
-Test run finished : 2008/09/18 11:35:34
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/pagesetup.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/pagesetup.log
deleted file mode 100644
index f04585c3f..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/pagesetup.log
+++ /dev/null
@@ -1,77 +0,0 @@
-Test run started : 07/21/2008 02:00:06 PM
-BEGIN PageSetup
- TEST START : Sheet_PrintArea
- ITEM Assertion OK : PrintArea has changed as expected
- TEST OK : Sheet_PrintArea
- TEST START : Test margins (no headers)
- ITEM Assertion OK : PageSetup.LeftMargin set/get
- ITEM Assertion OK : PageSetup.RightMargin set/get
- ITEM Assertion OK : PageSetup.TopMargin set/get
- ITEM Assertion OK : PageSetup.BottomMargin set/get
-Verify that page margins on sheet 1 are all 0.5inch
- TEST OK : Test margins (no headers)
- TEST START : Test margins (headers)
- ITEM Assertion OK : PageSetup.HeaderMargin set/get
- ITEM Assertion OK : PageSetup.FooterMargin set/get
- ITEM Assertion OK : PageSetup.LeftMargin set/get
- ITEM Assertion OK : PageSetup.LeftMargin set/get
-Verify that top/bottom/header/footer page margins on sheet 2 are all 0.5inch
- TEST OK : Test margins (headers)
- TEST START : Test header/footer text
- ITEM Assertion OK : PageSetup.LeftHeader set
- ITEM Assertion OK : PageSetup.LeftHeader set/get
- ITEM Assertion OK : PageSetup.CenterHeader set
- ITEM Assertion OK : PageSetup.CenterHeader set/get
- ITEM Assertion OK : PageSetup.RightHeader set
- ITEM Assertion OK : PageSetup.RightHeader set/get
- ITEM Assertion OK : PageSetup.LeftFooter set
- ITEM Assertion OK : PageSetup.LeftFooter set/get
- ITEM Assertion OK : PageSetup.CenterFooter set
- ITEM Assertion OK : PageSetup.CenterFooter set/get
- ITEM Assertion OK : PageSetup.RightFooter set
- ITEM Assertion OK : PageSetup.RightFooter set/get
-Verify that headers on sheet 2 are Ready,to,go
-Verify that footers on sheet 2 are This,now,Works
- TEST OK : Test header/footer text
- TEST START : Test zoom
- ITEM Assertion OK : PageSetup.Zoom set
- ITEM Assertion OK : PageSetup.Zoom set/get
-Verify that sheet 1 zoom is 10%
- TEST OK : Test zoom
- TEST START : Test orientation
- ITEM Assertion OK : PageSetup.Zoom set
- ITEM Assertion OK : PageSetup.Orientation set/get
-Verify that sheet 1 orientation is now landscape
- TEST OK : Test orientation
- TEST START : Test order
- ITEM Assertion OK : PageSetup.Order get
- ITEM Assertion OK : PageSetup.Order set/get
-Verify that order on sheet 1 is now over, then down.
- TEST OK : Test order
- TEST START : Test first page number
- ITEM Assertion OK : PageSetup.FirstPageNumber get
- ITEM Assertion OK : PageSetup.FirstPageNumber set/get
-Verify that first page number on sheet 1 is now 2.
- TEST OK : Test first page number
- TEST START : Test center vertically
- ITEM Assertion OK : PageSetup.CenterVertically get
- ITEM Assertion OK : PageSetup.CenterVertically set/get
-Verify that CenterVertically on sheet 1 is now true.
- TEST OK : Test center vertically
- TEST START : Test center horizontally
- ITEM Assertion OK : PageSetup.CenterHorizontally get
- ITEM Assertion OK : PageSetup.CenterHorizontally set/get
-Verify that CenterHorizontally on sheet 1 is now true.
- TEST OK : Test center horizontally
- TEST START : Test FitToPagesTall
- ITEM Assertion OK : PageSetup.FitToPagesTall set/get
- TEST OK : Test FitToPagesTall
- TEST START : Test FitToPagesWide
- ITEM Assertion OK : PageSetup.FitToPagesWide set/get
- TEST OK : Test FitToPagesWide
- TEST START : Test PrintHeadings
- ITEM Assertion OK : PageSetup.PrintHeadings set/get
- ITEM Assertion OK : PageSetup.PrintHeadings set/get
- TEST OK : Test PrintHeadings
-END PageSetup
-Test run finished : 07/21/2008 02:00:07 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/partition.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/partition.log
deleted file mode 100644
index 7b4f2a01b..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/partition.log
+++ /dev/null
@@ -1,11 +0,0 @@
-Test run started : 12/10/2007 11:26:43 AM
-BEGIN Partition
- TEST START : Test Partition function
- ITEM Assertion OK : the number 20 occurs in the range:20:24
- ITEM Assertion OK : the number 20 occurs in the range: 20: 20
- ITEM Assertion OK : the number 120 occurs in the range:100:
- ITEM Assertion OK : the number -5 occurs in the range: : -1
- ITEM Assertion OK : the number 2 occurs in the range: 2: 3
- TEST OK : Test Partition function
-END Partition
-Test run finished : 12/10/2007 11:26:43 AM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log
deleted file mode 100644
index fb37b6ff2..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log
+++ /dev/null
@@ -1,16 +0,0 @@
-Test run started : 2008/06/19 17:14:57
-----------------------------------------------------------------
-ShowDetail-Issue
- TEST START : ShowDetail-Issue
- ITEM Assertion OK : Range.ShowDetail is True
- ITEM Assertion OK : Range.ShowDetail is False
-END 'ShowDetail-Issue' Symbol
- TEST OK : ShowDetail-Issue
-----------------------------------------------------------------
-RangeMerged-Issue
- TEST START : RangeMerged-Issue
- ITEM Assertion OK : Range.RangeMerged is $F$2:$H$5
- ITEM Assertion OK : The first address of Range.RangeMerged is $F$2
-END 'RangeMerged-Issue' Symbol
- TEST OK : RangeMerged-Issue
-Test run finished : 2008/06/19 17:14:57
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/replace.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/replace.log
deleted file mode 100644
index 8f600faaa..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/replace.log
+++ /dev/null
@@ -1,14 +0,0 @@
-Test run started : 09/05/2008 10:21:46 AM
-BEGIN Replace
- TEST START : Test Replace function
- ITEM Assertion OK : common string:aefefdBc
- ITEM Assertion OK : expression string:aefefdef
- ITEM Assertion OK : binanary compare:aefefdBc
- ITEM Assertion OK : text compare:aefefdef
- ITEM Assertion OK : text compare:aefefdef
- ITEM Assertion OK : start = 3:cefdBc
- ITEM Assertion OK : count = 2: aefefdBc
- ITEM Assertion OK : start = 1, count = 0, not support in Unix: abcbcdBc
- TEST OK : Test Replace function
-END Replace
-Test run finished : 09/05/2008 10:21:47 AM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/stringplusdouble.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/stringplusdouble.log
deleted file mode 100644
index 6e8b8d994..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/stringplusdouble.log
+++ /dev/null
@@ -1,62 +0,0 @@
-Test run started : 05/29/2008 02:51:22 PM
-BEGIN String Plus Double
- TEST START : double = string + double
-The next compute raises error: s = null, d = null, r = s + d
- ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0
-The next compute raises error: s = null, d = 20, r = s + d
- ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20
- ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10
- ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100
- ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30
- ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020
-The next compute raises error: s = 'abc', d = null, r = s + d
- ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = null, r = s & d
- ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s + d
- ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s & d
- ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1
- TEST OK : double = string + double
- TEST START : string = string + double
-The next compute raises error: s = null, d = null, r = s + d
- ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0
-The next compute raises error: s = null, d = 20, r = s + d
- ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20
- ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10
- ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100
- ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30
- ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020
-The next compute raises error: s = 'abc', d = null, r = s + d
- ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1
- ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: abc0
-The next compute raises error: s = 'abc', d = 20, r = s + d
- ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1
- ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: abc20
- TEST OK : string = string + double
- TEST START : double = string + string
-The next compute raises error: s = null, d = null, r = s + d
- ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1
-The next compute raises error: s = null, d = null, r = s & d
- ITEM Assertion OK : s = null, d = null, r = s & d .The result is: -1
- ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: 20
- ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20
- ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10
- ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 10
- ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 1020
- ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020
-The next compute raises error: s = 'abc', d = null, r = s + d
- ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = null, r = s & d
- ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s + d
- ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s & d
- ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1
- TEST OK : double = string + string
-END String Plus Double
-Test run finished : 05/29/2008 02:51:22 PM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/unix/window2.log b/scratch/sc-vba/testvba/TestDocuments/logs/unix/window2.log
deleted file mode 100644
index 8e26d0580..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/unix/window2.log
+++ /dev/null
@@ -1,41 +0,0 @@
-Test run started : 2008/09/22 11:18:57
-BEGIN Window2
- TEST START : Test Window.SplitRow
- ITEM Assertion OK : Test SplitColumn: 2 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion OK : Test SplitRow: 2 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion OK : Test SplitVertical: 242.465788476212
- ITEM Assertion OK : Test SplitHorizontal: 242.465788476212
- ITEM Assertion OK : Test SplitRow: 4 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion OK : Test SplitColumn: 3 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion OK : Test SplitColumn: 0
- ITEM Assertion OK : Test SplitRow: 0
- TEST OK : Test Window.SplitRow
- TEST START : Test Window.DisplayGridlines
- ITEM Assertion OK : Test gridlines are on
- ITEM Assertion OK : Test gridlines are off
- TEST OK : Test Window.DisplayGridlines
- TEST START : Test Window.DisplayHeadings
- ITEM Assertion OK : Test Headings are on
- ITEM Assertion OK : Test Headings are off
- TEST OK : Test Window.DisplayHeadings
- TEST START : Test Window.Visibility
- ITEM Assertion OK : Window is visible
- ITEM Assertion OK : Window is not visible
- TEST OK : Test Window.Visibility
- TEST START : Test Window.FreezePanes
- ITEM Assertion OK : Test no panes frozen
- ITEM Assertion OK : Test panes frozen at center
- ITEM Assertion OK : Test panes frozen at split
- TEST OK : Test Window.FreezePanes
- TEST START : Test Window.View
- TEST OK : Test Window.View
- TEST START : Test Window.Zoom
- ITEM Assertion OK : Test zoom=100%
- ITEM Assertion OK : Test zoom=150%
- TEST OK : Test Window.Zoom
- TEST START : Test Windows.Count
- ITEM Assertion OK : Windows Count: 1
- ITEM Assertion OK : Application.Windows Count: 1
- TEST OK : Test Windows.Count
-END Window2
-Test run finished : 2008/09/22 11:18:58
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/AutoFilter.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/AutoFilter.log
deleted file mode 100644
index b8d0b85a8..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/AutoFilter.log
+++ /dev/null
@@ -1,20 +0,0 @@
-Test run started : 16/10/2007 17:42:01
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1 'starts with' string criteria
- ITEM Assertion OK : test2 'not equal to' string criteria
- ITEM Assertion OK : test3 'ends with' string criteria
- ITEM Assertion OK : test4 field 'all'
- ITEM Assertion OK : test5 numeric '<15'
- ITEM Assertion OK : test6 numeric '>=15'
- ITEM Assertion OK : test7 numeric '<=12'
-Test Results
-============
-
-Tests passed: 7
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 16/10/2007 17:42:02
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/CalcFont.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/CalcFont.log
deleted file mode 100644
index e8695523a..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/CalcFont.log
+++ /dev/null
@@ -1,17 +0,0 @@
-Test run started : 15/01/2009 17:00:35
-CalcFont_Format
- TEST START : Font_Format
- ITEM Assertion OK : correctly set font to Bold
- ITEM Assertion OK : correctly set font to Italic
- ITEM Assertion OK : correctly read FontStyle
- ITEM Assertion OK : correctly set font to Shadow
- ITEM Assertion OK : correctly set font color
- ITEM Assertion OK : correctly set font color index
- ITEM Assertion OK : correctly set font name
- ITEM Assertion OK : correctly set font outline
- ITEM Assertion OK : correctly set font size
- ITEM Assertion OK : correctly set font strikethrough
- ITEM Assertion OK : correctly set font underline
- TEST Success. : Font_Format
-CalcFont_Format
-Test run finished : 15/01/2009 17:00:36
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/MiscOperatorTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/MiscOperatorTests.log
deleted file mode 100644
index 3ccec0a15..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/MiscOperatorTests.log
+++ /dev/null
@@ -1,29 +0,0 @@
-Test run started : 15/01/2009 17:03:13
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1: res = Not ( A > B )
- ITEM Assertion OK : test2: res = Not ( B > A )
- ITEM Assertion OK : test3: res = Not ( D )
- ITEM Assertion OK : test4: res = Not A
- ITEM Assertion OK : test5: res = ( A > D )
- ITEM Assertion OK : test6: res = ( D > A )
- ITEM Assertion OK : test7: res = ( A < D )
- ITEM Assertion OK : test8: res = ( D < A )
- ITEM Assertion OK : test9: res = ( A >= D )
- ITEM Assertion OK : test10: res = ( D >= A )
- ITEM Assertion OK : test11: res = ( A <= D )
- ITEM Assertion OK : test12: res = ( D <= A )
- ITEM Assertion OK : test13: res = ( D = A )
- ITEM Assertion OK : test14: res = ( A = D )
- ITEM Assertion OK : test15: res = ( D <> A )
- ITEM Assertion OK : test16: res = ( A <> D )
-Test Results
-============
-
-Tests passed: 16
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 15/01/2009 17:03:15
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/MiscRangeTests.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/MiscRangeTests.log
deleted file mode 100644
index d190abb5f..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/MiscRangeTests.log
+++ /dev/null
@@ -1,45 +0,0 @@
-Test run started : 17/07/2007 15:08:56
-----------------------------------------------------------------
-MiscRangeTests
- TEST START : MiscRangeTests
- ITEM Assertion OK : test 1
- ITEM Assertion OK : test 2
- ITEM Assertion OK : test 3
- ITEM Assertion OK : test 4
- ITEM Assertion OK : test 5
- ITEM Assertion OK : test 6
- ITEM Assertion OK : test 7
- ITEM Assertion OK : test 8
- ITEM Assertion OK : test 9
- ITEM Assertion OK : test 10
- ITEM Assertion OK : test 11
- ITEM Assertion OK : test 12
- ITEM Assertion OK : test 13
- ITEM Assertion OK : test 14
- ITEM Assertion OK : test 15
- ITEM Assertion OK : test 16
- ITEM Assertion OK : test 17
- ITEM Assertion OK : test 18
- ITEM Assertion OK : test 19
- ITEM Assertion OK : test 20
- ITEM Assertion OK : test 21
- ITEM Assertion OK : test 22
- ITEM Assertion OK : test 23
- ITEM Assertion OK : test 24
- ITEM Assertion OK : test 25
- ITEM Assertion OK : test 26
- ITEM Assertion OK : test 27
- ITEM Assertion OK : test 28
- ITEM Assertion OK : test 29
- ITEM Assertion OK : test 30
- ITEM Assertion OK : test 31
-No. tests: 31
-Summary
-=======
-Run: 31
-Passed: 31
-Failed: 0
-
-END 'MiscRangeTests
- TEST OK : MiscRangeTests
-Test run finished : 17/07/2007 15:08:59
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/PageBreaks.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/PageBreaks.log
deleted file mode 100644
index 30b6e45d1..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/PageBreaks.log
+++ /dev/null
@@ -1,10 +0,0 @@
-Test run started : 08/10/2008 12:02:12
-----------------------------------------------------------------
- TEST START : PageBreaks-Issue
- ITEM Assertion OK : HPageBreaks.Count is 3
- ITEM Assertion OK : HPageBreak.Type is -4135
- ITEM Assertion OK : HPageBreak.Location: Range.Row is 5
- ITEM Assertion OK : HPageBreak.Delete: HPageBreaks.Count is 2
-END 'PageBreaks-Issue' Symbol
- TEST OK : PageBreaks-Issue
-Test run finished : 08/10/2008 12:02:12
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-2.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-2.log
deleted file mode 100644
index b80d996e3..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-2.log
+++ /dev/null
@@ -1,68 +0,0 @@
-Test run started : 10/07/2007 01:55:47
-----------------------------------------------------------------
-ClearFormtsIssue
- TEST START : ClearFormtsIssue
- ITEM Assertion OK : Range.Font.Bold is: True
- ITEM Assertion OK : Range.Font.Bold is: False
-END 'ClearFormtsIssue' Symbol
- TEST OK : ClearFormtsIssue
-----------------------------------------------------------------
-VerticalAlignment-Issue
- TEST START : VerticalAlignment-Issue
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : - Range.VerticalAlignment (get)
- ITEM Assertion OK : - Range.VerticalAlignment (set)
- ITEM Assertion OK : Range.VeritcalAlignment is Null
-END 'VerticalAlignment-Issue' Symbol
- TEST OK : VerticalAlignment-Issue
-----------------------------------------------------------------
-HorizontalAlignment-Issue
- TEST START : HorizontalAlignment-Issue
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : - Range.HorizontalAlignment (get)
- ITEM Assertion OK : - Range.HorizontalAlignment (set)
- ITEM Assertion OK : Range.HorizontalAlignment is Null
-END 'HorizontalAlignment-Issue' Symbol
- TEST OK : HorizontalAlignment-Issue
-----------------------------------------------------------------
-WrapText-Issue
- TEST START : WrapText-Issue
- ITEM Assertion OK : - Range.WrapText (get)
- ITEM Assertion OK : - Range.WrapText (get)
- ITEM Assertion OK : Range.WrapText is Null
-END 'WrapText-Issue' Symbol
- TEST OK : WrapText-Issue
-----------------------------------------------------------------
-FontBorderIssues
- TEST START : FontBorderIssues
- ITEM Assertion OK : - = Borders.Color (getColor)
- ITEM Assertion OK : - = Font.Color (getColor)
-END 'FontBorderIssues' Symbol
- TEST OK : FontBorderIssues
-----------------------------------------------------------------
-RangeSizeIssues
- TEST START : RangeSizeIssues
- ITEM Assertion OK : Range.Left is: 100.5291
- ITEM Assertion OK : Range.Top is: 95.39775
- ITEM Assertion OK : Range.Width is: 191.25
- ITEM Assertion OK : Range.Height is: 271.5
-END 'RangeSizeIssues' Symbol
- TEST OK : RangeSizeIssues
-----------------------------------------------------------------
-ApplicationIssues
- TEST START : ApplicationIssues
- ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range.Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Application.ActiveSheet.Name: Sheet1
-END 'ApplicationIssues' Symbol
- TEST OK : ApplicationIssues
-Test run finished : 10/07/2007 01:55:48
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-3.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-3.log
deleted file mode 100644
index 365d126a7..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges-3.log
+++ /dev/null
@@ -1,8 +0,0 @@
-Test run started : 10/07/2007 01:55:51
-----------------------------------------------------------------
-MyGoalseek-Issue
- TEST START : MyGoalseek-Issue
- ITEM Assertion OK : Variable Range value: 15
-END 'MyGoalseek-Issue' Symbol
- TEST OK : MyGoalseek-Issue
-Test run finished : 10/07/2007 01:55:51
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges.log
deleted file mode 100644
index 6491fe417..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/Ranges.log
+++ /dev/null
@@ -1,280 +0,0 @@
-Test run started : 08/10/2008 11:30:21
-----------------------------------------------------------------
-ApplicationMethods
- TEST START : ApplicationMethods
- ITEM Assertion OK : Name of Workbook is: Ranges.xls
- ITEM Assertion OK : Address of Application.Columns is: $A:$A
- ITEM Assertion OK : Address of Application.Rows is: $1:$1
- ITEM Assertion OK : Address of Application.Range is: $1:$1,$5:$7
- ITEM Assertion OK : Please check manually: DefaultFilePath is: C:\Documents and Settings\vituosity\My Documents
- ITEM Assertion OK : Please check manually: Library Path is: C:\Documents and Settings\vituosity\Application Data\OpenOffice.org\3\user\basic
- ITEM Assertion OK : Please check manually: Template Path is: C:\Documents and Settings\vituosity\Application Data\OpenOffice.org\3\user\template
- ITEM Assertion OK : FileSeparator is \
- ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls
-END 'ApplicationMethods' Symbol
- TEST OK : ApplicationMethods
-----------------------------------------------------------------
-Insert-Issue
- TEST START : Insert-Issue
- ITEM Assertion OK : Insert with xlShiftToRight: 10
-END 'Insert-Issue' Symbol
- TEST OK : Insert-Issue
-----------------------------------------------------------------
-MergeCells-Issue
- TEST START : MergeCells-Issue
- ITEM Assertion OK : Range.MergeCells is True
- ITEM Assertion FAIL : MergeCells is null: False
- ITEM Assertion OK : RowCount after Merge: 13
- ITEM Assertion OK : Range.MergeCells is False
- ITEM Assertion OK : MergeCells is null: False
- ITEM Assertion FAIL : MergeCells of Second Area is null : False
- ITEM Assertion FAIL : MergeCells of Ranges is Null: False
- ITEM Assertion OK : RowCount after Merge: 7
- ITEM Assertion OK : Range.MergeCells is False
- ITEM Assertion OK : MergeCells is null: False
- ITEM Assertion OK : RowCount after Merge: 7
-END 'MergeCells-Issue' Symbol
- TEST OK : MergeCells-Issue
-----------------------------------------------------------------
-Areas-Issue
- TEST START : Areas-Issue
- ITEM Assertion OK : Range Areas Count is2
- ITEM Assertion OK : First Range Address is: $E$8:$G$13
- ITEM Assertion OK : First Row is: 8
- ITEM Assertion OK : First Column is: 5
- ITEM Assertion OK : EntireRow Address is: $8:$13,$13:$19
- ITEM Assertion OK : EntireColumn Address is: $E:$G,$G:$K
- ITEM Assertion OK : Range Count:53
-END 'Areas-Issue' Symbol
- TEST OK : Areas-Issue
-----------------------------------------------------------------
-Fill-Methods-Issue
- TEST START : Fill-Methods-Issue
- ITEM Assertion OK : Range Value after FillDown: MyFillValue
- ITEM Assertion OK : Range Value after FillDown: MyFillValue
- ITEM Assertion OK : Range Value after FillDown: MyRightFillValue
- ITEM Assertion OK : Range Value after FillDown: MyBottomFillValue
-END 'Fill-Methods-Issue' Symbol
- TEST OK : Fill-Methods-Issue
-----------------------------------------------------------------
-Range/Item-Method-Issue
- TEST START : Range/Item-Method-Issue
- ITEM Assertion OK : Range of multiple columns is: $A:$A,$C:$C
- ITEM Assertion OK : Range of multiple rows is: $1:$1,$5:$7
- ITEM Assertion OK : Range of several columns is: $C:$E,$D:$D
- ITEM Assertion OK : Range of several rows is: $5:$8,$6:$10
- ITEM Assertion OK : Range of several single cells is: $C$5,$E$8
- ITEM Assertion OK : Range of several named ranges is: $L$1:$M$6,$E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range of a single Item Cell is: $E$21
- ITEM Assertion OK : Range of a single Item Cell is: $F$21
- ITEM Assertion OK : Range of a single Item Cell is: $F$10
-END 'Range/Item-Method-Issue' Symbol
- TEST OK : Range/Item-Method-Issue
-----------------------------------------------------------------
-R1C1-Formulas-Issue
- TEST START : R1C1-Formulas-Issue
- ITEM Assertion OK : R1C1 Range.Formula is: =IF(OR(R[-2]C[1]=0,RC[2]="YES"),"")
- ITEM Assertion OK : Range.Formula is: =IF(OR(J8=0,K10="YES"),"")
-END 'R1C1-Formulas-Issue' Symbol
- TEST OK : R1C1-Formulas-Issue
-----------------------------------------------------------------
-Verify_Delete
- TEST START : Verify_Delete
- ITEM Assertion OK : Ranges are intersecting: $G$13
- ITEM Assertion OK : Delete with Default: $AJ$4
- ITEM Assertion OK : Delete with ShifttoLeft: $AJ$4
- ITEM Assertion OK : Delete with ShiftUp: $M$22
-END 'Verify_Delete' Symbol
- TEST OK : Verify_Delete
-----------------------------------------------------------------
-Value-Issue
- TEST START : Value-Issue
- ITEM Assertion OK : Value of Range is: 12.3
- ITEM Assertion OK : Text of Range is: 12.3
- ITEM Assertion OK : Range has Formula: False
- ITEM Assertion OK : Cell has Formula: False
- ITEM Assertion FAIL : Text of Range is null: False
- ITEM Assertion OK : Range has Formula: True
- ITEM Assertion OK : Cell has Formula: True
- ITEM Assertion OK : Value of Cell is: 12
- ITEM Assertion OK : Application.Calculation is : -4135
- ITEM Assertion OK : Calculation is automated: True
- ITEM Assertion OK : Range has Formula: True
- ITEM Assertion OK : Value of Cell is: 16
- ITEM Assertion OK : Text of Cell is: 16
- ITEM Assertion OK : Text of Cell is: 16
- ITEM Assertion OK : Range has Formula after 'ClearContents: False
- ITEM Assertion OK : Text of Cell is:
- ITEM Assertion OK : Text of Cell is:
-END 'Value-Issue' Symbol
- TEST OK : Value-Issue
-----------------------------------------------------------------
-AutoFit issue
- TEST START : AutoFit issue
- ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 680
- ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 582
-END 'AutoFit issue' Symbol
- TEST OK : AutoFit issue
-----------------------------------------------------------------
-Selections
- TEST START : Selections
- ITEM Assertion OK : ActiveCell is : $E$8
- ITEM Assertion OK : Active Cell is : $E$8
- ITEM Assertion OK : Number of Cells in Range: 52
- ITEM Assertion OK : Number of Cells in Range: 52
- ITEM Assertion OK : Number of Cells in Range: 52
-END 'Selections' Symbol
- TEST OK : Selections
-----------------------------------------------------------------
-Offset-Resize
- TEST START : Offset-Resize
- ITEM Assertion OK : Offset is : $G$10:$I$15,$I$15:$M$21
- ITEM Assertion OK : Offset is : $G$7:$I$12,$I$12:$M$18
- ITEM Assertion OK : Resized Range is : $A$20:$D$23
-END 'Offset-Resize' Symbol
- TEST OK : Offset-Resize
-----------------------------------------------------------------
-Ranges-Address
- TEST START : Ranges-Address
- ITEM Assertion OK : Range Address is: $E$8:$G$13,$G$13:$K$19
- ITEM Assertion OK : Range Address is: $E8:$G13,$G13:$K19
- ITEM Assertion OK : Range Address is: E$8:G$13,G$13:K$19
- ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion FAIL : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion OK : Range Address is: R8C5:R13C7,R13C7:R19C11
- ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5],R[11]C[5]:R[17]C[9]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13,$G$13:$K$19
-END 'Ranges-Address' Symbol
- TEST OK : Ranges-Address
-----------------------------------------------------------------
-Range-Address
- TEST START : Range-Address
- ITEM Assertion OK : Range Address is: $E$8:$G$13
- ITEM Assertion OK : Range Address is: $E8:$G13
- ITEM Assertion OK : Range Address is: E$8:G$13
- ITEM Assertion OK : Range Address is: R8C5:R13C7
- ITEM Assertion FAIL : Range Address is: R8C5:R13C7
- ITEM Assertion OK : Range Address is: R8C5:R13C7
- ITEM Assertion OK : Range Address is: R[6]C[3]:R[11]C[5]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$8:$G$13
-END 'Range-Address' Symbol
- TEST OK : Range-Address
-----------------------------------------------------------------
-Column-Address
- TEST START : Column-Address
- ITEM Assertion OK : Range Address is: $F$8:$F$13
- ITEM Assertion OK : Range Address is: $F8:$F13
- ITEM Assertion OK : Range Address is: F$8:F$13
- ITEM Assertion OK : Range Address is: R8C6:R13C6
- ITEM Assertion FAIL : Range Address is: R8C6:R13C6
- ITEM Assertion OK : Range Address is: R8C6:R13C6
- ITEM Assertion OK : Range Address is: R[6]C[4]:R[11]C[4]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$8:$F$13
-END 'Column-Address' Symbol
- TEST OK : Column-Address
-----------------------------------------------------------------
-Row-Address
- TEST START : Row-Address
- ITEM Assertion OK : Range Address is: $E$9:$G$9
- ITEM Assertion OK : Range Address is: $E9:$G9
- ITEM Assertion OK : Range Address is: E$9:G$9
- ITEM Assertion OK : Range Address is: R9C5:R9C7
- ITEM Assertion FAIL : Range Address is: R9C5:R9C7
- ITEM Assertion OK : Range Address is: R9C5:R9C7
- ITEM Assertion OK : Range Address is: R[7]C[3]:R[7]C[5]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$E$9:$G$9
-END 'Row-Address' Symbol
- TEST OK : Row-Address
-----------------------------------------------------------------
-SingleCell-Address
- TEST START : SingleCell-Address
- ITEM Assertion OK : Range Address is: $F$9
- ITEM Assertion OK : Range Address is: $F9
- ITEM Assertion OK : Range Address is: F$9
- ITEM Assertion OK : Range Address is: R9C6
- ITEM Assertion FAIL : Range Address is: R9C6
- ITEM Assertion OK : Range Address is: R9C6
- ITEM Assertion OK : Range Address is: R[7]C[4]
- ITEM Assertion OK : RangeAddress is [Ranges.xls]Sheet1!$F$9
-END 'SingleCell-Address' Symbol
- TEST OK : SingleCell-Address
-----------------------------------------------------------------
-Heights and Widths
- TEST START : Heights and Widths
- ITEM Assertion OK : Range RowHeight is 40
- ITEM Assertion OK : Range ColumnWidth is 50
- ITEM Assertion OK : Range Height is 240
- ITEM Assertion FAIL : Range Width is 675
- ITEM Assertion OK : Range RowHeight is 50
- ITEM Assertion OK : Range ColumnWidth is 50
- ITEM Assertion OK : Range Height is 300
- ITEM Assertion FAIL : Range Width is 675
- ITEM Assertion OK : RowHeight is null: True
- ITEM Assertion OK : ColumnWidth is null: True
-END 'Heights and Widths' Symbol
- TEST OK : Heights and Widths
-----------------------------------------------------------------
-RangeRowColumn-Issue
- TEST START : RangeRowColumn-Issue
- ITEM Assertion OK : Row is: 8
- ITEM Assertion OK : Column is: 5
- ITEM Assertion OK : EntireRow.Columns.Count = 1024
- ITEM Assertion OK : EntireColumn.Rows.Count = 131072
-END 'RangeRowColumn-Issue' Symbol
- TEST OK : RangeRowColumn-Issue
-----------------------------------------------------------------
-Replace-Issue
- TEST START : Replace-Issue
- ITEM Assertion OK : Value after Replace: YourValue
- ITEM Assertion OK : Value after Replace: YourValue
- ITEM Assertion OK : Value after Replace: ReplaceValue
- ITEM Assertion OK : Value after Replace: New ReplaceValue
- ITEM Assertion OK : Value after Replace: New ReplaceValue
- ITEM Assertion OK : Value after Replace: New Replace
- ITEM Assertion OK : Value after Replace:
-END 'Replace-Issue' Symbol
- TEST OK : Replace-Issue
-----------------------------------------------------------------
-Hidden-Issue
- TEST START : Hidden-Issue
- ITEM Assertion OK : - Range.Rows.Hidden (set)
- ITEM Assertion OK : - Range.Rows.Hidden (get)
- ITEM Assertion OK : - Range.Rows.Item(1).Hidden (set)
- ITEM Assertion OK : - Range.Rows.Item(1).Hidden (get)
- ITEM Assertion OK : - Range.Columns.Hidden (set)
- ITEM Assertion OK : - Range.Columns.Hidden (get)
- ITEM Assertion OK : - Range.Columns.Item(1).Hidden (set)
- ITEM Assertion OK : - Range.Columns.Item(1).Hidden (get)
-END 'Hidden-Issue' Symbol
- TEST OK : Hidden-Issue
-----------------------------------------------------------------
-End issue
- TEST START : End issue
- ITEM Assertion OK : - = $E$48
- ITEM Assertion OK : - = $E$1
- ITEM Assertion OK : - = $E$3
- ITEM Assertion OK : - = $A$8
- ITEM Assertion OK : - = $B$8
- ITEM Assertion OK : - = $AMJ$8
- ITEM Assertion OK : - = $Z$8
-END 'End issue' Symbol
- TEST OK : End issue
-----------------------------------------------------------------
-Outline issue
- TEST START : Outline issue
- ITEM Assertion OK : - Range.clearOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
-END 'Outline issue' Symbol
- TEST OK : Outline issue
-----------------------------------------------------------------
-Validation
- TEST START : Validation
- ITEM Assertion OK : Validation Input Message is : Attention!
- ITEM Assertion OK : Validation Input Message is : Enter an integer from five to ten
- ITEM Assertion OK : Validation Error Title is : You must enter a number from five to ten
- ITEM Assertion OK : Validation Error Message is : An Error occured
- ITEM Assertion OK : Validation Error Title is : Microsoft Excel
-END 'Validation' Symbol
- TEST OK : Validation
-Test run finished : 08/10/2008 11:30:24
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/Shapes.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/Shapes.log
deleted file mode 100644
index fe62ab03d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/Shapes.log
+++ /dev/null
@@ -1,77 +0,0 @@
-Test run started : 16/10/2007 17:46:03
-BEGIN Shapes_Collection_Behaviour
- TEST START : Shapes_Collection_Behaviour
- ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape1'
- ITEM Assertion OK : Name of indexed shape should be 'Sheet2Shape2'
- TEST Success. : Shapes_Collection_Behaviour
-END Shapes_Collection_Behaviour
-BEGIN Shapes_Select_Item
- TEST START : Shapes_Select_Item
- ITEM Assertion OK : Correctly selected shape through Range
- ITEM Assertion OK : Correctly selected shape through Item
- ITEM Assertion OK : Needs to be visually checked. Is there a line on the document?
- ITEM Assertion OK : Needs to be visually checked. Are All Shapes Selected?
- TEST Success. : Shapes_Select_Item
-END Shapes_Select_Item
-BEGIN Shapes_Fill
- TEST START : Shapes_Fill
- ITEM Assertion OK : correctly set visibility of shape fill
- ITEM Assertion OK : correctly set transparency of shape line
- ITEM Assertion OK : correctly set forecolor of shape fill
- ITEM Assertion FAIL : correctly set backcolor of shape fill
- ITEM Assertion OK : the success of the TwoColorGradient method needs to be verified visually!
- ITEM Assertion OK : correctly set forecolor of shape fill
- ITEM Assertion FAIL : correctly set forecolor of shape fill
- TEST Success. : Shapes_Fill
-END Shapes_Fill
-BEGIN Shapes_Line
- TEST START : Shapes_Line
- ITEM Assertion FAIL : correctly set weight of shape line
- ITEM Assertion OK : correctly set visibility of shape line
- ITEM Assertion OK : correctly set transparency of shape line
- ITEM Assertion OK : correctly set dash style of shape line
- ITEM Assertion OK : correctly set dash style of shape line
- ITEM Assertion OK : correctly set forecolor of shape line
- ITEM Assertion FAIL : correctly set backcolor of shape line
- TEST Success. : Shapes_Line
-END Shapes_Line
-BEGIN Shapes_TextFrame
- TEST START : Shapes_TextFrame
- ITEM Assertion OK : correctly set Autosize of Shape TextFrame
- TEST Success. : Shapes_TextFrame
-END Shapes_TextFrame
-BEGIN Shapes_SimpleGeometry
- TEST START : Shapes_SimpleGeometery
- ITEM Assertion OK : shape height should be 49.4519655148368 and got 49.4078709034412
- ITEM Assertion OK : shape width should be 101.467710269751 and got 101.423615658355
- ITEM Assertion OK : shape left should be 68.5574761223637 and got 68.5417279658754
- ITEM Assertion OK : shape top should be 44.1511784471699 and got 44.1354302906816
- ITEM Assertion OK : shape rotation should be 0 and got 0
- ITEM Assertion OK : shape rotation should be 25 and got 25
- ITEM Assertion OK : shape incrementrotation should be 50 and got 50
- ITEM Assertion OK : shape incrementleft should be 69.7480272284707 and got 69.7322790719824
- ITEM Assertion OK : shape incrementtop should be 93.8141674447769 and got 93.7984192882885
- TEST Success. : Shapes_SimpleGeometery
-END Shapes_SimpleGeometry
-BEGIN Shapes_Range
- TEST START : Shapes_Range
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to contain 1 element, it contains 1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(1) to return Sheet2Shape1 got Sheet2Shape1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to contain 1 element, it contains 1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Sheet2Shape3) to return Sheet2Shape3 got Sheet2Shape3
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to contain 2 elements, it contains 2
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array(3, 1) to return concated element/shape names Sheet2Shape3Sheet2Shape1 and got Sheet2Shape3Sheet2Shape1
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to contain 3 elements, it contains 3
- ITEM Assertion OK : expected Sheets(2).Shapes.Range(Array('Sheet2Shape3', 1, 'Sheet2Shape2')) to return concated element/shape names Sheet2Shape3Sheet2Shape1Sheet2Shape2 and got Sheet2Shape3Sheet2Shape1Sheet2Shape2
- TEST Success. : Shapes_Range
-END Shapes_Range
-BEGIN Shapes_ShapeRange
- TEST START : Shapes_ShapeRange
- ITEM Assertion OK : ShapeRange.IncrementLeft shp1.left should be 89.7322790719824 and got 89.7165297816359
- ITEM Assertion OK : ShapeRange.IncrementLeft shp2.left should be 240.02518299054 and got 240.009433700193
- ITEM Assertion OK : ShapeRange.IncrementTop shp1.Top should be 113.798419288289 and got 113.782669997942
- ITEM Assertion OK : ShapeRange.IncrementTop shp2.Top should be 67.4519655148368 and got 67.4362162244903
- ITEM Assertion OK : ShapeRange.IncrementRotation shp1.Rotation should be 70 and got 70
- ITEM Assertion OK : ShapeRange.IncrementRotation shp2.Rotation should be 20 and got 20
-END Shapes_ShapeRange
-Test run finished : 16/10/2007 17:46:04
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/StrConv-test.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/StrConv-test.log
deleted file mode 100644
index b1f779423..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/StrConv-test.log
+++ /dev/null
@@ -1,9 +0,0 @@
-Test run started : 08/10/2008 12:04:16
-BEGIN StrConv
- TEST START : Test StrConv function
- ITEM Assertion OK : Converts the string to uppercase characters:ABC EFG HIJ
- ITEM Assertion OK : Converts the string to lowercase characters:abc efg hij
- ITEM Assertion OK : Converts the first letter of every word in string to uppercase:Abc Efg Hij
- TEST OK : Test StrConv function
-END StrConv
-Test run finished : 08/10/2008 12:04:16
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/Template.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/Template.log
deleted file mode 100644
index 774994adb..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/Template.log
+++ /dev/null
@@ -1,14 +0,0 @@
-Test run started : 08/10/2008 12:05:52
-----------------------------------------------------------------
-TestCaseName
- TEST START : TestCaseName
- ITEM Assertion OK : Something has been done.
-Test Results
-============
-
-Tests passed: 1
-Tests failed: 0
-
-END 'TestCaseName
- TEST OK : TestCaseName
-Test run finished : 08/10/2008 12:05:52
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestAddress.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/TestAddress.log
deleted file mode 100644
index 0007e6f9c..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestAddress.log
+++ /dev/null
@@ -1,67 +0,0 @@
-Test run started : 08/10/2008 11:30:32
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1 Range('e3:f3') A1 style addressing
- ITEM Assertion OK : test2 Range('e3:f3') R1C1 style addressing
- ITEM Assertion OK : test3 Range ('e:f') A1 style addressing
- ITEM Assertion OK : test4 Range ('e:f') R1C1 style addressing
- ITEM Assertion OK : test5 Columns A1 style addressing
- ITEM Assertion OK : test6 Columns R1C1 style addressing
- ITEM Assertion OK : test7 Columns(3) A1 style addressing
- ITEM Assertion OK : test8 Columns(3) R1C1 style addressing
- ITEM Assertion OK : test9 Columns('e') A1 style addressing
- ITEM Assertion OK : test10 Columns('e') R1C1 style addressing
- ITEM Assertion OK : test11 Columns('b:d') A1 style addressing
- ITEM Assertion OK : test12 Columns('b:d') R1C1 style addressing
- ITEM Assertion OK : test13 Range('c1:g10').Columns A1 style addressing
- ITEM Assertion OK : test14 Range('c1:g10').Columns R1C1 style addressing
- ITEM Assertion OK : test15 Range('c1:g10').Columns(1) A1 style addressing
- ITEM Assertion OK : test16 Range('c1:g10').Columns(1) R1C1 style addressing
- ITEM Assertion OK : test17 Range('c1:g10').Columns('a') A1 style addressing
- ITEM Assertion OK : test18 Range('c1:g10').Columns('a') R1C1 style addressing
- ITEM Assertion OK : test19 Range('c1:g10').Columns('c') A1 style addressing
- ITEM Assertion OK : test20 Range('c1:g10').Columns('c') R1C1 style addressing
- ITEM Assertion OK : test21 Range('c1:g10').Columns('x:z') A1 style addressing
- ITEM Assertion OK : test22 Range('c1:g10').Columns('x:z') R1C1 style addressing
- ITEM Assertion OK : test23 Range('c1:g10').Columns(30) A1 style addressing
- ITEM Assertion OK : test24 Range('c1:g10').Columns(30) R1C1 style addressing
- ITEM Assertion OK : test25 Worksheets('Sheet2').Cells(1, 1) A1 style addressing
- ITEM Assertion OK : test26 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, RowAddressAbsolute is false
- ITEM Assertion OK : test27 Worksheets('Sheet2').Cells(1, 1) A1 style addressing, ColAddressAbsolute is false
- ITEM Assertion OK : test28 Worksheets('Sheet2').Cells(1, 1) R1C1 style addressing
- ITEM Assertion OK : test29 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing
- ITEM Assertion OK : test30 Worksheets('Sheet2').Range('A1').EntireColumn A1 style addressing
- ITEM Assertion OK : test31 Worksheets('Sheet2').Range('A1:E5').EntireRow A1 style addressing
- ITEM Assertion OK : test32 Worksheets('Sheet2').Range('A1') A1 style addressing
- ITEM Assertion OK : test33 Worksheets('Sheet2').Range('IV65536').EntireRow A1 style addressing
- ITEM Assertion OK : test34 Worksheets('Sheet2').Range('IU2:IV65536') A1 style addressing
- ITEM Assertion OK : test35 Range('c1:g10').Columns('x:z') R1C1 style addressing
- ITEM Assertion OK : test36 Worksheets('Sheet2').Range('A1') A1 style addressing
- ITEM Assertion OK : test37 Worksheets('Sheet2').Range('A1:E5').EntireColumn A1 style addressing
- ITEM Assertion OK : test38 Worksheets('Sheet2').Range('10:12') A1 style addressing
- ITEM Assertion OK : test39 Worksheets('Sheet2').Range('10:12') R1C1 style addressing
- ITEM Assertion OK : test40 Range('Sheet3!A1:B4') A1 style addressing
- ITEM Assertion OK : test41 Range('Sheet3!A1,B1,D4:F20') A1 style addressing
- ITEM Assertion OK : test42 Range('g20:h40').Columns('c:c')
- ITEM Assertion OK : test43 Range('g20:h40').Columns('c:f')
- ITEM Assertion OK : test44 Range('g20:h40').Columns(-1)
- ITEM Assertion OK : test45 Range('c4:g10').Rows(-1)
- ITEM Assertion OK : test46 Range('a2:b4').Rows('1:1')
- ITEM Assertion OK : test47 Range('a2:b4').Rows('1:2')
- ITEM Assertion OK : test48 Range('a2:b4').Rows('2:2')
- ITEM Assertion OK : test49 Range('a2:b4').Rows('2:3')
- ITEM Assertion OK : test50 Range(' A2:B4 ')
- ITEM Assertion OK : test51 Range('A 2:B 4')
- ITEM Assertion OK : test52 Range('A2 : B4 ')
- ITEM Assertion OK : test53 Range('Sheet1 !A2 : B4 ')
- ITEM Assertion OK : test54 Range('Sheet1! A2 : B4 ')
-Test Results
-============
-
-Tests passed: 54
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 08/10/2008 11:30:32
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest.log
deleted file mode 100644
index 492c24bc0..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest.log
+++ /dev/null
@@ -1,60 +0,0 @@
-Test run started : 10/07/2007 01:56:07
-BEGIN TestCalc
- TEST START : RangeTest2
- ITEM Assertion OK : - Range("D15").Row
- ITEM Assertion OK : - WorkSheet("D15").Range.Row
- ITEM Assertion OK : - Range("D15").Column
- ITEM Assertion OK : - Worksheet.Range("D15").Column
- ITEM Assertion OK : - Range("D1").EntireRow.Valuer
- ITEM Assertion OK : - Range("D1").EntireRow.Valuer
- ITEM Assertion OK : - Range("D1").EntireRow.Columns.Count
- ITEM Assertion OK : - Range("D1").EntireColumn.Rows.Count
- ITEM Assertion OK : - Range("D15").ClearContent
- ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Rows.Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Rows(1).Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Columns.Hidden (get)
- ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (set)
- ITEM Assertion OK : - Range("M1:N2").Columns(1).Hidden (get)
- ITEM Assertion OK : - Range("B38").Orientation (get)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlDownward)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlUpward)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical)
- ITEM Assertion OK : - Range("B38").Orientation (set)
- ITEM Assertion OK : - Range("B38").Orientation (set = xlVertical)
- ITEM Assertion OK : - Range("B39").WrapText (get)
- ITEM Assertion OK : - Range("B39").WrapText (set)
- ITEM Assertion OK : - Range("B39").WrapText (set)
- ITEM Assertion OK : - Range("E39").MergeCells (get)
- ITEM Assertion OK : - Range("F39").MergeCells (get)
- ITEM Assertion OK : - Range("E39").MergeCells (set)
- ITEM Assertion FAIL : - Range("F39").MergeCells (set)
- ITEM Assertion OK : - Range("E39").MergeCells (set)
- ITEM Assertion OK : - Range("F39").MergeCells (set)
- ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True
- ITEM Assertion OK : - Range("C41:C42").Replace MatchCase:=True
- ITEM Assertion OK : - Range("D41:D42").Replace MatchCase:=False
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (get)
- ITEM Assertion OK : - Range("B39").VerticalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (get)
- ITEM Assertion OK : - Range("B39").HorizontalAlignment (set)
- ITEM FAIL (RangeTest2)
- TEST Not succesfully completed : RangeTest2
-END TestCalc
-Test run finished : 10/07/2007 01:56:12
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest2.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest2.log
deleted file mode 100644
index 9159217cb..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest2.log
+++ /dev/null
@@ -1,65 +0,0 @@
-Test run started : 08/10/2008 11:30:38
-BEGIN TestCalc
- TEST START : RangeTest3
- ITEM Assertion OK : - setFormulaR1C1
- ITEM Assertion OK : - getFormulaR1C1
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy(Range("I10"))
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteValues
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormulas
- ITEM Assertion OK : PasteSpecial Paste:=xlPasteFormats
- ITEM Assertion OK : PasteSpecial
- ITEM Assertion OK : PasteSpecial SkipBlanks:=True
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationAdd
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationSubtract
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationMultiply
- ITEM Assertion OK : PasteSpecial Operation:=xlPasteSpecialOperationDivide
- ITEM Assertion OK : PasteSpecial Transpose:=True
- ITEM Assertion FAIL : ActiveWorkbook.FileFormat
- ITEM Assertion OK : ActiveWorkbook.Name
- ITEM Assertion OK : ActiveWorkbook.FullName und ActiveWorkbook.Path
- ITEM Assertion FAIL : - = ActiveWorkbook.Colors(3) set
- ITEM Assertion OK : - = ActiveWorkbook.ResetColors
- ITEM Assertion OK : - = ActiveWorkbook.Colors(3) get
- ITEM Assertion OK : - = Range("K22").End (xlDown)
- ITEM Assertion OK : - = Range("K22").End (xlUo)
- ITEM Assertion OK : - = Range("K22").End (xlToLeft)
- ITEM Assertion OK : - = Range("K22").End (xlRight)
- ITEM Assertion OK : - ActiveSpreadsheet.Next
- ITEM Assertion OK : - ActiveSpreadsheet.Next
- ITEM Assertion OK : - ActiveSpreadsheet.Previous
- ITEM Assertion OK : - ActiveSpreadsheet.Previous
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="x"
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="<>"
- ITEM Assertion OK : - Range("J4:J11").AutoFilter field:=1, Criteria1:="="
- ITEM Assertion OK : - Range("J4:J11").AutoFilter
- ITEM Assertion OK : - ActiveSheet.Resize.Select
- ITEM Assertion OK : - Application.GoTo Reference:="R8C2"
- ITEM Assertion FAIL : - Application.GoTo Reference:="R[8]C[2]"
- ITEM Assertion OK : - Application.GoTo Reference:="R8C2"
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Ungroup- please check visually
- ITEM Assertion OK : - Range.Ungroup - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.Group - please check visually
- ITEM Assertion OK : - Range.clearOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - Range.AutoOutline - please check visually
- ITEM Assertion OK : - ActiveSheet.UsedRange.Select
- ITEM Assertion OK : - Range("A13").AddIndent
- ITEM Assertion OK : - Range("A13").IndentLevel set
- ITEM Assertion OK : - Range("A13").IndentLevel get
- ITEM Assertion OK : - Range("A13").IndentLevel get
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial()
- ITEM Assertion OK : - Range.Calculate
- ITEM Assertion OK : Worksheet.Calculate
- ITEM Assertion OK : - Application.Calculate
- ITEM Assertion OK : Global.Calculate
- ITEM Assertion OK : Calculation set
- ITEM FAIL (RangeTest3)
- TEST Not succesfully completed : RangeTest3
-END TestCalc
-Test run finished : 08/10/2008 11:30:41
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestIntersection.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/TestIntersection.log
deleted file mode 100644
index 2cf4fe36e..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestIntersection.log
+++ /dev/null
@@ -1,26 +0,0 @@
-Test run started : 15/01/2009 17:05:08
-----------------------------------------------------------------
-TestIntersection
- TEST START : TestIntersection
- ITEM Assertion OK : test1 Application.Intersect( Range('A2:D10'), Range('C4:E6'))
- ITEM Assertion OK : test2 Application.Intersect( Range('A2:D10'), Range('A4:G10'))
- ITEM Assertion OK : test3 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('A4:G10'))
- ITEM Assertion OK : test4 Application.Intersect( Range('A4:G10'), Range('A2:c8,d2:f8,g2:i8'))
- ITEM Assertion OK : test5 Application.Intersect( Range('A2:c8,d2:f8,g2:i8'), Range('g4:i10,A4:G10'))
- ITEM Assertion OK : test6 Application.Intersect( Range('g4:i10,A4:G10'), Range('A2:c8,d2:f8,g2:i8'))
- ITEM Assertion OK : test7 Application.Intersect( Range('a2:d10,b5:e10'), Range('a5:i10'))
- ITEM Assertion OK : test8 Application.Intersect( Range('a2:c8,d2:f8'), Range('b6:e9,a6:f9'))
- ITEM Assertion OK : test9 Application.Intersect( Range('a2:c8,e2:f8'), Range('b6:e9,a6:f9'))
- ITEM Assertion OK : test10 Application.Intersect( Range('a1:a3,c1:c3'), Range('a2:c3'))
- ITEM Assertion OK : test11 Application.Intersect( Range('a1:a3,b1:b3'), Range('a2:c3'))
- ITEM Assertion OK : test12 Application.Intersect( Range('a2:d5,b3:f7,c1:g4'), Range('b2:e6'))
- ITEM Assertion OK : test13 Range(" a2:d10,b5:e10,g13:j32 "), Range(" a5:i10,b6:e9 "), Range("b2:r5,f10:h19")
-Test Results
-============
-
-Tests passed: 13
-Tests failed: 0
-
-END 'TestIntersection
- TEST OK : TestIntersection
-Test run finished : 15/01/2009 17:05:09
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestUnion.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/TestUnion.log
deleted file mode 100644
index 2382db549..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/TestUnion.log
+++ /dev/null
@@ -1,17 +0,0 @@
-Test run started : 15/01/2009 17:06:07
-----------------------------------------------------------------
-TestUnion
- TEST START : TestUnion
- ITEM Assertion OK : test1Application.Range('A2:D10'), Range('C4:E6')
- ITEM Assertion OK : test2Application.Range('A2:D5,a3:d4'), Range('A4:G10')
- ITEM Assertion OK : test3Application.Range('A4:G10,A1:B6'), Range('A2:D5,A3:D4')
- ITEM Assertion OK : test4Application.Range('A5:D10'), Range('B5:E10')
-Test Results
-============
-
-Tests passed: 4
-Tests failed: 0
-
-END 'TestUnion
- TEST OK : TestUnion
-Test run finished : 15/01/2009 17:06:08
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/VariantTest.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/VariantTest.log
deleted file mode 100644
index d2bfeb8e1..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/VariantTest.log
+++ /dev/null
@@ -1,47 +0,0 @@
-Test run started : 08/10/2008 12:07:24
-----------------------------------------------------------------
-TestAddress
- TEST START : TestAddress
- ITEM Assertion OK : test1: res = (aboo = '')
- ITEM Assertion OK : test 2: res = (aboo = 'fiddlesticks')
- ITEM Assertion OK : test 3: res = ('' = aboo)
- ITEM Assertion OK : test 4: res = ('fiddlesticks' = aboo )
- ITEM Assertion OK : test 5: res = (testString = '')
- ITEM Assertion OK : test 6: res = (testString = 'fiddlesticks')
- ITEM Assertion OK : test 7: res = ('' = testString)
- ITEM Assertion OK : test 8: res = ('fiddlesticks' = testString )
- ITEM Assertion OK : test 9: res = ( aboo < " )
- ITEM Assertion OK : test 10: res = ( testString < " )
- ITEM Assertion OK : test 11: res = ( aboo > " )
- ITEM Assertion OK : test 12: res = ( testString > " )
- ITEM Assertion OK : test 13: res = ( aboo <> '' )
- ITEM Assertion OK : test 14: res = ( testString <> '' )
- ITEM Assertion OK : test 15: res = (aboo = something/14)
- ITEM Assertion OK : test 16: res = something + 'string'
- ITEM Assertion OK : test 17: res = something & 'string'
- ITEM Assertion OK : test 18: res = something MOD 10 )
- ITEM Assertion OK : test 19: res = something AND 1 )
- ITEM Assertion OK : test 20: res = something AND 0 )
- ITEM Assertion OK : test 21: res = something OR 12)
- ITEM Assertion OK : test 22: res = something OR 0 )
- ITEM Assertion OK : test 23: res = something XOR 0 )
- ITEM Assertion OK : test 24: res = something XOR 1 )
- ITEM Assertion OK : test 25: res = something EQV 0 )
- ITEM Assertion OK : test 26: res = something EQV 1 )
- ITEM Assertion OK : test 27: res = something IMP 0 )
- ITEM Assertion OK : test 28: res = something IMP 1 )
- ITEM Assertion OK : test 29: res = something IMP 14 )
- ITEM Assertion OK : test 30: res = NOT something )
- ITEM Assertion OK : test 31: res = something + 12 )
- ITEM Assertion OK : test 32: res = something - 12 )
- ITEM Assertion OK : test 33: res = -something )
- ITEM Assertion OK : test 34: res = something * 12 )
-Test Results
-============
-
-Tests passed: 34
-Tests failed: 0
-
-END 'TestAddress
- TEST OK : TestAddress
-Test run finished : 08/10/2008 12:07:26
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/Window.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/Window.log
deleted file mode 100644
index 178582e75..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/Window.log
+++ /dev/null
@@ -1,46 +0,0 @@
-Test run started : 08/10/2008 12:09:50
-----------------------------------------------------------------
- TEST START : Window-Issue
- ITEM Assertion OK : Window.Left is: 0 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.Top is: 26 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.Width is: 1280 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.Height is: 968 (Test only applies to maximized Window)
- ITEM Assertion OK : Window.ScrollColumn is: 100
- ITEM Assertion OK : Window.ScrollColumn is: 1
- ITEM Assertion OK : Window.ScrollRow is: 100
- ITEM Assertion OK : Window.ScrollRow is: 1
- ITEM Assertion OK : Window.LargeScroll(Down): ScrollRow is: 127 (Test may only apply to maximized Window)
- ITEM Assertion OK : Window.LargeScroll(Up): ScrollRow is: 1
- ITEM Assertion OK : Window.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window)
- ITEM Assertion OK : Window.LargeScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Window.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window)
- ITEM Assertion OK : Window.SmallScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Window.DisplayWorkBookTabs is: False
- ITEM Assertion OK : Window.DisplayWorkBookTabs is: True
- ITEM Assertion OK : Window.DisplayVerticalScrollBar is: True
- ITEM Assertion OK : Window.DisplayVerticalScrollBar is: False
- ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: False
- ITEM Assertion OK : Window.DisplayHorizontalScrollBar is: True
- ITEM Assertion OK : Window.DisplayHeadings is: False
- ITEM Assertion OK : Window.DisplayHeadings is: True
- ITEM Assertion OK : Window.DisplayOutline is: False
- ITEM Assertion OK : Window.DisplayOutline is: True
- ITEM Assertion OK : Window.Visible is: False
- ITEM Assertion OK : Window.Visible is: True
- ITEM Assertion OK : Window.Caption is: MyCaption
- ITEM Assertion OK : Pane.ScrollColumn is: 100
- ITEM Assertion OK : Pane.ScrollColumn is: 1
- ITEM Assertion OK : Pane.ScrollRow is: 100
- ITEM Assertion OK : Pane.ScrollRow is: 1
- ITEM Assertion OK : Pane.LargeScroll(Down): ScrollRow is: 127 (Test may only apply to maximized Window)
- ITEM Assertion OK : Pane.LargeScroll(Up): ScrollRow is: 1
- ITEM Assertion OK : Pane.LargeScroll(ToRight): ScrollColumn is: 58 (Test may only apply to maximized Window)
- ITEM Assertion OK : Pane.LargeScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Pane.SmallScroll(ToRight): ScrollColumn is: 4 (Test may only apply to maximized Window)
- ITEM Assertion OK : Pane.SmallScroll(ToLeft): ScrollColumn is: 1
- ITEM Assertion OK : Window Selection: $A$2:$D$5
- ITEM Assertion OK : ActiveSheet name of Window: Sheet1
- ITEM Assertion OK : Window ActiveCell: $A$1
-END 'Window-Issue' Symbol
- TEST OK : Window-Issue
-Test run finished : 08/10/2008 12:09:50
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/bytearraystring.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/bytearraystring.log
deleted file mode 100644
index 8913fc096..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/bytearraystring.log
+++ /dev/null
@@ -1,8 +0,0 @@
-Test run started : 08/10/2008 12:54:46
-BEGIN Bytearray To String
- TEST START : Test the conversion between bytearray and string
- ITEM Assertion OK : The number of byte is:6
- ITEM Assertion OK : the return string is: abc
- TEST OK : Test the conversion between bytearray and string
-END Bytearray To String
-Test run finished : 08/10/2008 12:54:46
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/dateserial.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/dateserial.log
deleted file mode 100644
index 0b02f7b91..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/dateserial.log
+++ /dev/null
@@ -1,9 +0,0 @@
-Test run started : 08/10/2008 12:56:07
-BEGIN DateSerial
- TEST START : Test DateSerial function
- ITEM Assertion OK : the return date is: 15/06/1999
- ITEM Assertion OK : the return date is: 15/06/1999
- ITEM Assertion OK : the return date is: 15/06/1999
- TEST OK : Test DateSerial function
-END DateSerial
-Test run finished : 08/10/2008 12:56:07
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/datevalue.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/datevalue.log
deleted file mode 100644
index 469846336..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/datevalue.log
+++ /dev/null
@@ -1,8 +0,0 @@
-Test run started : 08/10/2008 13:07:49
-BEGIN DateValue
- TEST START : Test DateValue function
- ITEM Assertion OK : the return date is: 12/02/1969
- ITEM Assertion OK : the return date is: 21/01/2008
- TEST OK : Test DateValue function
-END DateValue
-Test run finished : 08/10/2008 13:07:49
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/format.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/format.log
deleted file mode 100644
index ef84cbbdb..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/format.log
+++ /dev/null
@@ -1,36 +0,0 @@
-Test run started : 15/01/2009 17:07:59
-BEGIN Format
- TEST START : Test Predefined_Number_Format_Sample function
- ITEM Assertion OK : General Number: 562486.2356
- ITEM Assertion OK : Fixed: 0.20
- ITEM Assertion OK : Standard: 562,486.24
- ITEM Assertion OK : Percent: 75.21%
- ITEM Assertion OK : Scientific: 5.62E+05
- ITEM Assertion OK : Scientific: -3.46E+03
- ITEM Assertion OK : Yes/No: No
- ITEM Assertion OK : Yes/No: Yes
- ITEM Assertion OK : True/False: False
- ITEM Assertion OK : True/False: True
- ITEM Assertion OK : On/Off: Off
- ITEM Assertion OK : On/Off: On
- TEST OK : Test Predefined_Number_Format_Sample function
- TEST START : Test Custom_Number_Format_Sample function
- ITEM Assertion OK : 00.0000: 23.6750
- ITEM Assertion OK : 00.00: 23.68
- ITEM Assertion OK : 00000: 02658
- ITEM Assertion OK : 00.00: 2658.00
- ITEM Assertion OK : ##.####: 23.675
- ITEM Assertion OK : ##.##: 23.68
- ITEM Assertion OK : #,###.##: 12,345.25
- ITEM Assertion OK : ##.00%: 25.00%
- ITEM Assertion OK : #,###: 1,000,000
- ITEM Assertion OK : ######E-###: 109838E-5
- ITEM Assertion OK : $#,###.##: $2,345.25
- ITEM Assertion OK : ##.###\%: .25%
- TEST OK : Test Custom_Number_Format_Sample function
- TEST START : Test Custom_Text_Format_Sample function
- ITEM Assertion OK : <: vba
- ITEM Assertion OK : >: VBA
- TEST OK : Test Custom_Text_Format_Sample function
-END Format
-Test run finished : 15/01/2009 17:07:59
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/pagesetup.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/pagesetup.log
deleted file mode 100644
index a1c90473c..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/pagesetup.log
+++ /dev/null
@@ -1,87 +0,0 @@
-Test run started : 7/21/2008 10:37:24 AM
-BEGIN PageSetup
- TEST START : Sheet_PrintArea
- ITEM Assertion OK : PrintArea has changed as expected
- TEST OK : Sheet_PrintArea
- TEST START : Test margins (no headers)
- ITEM Assertion OK : PageSetup.LeftMargin set/get
- ITEM Assertion OK : PageSetup.RightMargin set/get
- ITEM Assertion OK : PageSetup.TopMargin set/get
- ITEM Assertion OK : PageSetup.BottomMargin set/get
-Verify that page margins on sheet 1 are all 0.5inch
- TEST OK : Test margins (no headers)
- TEST START : Test margins (headers)
- ITEM Assertion OK : PageSetup.HeaderMargin set/get
- ITEM Assertion OK : PageSetup.FooterMargin set/get
- ITEM Assertion OK : PageSetup.LeftMargin set/get
- ITEM Assertion OK : PageSetup.LeftMargin set/get
-Verify that top/bottom/header/footer page margins on sheet 2 are all 0.5inch
- TEST OK : Test margins (headers)
- TEST START : Test header/footer text
- ITEM Assertion OK : PageSetup.LeftHeader set
- ITEM Assertion OK : PageSetup.LeftHeader set/get
- ITEM Assertion OK : PageSetup.CenterHeader set
- ITEM Assertion OK : PageSetup.CenterHeader set/get
- ITEM Assertion OK : PageSetup.RightHeader set
- ITEM Assertion OK : PageSetup.RightHeader set/get
- ITEM Assertion OK : PageSetup.LeftFooter set
- ITEM Assertion OK : PageSetup.LeftFooter set/get
- ITEM Assertion OK : PageSetup.CenterFooter set
- ITEM Assertion OK : PageSetup.CenterFooter set/get
- ITEM Assertion OK : PageSetup.RightFooter set
- ITEM Assertion OK : PageSetup.RightFooter set/get
-Verify that headers on sheet 2 are Ready,to,go
-Verify that footers on sheet 2 are This,now,Works
- TEST OK : Test header/footer text
- TEST START : Test zoom
- ITEM Assertion OK : PageSetup.Zoom set
- ITEM Assertion OK : PageSetup.Zoom set/get
-Verify that sheet 1 zoom is 10%
- TEST OK : Test zoom
- TEST START : Test orientation
- ITEM Assertion OK : PageSetup.Zoom set
- ITEM Assertion OK : PageSetup.Orientation set/get
-Verify that sheet 1 orientation is now landscape
- TEST OK : Test orientation
- TEST START : Test paper size
- ITEM Assertion OK : PageSetup.PaperSize get
- ITEM Assertion OK : PageSetup.PaperSize set/get
-Verify that paper size on sheet 1 is now Letter
- TEST OK : Test paper size
- TEST START : Test order
- ITEM Assertion OK : PageSetup.Order get
- ITEM Assertion OK : PageSetup.Order set/get
-Verify that order on sheet 1 is now over, then down.
- TEST OK : Test order
- TEST START : Test first page number
- ITEM Assertion OK : PageSetup.FirstPageNumber get
- ITEM Assertion OK : PageSetup.FirstPageNumber set/get
-Verify that first page number on sheet 1 is now 2.
- TEST OK : Test first page number
- TEST START : Test center vertically
- ITEM Assertion OK : PageSetup.CenterVertically get
- ITEM Assertion OK : PageSetup.CenterVertically set/get
-Verify that CenterVertically on sheet 1 is now true.
- TEST OK : Test center vertically
- TEST START : Test center horizontally
- ITEM Assertion OK : PageSetup.CenterHorizontally get
- ITEM Assertion OK : PageSetup.CenterHorizontally set/get
-Verify that CenterHorizontally on sheet 1 is now true.
- TEST OK : Test center horizontally
- TEST START : Test FitToPagesTall
- ITEM Assertion OK : PageSetup.FitToPagesTall set/get
- TEST OK : Test FitToPagesTall
- TEST START : Test FitToPagesWide
- ITEM Assertion OK : PageSetup.FitToPagesWide set/get
- TEST OK : Test FitToPagesWide
- TEST START : Test PrintHeadings
- ITEM Assertion OK : PageSetup.PrintHeadings set/get
- ITEM Assertion OK : PageSetup.PrintHeadings set/get
- TEST OK : Test PrintHeadings
- TEST START : Test PrintTitleRows
- ITEM Assertion OK : PageSetup.PrintTitleRows get
- ITEM Assertion OK : PageSetup.PrintTitleRows set range/get
- ITEM Assertion OK : PageSetup.PrintTitleRows set false/get
- TEST OK : Test PrintTitleRows
-END PageSetup
-Test run finished : 7/21/2008 10:37:32 AM
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/partition.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/partition.log
deleted file mode 100644
index 1ea267d64..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/partition.log
+++ /dev/null
@@ -1,11 +0,0 @@
-Test run started : 08/10/2008 13:09:51
-BEGIN Partition
- TEST START : Test Partition function
- ITEM Assertion OK : the number 20 occurs in the range:20:24
- ITEM Assertion OK : the number 20 occurs in the range: 20: 20
- ITEM Assertion OK : the number 120 occurs in the range:100:
- ITEM Assertion OK : the number -5 occurs in the range: : -1
- ITEM Assertion OK : the number 2 occurs in the range: 2: 3
- TEST OK : Test Partition function
-END Partition
-Test run finished : 08/10/2008 13:09:51
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/range-4.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/range-4.log
deleted file mode 100644
index 11de80133..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/range-4.log
+++ /dev/null
@@ -1,16 +0,0 @@
-Test run started : 08/10/2008 11:30:16
-----------------------------------------------------------------
-ShowDetail-Issue
- TEST START : ShowDetail-Issue
- ITEM Assertion OK : Range.ShowDetail is True
- ITEM Assertion OK : Range.ShowDetail is False
-END 'ShowDetail-Issue' Symbol
- TEST OK : ShowDetail-Issue
-----------------------------------------------------------------
-RangeMerged-Issue
- TEST START : RangeMerged-Issue
- ITEM Assertion OK : Range.RangeMerged is $F$2:$H$5
- ITEM Assertion OK : The first address of Range.RangeMerged is $F$2
-END 'RangeMerged-Issue' Symbol
- TEST OK : RangeMerged-Issue
-Test run finished : 08/10/2008 11:30:16
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/replace.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/replace.log
deleted file mode 100644
index e96004e4d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/replace.log
+++ /dev/null
@@ -1,14 +0,0 @@
-Test run started : 2007-11-21 11:24:04
-BEGIN Replace
- TEST START : Test Replace function
- ITEM Assertion OK : common string:aefefdBc
- ITEM Assertion OK : expression string:aefefdef
- ITEM Assertion OK : binanary compare:aefefdBc
- ITEM Assertion OK : text compare:aefefdef
- ITEM Assertion OK : text compare:aefefdef
- ITEM Assertion OK : start = 3:cefdBc
- ITEM Assertion OK : count = 2: aefefdBc
- ITEM Assertion OK : start = 1, count = 0, not support in Unix: abcbcdBc
- TEST OK : Test Replace function
-END Replace
-Test run finished : 2007-11-21 11:24:04
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/stringplusdouble.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/stringplusdouble.log
deleted file mode 100644
index 51a958a41..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/stringplusdouble.log
+++ /dev/null
@@ -1,62 +0,0 @@
-Test run started : 15/01/2009 17:09:03
-BEGIN String Plus Double
- TEST START : double = string + double
-The next compute raises error: s = null, d = null, r = s + d
- ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0
-The next compute raises error: s = null, d = 20, r = s + d
- ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20
- ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10
- ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100
- ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30
- ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020
-The next compute raises error: s = 'abc', d = null, r = s + d
- ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = null, r = s & d
- ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s + d
- ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s & d
- ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1
- TEST OK : double = string + double
- TEST START : string = string + double
-The next compute raises error: s = null, d = null, r = s + d
- ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = null, r = s & d .The result is: 0
-The next compute raises error: s = null, d = 20, r = s + d
- ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: -1
- ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20
- ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10
- ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 100
- ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 30
- ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020
-The next compute raises error: s = 'abc', d = null, r = s + d
- ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1
- ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: abc0
-The next compute raises error: s = 'abc', d = 20, r = s + d
- ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1
- ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: abc20
- TEST OK : string = string + double
- TEST START : double = string + string
-The next compute raises error: s = null, d = null, r = s + d
- ITEM Assertion OK : s = null, d = null, r = s + d .The result is: -1
-The next compute raises error: s = null, d = null, r = s & d
- ITEM Assertion OK : s = null, d = null, r = s & d .The result is: -1
- ITEM Assertion OK : s = null, d = 20, r = s + d .The result is: 20
- ITEM Assertion OK : s = null, d = 20, r = s & d .The result is: 20
- ITEM Assertion OK : s = '10', d = null, r = s + d .The result is: 10
- ITEM Assertion OK : s = '10', d = null, r = s & d .The result is: 10
- ITEM Assertion OK : s = '10', d = 20, r = s + d .The result is: 1020
- ITEM Assertion OK : s = '10', d = 20, r = s & d .The result is: 1020
-The next compute raises error: s = 'abc', d = null, r = s + d
- ITEM Assertion OK : s = 'abc', d = null, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = null, r = s & d
- ITEM Assertion OK : s = 'abc', d = null, r = s & d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s + d
- ITEM Assertion OK : s = 'abc', d = 20, r = s + d .The result is: -1
-The next compute raises error: s = 'abc', d = 20, r = s & d
- ITEM Assertion OK : s = 'abc', d = 20, r = s & d .The result is: -1
- TEST OK : double = string + string
-END String Plus Double
-Test run finished : 15/01/2009 17:09:03
diff --git a/scratch/sc-vba/testvba/TestDocuments/logs/win/window2.log b/scratch/sc-vba/testvba/TestDocuments/logs/win/window2.log
deleted file mode 100644
index 01fba9c6d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/logs/win/window2.log
+++ /dev/null
@@ -1,41 +0,0 @@
-Test run started : 15/01/2009 17:10:02
-BEGIN Window2
- TEST START : Test Window.SplitRow
- ITEM Assertion OK : Test SplitColumn: 2 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion FAIL : Test SplitRow: 1 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion OK : Test SplitVertical: 242.283803521067
- ITEM Assertion OK : Test SplitHorizontal: 242.283803521067
- ITEM Assertion FAIL : Test SplitRow: 3 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion OK : Test SplitColumn: 3 (Test only applies to maximized Window and at least has 800*600 solotion)
- ITEM Assertion OK : Test SplitColumn: 0
- ITEM Assertion OK : Test SplitRow: 0
- TEST OK : Test Window.SplitRow
- TEST START : Test Window.DisplayGridlines
- ITEM Assertion OK : Test gridlines are on
- ITEM Assertion OK : Test gridlines are off
- TEST OK : Test Window.DisplayGridlines
- TEST START : Test Window.DisplayHeadings
- ITEM Assertion OK : Test Headings are on
- ITEM Assertion OK : Test Headings are off
- TEST OK : Test Window.DisplayHeadings
- TEST START : Test Window.Visibility
- ITEM Assertion OK : Window is visible
- ITEM Assertion OK : Window is not visible
- TEST OK : Test Window.Visibility
- TEST START : Test Window.FreezePanes
- ITEM Assertion OK : Test no panes frozen
- ITEM Assertion OK : Test panes frozen at center
- ITEM Assertion OK : Test panes frozen at split
- TEST OK : Test Window.FreezePanes
- TEST START : Test Window.View
- TEST OK : Test Window.View
- TEST START : Test Window.Zoom
- ITEM Assertion OK : Test zoom=100%
- ITEM Assertion OK : Test zoom=150%
- TEST OK : Test Window.Zoom
- TEST START : Test Windows.Count
- ITEM Assertion OK : Windows Count: 1
- ITEM Assertion OK : Application.Windows Count: 1
- TEST OK : Test Windows.Count
-END Window2
-Test run finished : 15/01/2009 17:10:03
diff --git a/scratch/sc-vba/testvba/TestDocuments/notwork/error.xls b/scratch/sc-vba/testvba/TestDocuments/notwork/error.xls
deleted file mode 100644
index ea2095d5e..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/notwork/error.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/notwork/imagecontrols.xls b/scratch/sc-vba/testvba/TestDocuments/notwork/imagecontrols.xls
deleted file mode 100644
index 0de17b403..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/notwork/imagecontrols.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/notwork/keyword.xls b/scratch/sc-vba/testvba/TestDocuments/notwork/keyword.xls
deleted file mode 100644
index 3bf711ed4..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/notwork/keyword.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/notwork/objectmodule.xls b/scratch/sc-vba/testvba/TestDocuments/notwork/objectmodule.xls
deleted file mode 100644
index d3aff35b9..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/notwork/objectmodule.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/notwork/stringtodouble.ods b/scratch/sc-vba/testvba/TestDocuments/notwork/stringtodouble.ods
deleted file mode 100644
index 5a732a765..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/notwork/stringtodouble.ods
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/partition.xls b/scratch/sc-vba/testvba/TestDocuments/partition.xls
deleted file mode 100644
index 5c8d12b1d..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/partition.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/range-4.xls b/scratch/sc-vba/testvba/TestDocuments/range-4.xls
deleted file mode 100644
index 524523694..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/range-4.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/replace.xls b/scratch/sc-vba/testvba/TestDocuments/replace.xls
deleted file mode 100644
index dcf3c6e8e..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/replace.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/stringplusdouble.xls b/scratch/sc-vba/testvba/TestDocuments/stringplusdouble.xls
deleted file mode 100644
index 596be7f6b..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/stringplusdouble.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/TestDocuments/window2.xls b/scratch/sc-vba/testvba/TestDocuments/window2.xls
deleted file mode 100644
index 4d5e1cbfe..000000000
--- a/scratch/sc-vba/testvba/TestDocuments/window2.xls
+++ /dev/null
Binary files differ
diff --git a/scratch/sc-vba/testvba/makefile.mk b/scratch/sc-vba/testvba/makefile.mk
deleted file mode 100644
index d09181663..000000000
--- a/scratch/sc-vba/testvba/makefile.mk
+++ /dev/null
@@ -1,77 +0,0 @@
-#*************************************************************************
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.4 $
-#
-# last change: $Author: rt $ $Date: 2007/04/27 09:25:06 $
-#
-# 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
-#
-#*************************************************************************
-
-PRJ=..$/..$/..$/..$/
-
-PRJNAME=sc
-TARGET=testvba
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-DLLPRE =
-
-.IF "$(ENABLE_VBA)"!="YES"
-dummy:
- @echo "not building vba..."
-.ENDIF
-
-INCPRE=$(INCCOM)$/$(TARGET)
-CDEFS+=-DVBA_OOBUILD_HACK
-# ------------------------------------------------------------------
-
-SLOFILES= \
- $(SLO)$/testvba.obj \
-
-
-# --- Targets ------------------------------------------------------
-
-APP1TARGET=testclient
-APP1OBJS= $(SLOFILES)
-
-APP1STDLIBS=\
- $(SALLIB) \
- $(STDLIBCPP) \
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(COMPHELPERLIB) \
- $(TOOLSLIB) \
- $(UNOTOOLSLIB) \
-
-#APP1OBJS= $(OBJ)$/testclient.obj
-.INCLUDE : target.mk
-
-
diff --git a/scratch/sc-vba/testvba/runTests.pl b/scratch/sc-vba/testvba/runTests.pl
deleted file mode 100755
index 09a6cb65d..000000000
--- a/scratch/sc-vba/testvba/runTests.pl
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/perl -w
-use URI::Escape;
-use File::Basename;
-use Cwd;
-use Cwd 'abs_path';
-
-$numArgs = $#ARGV + 1;
-print "thanks, you gave me $numArgs command-line arguments.\n";
-
-foreach $argnum (0 .. $#ARGV) {
- print "$ARGV[$argnum]\n";
-}
-
-
-my $binDir = abs_path( dirname($0) );
-
-my $sysDir = "unix";
-my $fileSep = "/";
-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.0/program";
-my $urelibpath = "$officepath/ure/lib";
-my $urebinpath = "$officepath/URE/bin";
-my $binext = "";
-my $testDocDir = "$binDir/TestDocuments";
-my $testLogDir = "$binDir/Logs";
-my $testclientname = "testclient";
-my $buildtestclient = "../../../../unxlngi6.pro/bin/$testclientname";
-
-# test testclient
-if ( -e "$buildtestclient" )
-{
- print "use the latest build\n";
- system( "cp $buildtestclient ." );
-}
-elsif ( !( -e "$testclientname" ) )
-{
- print "$testclientname do not exist\n";
- exit;
-}
-
-# test for uname
-system("uname");
-$exit_value = $? >> 8;
-$signal_num = $? & 127;
-$dumped_core = $? & 128;
-
-$failed = ( $exit_value || $signal_num || $dumped_core );
-
-print "$failed = ( $exit_value || $signal_num || $dumped_core )\n";
-
-if ( !$failed && open(UNAME, "uname -a|") ) {
- $theResult = <UNAME>;
- close(UNAME);
- if ( $theResult =~ /^CYGWIN/ ) {
- # windows under cygwin
- $sysDir = "win" ;
- $tmpPath=$ENV{"PATH"};
-# adjust for ooo-build ( need to make sure this works for non ooo-build too )
- my $tmpofficepath = "$officepath"."/OpenOffice.org 3";
- my $tmpofficebinpath = "$tmpofficepath/program";
- my $tmpbasiclibpath = "$tmpofficepath/Basis/program";
- my $tmpurebinpath = "$tmpofficepath/URE/bin";
- $ENV{"PATH"} = "$tmpofficebinpath:$tmpbasiclibpath:$tmpurebinpath:$tmpPath";
- $testDocDir=`cygpath -m $testDocDir`;
- uri_escape($testDocDir);
- # hacky windows url construction
- $testDocDir="file:///$testDocDir";
-
- chomp($testDocDir);
- #print "*** doc dir is $testDocDir\n";
- $testLogDir = `cygpath -m "$testLogDir"`;
- uri_escape($testLogDir);
- $testLogDir="file:///$testLogDir";
- chomp($testLogDir);
- #print "*** log dir is $testLogDir\n";
- $binext = ".exe";
- }
- else{
- # unix we need to find sal etc. ( from the office path )
- my $tmpPath=$ENV{"PATH"};
- $ENV{"PATH"} = "$programpath:$basiclibrarypath:$urelibpath/../bin:$tmpPath";
- $tmpPATH = $ENV{"LD_LIBRARY_PATH"};
- $ENV{"LD_LIBRARY_PATH"} = "$officepath:$programpath:$basiclibrarypath:$urelibpath:$urelibpath../bin/javaldx:$urelibpath/../bin:$tmpPATH";
- $ENV{"LD_LIBRARY_PATH"} = "$officepath:$programpath:$basiclibrarypath:$urelibpath:$tmpPATH";
- my $testPath = $ENV{"LD_LIBRARY_PATH"};
- print "$testPath\n";
- $testPath = $ENV{"PATH"};
- print "$testPath\n";
- $ENV{"STAR_RESOURCEPATH"} = "$officepath/basis3.0/program/resource";
- $ENV{"SAL_ALLOW_LINKOO_SYMLINKS"} = "1";
- $testPath = $ENV{"LANG"};
- print "$testPath\n";
- }
-}
-else
-{
- # ordinary windows, not sure if this will actually work
- $sysDir = "win" ;
- $tmpPath=$ENV{"PATH"};
- $ENV{"PATH"} = "$tmpPath;$officepath";
- $binext = ".exe";
-}
-
-# the exe needs system paths or urls ( urls are by far the least troublesome )
-
-my $runCmd = "";
-my $analyseCmd = "";
-
-if ( "$DocName" eq "" )
-{
- $runCmd = "$binDir/testclient$binext $testDocDir $testLogDir";
- $analyseCmd = "perl $binDir/testResults.pl $binDir/Logs $binDir/TestDocuments/logs/$sysDir";
-}
-else
-{
- $runCmd = "$binDir/testclient$binext $testDocDir $testLogDir $testDocDir/$DocName";
- $analyseCmd = "perl $binDir/testResult.pl $binDir/Logs $binDir/TestDocuments/logs/$sysDir $DocName";
-}
-print "runCmd = $runCmd\n";
-
-system ("rm -rf $testLogDir/*");
-my $status = system( $runCmd );
-print "analyseCmd = $analyseCmd\n";
-$status = system( $analyseCmd );
diff --git a/scratch/sc-vba/testvba/testResult.pl b/scratch/sc-vba/testvba/testResult.pl
deleted file mode 100755
index b3648b4cf..000000000
--- a/scratch/sc-vba/testvba/testResult.pl
+++ /dev/null
@@ -1,171 +0,0 @@
-#!/usr/bin/perl -w
-use File::Temp qw/ tempfile tempdir /;
-use File::Basename;
-use File::stat;
-use File::Copy;
-
-my $binDir = dirname($0);
-my $timestampclean= "perl $binDir/timestampsClean.pl";
-#sub gen_diff($)
-
-sub testLog
-{
- # 2 No Log to compare against
- # 1 Log passed
- # 0 Log failed
- my $result = 0;
- my $testfile = shift;
- my $dirtocheck = shift;
- my $filename = basename($testfile);
- $filename = "$logdir/$filename";
- print "processing $testfile $filename\n";
- if ( -f $filename ) {
- my $tmpFile;
- $dir = tempdir( CLEANUP => 1 );
- ($fh, $tmpFile) = tempfile( DIR => $dir );
- close($fh);
- #
- my $status = system("diff -U 0 -p $testfile $filename | $timestampclean > $tmpFile");
- my $info = stat($tmpFile) or die "no $tmpFile: $!";
- if ( ($status >>=8) == 0 && ( $info->size == 0) ) {
- #print "diff worked size is 0\n";
- $result = 1;
- }
- elsif ( ($status >>=8) == 0 && ( $info->size > 0) )
- {
- #print "diff worked size > 0\n";
- $result = 0;
- }
- else
- {
- #print "diff failed size > 0\n";
- $result = 0;
- }
- }
- else
- {
- #print "not file > 0\n";
- $result = 2;
- }
- #print "diff result = $result\n";
- return $result;
-}
-
-if ( ! ( $logdir = shift @ARGV ) ) {
- print STDERR "No logdir specified!\n";
- usage();
- exit 1;
-}
-
-if ( ! ( $testlogdir = shift @ARGV ) ) {
- print STDERR "No testdocuments dir to compare against specified!\n";
- usage();
- exit 1;
-}
-
-if ( !(-d $logdir ) ) {
- print STDERR "No output directory $logdir exists, please create it!!!!\n";
- exit 1;
-}
-if ( !(-d $testlogdir ) ) {
- print STDERR "the directory containing the logfiles to compare against \"$logdir\" does not exist\n";
- usage();
- exit 1;
-}
-print "logdir $logdir\n";
-print "testlogdir $testlogdir\n";
-sub filter_crud($)
-{
- my $a = shift;
-
- $a =~ /~$/ && return;
- $a =~ /\#$/ && return;
- $a =~ /\.orig$/ && return;
- $a =~ /unxlng.*\.pro$/ && return;
- $a =~ /wntmsc.*\.pro$/ && return;
- $a =~ /.swp$/ && return;
- $a =~ /POSITION/ && return;
- $a =~ /ReadMe/ && return;
- $a =~ /.tmp$/ && return;
- $a =~ /\.svn/ && return;
- $a eq 'CVS' && return;
- $a eq '.' && return;
- $a eq '..' && return;
-
- return $a;
-}
-sub slurp_dir($);
-
-sub slurp_dir($)
-{
- my $dir = shift;
- my ($dirhandle, $fname);
- my @files = ();
-
- opendir ($dirhandle, $dir) || die "Can't open $dir";
- while ($fname = readdir ($dirhandle)) {
- $fname = filter_crud($fname);
- defined $fname || next;
-# if (-d "$dir/$fname") {
-# push @files, slurp_dir("$dir/$fname");
-# } else
- {
- push @files, "$dir/$fname";
- }
- }
- closedir ($dirhandle);
-
- return @files;
-}
-
-if (-d $testlogdir) {
- push @files, slurp_dir($testlogdir);
-}
-
-my $processed = 0;
-my $passed = 0;
-my @passedTests=();
-my @skippedTests=();
-my @failedTests=();
-
-my $failureCmd="";
-my $testfile = shift @ARGV;
-my $testfilepath = "$testlogdir/$testfile";
-$testfilepath =~ s/\.xls/\.log/;
-print "$testfilepath\n";
-for $a (@files) {
- $filename = $a;
- if ( "$testfilepath" eq "$filename" )
- {
- $processed++;
- my $testcase = $a;
- $testcase =~ s/\.log/\.xls/;
- my $result = testLog( $a, $logdir );
- if ( $result == 0 ) {
- push @failedTests, basename($testcase);
- if ( $failureCmd eq "" ) { $failureCmd = " diff -up $a $logdir "; }
- }
- elsif ( $result == 2 ) {
- #print "skipped $a\n";
- push @skippedTests, $testcase;
- }
- else {
- $passed++;
- push @passedTests, $testcase;
- #print "Test document for $a \t \t passed. \n";
- }
- }
-}
-my $compared=@passedTests+@failedTests;
-my $skip = @skippedTests;
-print "skipped $skip test-cases(s)\n";
-print "compared $compared test-case documents\n";
-print "\t \t $passed tests $@passedTests\n";
-if ( @failedTests > 0 ) {
- print "the following test-case documents failed, please examine the logs manually\n";
-
- for $a (@failedTests) {
- print "\t$a\n";
- }
- print "e.g. $failureCmd\n"
-}
diff --git a/scratch/sc-vba/testvba/testResults.pl b/scratch/sc-vba/testvba/testResults.pl
deleted file mode 100755
index 1a0a7ef7f..000000000
--- a/scratch/sc-vba/testvba/testResults.pl
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/usr/bin/perl -w
-use File::Temp qw/ tempfile tempdir /;
-use File::Basename;
-use File::stat;
-use File::Copy;
-
-my $binDir = dirname($0);
-my $timestampclean= "perl $binDir/timestampsClean.pl";
-#sub gen_diff($)
-
-sub testLog
-{
- # 2 No Log to compare against
- # 1 Log passed
- # 0 Log failed
- my $result = 0;
- my $testfile = shift;
- my $dirtocheck = shift;
- my $filename = basename($testfile);
- $filename = "$logdir/$filename";
- print "processing $testfile $filename\n";
- if ( -f $filename ) {
- my $tmpFile;
- $dir = tempdir( CLEANUP => 1 );
- ($fh, $tmpFile) = tempfile( DIR => $dir );
- close($fh);
- #
- my $status = system("diff -U 0 -p $testfile $filename | $timestampclean > $tmpFile");
- my $info = stat($tmpFile) or die "no $tmpFile: $!";
- if ( ($status >>=8) == 0 && ( $info->size == 0) ) {
- #print "diff worked size is 0\n";
- $result = 1;
- }
- elsif ( ($status >>=8) == 0 && ( $info->size > 0) )
- {
- #print "diff worked size > 0\n";
- $result = 0;
- }
- else
- {
- #print "diff failed size > 0\n";
- $result = 0;
- }
- }
- else
- {
- #print "not file > 0\n";
- $result = 2;
- }
- #print "diff result = $result\n";
- return $result;
-}
-
-if ( ! ( $logdir = shift @ARGV ) ) {
- print STDERR "No logdir specified!\n";
- usage();
- exit 1;
-}
-
-if ( ! ( $testlogdir = shift @ARGV ) ) {
- print STDERR "No testdocuments dir to compare against specified!\n";
- usage();
- exit 1;
-}
-
-if ( !(-d $logdir ) ) {
- print STDERR "No output directory $logdir exists, please create it!!!!\n";
- exit 1;
-}
-if ( !(-d $testlogdir ) ) {
- print STDERR "the directory containing the logfiles to compare against \"$logdir\" does not exist\n";
- usage();
- exit 1;
-}
-print "logdir $logdir\n";
-print "testlogdir $testlogdir\n";
-sub filter_crud($)
-{
- my $a = shift;
-
- $a =~ /~$/ && return;
- $a =~ /\#$/ && return;
- $a =~ /\.orig$/ && return;
- $a =~ /unxlng.*\.pro$/ && return;
- $a =~ /wntmsc.*\.pro$/ && return;
- $a =~ /.swp$/ && return;
- $a =~ /POSITION/ && return;
- $a =~ /ReadMe/ && return;
- $a =~ /.tmp$/ && return;
- $a =~ /\.svn/ && return;
- $a eq 'CVS' && return;
- $a eq '.' && return;
- $a eq '..' && return;
-
- return $a;
-}
-sub slurp_dir($);
-
-sub slurp_dir($)
-{
- my $dir = shift;
- my ($dirhandle, $fname);
- my @files = ();
-
- opendir ($dirhandle, $dir) || die "Can't open $dir";
- while ($fname = readdir ($dirhandle)) {
- $fname = filter_crud($fname);
- defined $fname || next;
-# if (-d "$dir/$fname") {
-# push @files, slurp_dir("$dir/$fname");
-# } else
- {
- push @files, "$dir/$fname";
- }
- }
- closedir ($dirhandle);
-
- return @files;
-}
-
-if (-d $testlogdir) {
- push @files, slurp_dir($testlogdir);
-}
-
-my $processed = 0;
-my $passed = 0;
-my @passedTests=();
-my @skippedTests=();
-my @failedTests=();
-
-my $failureCmd="";
-for $a (@files) {
- $processed++;
- my $testcase = $a;
- $testcase =~ s/\.log/\.xls/;
- my $result = testLog( $a, $logdir );
- if ( $result == 0 ) {
- push @failedTests, basename($testcase);
- if ( $failureCmd eq "" ) { $failureCmd = " diff -up $a $logdir "; }
- }
- elsif ( $result == 2 ) {
- #print "skipped $a\n";
- push @skippedTests, $testcase;
- }
- else {
- $passed++;
- push @passedTests, $testcase;
- #print "Test document for $a \t \t passed. \n";
- }
-}
-my $compared=@passedTests+@failedTests;
-my $skip = @skippedTests;
-print "skipped $skip test-cases(s)\n";
-print "compared $compared test-case documents\n";
-print "\t \t $passed tests $@passedTests\n";
-if ( @failedTests > 0 ) {
- print "the following test-case documents failed, please examine the logs manually\n";
-
- for $a (@failedTests) {
- print "\t$a\n";
- }
- print "e.g. $failureCmd\n"
-}
diff --git a/scratch/sc-vba/testvba/testvba.cxx b/scratch/sc-vba/testvba/testvba.cxx
deleted file mode 100644
index b25997e2b..000000000
--- a/scratch/sc-vba/testvba/testvba.cxx
+++ /dev/null
@@ -1,309 +0,0 @@
-#include "cppuhelper/bootstrap.hxx"
-
-#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-#include <com/sun/star/document/XTypeDetection.hpp>
-
-#include <tools/urlobj.hxx>
-#include <osl/file.hxx>
-
-#include <memory>
-#include <iostream>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::sheet;
-
-using ::com::sun::star::beans::Property;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::beans::XPropertySetInfo;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::lang::XComponent;
-using ::com::sun::star::lang::XMultiComponentFactory;
-using ::com::sun::star::frame::XComponentLoader;
-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::XComponentContext;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::ucb::XSimpleFileAccess;
-using ::com::sun::star::document::XTypeDetection;
-using ::rtl::OUString;
-
-using ::std::auto_ptr;
-
-const OUString EXTN = rtl::OUString::createFromAscii(".xls");
-
-OUString convertToURL( const OUString& rPath )
-{
- rtl::OUString aURL;
- INetURLObject aObj;
- aObj.SetURL( rPath );
- bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
- if ( bIsURL )
- aURL = rPath;
- else
- {
- osl::FileBase::getFileURLFromSystemPath( rPath, aURL );
- if ( aURL.equals( rPath ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "could'nt convert " ).concat( rPath ).concat( rtl::OUString::createFromAscii( " to a URL, is it a fully qualified path name? " ) ), Reference< uno::XInterface >() );
- }
- return aURL;
-}
-
-OUString ascii(const sal_Char* cstr)
-{
- return OUString::createFromAscii(cstr);
-}
-
-const sal_Char* getStr(const OUString& ou)
-{
- return OUStringToOString(ou, RTL_TEXTENCODING_UTF8).getStr();
-}
-
-
-int usage( const char* pName )
-{
- std::cerr << "usage: " << pName << "<path to testdocument dir> <output_directory>" << std::endl;
- return 1;
-
-}
-
-class TestVBA
-{
-private:
- Reference< XComponentContext > mxContext;
- Reference< XMultiComponentFactory > mxMCF;
- Reference< XComponentLoader > mxCompLoader;
- Reference< XSimpleFileAccess > mxSFA;
- rtl::OUString msOutDirPath;
-protected:
-public:
- TestVBA( const Reference< XComponentContext >& _xContext,
- const Reference< XMultiComponentFactory >& _xMCF,
- const Reference< XComponentLoader >& _xCompLoader,
- const rtl::OUString& _outDirPath ) : mxContext( _xContext ), mxMCF( _xMCF ),
-mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
- {
- mxSFA.set( mxMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), mxContext), uno::UNO_QUERY_THROW );
- }
-
- rtl::OUString getLogLocation() throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception )
- {
- rtl::OUString sLogLocation;
- Reference< XPropertySet > pathSettings( mxMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.comp.framework.PathSettings" ), mxContext), uno::UNO_QUERY_THROW );
- pathSettings->getPropertyValue( rtl::OUString::createFromAscii( "Work" ) ) >>= sLogLocation;
- sLogLocation = sLogLocation.concat( rtl::OUString::createFromAscii( "/" ) ).concat( rtl::OUString::createFromAscii( "HelperAPI-test.log" ) );
- return sLogLocation;
- }
- rtl::OUString getLogLocationWithName( OUString fileName ) throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception )
- {
- printf("%s\n", getenv("HOME") );
- printf("file name %s\n", rtl::OUStringToOString( fileName, RTL_TEXTENCODING_UTF8 ).getStr() );
- //rtl::OUString sLogLocation( rtl::OUString::createFromAscii( getenv("HOME") ) );
- rtl::OUString sLogLocation;
- Reference< XPropertySet > pathSettings( mxMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.comp.framework.PathSettings" ), mxContext), uno::UNO_QUERY_THROW );
- pathSettings->getPropertyValue( rtl::OUString::createFromAscii( "Work" ) ) >>= sLogLocation;
- sLogLocation = sLogLocation.concat( rtl::OUString::createFromAscii( "/" ) ).concat( fileName.copy ( 0, fileName.lastIndexOf( EXTN ) ) + rtl::OUString::createFromAscii( ".log" ) );
- return sLogLocation;
- }
-
- void init()
- {
- // blow away previous logs?
- }
-
- void proccessDocument( const rtl::OUString& sUrl )
- {
- if ( !mxSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".xls", 4 ) )
-
- {
- try
- {
- OSL_TRACE( "processing %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
- printf( "processing %s\n", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
- // Loading the wanted document
- Sequence< PropertyValue > propertyValues(1);
- propertyValues[0].Name = rtl::OUString::createFromAscii( "Hidden" );
- propertyValues[0].Value <<= sal_False;
-
- rtl::OUString sfileUrl = convertToURL( sUrl );
- printf( "try to get xDoc %s\n", rtl::OUStringToOString( sfileUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
- Reference< uno::XInterface > xDoc =
- mxCompLoader->loadComponentFromURL( sfileUrl, rtl::OUString::createFromAscii( "_blank" ), 0, propertyValues);
- printf( "got xDoc\n" );
-
- OUString logFileURL = convertToURL( getLogLocation() );
- try
- {
- Reference< script::provider::XScriptProviderSupplier > xSupplier( xDoc, uno::UNO_QUERY_THROW ) ;
- if ( mxSFA->exists( logFileURL ) )
- mxSFA->kill( logFileURL );
-
- printf("try to get the ScriptProvider\n");
- Reference< script::provider::XScriptProvider > xProv = xSupplier->getScriptProvider();
- printf("get the ScriptProvider\n");
- printf("try to get the Script\n");
- Reference< script::provider::XScript > xScript;
- try
- {
- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.TestMacros.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e )
- {
- try
- {
- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMacro.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e2 )
- {
- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMain.Main?language=Basic&location=document" ));
- }
- }
- OSL_TRACE("Got script for doc %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
- printf("get the Script\n");
- Sequence< uno::Any > aArgs;
- Sequence< sal_Int16 > aOutArgsIndex;
- Sequence< uno::Any > aOutArgs;
-
- xScript->invoke(aArgs, aOutArgsIndex, aOutArgs);
-
- OUString fileName = sUrl.copy ( sUrl.lastIndexOf( '/' ) );
- OUString newLocation = msOutDirPath + fileName.copy ( 0, fileName.lastIndexOf( EXTN ) ) + rtl::OUString::createFromAscii( ".log" );
- try
- {
- printf("move log file\n");
- mxSFA->move( logFileURL, newLocation );
- OSL_TRACE("new logfile location is %s ", rtl::OUStringToOString( newLocation, RTL_TEXTENCODING_UTF8 ).getStr() );
- printf("moved to new location\n");
- }
- catch ( uno::Exception& e )
- {
- logFileURL = convertToURL( getLogLocationWithName( fileName ) );
- printf("move log file from %s\n", rtl::OUStringToOString( logFileURL, RTL_TEXTENCODING_UTF8 ).getStr() );
- mxSFA->move( logFileURL, newLocation );
- OSL_TRACE("new logfile location is %s ", rtl::OUStringToOString( newLocation, RTL_TEXTENCODING_UTF8 ).getStr() );
- printf("moved to new location\n");
- }
-
- }
- catch ( uno::Exception& e )
- {
- std::cerr << "Caught exception " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
- }
-
- // interface is supported, otherwise use XComponent.dispose
- Reference< util::XCloseable > xCloseable ( xDoc, uno::UNO_QUERY );
-
- if ( xCloseable.is() )
- {
- printf("try to close\n");
- // will close application. and only run a test case for 3.0
- // maybe it is a bug. yes, it is a bug
- // if only one frame and model, click a button which related will colse.
- // will make a crash. It related with window listener.
- // so, for run all test cases, it should not close the document at this moment.
- xCloseable->close(sal_False);
- printf("closed\n");
- }
- else
- {
- printf("try to dispose\n");
- Reference< XComponent > xComp( xDoc, uno::UNO_QUERY_THROW );
- // same as close.
- xComp->dispose();
- printf("disposed\n");
- }
- }
- catch( uno::Exception& e )
- {
- std::cerr << "Caught exception " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
- }
-
- }
- printf("complete processing %s\n", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- void traverse( const rtl::OUString& sFileDirectory )
- {
- rtl::OUString sFileDirectoryURL = convertToURL( sFileDirectory );
- if ( !mxSFA->isFolder( sFileDirectoryURL) )
- {
- throw lang::IllegalArgumentException( rtl::OUString::createFromAscii( "not a directory: ").concat( sFileDirectoryURL ), Reference<uno::XInterface>(), 1 );
- }
- // Getting all files and directories in the current directory
- Sequence<OUString> entries = mxSFA->getFolderContents( sFileDirectoryURL, sal_False );
-
- // Iterating for each file and directory
- printf( "Entries %d\n", (int)entries.getLength() );
- for ( sal_Int32 i = 0; i < entries.getLength(); ++i )
- {
- proccessDocument( entries[ i ] );
- }
- }
-};
-
-void tryDispose( Reference< uno::XInterface > xIF, const char* sComp )
-{
- Reference< lang::XComponent > xComponent( xIF, uno::UNO_QUERY );
- if ( xComponent.is() )
- {
- try
- {
- xComponent->dispose();
- }
- catch( uno::Exception& e )
- {
- std::cerr << "tryDispose caught exception " <<rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << " while disposing " << sComp << std::endl;
- }
- }
-}
-int main( int argv, char** argc )
-{
- if ( !( argv > 2 ) )
- return usage( argc[0] );
- try
- {
-
- OSL_TRACE("Attempting to bootstrap normal");
- Reference<XComponentContext> xCC = ::cppu::bootstrap();
- Reference<XMultiComponentFactory> xFactory = xCC->getServiceManager();
- OSL_TRACE("got servicemanager");
- std::cout << "got servicemanager" << std::endl;
- Reference<XInterface> desktop = xFactory->createInstanceWithContext(
- ascii("com.sun.star.frame.Desktop"), xCC);
- OSL_TRACE("got desktop");
- std::cout << "got desktop" << std::endl;
- Reference<frame::XComponentLoader> xLoader(desktop, UNO_QUERY_THROW);
- TestVBA* dTest = new TestVBA( xCC, xFactory, xLoader, ascii( argc[ 2 ] ) );
- if ( argv == 4 )
- {
- std::cout << "before process" << std::endl;
- dTest->proccessDocument( ascii( argc[ 3 ] ) );
- std::cout << "after process" << std::endl;
- }
- else
- {
- dTest->traverse( ascii( argc[ 1 ] ) );
- }
- delete dTest;
-// tryDispose( xLoader, "desktop" );
-// tryDispose( xCC, "remote context" );
-
- }
- catch( uno::Exception& e )
- {
- std::cerr << "Caught Exception " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
- }
-
-}
diff --git a/scratch/sc-vba/testvba/timestampsClean.pl b/scratch/sc-vba/testvba/timestampsClean.pl
deleted file mode 100755
index 400be226d..000000000
--- a/scratch/sc-vba/testvba/timestampsClean.pl
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/perl -w
-
-my @output_buffer = ();
-my $fname;
-my $detectedSomeGuff = 0;
-sub pure_guff($)
-{
- my $array = shift;
- my @lines = @{$array};
- my $contains_sense = '';
- my $contains_guff = '';
- while (scalar @lines)
- {
- my $line = pop @lines;
- if ($line =~ m/Test run started :/ ||
- $line =~ m/ITEM Assertion OK/ ||
- $line =~ m/Test run finished :/) {
- $contains_guff = '1';
- } elsif ($line =~ m/^[\+\-][^\-\+]/) {
- $contains_sense = '1';
- }
- }
- if ($contains_guff && $contains_sense) {
- print STDERR "Patch fragment with mixed good/bad changes in '$ARGV' near $line_index\n";
- $contains_guff = '';
- }
- elsif ( $contains_guff ) {
- $detectedSomeGuff++;
- }
-# print "contains guff: $contains_guff\n";
- return $contains_guff;
-}
-
-sub output_lines($)
-{
- my $array = shift;
- my @lines = @{$array};
-
- if (pure_guff (\@lines)) {
- return;
- }
-
- while (scalar @lines)
- {
- my $line = pop @lines;
- push @output_buffer, $line;
- }
-}
-
-my $header;
-my @lines;
-my $frag_count = 0;
-$line_index = 0;
-
-while (<>) {
- if (/^\@\@/ || /^[^ \-\+]/) {
- output_lines (\@lines);
- @lines = ();
- $frag_count++;
- }
- unshift @lines, $_;
- $line_index++;
- close ARGV if eof;
-}
-output_lines(\@lines);
-
-# $detectedSomeGuff contains the skipped hunks that contain acceptable diff
-# e.g. a timestamp or an OK assertion that contains different content
-# like perhaps a path
-#print "frag_count = $frag_count fragstocount = $fragstocount detectedSomeGuff = $detectedSomeGuff \n";
-if ($frag_count > $detectedSomeGuff) {
- print @output_buffer;
-}