diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-02-13 13:03:24 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-02-13 13:03:24 +0000 |
commit | 90e0834d5612cf75e9a21b3a6bab10f6a98ac053 (patch) | |
tree | e81fbf0a382cf14023e45571b6f6e48396a52659 /sc/source | |
parent | CWS-TOOLING: integrate CWS tbe35 (diff) | |
download | core-90e0834d5612cf75e9a21b3a6bab10f6a98ac053.tar.gz core-90e0834d5612cf75e9a21b3a6bab10f6a98ac053.zip |
CWS-TOOLING: integrate CWS npower11
2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with
formula::FormulaGrammar::CONV_XL_R1C1
2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx
2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest
m39 ) changes
2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39)
2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage
2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC)
2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC)
2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1
2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target
2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes
for ScCellRangeObj and replace by a single class.
2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs
2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants
2008-11-25 17:05:39 +0100 npower r264317 : namespace changes
2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws
2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes
2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes
2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes
2008-11-24 18:24:17 +0100 npower r264263 : svn migration
2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore
2008-11-24 18:21:23 +0100 npower r264261 : svn migration
2008-11-24 18:18:31 +0100 npower r264260 : svn migration
Diffstat (limited to 'sc/source')
246 files changed, 12848 insertions, 4064 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 2271269a7858..07dd28ae3aaa 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -366,6 +366,32 @@ void ScCompiler::DeInit() } } +bool ScCompiler::IsEnglishSymbol( const String& rName ) +{ + // function names are always case-insensitive + String aUpper( ScGlobal::pCharClass->upper( rName ) ); + + // 1. built-in function name + OpCode eOp = ScCompiler::GetEnglishOpCode( aUpper ); + if ( eOp != ocNone ) + { + return true; + } + // 2. old add in functions + USHORT nIndex; + if ( ScGlobal::GetFuncCollection()->SearchFunc( aUpper, nIndex ) ) + { + return true; + } + + // 3. new (uno) add in functions + String aIntName(ScGlobal::GetAddInCollection()->FindFunction( aUpper, FALSE )); + if (aIntName.Len()) + { + return true; + } + return false; // no valid function name +} // static void ScCompiler::InitCharClassEnglish() diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 7c45d7f9a45f..b62470ceee3b 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -254,7 +254,7 @@ bool lcl_hasVBAEnabled() uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY); // test if vba service is present uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xGlobals( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/org.openoffice.vba.theGlobals") ), uno::UNO_QUERY ); + uno::Reference< uno::XInterface > xGlobals( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ), uno::UNO_QUERY ); return xGlobals.is(); } diff --git a/sc/source/ui/vba/helperdecl.hxx b/sc/source/ui/vba/helperdecl.hxx index 2635c011e22a..95569a993b9c 100644 --- a/sc/source/ui/vba/helperdecl.hxx +++ b/sc/source/ui/vba/helperdecl.hxx @@ -28,7 +28,7 @@ * ************************************************************************/ #include <comphelper/servicedecl.hxx> -#include <org/openoffice/vba/XHelperInterface.hpp> +#include <ooo/vba/XHelperInterface.hpp> namespace comphelper { namespace service_decl { @@ -86,7 +86,7 @@ struct OwnCreateFunc<ImplT, with_args<false> > { css::uno::Reference<css::uno::XComponentContext> const& xContext ) const { - return css::uno::Reference< org::openoffice::vba::XHelperInterface >(new OwnServiceImpl<ImplT>( rServiceDecl, xContext )); + return css::uno::Reference< ooo::vba::XHelperInterface >(new OwnServiceImpl<ImplT>( rServiceDecl, xContext )); } }; @@ -101,7 +101,7 @@ struct OwnCreateFunc<ImplT, with_args<true> > { css::uno::Reference<css::uno::XComponentContext> const& xContext ) const { - css::uno::Reference< org::openoffice::vba::XHelperInterface > xHelp( + css::uno::Reference< ooo::vba::XHelperInterface > xHelp( new OwnServiceImpl<ImplT>( rServiceDecl, args, xContext ) ); css::uno::Reference< css::uno::XInterface > xIf( xHelp, css::uno::UNO_QUERY ) ; return xIf; diff --git a/sc/source/ui/vba/makefile.mk b/sc/source/ui/vba/makefile.mk index 99aa230e93ac..fb1cc00488b8 100644 --- a/sc/source/ui/vba/makefile.mk +++ b/sc/source/ui/vba/makefile.mk @@ -84,13 +84,16 @@ SLOFILES= \ $(SLO)$/vbacombobox.obj \ $(SLO)$/vbavalidation.obj \ $(SLO)$/vbacontrol.obj \ + $(SLO)$/vbacontrols.obj \ $(SLO)$/vbaoleobject.obj \ $(SLO)$/vbaoleobjects.obj \ $(SLO)$/vbabutton.obj \ $(SLO)$/vbalabel.obj \ $(SLO)$/vbatextbox.obj \ + $(SLO)$/vbatextboxshape.obj \ $(SLO)$/vbaradiobutton.obj \ $(SLO)$/vbalistbox.obj \ + $(SLO)$/vbalistcontrolhelper.obj \ $(SLO)$/vbapropvalue.obj \ $(SLO)$/vbapane.obj \ $(SLO)$/vbashape.obj \ @@ -112,8 +115,26 @@ SLOFILES= \ $(SLO)$/vbaformatconditions.obj \ $(SLO)$/vbastyle.obj \ $(SLO)$/vbastyles.obj \ - $(SLO)$/service.obj \ - + $(SLO)$/vbaassistant.obj \ + $(SLO)$/vbauserform.obj \ + $(SLO)$/vbacheckbox.obj \ + $(SLO)$/vbatogglebutton.obj \ + $(SLO)$/vbaframe.obj \ + $(SLO)$/vbascrollbar.obj \ + $(SLO)$/vbaprogressbar.obj \ + $(SLO)$/vbamultipage.obj \ + $(SLO)$/vbapages.obj \ + $(SLO)$/vbacommandbarcontrol.obj \ + $(SLO)$/vbacommandbarcontrols.obj \ + $(SLO)$/vbacommandbar.obj \ + $(SLO)$/vbacommandbars.obj \ + $(SLO)$/vbahyperlink.obj \ + $(SLO)$/vbapagesetup.obj \ + $(SLO)$/vbapagebreak.obj \ + $(SLO)$/vbapagebreaks.obj \ + $(SLO)$/vbaspinbutton.obj \ + $(SLO)$/vbaimage.obj \ + $(SLO)$/service.obj # --- Targets ------------------------------------------------------ diff --git a/sc/source/ui/vba/service.cxx b/sc/source/ui/vba/service.cxx index cb30bbcf8a93..53ed2d3bebcb 100644 --- a/sc/source/ui/vba/service.cxx +++ b/sc/source/ui/vba/service.cxx @@ -53,12 +53,22 @@ namespace worksheet { extern sdecl::ServiceDecl const serviceDecl; } +namespace window +{ +extern sdecl::ServiceDecl const serviceDecl; +} namespace globals { extern sdecl::ServiceDecl const serviceDecl; } - - +namespace userform +{ +extern sdecl::ServiceDecl const serviceDecl; +} +namespace hyperlink +{ +extern sdecl::ServiceDecl const serviceDecl; +} extern "C" { @@ -76,7 +86,7 @@ extern "C" // Component registration if ( component_writeInfoHelper( pServiceManager, pRegistryKey, - range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl ) ) + range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) ) { // Singleton registration try @@ -85,9 +95,9 @@ extern "C" reinterpret_cast< registry::XRegistryKey * >(pRegistryKey); Reference< registry::XRegistryKey >xKey = pKey->createKey( - rtl::OUString::createFromAscii( ("org.openoffice.vba.Globals/UNO/SINGLETONS/org.openoffice.vba.theGlobals") ) ); + rtl::OUString::createFromAscii( ("ooo.vba.Globals/UNO/SINGLETONS/ooo.vba.theGlobals") ) ); xKey->setStringValue( ::rtl::OUString::createFromAscii( - ("org.openoffice.vba.Globals") ) ); + ("ooo.vba.Globals") ) ); return sal_True; } catch( uno::Exception& /*e*/ ) @@ -104,7 +114,7 @@ extern "C" { OSL_TRACE("In component_getFactory for %s", pImplName ); void* pRet = component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl ); + pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ); OSL_TRACE("Ret is 0x%x", pRet); return pRet; } diff --git a/sc/source/ui/vba/testvba/README b/sc/source/ui/vba/testvba/README index 6668f049d8dc..3a91946de8df 100644 --- a/sc/source/ui/vba/testvba/README +++ b/sc/source/ui/vba/testvba/README @@ -1,35 +1,37 @@ -running dmake in this directory runs a set of regression (unit) tests. +to run the tests -Note: - o you need to set OFFICEPATH env variable to the install directory of your office installation e.g. +build +===== + dmake -export OFFICEPATH="/cygdrive/f/Program\ Files/OpenOffice.org\ 2.3" +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 ) - o naturally in order to run the tests you need to source the build env scripts in the top level build directory [1] +[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 ) - o the testclient runs looks for testdocuments in the '../TestDocuments' [3] directory. For each document the test client runs the macro 'Standard.TestMacros.Main' located in that test document. The macro(s) write a log file, the log files end up in the Logs sub-directory ( in this directory ). A logfile exists for each testdocument that has successfully run. The log files are compared against benchmark logfiles to ensure no regressions have occured ( see [4] for directory structure and location of benchmark files ). At this point we are not concerned with known failures [5] + 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 +==== -[1] Ideally this should not be necessary and you should be able to run the tests without a build env - future +assuming perl is installed + './runTests.pl $(OFFICE_PROGRAM_PATH)' + or './runTests.pl $(OFFICE_PROGRAM_PATH) testfilename' for one file test. -[2] The test client should be re-written in C++ to get a better handle on lifecycle issues. E.g. currently on windows and sometimes on linux the client won't exit, also the office process doesn't alway exit -[3] +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. -The TestDocument directory contains - o test documents ( *.xls ) - o logs directory ( contains the benchmark logs to compare against ) +========> -[4] +skipped 0 test-cases(s) +compared 9 test-case documents + 9 tests passedTests -The logs directory contains the following sub-directories - o excel ( the orig logs produced by an excel file ) - o unix ( the log produced by OpenOffice running imported Excel document under unix ) - o win ( the log produced by OpenOffice running imported Excel document under windows ) - -[*] the seperate win & unix directories are to facilate tests that will produce different results under the different platforms e.g. paths etc. - -[5] - -o Currently the logs in the excel directory are only stored for comparison, they are not used by the tooling -o Currently we don't measure how many tests pass or fail, the immediate focus is that we don't get any regressions ( but of course we do look at these manually and try and get all tests to pass ) +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/sc/source/ui/vba/TestDocuments/AutoFilter.xls b/sc/source/ui/vba/testvba/TestDocuments/AutoFilter.xls Binary files differindex 9b3a1043c5ee..9b3a1043c5ee 100644 --- a/sc/source/ui/vba/TestDocuments/AutoFilter.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/AutoFilter.xls diff --git a/sc/source/ui/vba/TestDocuments/MiscRangeTests.xls b/sc/source/ui/vba/testvba/TestDocuments/MiscRangeTests.xls Binary files differindex ebd9e91b5b28..ebd9e91b5b28 100644 --- a/sc/source/ui/vba/TestDocuments/MiscRangeTests.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/MiscRangeTests.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/PageBreaks.xls b/sc/source/ui/vba/testvba/TestDocuments/PageBreaks.xls Binary files differnew file mode 100644 index 000000000000..b6651fa5d617 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/PageBreaks.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls b/sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls Binary files differnew file mode 100755 index 000000000000..dfa1b2a8be58 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls diff --git a/sc/source/ui/vba/TestDocuments/Ranges-2.xls b/sc/source/ui/vba/testvba/TestDocuments/Ranges-2.xls Binary files differindex f6e81cf933fd..f6e81cf933fd 100644 --- a/sc/source/ui/vba/TestDocuments/Ranges-2.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/Ranges-2.xls diff --git a/sc/source/ui/vba/TestDocuments/Ranges-3.xls b/sc/source/ui/vba/testvba/TestDocuments/Ranges-3.xls Binary files differindex 8722f6d3057e..8722f6d3057e 100644 --- a/sc/source/ui/vba/TestDocuments/Ranges-3.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/Ranges-3.xls diff --git a/sc/source/ui/vba/TestDocuments/Ranges.xls b/sc/source/ui/vba/testvba/TestDocuments/Ranges.xls Binary files differindex 3abdc4620aa8..3abdc4620aa8 100644 --- a/sc/source/ui/vba/TestDocuments/Ranges.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/Ranges.xls diff --git a/sc/source/ui/vba/TestDocuments/Shapes.xls b/sc/source/ui/vba/testvba/TestDocuments/Shapes.xls Binary files differindex 8938ca4d213e..254f3c97756c 100644 --- a/sc/source/ui/vba/TestDocuments/Shapes.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/Shapes.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/StrConv-test.xls b/sc/source/ui/vba/testvba/TestDocuments/StrConv-test.xls Binary files differnew file mode 100755 index 000000000000..198abbec5871 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/StrConv-test.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/Template.xls b/sc/source/ui/vba/testvba/TestDocuments/Template.xls Binary files differnew file mode 100755 index 000000000000..4387231fe744 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/Template.xls diff --git a/sc/source/ui/vba/TestDocuments/TestAddress.xls b/sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls Binary files differindex 1834bd649f3d..1834bd649f3d 100644 --- a/sc/source/ui/vba/TestDocuments/TestAddress.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls diff --git a/sc/source/ui/vba/TestDocuments/TestCalc_Rangetest.xls b/sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest.xls Binary files differindex a497d4f10f3e..a497d4f10f3e 100644 --- a/sc/source/ui/vba/TestDocuments/TestCalc_Rangetest.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest.xls diff --git a/sc/source/ui/vba/TestDocuments/TestCalc_Rangetest2.xls b/sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest2.xls Binary files differindex 34c606fc28f5..34c606fc28f5 100644 --- a/sc/source/ui/vba/TestDocuments/TestCalc_Rangetest2.xls +++ b/sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest2.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/Window.xls b/sc/source/ui/vba/testvba/TestDocuments/Window.xls Binary files differnew file mode 100644 index 000000000000..6fb6963c2f31 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/Window.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/bytearraystring.xls b/sc/source/ui/vba/testvba/TestDocuments/bytearraystring.xls Binary files differnew file mode 100755 index 000000000000..471bbc349e5b --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/bytearraystring.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/dateserial.xls b/sc/source/ui/vba/testvba/TestDocuments/dateserial.xls Binary files differnew file mode 100755 index 000000000000..768fb513eba4 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/dateserial.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/datevalue.xls b/sc/source/ui/vba/testvba/TestDocuments/datevalue.xls Binary files differnew file mode 100755 index 000000000000..852a51d100b8 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/datevalue.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/format.xls b/sc/source/ui/vba/testvba/TestDocuments/format.xls Binary files differnew file mode 100644 index 000000000000..99ed64d38915 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/format.xls diff --git a/sc/source/ui/vba/TestDocuments/logs/excel/AutoFilter.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/AutoFilter.log index 5fe70ae82dcf..1fe0cbd01fe5 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/AutoFilter.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/AutoFilter.log @@ -1,20 +1,20 @@ -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 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 +
+END 'TestAddress
+ TEST OK : TestAddress
+Test run finished : 17/07/2007 17:36:23
diff --git a/sc/source/ui/vba/TestDocuments/logs/excel/MiscRangeTests.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/MiscRangeTests.log index 97275e1d2f64..260465386d07 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/MiscRangeTests.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/MiscRangeTests.log @@ -1,45 +1,45 @@ -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 +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 +
+END 'MiscRangeTests
+ TEST OK : MiscRangeTests
+Test run finished : 17/07/2007 15:01:39
diff --git a/sc/source/ui/vba/TestDocuments/logs/excel/Ranges-2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges-2.log index 80765963231c..736d5bbc42d0 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/Ranges-2.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges-2.log @@ -1,68 +1,68 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/excel/Ranges-3.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges-3.log index e44b641464b6..a7de979d5e13 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/Ranges-3.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges-3.log @@ -1,8 +1,8 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/excel/Ranges.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges.log index 56eb8a8285dd..8c9644aac155 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/Ranges.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges.log @@ -1,280 +1,280 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/excel/TestAddress.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestAddress.log index 2b397eb847a9..01e5503a7e62 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/TestAddress.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestAddress.log @@ -1,62 +1,62 @@ -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 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 +
+END 'TestAddress
+ TEST OK : TestAddress
+Test run finished : 17/07/2007 15:25:19
diff --git a/sc/source/ui/vba/TestDocuments/logs/excel/TestCalc_Rangetest.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest.log index ddfcf7d0aadb..f055279ec6f4 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/TestCalc_Rangetest.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest.log @@ -1,60 +1,60 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/excel/TestCalc_Rangetest2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest2.log index ee077c9c2dc9..19a5ba96b54a 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/excel/TestCalc_Rangetest2.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest2.log @@ -1,64 +1,64 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/unix/AutoFilter.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/AutoFilter.log index 55f5d9526618..55f5d9526618 100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/AutoFilter.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/AutoFilter.log diff --git a/sc/source/ui/vba/TestDocuments/logs/unix/MiscRangeTests.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/MiscRangeTests.log index 215842f9a7e6..215842f9a7e6 100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/MiscRangeTests.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/MiscRangeTests.log diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/PageBreaks.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/PageBreaks.log new file mode 100644 index 000000000000..0ff400d49e85 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/PageBreaks.log @@ -0,0 +1,10 @@ +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/sc/source/ui/vba/TestDocuments/logs/unix/Ranges-2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges-2.log index 8b7076efaea0..8b7076efaea0 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/Ranges-2.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges-2.log diff --git a/sc/source/ui/vba/TestDocuments/logs/unix/Ranges-3.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges-3.log index a130737ceb65..a130737ceb65 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/Ranges-3.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges-3.log diff --git a/sc/source/ui/vba/TestDocuments/logs/unix/Ranges.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges.log index 220603f45b09..dd4fb4923209 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/Ranges.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges.log @@ -1,4 +1,4 @@ -Test run started : 19/06/2007 11:17:14 +Test run started : 17/12/2008 14:18:34 ---------------------------------------------------------------- ApplicationMethods TEST START : ApplicationMethods @@ -7,8 +7,8 @@ ApplicationMethods 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/sles/patchCheckBuild/ooo-build/InstallDir/UserInstallation/user/basic - ITEM Assertion OK : Please check manually: Template Path is: /data4/sles/patchCheckBuild/ooo-build/InstallDir/UserInstallation/user/template + ITEM Assertion OK : Please check manually: Library Path is: /media/disk/BUILD-related/CWS/my_working_copy/INSTALL_FOR_TEST/opt/UserInstallation/user/basic + ITEM Assertion OK : Please check manually: Template Path is: /media/disk/BUILD-related/CWS/my_working_copy/INSTALL_FOR_TEST/opt/UserInstallation/user/template ITEM Assertion OK : FileSeparator is / ITEM Assertion OK : Name of ActiveWorkbook is: Ranges.xls END 'ApplicationMethods' Symbol @@ -74,7 +74,7 @@ END 'Range/Item-Method-Issue' Symbol 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 FAIL : Range.Formula is: =IF(OR(J8=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 ---------------------------------------------------------------- @@ -111,8 +111,8 @@ END 'Value-Issue' Symbol ---------------------------------------------------------------- AutoFit issue TEST START : AutoFit issue - ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 657 - ITEM Assertion FAIL : Rows.AutoFit: CurrentHeight is 78 + ITEM Assertion OK : Columns.AutoFit: CurrentWidth is 679 + ITEM Assertion OK : Rows.AutoFit: CurrentHeight is 546 END 'AutoFit issue' Symbol TEST OK : AutoFit issue ---------------------------------------------------------------- @@ -204,12 +204,12 @@ 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 Width is 787.5 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 FAIL : RowHeight is null: False + ITEM Assertion OK : Range Width is 787.5 + ITEM Assertion OK : RowHeight is null: True ITEM Assertion OK : ColumnWidth is null: True END 'Heights and Widths' Symbol TEST OK : Heights and Widths @@ -218,7 +218,7 @@ 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 : EntireRow.Columns.Count = 1024 ITEM Assertion OK : EntireColumn.Rows.Count = 131072 END 'RangeRowColumn-Issue' Symbol TEST OK : RangeRowColumn-Issue @@ -255,7 +255,7 @@ End issue ITEM Assertion OK : - = $E$3 ITEM Assertion OK : - = $A$8 ITEM Assertion OK : - = $B$8 - ITEM Assertion OK : - = $IV$8 + ITEM Assertion FAIL : - = $AMJ$8 ITEM Assertion OK : - = $Z$8 END 'End issue' Symbol TEST OK : End issue @@ -277,4 +277,4 @@ Validation ITEM Assertion OK : Validation Error Title is : Microsoft Excel END 'Validation' Symbol TEST OK : Validation -Test run finished : 19/06/2007 11:17:18 +Test run finished : 17/12/2008 14:18:40 diff --git a/sc/source/ui/vba/TestDocuments/logs/unix/Shapes.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Shapes.log index 3193a0b1094d..3193a0b1094d 100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/Shapes.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Shapes.log diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/StrConv-test.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/StrConv-test.log new file mode 100644 index 000000000000..c7a7d8750583 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/StrConv-test.log @@ -0,0 +1,9 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Template.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Template.log new file mode 100644 index 000000000000..c6376c5b3732 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Template.log @@ -0,0 +1,14 @@ +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/sc/source/ui/vba/TestDocuments/logs/unix/TestAddress.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestAddress.log index 42360c3ffe8a..42360c3ffe8a 100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/TestAddress.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestAddress.log diff --git a/sc/source/ui/vba/TestDocuments/logs/unix/TestCalc_Rangetest.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest.log index 083819d4b64e..083819d4b64e 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/TestCalc_Rangetest.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest.log diff --git a/sc/source/ui/vba/TestDocuments/logs/unix/TestCalc_Rangetest2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest2.log index deefbd95374c..b1573c06d90e 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/unix/TestCalc_Rangetest2.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest2.log @@ -1,7 +1,7 @@ -Test run started : 18/06/2007 16:34:18 +Test run started : 10/03/2008 15:15:19 BEGIN TestCalc TEST START : RangeTest3 - ITEM Assertion FAIL : - setFormulaR1C1 + ITEM Assertion OK : - setFormulaR1C1 ITEM Assertion OK : - getFormulaR1C1 ITEM Assertion OK : - Range.Copy() and Range.PasteSpecial() ITEM Assertion OK : - Range.Copy(Range("I10")) @@ -62,4 +62,4 @@ BEGIN TestCalc ITEM FAIL (RangeTest3) TEST Not succesfully completed : RangeTest3 END TestCalc -Test run finished : 18/06/2007 16:34:20 +Test run finished : 10/03/2008 15:15:21 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Window.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Window.log new file mode 100644 index 000000000000..ec9a6656113e --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/Window.log @@ -0,0 +1,46 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/bytearraystring.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/bytearraystring.log new file mode 100644 index 000000000000..bd243283d8f1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/bytearraystring.log @@ -0,0 +1,8 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/dateserial.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/dateserial.log new file mode 100644 index 000000000000..4dd5f53160f2 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/dateserial.log @@ -0,0 +1,9 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/datevalue.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/datevalue.log new file mode 100644 index 000000000000..830d5e7b6c3e --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/datevalue.log @@ -0,0 +1,8 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log new file mode 100644 index 000000000000..50fac171544b --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log @@ -0,0 +1,36 @@ +Test run started : 17/12/2008 14:15:22 +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 : 17/12/2008 14:15:22 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/pagesetup.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/pagesetup.log new file mode 100644 index 000000000000..f04585c3f9e1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/pagesetup.log @@ -0,0 +1,77 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/partition.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/partition.log new file mode 100644 index 000000000000..7b4f2a01bead --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/partition.log @@ -0,0 +1,11 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/range-4.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/range-4.log new file mode 100644 index 000000000000..fb37b6ff201b --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/range-4.log @@ -0,0 +1,16 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log new file mode 100644 index 000000000000..461955dc2402 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log @@ -0,0 +1,14 @@ +Test run started : 17/12/2008 13:53:49 +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 : 17/12/2008 13:53:49 diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/unix/stringplusdouble.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/stringplusdouble.log new file mode 100644 index 000000000000..6e8b8d994bd1 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/stringplusdouble.log @@ -0,0 +1,62 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log new file mode 100644 index 000000000000..5d297f80a152 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log @@ -0,0 +1,45 @@ +Test run started : 05/29/2008 02:55:48 PM +BEGIN Window2 + TEST START : Test Window.SplitRow + ITEM Assertion OK : Test SplitColumn: 2 + ITEM Assertion FAIL : Test SplitRow: 5 + ITEM Assertion FAIL : Test SplitVertical: 64.5090003183026 + ITEM Assertion OK : Test SplitHorizontal: 502.570118758869 + ITEM Assertion OK : Test SplitVertical: 242.283803521067 + ITEM Assertion OK : Test SplitRow: 19 + ITEM Assertion OK : Test SplitHorizontal: 242.283803521067 + ITEM Assertion OK : Test SplitColumn: 1 + ITEM Assertion FAIL : Test SplitRow: 8 + ITEM Assertion OK : Test SplitColumn: 10 + ITEM Assertion OK : Test SplitColumn: 0 + ITEM Assertion OK : Test SplitRow: 0 + TEST OK : Test Window.SplitRow +TEST ERROR - no test begun: 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 + TEST FAIL : Test Window.Visibility (hit error handler). + 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 : 05/29/2008 02:55:48 PM diff --git a/sc/source/ui/vba/TestDocuments/logs/win/AutoFilter.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/AutoFilter.log index 10e2493f44d2..b8d0b85a8ff9 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/AutoFilter.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/AutoFilter.log @@ -1,20 +1,20 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/win/MiscRangeTests.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/MiscRangeTests.log index 6bac7bded52f..d190abb5f645 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/MiscRangeTests.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/MiscRangeTests.log @@ -1,45 +1,45 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/win/Ranges-2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges-2.log index 0e4d796a0cee..b80d996e3d3f 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/Ranges-2.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges-2.log @@ -1,68 +1,68 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/win/Ranges-3.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges-3.log index 20fb6ed18c5d..365d126a7e2d 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/Ranges-3.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges-3.log @@ -1,8 +1,8 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/win/Ranges.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges.log index d7da1bf13392..fe77d7a9d467 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/Ranges.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges.log @@ -1,280 +1,280 @@ -Test run started : 10/07/2007 01:55:56 ----------------------------------------------------------------- -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.org2\user\basic - ITEM Assertion OK : Please check manually: Template Path is: C:\Documents and Settings\vituosity\Application Data\OpenOffice.org2\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 FAIL : Range.Formula is: =IF(OR(J8=0,RC[2]="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 467 - ITEM Assertion FAIL : Rows.AutoFit: CurrentHeight is 78 -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 FAIL : RowHeight is null: False - 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/07/2007 01:56:04 +Test run started : 10/07/2007 01:55:56
+----------------------------------------------------------------
+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.org2\user\basic
+ ITEM Assertion OK : Please check manually: Template Path is: C:\Documents and Settings\vituosity\Application Data\OpenOffice.org2\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 FAIL : Range.Formula is: =IF(OR(J8=0,RC[2]="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 467
+ ITEM Assertion FAIL : Rows.AutoFit: CurrentHeight is 78
+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 FAIL : RowHeight is null: False
+ 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/07/2007 01:56:04
diff --git a/sc/source/ui/vba/TestDocuments/logs/win/Shapes.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Shapes.log index 46a53e2c29d0..fe62ab03d3f2 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/Shapes.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/Shapes.log @@ -1,77 +1,77 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/win/TestAddress.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/TestAddress.log index 5392f7510c4e..cc51e378f06a 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/TestAddress.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/TestAddress.log @@ -1,62 +1,62 @@ -Test run started : 17/07/2007 15:26:54 ----------------------------------------------------------------- -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:26:56 +Test run started : 17/07/2007 15:26:54
+----------------------------------------------------------------
+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:26:56
diff --git a/sc/source/ui/vba/TestDocuments/logs/win/TestCalc_Rangetest.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest.log index 5414c7d7bbf9..492c24bc023c 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/TestCalc_Rangetest.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest.log @@ -1,60 +1,60 @@ -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 +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/sc/source/ui/vba/TestDocuments/logs/win/TestCalc_Rangetest2.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest2.log index fa6b82e9654a..2532289bbe41 100755..100644 --- a/sc/source/ui/vba/TestDocuments/logs/win/TestCalc_Rangetest2.log +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest2.log @@ -1,65 +1,65 @@ -Test run started : 10/07/2007 01:56:15 -BEGIN TestCalc - TEST START : RangeTest3 - ITEM Assertion FAIL : - 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/07/2007 01:56:23 +Test run started : 10/07/2007 01:56:15
+BEGIN TestCalc
+ TEST START : RangeTest3
+ ITEM Assertion FAIL : - 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/07/2007 01:56:23
diff --git a/sc/source/ui/vba/testvba/TestDocuments/logs/win/pagesetup.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/pagesetup.log new file mode 100644 index 000000000000..a1c90473ce07 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/pagesetup.log @@ -0,0 +1,87 @@ +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/sc/source/ui/vba/testvba/TestDocuments/logs/win/replace.log b/sc/source/ui/vba/testvba/TestDocuments/logs/win/replace.log new file mode 100644 index 000000000000..e96004e4d2a6 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/logs/win/replace.log @@ -0,0 +1,14 @@ +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/sc/source/ui/vba/testvba/TestDocuments/partition.xls b/sc/source/ui/vba/testvba/TestDocuments/partition.xls Binary files differnew file mode 100644 index 000000000000..5c8d12b1d54f --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/partition.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/range-4.xls b/sc/source/ui/vba/testvba/TestDocuments/range-4.xls Binary files differnew file mode 100755 index 000000000000..52452369462f --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/range-4.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/replace.xls b/sc/source/ui/vba/testvba/TestDocuments/replace.xls Binary files differnew file mode 100644 index 000000000000..dcf3c6e8ec06 --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/replace.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/stringplusdouble.xls b/sc/source/ui/vba/testvba/TestDocuments/stringplusdouble.xls Binary files differnew file mode 100644 index 000000000000..596be7f6b9bc --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/stringplusdouble.xls diff --git a/sc/source/ui/vba/testvba/TestDocuments/window2.xls b/sc/source/ui/vba/testvba/TestDocuments/window2.xls Binary files differnew file mode 100755 index 000000000000..1bb2cd5a67da --- /dev/null +++ b/sc/source/ui/vba/testvba/TestDocuments/window2.xls diff --git a/sc/source/ui/vba/testvba/TestVBA.java b/sc/source/ui/vba/testvba/TestVBA.java deleted file mode 100644 index 1e6bb2fa769a..000000000000 --- a/sc/source/ui/vba/testvba/TestVBA.java +++ /dev/null @@ -1,198 +0,0 @@ -//package org.openoffice.vba; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.script.provider.*; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.AnyConverter; -import java.io.File; -import java.io.InputStream; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.OutputStream; -public class TestVBA -{ -private com.sun.star.lang.XMultiComponentFactory xMCF = null; -private com.sun.star.uno.XComponentContext xContext = null; -private com.sun.star.frame.XComponentLoader xCompLoader = null; -private File outDir; - -public TestVBA( com.sun.star.uno.XComponentContext _xContext, com.sun.star.lang.XMultiComponentFactory _xMCF, com.sun.star.frame.XComponentLoader _xCompLoader, File _outDir -) -{ - xMCF = _xMCF; - xContext = _xContext; - xCompLoader = _xCompLoader; - outDir = _outDir; -} - -public String getLogLocation() throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException, com.sun.star.uno.Exception -{ - XPropertySet pathSettings = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xMCF.createInstanceWithContext( "com.sun.star.comp.framework.PathSettings", xContext) ); - String sLogLocation = AnyConverter.toString ( pathSettings.getPropertyValue( "Work" ) ); - sLogLocation = sLogLocation + "/" + "HelperAPI-test.log"; - return sLogLocation; -} - -public void init() -{ - // blow away previous logs? -} - -public void traverse( File fileDirectory ) -{ - if ( !fileDirectory.isDirectory() ) - { - throw new IllegalArgumentException( - "not a directory: " + fileDirectory.getName() - ); - } - - // Getting all files and directories in the current directory - File[] entries = fileDirectory.listFiles(); - - - // Iterating for each file and directory - for ( int i = 0; i < entries.length; ++i ) - { - // Testing, if the entry in the list is a directory -/* - if ( entries[ i ].isDirectory() ) - { - // ignore Recursive call for the new directory - // traverse( entries[ i ] ); - } - else -*/ - if ( !entries[ i ].isDirectory() && - entries[ i ].getName().endsWith(".xls") ) - { - try - { - // Composing the URL by replacing all backslashs - String sUrl = "file:///" - + entries[ i ].getAbsolutePath().replace( '\\', '/' ); - System.out.println( "processing " + sUrl ); - // Loading the wanted document - com.sun.star.beans.PropertyValue propertyValues[] = - new com.sun.star.beans.PropertyValue[1]; - propertyValues[0] = new com.sun.star.beans.PropertyValue(); - propertyValues[0].Name = "Hidden"; - propertyValues[0].Value = new Boolean(true); - propertyValues[0].Value = new Boolean(false); - - Object oDoc = - xCompLoader.loadComponentFromURL( - sUrl, "_blank", 0, propertyValues); - String logFileURL = getLogLocation(); - java.net.URI logURI = new java.net.URI( logFileURL ); - java.net.URL logURL = logURI.toURL(); - try - { - XScriptProviderSupplier xSupplier = - (XScriptProviderSupplier)UnoRuntime.queryInterface( - XScriptProviderSupplier.class, oDoc ); - File logFile = new File( logURI ); - if ( logFile.exists() ) - { - if ( !logFile.delete() ) - throw new java.lang.RuntimeException("failed to delete " + logFileURL ); - } - - XScriptProvider xProv = xSupplier.getScriptProvider(); - XScript xScript = xProv.getScript("vnd.sun.star.script:Standard.TestMacros.Main?language=Basic&location=document"); - System.out.println("Got script for doc " + entries[ i ] ); - Object[][] out = new Object[1][0]; - out[0] = new Object[0]; - - short[][] num = new short[1][0]; - num[0] = new short[0]; - - xScript.invoke(new Object[0], num, out); - - logFile = new File( logURI ); - System.out.println( "fileName is " + entries[ i ].getName().substring(0, entries[ i ].getName().lastIndexOf( ".xls" ) ) ); - File newLoc = new File( outDir, entries[ i ].getName().substring(0, entries[ i ].getName().lastIndexOf( ".xls" ) ) + ".log" ); - System.out.println("Moving logfile to " + newLoc.getAbsolutePath() ); - boolean ret = logFile.renameTo( newLoc ); - - System.out.println("Have run and move of log file worked = " + ret ); - } - catch ( Exception ex ) - { - ex.printStackTrace(System.err); - - } - // interface is supported, otherwise use XComponent.dispose - com.sun.star.util.XCloseable xCloseable = - (com.sun.star.util.XCloseable)UnoRuntime.queryInterface( - com.sun.star.util.XCloseable.class, oDoc); - - if ( xCloseable != null ) - { - xCloseable.close(false); - } - else - { - com.sun.star.lang.XComponent xComp = - (com.sun.star.lang.XComponent)UnoRuntime.queryInterface( - com.sun.star.lang.XComponent.class, oDoc); - - xComp.dispose(); - } - } - catch( Exception e ) - { - e.printStackTrace(System.err); - } - - } - } -} -public static void usage() -{ - System.out.println("usage: java TestVba.java " + - "\"<path to testdocument dir>\" " + - " \"<output_directory>\""); - System.exit(1); - -} -public static void main( String[] args ) -{ - if ( !( args.length > 1 ) ) - usage(); - - com.sun.star.uno.XComponentContext xContext = null; - - try - { - // get the remote office component context - xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); - System.out.println("Connected to a running office ..."); - - // get the remote office service manager - com.sun.star.lang.XMultiComponentFactory xMCF = - xContext.getServiceManager(); - - Object oDesktop = xMCF.createInstanceWithContext( - "com.sun.star.frame.Desktop", xContext); - - com.sun.star.frame.XComponentLoader xCompLoader = (com.sun.star.frame.XComponentLoader) - UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class, - oDesktop); - - File testDir = new File(args[0]); - File outDir = new File(args[1]); - if ( !testDir.isDirectory() || !outDir.isDirectory() ) - usage(); - TestVBA inst = new TestVBA( xContext, xMCF, xCompLoader, outDir ); - inst.traverse( testDir ); - System.out.println("Log dir is " + inst.getLogLocation() ); - - } - catch( Exception e ) - { - System.out.println("Caught exception"); - System.out.println(e); - } - System.exit(0); -} -} diff --git a/sc/source/ui/vba/testvba/build.xml b/sc/source/ui/vba/testvba/build.xml deleted file mode 100644 index a236647ab409..000000000000 --- a/sc/source/ui/vba/testvba/build.xml +++ /dev/null @@ -1,95 +0,0 @@ -<!-- - - DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - - Copyright 2008 by Sun Microsystems, Inc. - - OpenOffice.org - a multi-platform office productivity suite - - $RCSfile: build.xml,v $ - - $Revision: 1.3.138.1 $ - - This file is part of OpenOffice.org. - - OpenOffice.org is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 3 - only, as published by the Free Software Foundation. - - OpenOffice.org is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License version 3 for more details - (a copy is included in the LICENSE file that accompanied this code). - - You should have received a copy of the GNU Lesser General Public License - version 3 along with OpenOffice.org. If not, see - <http://www.openoffice.org/license.html> - for a copy of the LGPLv3 License. - ---> -<project name="testvba" default="all" basedir="."> - - <!-- =================== Environmental Properties ======================= --> - - <property name="prj" value=".."/> - <property name="build.compiler" value="classic"/> - <property name="optimize" value="off"/> - <property name="debug" value="on"/> - <property name="jardir" value="${out}/class"/> - <property name="bindir" value="${out}/bin"/> - - <!-- ==================== build classpath setting ======================= --> - <path id="idlclasspath"> - <pathelement location="${solar.jar}/jurt.jar"/> - <pathelement location="${solar.jar}/unoil.jar"/> - <pathelement location="${solar.jar}/juh.jar"/> - <pathelement location="${solar.jar}/java_uno.jar"/> - <pathelement location="${solar.jar}/ridl.jar"/> - </path> - - <!-- ==================== build classpath setting ======================= --> - <path id="clientclasspath"> - <pathelement location="${test.officepath}/program/classes/jurt.jar"/> - <pathelement location="${test.officepath}/program/classes/unoil.jar"/> - <pathelement location="${test.officepath}/program/classes/juh.jar"/> - <pathelement location="${test.officepath}/program/classes/java_uno.jar"/> - <pathelement location="${test.officepath}/program/classes/ridl.jar"/> - <pathelement location="${out}/class"/> - </path> - - <property name="debugcp" refid="clientclasspath"/> - <!-- ===================== Prepare Directories ========================= --> - <target name="prepare"> - <mkdir dir="${jardir}"/> - </target> - - <!-- ======================== Compile Classes ========================== --> - <target name="compile" depends="prepare"> - <javac srcdir="." destdir="${jardir}" - includes="**/*.java" classpathref="idlclasspath" - debug="${debug}" optimize="${optimize}" deprecation="off"> - </javac> - </target> - - <!-- ====================== Clean Generated Files ===================== --> - <target name="clean"> - <delete dir="${jardir}"/> - </target> - <!-- ========================= All In One Build ======================= --> - - <!-- - <target name="all" depends="compile"/> ---> - - <target name="all" depends="test"/> - - <target name="test" depends="compile"> - <echo> testcp = ${debugcp}" - </echo> - <java classname="TestVBA" fork="true" dir="." classpathref="clientclasspath"> - <arg value="${test.documents}"/> - <arg value="${test.out}"/> - </java> - </target> -</project> diff --git a/sc/source/ui/vba/testvba/makefile.mk b/sc/source/ui/vba/testvba/makefile.mk index 1a18599985e5..b89eedff20df 100644 --- a/sc/source/ui/vba/testvba/makefile.mk +++ b/sc/source/ui/vba/testvba/makefile.mk @@ -30,28 +30,44 @@ #************************************************************************* PRJ=..$/..$/..$/..$/ + PRJNAME=sc TARGET=testvba +ENABLE_EXCEPTIONS=TRUE -.INCLUDE : ant.mk - -.IF "$(SOLAR_JAVA)"!="" +# --- Settings ----------------------------------------------------- -ALLTAR : PROCESSRESULTS +.INCLUDE : settings.mk +DLLPRE = -TESTDOCUMENTS=..$/TestDocuments -.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC" -TESTDOCUMENTLOGS=$(TESTDOCUMENTS)$/logs$/unix -.ELSE -TESTDOCUMENTLOGS=$(TESTDOCUMENTS)$/logs$/win +.IF "$(ENABLE_VBA)"!="YES" +dummy: + @echo "not building vba..." .ENDIF -OUTPUTDIR:=..$/$(TARGET)$/Logs -ANT_FLAGS+=-Dtest.documents=$(TESTDOCUMENTS) -ANT_FLAGS+=-Dtest.out=$(OUTPUTDIR) -ANT_FLAGS+=-Dtest.officepath=$(OFFICEPATH) -#UNITTEST : $(LOCAL_COMMON_OUT)$/class/TestVBA.class -PROCESSRESULTS : ANTBUILD - $(PERL) testResults.pl $(OUTPUTDIR) $(TESTDOCUMENTLOGS) +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 + -.ENDIF diff --git a/sc/source/ui/vba/testvba/runTests.pl b/sc/source/ui/vba/testvba/runTests.pl new file mode 100644 index 000000000000..8f8f329504c0 --- /dev/null +++ b/sc/source/ui/vba/testvba/runTests.pl @@ -0,0 +1,121 @@ +#!/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.1/program"; +my $urelibpath = "$officepath/ure/lib"; +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"}; + $ENV{"PATH"} = "$officepath:$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/sc/source/ui/vba/testvba/testResult.pl b/sc/source/ui/vba/testvba/testResult.pl new file mode 100644 index 000000000000..5f065924d5c4 --- /dev/null +++ b/sc/source/ui/vba/testvba/testResult.pl @@ -0,0 +1,171 @@ +#!/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/sc/source/ui/vba/testvba/testResults.pl b/sc/source/ui/vba/testvba/testResults.pl index ea57296dbd04..39ec26ba38be 100755 --- a/sc/source/ui/vba/testvba/testResults.pl +++ b/sc/source/ui/vba/testvba/testResults.pl @@ -1,10 +1,11 @@ #!/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= "$binDir/timestampsClean.pl"; +my $timestampclean= "perl $binDir/timestampsClean.pl"; #sub gen_diff($) sub testLog @@ -19,8 +20,11 @@ sub testLog $filename = "$logdir/$filename"; print "processing $testfile $filename\n"; if ( -f $filename ) { - #print "diffing\n"; - my $tmpFile = "/tmp/gen_diff"; + 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) ) { diff --git a/sc/source/ui/vba/testvba/testvba.cxx b/sc/source/ui/vba/testvba/testvba.cxx new file mode 100644 index 000000000000..686b3e47eaa9 --- /dev/null +++ b/sc/source/ui/vba/testvba/testvba.cxx @@ -0,0 +1,309 @@ +#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/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index ccf4b077c755..32ed5f9e0af2 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -1,959 +1,1298 @@ -/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbaapplication.cxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include <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 <tools/diagnose_ex.h>
-
-#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( ) throw ( uno::RuntimeException )
-{
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XNamedRanges > xNamedRanges( getActiveSheet() , uno::UNO_QUERY_THROW );
- css::uno::Reference< excel::XNames > xNames ( new ScVbaNames( this , mxContext , xNamedRanges , xModel ) );
- return uno::makeAny( xNames );
-}
-
-
-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 ), formula::FormulaGrammar::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 >() );
-}
-
-namespace
-{
- static uno::Reference< frame::XController > lcl_getCurrentController()
- {
- const uno::Reference< frame::XModel > xWorkingDoc( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
- uno::Reference< frame::XController > xController;
- if ( xWorkingDoc.is() )
- xController.set( xWorkingDoc->getCurrentController(), uno::UNO_SET_THROW );
- else
- xController.set( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW );
- return xController;
- }
-}
-
-sal_Int32 SAL_CALL
-ScVbaApplication::getCursor() throw (uno::RuntimeException)
-{
- sal_Int32 nPointerStyle( POINTER_ARROW );
- try
- {
- const uno::Reference< frame::XController > xController( lcl_getCurrentController(), uno::UNO_SET_THROW );
- const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW );
- const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
- // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only?
- const Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow )
- nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle();
- }
- catch( const uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- switch( nPointerStyle )
- {
- 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)
-{
- try
- {
- ::std::vector< uno::Reference< frame::XController > > aControllers;
-
- const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
- if ( xModel2.is() )
- {
- const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW );
- while ( xEnumControllers->hasMoreElements() )
- {
- const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW );
- aControllers.push_back( xController );
- }
- }
- else
- {
- const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
- if ( xModel.is() )
- {
- const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
- aControllers.push_back( xController );
- }
- else
- {
- const uno::Reference< frame::XController > xController( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW );
- aControllers.push_back( xController );
- }
- }
-
- for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin();
- controller != aControllers.end();
- ++controller
- )
- {
- const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW );
- const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
-
- Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" );
- if ( !pWindow )
- continue;
-
- switch( _cursor )
- {
- case excel::XlMousePointer::xlNorthwestArrow:
- {
- const Pointer& rPointer( POINTER_ARROW );
- pWindow->GetSystemWindow()->SetPointer( rPointer );
- pWindow->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.
- pWindow->GetSystemWindow()->SetPointer( rPointer );
- pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_True );
- //It only set the edit window's mouse pointer
- //pWindow->.SetPointer( rPointer );
- //pWindow->.EnableChildPointerOverwrite( sal_True );
- //printf("\nset Cursor...%d\n", pWindow->.GetType());
- break;
- }
- case excel::XlMousePointer::xlDefault:
- {
- const Pointer& rPointer( POINTER_NULL );
- pWindow->GetSystemWindow()->SetPointer( rPointer );
- pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_False );
- break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() );
- // TODO: isn't this a flaw in the API? It should be allowed to throw an
- // IllegalArgumentException, or so
- }
- }
- }
- catch( const uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-// #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;
-}
+/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaapplication.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <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<ooo/vba/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 <ooo/vba/excel/XlMousePointer.hpp> +#include <com/sun/star/sheet/XNamedRanges.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.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 "vbatextboxshape.hxx" +#include "vbaassistant.hxx" +#include "vbacommandbars.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 <tools/diagnose_ex.h> + +#include <docuno.hxx> + +#include <basic/sbx.hxx> +#include <basic/sbstar.hxx> +#include <basic/sbuno.hxx> +#include <basic/sbmeth.hxx> + +#include "convuno.hxx" +#include "cellsuno.hxx" +#include "docsh.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +// Enable our own join detection for Intersection and Union +// should be more efficient than using ScRangeList::Join ( because +// we already are testing the same things ) + +#define OWN_JOIN 1 + +// #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< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xParent, xContext ){} +}; + +ScVbaApplication::ScVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( uno::Reference< 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::Reference< XAssistant > SAL_CALL +ScVbaApplication::getAssistant() throw (uno::RuntimeException) +{ + return uno::Reference< XAssistant >( new ScVbaAssistant( this, mxContext ) ); +} + +uno::Any SAL_CALL +ScVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >() ) ); + if( aIndex.hasValue() ) + return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) ); + return uno::makeAny( xCommandBars ); +} + +uno::Any SAL_CALL +ScVbaApplication::getSelection() throw (uno::RuntimeException) +{ + OSL_TRACE("** ScVbaApplication::getSelection() ** "); + 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 ); + // if ScVbaShape::getType( xShape ) == office::MsoShapeType::msoAutoShape + // and the uno object implements the com.sun.star.drawing.Text service + // return a textboxshape object + if ( ScVbaShape::getType( xShape ) == office::MsoShapeType::msoAutoShape ) + { + uno::Reference< lang::XServiceInfo > xShapeServiceInfo( xShape, uno::UNO_QUERY_THROW ); + if ( xShapeServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.Text" ) ) ) ) + { + return uno::makeAny( uno::Reference< msforms::XTextBoxShape >(new ScVbaTextBoxShape( mxContext, xShape, xShapes, getCurrentDocument() ) ) ); + } + } + 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< 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< 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< 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< 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 ), formula::FormulaGrammar::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 >() ); +} + +namespace +{ + static uno::Reference< frame::XController > lcl_getCurrentController() + { + const uno::Reference< frame::XModel > xWorkingDoc( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY ); + uno::Reference< frame::XController > xController; + if ( xWorkingDoc.is() ) + xController.set( xWorkingDoc->getCurrentController(), uno::UNO_SET_THROW ); + else + xController.set( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW ); + return xController; + } +} + +sal_Int32 SAL_CALL +ScVbaApplication::getCursor() throw (uno::RuntimeException) +{ + sal_Int32 nPointerStyle( POINTER_ARROW ); + try + { + const uno::Reference< frame::XController > xController( lcl_getCurrentController(), uno::UNO_SET_THROW ); + const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW ); + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only? + const Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow ) + nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle(); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + switch( nPointerStyle ) + { + 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) +{ + try + { + ::std::vector< uno::Reference< frame::XController > > aControllers; + + const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY ); + if ( xModel2.is() ) + { + const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW ); + while ( xEnumControllers->hasMoreElements() ) + { + const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW ); + aControllers.push_back( xController ); + } + } + else + { + const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY ); + if ( xModel.is() ) + { + const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); + aControllers.push_back( xController ); + } + else + { + const uno::Reference< frame::XController > xController( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW ); + aControllers.push_back( xController ); + } + } + + for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin(); + controller != aControllers.end(); + ++controller + ) + { + const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW ); + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" ); + if ( !pWindow ) + continue; + + switch( _cursor ) + { + case excel::XlMousePointer::xlNorthwestArrow: + { + const Pointer& rPointer( POINTER_ARROW ); + pWindow->GetSystemWindow()->SetPointer( rPointer ); + pWindow->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. + pWindow->GetSystemWindow()->SetPointer( rPointer ); + pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_True ); + //It only set the edit window's mouse pointer + //pWindow->.SetPointer( rPointer ); + //pWindow->.EnableChildPointerOverwrite( sal_True ); + //printf("\nset Cursor...%d\n", pWindow->.GetType()); + break; + } + case excel::XlMousePointer::xlDefault: + { + const Pointer& rPointer( POINTER_NULL ); + pWindow->GetSystemWindow()->SetPointer( rPointer ); + pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_False ); + break; + } + default: + throw uno::RuntimeException( rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() ); + // TODO: isn't this a flaw in the API? It should be allowed to throw an + // IllegalArgumentException, or so + } + } + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +// #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; +} + +typedef std::list< ScRange > Ranges; +typedef std::list< ScRangeList > RangesList; + +void lcl_addRangesToVec( RangesList& vRanges, const uno::Any& aArg ) throw ( script::BasicErrorException, uno::RuntimeException ) +{ + ScRangeList theRanges; + uno::Reference< excel::XRange > xRange( aArg, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW ); + sal_Int32 nCount = xCol->getCount(); + for( sal_Int32 i = 1; i <= nCount; ++i ) + { + uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::makeAny( sal_Int32(i) ), uno::Any() ), uno::UNO_QUERY_THROW ); + uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW ); + table::CellRangeAddress addr = xAddressable->getRangeAddress(); + ScRange refRange; + ScUnoConversion::FillScRange( refRange, addr ); + theRanges.Append( refRange ); + } + vRanges.push_back( theRanges ); +} + +void lcl_addRangeToVec( Ranges& vRanges, const uno::Any& aArg ) throw ( script::BasicErrorException, uno::RuntimeException ) +{ + uno::Reference< excel::XRange > xRange( aArg, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW ); + sal_Int32 nCount = xCol->getCount(); + for( sal_Int32 i = 1; i <= nCount; ++i ) + { + uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::makeAny( sal_Int32(i) ), uno::Any() ), uno::UNO_QUERY_THROW ); + uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW ); + table::CellRangeAddress addr = xAddressable->getRangeAddress(); + ScRange refRange; + ScUnoConversion::FillScRange( refRange, addr ); + vRanges.push_back( refRange ); + } +} + +bool lcl_canJoin( ScRange& r1, ScRange& r2 ) +{ + bool bCanJoin = false; + SCCOL startEndColDiff = r2.aStart.Col() - r1.aEnd.Col(); + SCROW startEndRowDiff = r2.aStart.Row() - r1.aEnd.Row(); + SCCOL startColDiff = r2.aStart.Col() - r1.aStart.Col(); + SCCOL endColDiff = r2.aEnd.Col() - r1.aEnd.Col(); + SCROW startRowDiff = r2.aStart.Row() - r1.aStart.Row(); + SCROW endRowDiff = r2.aEnd.Row() - r1.aEnd.Row(); + if ( ( startRowDiff == endRowDiff ) && startRowDiff == 0 && startColDiff >=0 && endColDiff > 0 && ( startEndColDiff <= 1 && startEndColDiff >= -r1.aEnd.Col() ) ) + bCanJoin = true; + else if ( ( startColDiff == endColDiff ) && startColDiff == 0 && startRowDiff >= 0 && endRowDiff > 0 && ( startEndRowDiff <= 1 && startEndRowDiff >= -r1.aEnd.Row() ) ) + bCanJoin = true; +#ifdef DEBUG + String sr1; + String sr2; + r1.Format( sr1, SCA_VALID ) ; + r2.Format( sr2, SCA_VALID ) ; + OSL_TRACE(" canJoin address %s with %s %s ( startRowDiff(%d), endRowDiff(%d), startColDiff(%d) endColDiff(%d) startEndRowDiff(%d), startEndColDiff(%d) ", + rtl::OUStringToOString( sr1, RTL_TEXTENCODING_UTF8 ).getStr(), + rtl::OUStringToOString( sr2, RTL_TEXTENCODING_UTF8 ).getStr(), bCanJoin ? "true" : "false", startRowDiff, endRowDiff, startColDiff, endColDiff, startEndRowDiff, startEndColDiff ); +#endif + return bCanJoin; +} +// strips out ranges that contain other ranges, also +// if the borders of the intersecting ranges are alligned +// then the the range is extended to the larger +// e.g. Range("A4:D10"), Range("B4:E10") would be combined +// to Range("A4:E10") +void lcl_strip_containedRanges( Ranges& vRanges ) +{ + // get rid of ranges that are surrounded by other ranges + for( Ranges::iterator it = vRanges.begin(); it != vRanges.end(); ++it ) + { + for( Ranges::iterator it_inner = vRanges.begin(); it_inner != vRanges.end(); ++it_inner ) + { + if ( it != it_inner ) + { +#ifdef DEBUG + String r1; + String r2; + it->Format( r1, SCA_VALID ) ; + it_inner->Format( r2, SCA_VALID ) ; + OSL_TRACE( "try strip/join address %s with %s ", + rtl::OUStringToOString( r1, RTL_TEXTENCODING_UTF8 ).getStr(), + rtl::OUStringToOString( r2, RTL_TEXTENCODING_UTF8 ).getStr() ); +#endif + if ( it->In( *it_inner ) ) + it_inner = vRanges.erase( it_inner ); + else if ( it_inner->In( *it ) ) + it = vRanges.erase( it ); +#ifndef OWN_JOIN + else if ( (*it_inner).aStart.Row() == (*it).aStart.Row() + && (*it_inner).aEnd.Row() == (*it).aEnd.Row() ) + { + it->ExtendTo( *it_inner ); + it_inner = vRanges.erase( it_inner ); + } +#else + else if ( lcl_canJoin( *it, *it_inner ) ) + { + it->ExtendTo( *it_inner ); + it_inner = vRanges.erase( it_inner ); + } + else if ( lcl_canJoin( *it_inner, *it) ) + { + it_inner->ExtendTo( *it ); + it = vRanges.erase( it ); + } +#endif + } + } + } + +} + +Ranges +lcl_intersectionImpl( ScRangeList& rl1, ScRangeList& rl2 ) +{ + Ranges intersections; + for ( USHORT x = 0 ; x < rl1.Count(); ++x ) + { + for ( USHORT y = 0 ; y < rl2.Count(); ++y ) + { +#ifdef DEBUG + String r1; + String r2; + rl1.GetObject( x )->Format( r1, SCA_VALID ) ; + rl2.GetObject( y )->Format( r2, SCA_VALID ) ; + OSL_TRACE( "comparing address %s with %s ", + rtl::OUStringToOString( r1, RTL_TEXTENCODING_UTF8 ).getStr(), + rtl::OUStringToOString( r2, RTL_TEXTENCODING_UTF8 ).getStr() ); +#endif + if( rl1.GetObject( x )->Intersects( *rl2.GetObject( y ) ) ) + { + ScRange aIntersection = ScRange( Max( rl1.GetObject( x )->aStart.Col(), rl2.GetObject( y )->aStart.Col() ), + Max( rl1.GetObject( x )->aStart.Row(), rl2.GetObject( y )->aStart.Row() ), + Max( rl1.GetObject( x )->aStart.Tab(), rl2.GetObject( y )->aStart.Tab() ), + Min( rl1.GetObject( x )->aEnd.Col(), rl2.GetObject( y )->aEnd.Col() ), + Min( rl1.GetObject( x )->aEnd.Row(), rl2.GetObject( y )->aEnd.Row() ), + Min( rl1.GetObject( x )->aEnd.Tab(), rl2.GetObject( y )->aEnd.Tab() ) ); + intersections.push_back( aIntersection ); + } + } + } + lcl_strip_containedRanges( intersections ); + return intersections; +} + +// Intersection of a set of ranges ( where each range is represented by a ScRangeList e.g. +// any range can be a multi-area range ) +// An intersection is performed between each range in the set of ranges. +// The resulting set of intersections is then processed to strip out any +// intersections that contain other intersections ( and also ranges that directly line up +// are joined ) ( see lcl_strip_containedRanges ) +RangesList lcl_intersections( RangesList& vRanges ) +{ + RangesList intersections; + for( RangesList::iterator it = vRanges.begin(); it != vRanges.end(); ++it ) + { + Ranges intermediateList; + for( RangesList::iterator it_inner = vRanges.begin(); it_inner != vRanges.end(); ++it_inner ) + { + if ( it != it_inner ) + { + Ranges ranges = lcl_intersectionImpl( *it, *it_inner ); + for ( Ranges::iterator range_it = ranges.begin(); range_it != ranges.end(); ++range_it ) + intermediateList.push_back( *range_it ); + } + } + it = vRanges.erase( it ); // remove it so we don't include it in the next pass. + + ScRangeList argIntersect; + lcl_strip_containedRanges( intermediateList ); + + for( Ranges::iterator it_inter = intermediateList.begin(); it_inter != intermediateList.end(); ++it_inter ) +#ifndef OWN_JOIN + argIntersect.Join( *it_inter ); +#else + argIntersect.Append( *it_inter ); +#endif + + intersections.push_back( argIntersect ); + } + return intersections; +} + +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) +{ + if ( !Arg1.is() || !Arg2.is() ) + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + + RangesList vRanges; + lcl_addRangesToVec( vRanges, uno::makeAny( Arg1 ) ); + lcl_addRangesToVec( vRanges, uno::makeAny( Arg2 ) ); + + if ( Arg3.hasValue() ) + lcl_addRangesToVec( vRanges, Arg3 ); + if ( Arg4.hasValue() ) + lcl_addRangesToVec( vRanges, Arg4 ); + if ( Arg5.hasValue() ) + lcl_addRangesToVec( vRanges, Arg5 ); + if ( Arg6.hasValue() ) + lcl_addRangesToVec( vRanges, Arg6 ); + if ( Arg7.hasValue() ) + lcl_addRangesToVec( vRanges, Arg7 ); + if ( Arg8.hasValue() ) + lcl_addRangesToVec( vRanges, Arg8 ); + if ( Arg9.hasValue() ) + lcl_addRangesToVec( vRanges, Arg9 ); + if ( Arg10.hasValue() ) + lcl_addRangesToVec( vRanges, Arg10 ); + if ( Arg11.hasValue() ) + lcl_addRangesToVec( vRanges, Arg11 ); + if ( Arg12.hasValue() ) + lcl_addRangesToVec( vRanges, Arg12 ); + if ( Arg13.hasValue() ) + lcl_addRangesToVec( vRanges, Arg13 ); + if ( Arg14.hasValue() ) + lcl_addRangesToVec( vRanges, Arg14 ); + if ( Arg15.hasValue() ) + lcl_addRangesToVec( vRanges, Arg15 ); + if ( Arg16.hasValue() ) + lcl_addRangesToVec( vRanges, Arg16 ); + if ( Arg17.hasValue() ) + lcl_addRangesToVec( vRanges, Arg17 ); + if ( Arg18.hasValue() ) + lcl_addRangesToVec( vRanges, Arg18 ); + if ( Arg19.hasValue() ) + lcl_addRangesToVec( vRanges, Arg19 ); + if ( Arg20.hasValue() ) + lcl_addRangesToVec( vRanges, Arg20 ); + if ( Arg21.hasValue() ) + lcl_addRangesToVec( vRanges, Arg21 ); + if ( Arg22.hasValue() ) + lcl_addRangesToVec( vRanges, Arg22 ); + if ( Arg23.hasValue() ) + lcl_addRangesToVec( vRanges, Arg23 ); + if ( Arg24.hasValue() ) + lcl_addRangesToVec( vRanges, Arg24 ); + if ( Arg25.hasValue() ) + lcl_addRangesToVec( vRanges, Arg25 ); + if ( Arg26.hasValue() ) + lcl_addRangesToVec( vRanges, Arg26 ); + if ( Arg27.hasValue() ) + lcl_addRangesToVec( vRanges, Arg27 ); + if ( Arg28.hasValue() ) + lcl_addRangesToVec( vRanges, Arg28 ); + if ( Arg29.hasValue() ) + lcl_addRangesToVec( vRanges, Arg29 ); + if ( Arg30.hasValue() ) + lcl_addRangesToVec( vRanges, Arg30 ); + + uno::Reference< excel::XRange > xRefRange; + + ScRangeList aCellRanges; + // first pass - gets the set of all possible interections of Arg1..ArgN + RangesList intersections = lcl_intersections( vRanges ); + // second pass - gets the intersections of the intersections ( don't ask, but this + // is what seems to happen ) + if ( intersections.size() > 1) + intersections = lcl_intersections( intersections ); + for( RangesList::iterator it = intersections.begin(); it != intersections.end(); ++it ) + { + for ( USHORT x = 0 ; x < it->Count(); ++x ) +#ifndef OWN_JOIN + aCellRanges.Join( *it->GetObject(x) ); +#else + aCellRanges.Append( *it->GetObject(x) ); +#endif + } + + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + ScDocShell* pDocShell = getDocShell( xModel ); + if ( aCellRanges.Count() == 1 ) + { + xRefRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) ); + } + else if ( aCellRanges.Count() > 1 ) + { + uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) ); + xRefRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, xRanges ); + + } + return xRefRange; +} + +uno::Reference< excel::XRange > SAL_CALL +ScVbaApplication::Union( 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) +{ + if ( !Arg1.is() || !Arg2.is() ) + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + + uno::Reference< excel::XRange > xRange; + Ranges vRanges; + lcl_addRangeToVec( vRanges, uno::makeAny( Arg1 ) ); + lcl_addRangeToVec( vRanges, uno::makeAny( Arg2 ) ); + + if ( Arg3.hasValue() ) + lcl_addRangeToVec( vRanges, Arg3 ); + if ( Arg4.hasValue() ) + lcl_addRangeToVec( vRanges, Arg4 ); + if ( Arg5.hasValue() ) + lcl_addRangeToVec( vRanges, Arg5 ); + if ( Arg6.hasValue() ) + lcl_addRangeToVec( vRanges, Arg6 ); + if ( Arg7.hasValue() ) + lcl_addRangeToVec( vRanges, Arg7 ); + if ( Arg8.hasValue() ) + lcl_addRangeToVec( vRanges, Arg8 ); + if ( Arg9.hasValue() ) + lcl_addRangeToVec( vRanges, Arg9 ); + if ( Arg10.hasValue() ) + lcl_addRangeToVec( vRanges, Arg10 ); + if ( Arg11.hasValue() ) + lcl_addRangeToVec( vRanges, Arg11 ); + if ( Arg12.hasValue() ) + lcl_addRangeToVec( vRanges, Arg12 ); + if ( Arg13.hasValue() ) + lcl_addRangeToVec( vRanges, Arg13 ); + if ( Arg14.hasValue() ) + lcl_addRangeToVec( vRanges, Arg14 ); + if ( Arg15.hasValue() ) + lcl_addRangeToVec( vRanges, Arg15 ); + if ( Arg16.hasValue() ) + lcl_addRangeToVec( vRanges, Arg16 ); + if ( Arg17.hasValue() ) + lcl_addRangeToVec( vRanges, Arg17 ); + if ( Arg18.hasValue() ) + lcl_addRangeToVec( vRanges, Arg18 ); + if ( Arg19.hasValue() ) + lcl_addRangeToVec( vRanges, Arg19 ); + if ( Arg20.hasValue() ) + lcl_addRangeToVec( vRanges, Arg20 ); + if ( Arg21.hasValue() ) + lcl_addRangeToVec( vRanges, Arg21 ); + if ( Arg22.hasValue() ) + lcl_addRangeToVec( vRanges, Arg22 ); + if ( Arg23.hasValue() ) + lcl_addRangeToVec( vRanges, Arg23 ); + if ( Arg24.hasValue() ) + lcl_addRangeToVec( vRanges, Arg24 ); + if ( Arg25.hasValue() ) + lcl_addRangeToVec( vRanges, Arg25 ); + if ( Arg26.hasValue() ) + lcl_addRangeToVec( vRanges, Arg26 ); + if ( Arg27.hasValue() ) + lcl_addRangeToVec( vRanges, Arg27 ); + if ( Arg28.hasValue() ) + lcl_addRangeToVec( vRanges, Arg28 ); + if ( Arg29.hasValue() ) + lcl_addRangeToVec( vRanges, Arg29 ); + if ( Arg30.hasValue() ) + lcl_addRangeToVec( vRanges, Arg30 ); + + ScRangeList aCellRanges; + lcl_strip_containedRanges( vRanges ); + + for( Ranges::iterator it = vRanges.begin(); it != vRanges.end(); ++it ) + aCellRanges.Append( *it ); + + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + ScDocShell* pDocShell = getDocShell( xModel ); + if ( aCellRanges.Count() == 1 ) + { + // normal range + xRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) ); + } + else if ( aCellRanges.Count() > 1 ) // Multi-Area + { + uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) ); + xRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, xRanges ); + } + + // #FIXME need proper (WorkSheet) parent + return xRange; +} + +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("ooo.vba.excel.Application" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx index bf5d0ef8ef28..dd828298fe2a 100644 --- a/sc/source/ui/vba/vbaapplication.hxx +++ b/sc/source/ui/vba/vbaapplication.hxx @@ -31,13 +31,13 @@ #define SC_VBA_APPLICATION_HXX -#include <org/openoffice/excel/XWorksheetFunction.hpp> -#include <org/openoffice/excel/XApplication.hpp> +#include <ooo/vba/excel/XWorksheetFunction.hpp> +#include <ooo/vba/excel/XApplication.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XApplication > ScVbaApplication_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XApplication > ScVbaApplication_BASE; class ScVbaApplication : public ScVbaApplication_BASE { @@ -49,7 +49,7 @@ public: 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; } + virtual css::uno::Reference< ov::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); @@ -64,10 +64,10 @@ public: 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 css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getActiveWorkbook() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getActiveCell() throw ( css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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); @@ -75,7 +75,9 @@ public: 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::Reference< ov::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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); @@ -94,10 +96,11 @@ public: 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( ) 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 css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::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 css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::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 diff --git a/sc/source/ui/vba/vbaassistant.cxx b/sc/source/ui/vba/vbaassistant.cxx new file mode 100644 index 000000000000..f99fb0c8819c --- /dev/null +++ b/sc/source/ui/vba/vbaassistant.cxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * 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 <sfx2/app.hxx> +#include <svtools/helpopt.hxx> + +#include <ooo/vba/office/MsoAnimationType.hpp> + +#include"vbaassistant.hxx" + + +using namespace com::sun::star; +using namespace ooo::vba; + +using namespace ooo::vba::office::MsoAnimationType; + +ScVbaAssistant::ScVbaAssistant( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext ): ScVbaAssistantImpl_BASE( xParent, xContext ) +{ + m_bIsVisible = sal_False; + m_nPointsLeft = 795; + m_nPointsTop = 248; + m_sName = rtl::OUString::createFromAscii( "Clippit" ); + m_nAnimation = msoAnimationIdle; +} + +ScVbaAssistant::~ScVbaAssistant() +{ +} + +sal_Bool SAL_CALL ScVbaAssistant::getVisible() throw (uno::RuntimeException) +{ + return m_bIsVisible; +} + +void SAL_CALL ScVbaAssistant::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) +{ + m_bIsVisible = bVisible; +} + +sal_Bool SAL_CALL ScVbaAssistant::getOn() throw (uno::RuntimeException) +{ + if( SvtHelpOptions().IsHelpAgentAutoStartMode() ) + return sal_True; + else + return sal_False; +} + +void SAL_CALL ScVbaAssistant::setOn( sal_Bool bOn ) throw (uno::RuntimeException) +{ + SvtHelpOptions().SetHelpAgentAutoStartMode( bOn ); + setVisible( bOn ); +} + + +::sal_Int32 SAL_CALL +ScVbaAssistant::getTop() throw (css::uno::RuntimeException) +{ + return m_nPointsTop; +} +void SAL_CALL +ScVbaAssistant::setTop( ::sal_Int32 _top ) throw (css::uno::RuntimeException) +{ + m_nPointsTop = _top; +} +::sal_Int32 SAL_CALL +ScVbaAssistant::getLeft() throw (css::uno::RuntimeException) +{ + return m_nPointsLeft; +} +void SAL_CALL +ScVbaAssistant::setLeft( ::sal_Int32 _left ) throw (css::uno::RuntimeException) +{ + m_nPointsLeft = _left; +} +::sal_Int32 SAL_CALL +ScVbaAssistant::getAnimation() throw (css::uno::RuntimeException) +{ + return m_nAnimation; +} +void SAL_CALL +ScVbaAssistant::setAnimation( ::sal_Int32 _animation ) throw (css::uno::RuntimeException) +{ + m_nAnimation = _animation; +} + +::rtl::OUString SAL_CALL +ScVbaAssistant::Name( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) +{ + return m_sName; +} + +rtl::OUString& +ScVbaAssistant::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaAssistant") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaAssistant::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.Assistant" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbaassistant.hxx b/sc/source/ui/vba/vbaassistant.hxx new file mode 100644 index 000000000000..a91d1bfd9c39 --- /dev/null +++ b/sc/source/ui/vba/vbaassistant.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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_ASSISTANT_HXX +#define SC_VBA_ASSISTANT_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/XAssistant.hpp> + +#include <sfx2/sfxhelp.hxx> + +#include "vbahelper.hxx" +#include "vbahelperinterface.hxx" + +typedef ::cppu::WeakImplHelper1< ov::XAssistant > Assistant; +typedef InheritedHelperInterfaceImpl< Assistant > ScVbaAssistantImpl_BASE; + +class ScVbaAssistant : public ScVbaAssistantImpl_BASE +{ +private: + sal_Bool m_bIsVisible; + sal_Int32 m_nPointsLeft; + sal_Int32 m_nPointsTop; + rtl::OUString m_sName; + sal_Int32 m_nAnimation; +public: + ScVbaAssistant( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext ); + virtual ~ScVbaAssistant(); + // XAssistant + virtual sal_Bool SAL_CALL getOn() throw (css::uno::RuntimeException); + virtual void SAL_CALL setOn( sal_Bool _on ) 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 getTop() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTop( ::sal_Int32 _top ) 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_Int32 SAL_CALL getAnimation() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAnimation( ::sal_Int32 _animation ) throw (css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL Name( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif//SC_VBA_ASSISTANT_HXX diff --git a/sc/source/ui/vba/vbaaxes.cxx b/sc/source/ui/vba/vbaaxes.cxx index bfe5cd21dcca..37701e702662 100644 --- a/sc/source/ui/vba/vbaaxes.cxx +++ b/sc/source/ui/vba/vbaaxes.cxx @@ -31,15 +31,15 @@ #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 <ooo/vba/excel/XlAxisType.hpp> +#include <ooo/vba/excel/XlAxisGroup.hpp> +#include <ooo/vba/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; +using namespace ::ooo::vba; +using namespace ::ooo::vba::excel::XlAxisType; +using namespace ::ooo::vba::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 @@ -86,7 +86,7 @@ ScVbaAxes::createAxis( const uno::Reference< excel::XChart >& xChart, const uno: } else throw script::BasicErrorException( rtl::OUString(), NULL, SbERR_METHOD_FAILED, rtl::OUString()); - uno::Reference< vba::XHelperInterface > xParent( xChart, uno::UNO_QUERY_THROW ); + uno::Reference< XHelperInterface > xParent( xChart, uno::UNO_QUERY_THROW ); return new ScVbaAxis( xParent, xContext, xAxisPropertySet, nType, nAxisGroup); } @@ -146,7 +146,7 @@ uno::Reference< container::XIndexAccess > createIndexWrapper( const uno::Referen } // #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 ) +ScVbaAxes::ScVbaAxes( const uno::Reference< XHelperInterface >& xParent,const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< excel::XChart >& xChart ) : ScVbaAxes_BASE( xParent, xContext, createIndexWrapper( xChart, xContext )), moChartParent( xChart ) { } @@ -199,7 +199,7 @@ ScVbaAxes::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Axes" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Axes" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaaxes.hxx b/sc/source/ui/vba/vbaaxes.hxx index cf8b4b50da6c..e0bfbe350acb 100644 --- a/sc/source/ui/vba/vbaaxes.hxx +++ b/sc/source/ui/vba/vbaaxes.hxx @@ -29,17 +29,17 @@ ************************************************************************/ #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 <ooo/vba/excel/XAxes.hpp> +#include <ooo/vba/excel/XAxis.hpp> +#include <ooo/vba/excel/XChart.hpp> #include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< oo::excel::XAxes > ScVbaAxes_BASE; +typedef CollTestImplHelper< ov::excel::XAxes > ScVbaAxes_BASE; class ScVbaAxes : public ScVbaAxes_BASE { - css::uno::Reference< oo::excel::XChart > moChartParent; // not the true parent I guess + css::uno::Reference< ov::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 ); + ScVbaAxes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< ov::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); @@ -48,7 +48,7 @@ public: // 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 ); + static css::uno::Reference< ov::excel::XAxis > createAxis( const css::uno::Reference< ov::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/sc/source/ui/vba/vbaaxis.cxx b/sc/source/ui/vba/vbaaxis.cxx index 62f6bc1ccd0b..4c64430c2fb5 100644 --- a/sc/source/ui/vba/vbaaxis.cxx +++ b/sc/source/ui/vba/vbaaxis.cxx @@ -29,21 +29,21 @@ ************************************************************************/ #include "vbaaxis.hxx" -#include <org/openoffice/excel/XlAxisCrosses.hpp> -#include <org/openoffice/excel/XlAxisType.hpp> -#include <org/openoffice/excel/XlScaleType.hpp> +#include <ooo/vba/excel/XlAxisCrosses.hpp> +#include <ooo/vba/excel/XlAxisType.hpp> +#include <ooo/vba/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; +using namespace ::ooo::vba; +using namespace ::ooo::vba::excel::XlAxisCrosses; +using namespace ::ooo::vba::excel::XlAxisType; +using namespace ::ooo::vba::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") ); +const rtl::OUString VBA_MIN( RTL_CONSTASCII_USTRINGPARAM("Max") ); +const rtl::OUString VBA_MAX( RTL_CONSTASCII_USTRINGPARAM("Min") ); ScVbaChart* ScVbaAxis::getChartPtr() throw( uno::RuntimeException ) { @@ -63,7 +63,7 @@ ScVbaAxis::isValueAxis() throw( script::BasicErrorException ) 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 ) +ScVbaAxis::ScVbaAxis( const uno::Reference< 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 ); @@ -78,7 +78,7 @@ ScVbaAxis::Delete( ) throw (script::BasicErrorException, uno::RuntimeException) xComponent->dispose(); } - uno::Reference< ::org::openoffice::excel::XAxisTitle > SAL_CALL + uno::Reference< ::ooo::vba::excel::XAxisTitle > SAL_CALL ScVbaAxis::getAxisTitle( ) throw (script::BasicErrorException, uno::RuntimeException) { uno::Reference< excel::XAxisTitle > xAxisTitle; @@ -137,12 +137,12 @@ ScVbaAxis::setCrosses( ::sal_Int32 _nCrosses ) throw (script::BasicErrorExceptio bCrossesAreCustomized = sal_False; return; case xlAxisCrossesMinimum: // The axis crosses at the minimum value. - mxPropertySet->getPropertyValue(MIN) >>= fNum; + mxPropertySet->getPropertyValue(VBA_MIN) >>= fNum; setCrossesAt( fNum ); bCrossesAreCustomized = sal_False; break; case xlAxisCrossesMaximum: // The axis crosses at the maximum value. - mxPropertySet->getPropertyValue(MAX) >>= fNum; + mxPropertySet->getPropertyValue(VBA_MAX) >>= fNum; setCrossesAt(fNum); bCrossesAreCustomized = sal_False; break; @@ -177,7 +177,7 @@ ScVbaAxis::getCrosses( ) throw (script::BasicErrorException, uno::RuntimeExcept mxPropertySet->getPropertyValue(ORIGIN) >>= forigin; //obsolete double fmax = AnyConverter.toDouble(mxPropertySet.getPropertyValue("Max")); double fmin = 0.0; - mxPropertySet->getPropertyValue(MIN) >>= fmin; + mxPropertySet->getPropertyValue(VBA_MIN) >>= fmin; if (forigin == fmin) nCrosses = xlAxisCrossesMinimum; else @@ -666,7 +666,7 @@ ScVbaAxis::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Axis" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Axis" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaaxis.hxx b/sc/source/ui/vba/vbaaxis.hxx index f62e020b371f..b8fafed82ee1 100644 --- a/sc/source/ui/vba/vbaaxis.hxx +++ b/sc/source/ui/vba/vbaaxis.hxx @@ -30,15 +30,15 @@ #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 <ooo/vba/excel/XAxis.hpp> +#include <ooo/vba/excel/XChart.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XAxis > ScVbaAxis_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XAxis > ScVbaAxis_BASE; class ScVbaChart; class ScVbaAxis : public ScVbaAxis_BASE { - css::uno::Reference< oo::excel::XChart > moChartParent; + css::uno::Reference< ov::excel::XChart > moChartParent; css::uno::Reference< css::beans::XPropertySet > mxPropertySet; sal_Int32 mnType; sal_Int32 mnGroup; @@ -46,13 +46,13 @@ class ScVbaAxis : public ScVbaAxis_BASE sal_Bool bCrossesAreCustomized; ScVbaChart* getChartPtr() throw( css::uno::RuntimeException ); sal_Bool isValueAxis() throw( css::script::BasicErrorException ); - std::auto_ptr<oo::ShapeHelper> oShapeHelper; + std::auto_ptr<ov::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 ); + ScVbaAxis( const css::uno::Reference< ov::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 css::uno::Reference< ::ooo::vba::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); diff --git a/sc/source/ui/vba/vbaaxistitle.cxx b/sc/source/ui/vba/vbaaxistitle.cxx index 6287df60b1ad..b0b30e3fc914 100644 --- a/sc/source/ui/vba/vbaaxistitle.cxx +++ b/sc/source/ui/vba/vbaaxistitle.cxx @@ -30,9 +30,9 @@ #include "vbaaxistitle.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; -ScVbaAxisTitle::ScVbaAxisTitle( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& _xTitleShape ) : AxisTitleBase( xParent, xContext, _xTitleShape ) +ScVbaAxisTitle::ScVbaAxisTitle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& _xTitleShape ) : AxisTitleBase( xParent, xContext, _xTitleShape ) { } @@ -51,7 +51,7 @@ ScVbaAxisTitle::getServiceNames() { uno::Sequence< rtl::OUString > BaseServiceNames = AxisTitleBase::getServiceNames(); aServiceNames.realloc( BaseServiceNames.getLength() + 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.AxisTitle" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.AxisTitle" ) ); for ( sal_Int32 index = 1; index < (BaseServiceNames.getLength() + 1); ++index ) aServiceNames[ index ] = BaseServiceNames[ index ]; } diff --git a/sc/source/ui/vba/vbaaxistitle.hxx b/sc/source/ui/vba/vbaaxistitle.hxx index 4af0b7a1d13f..685658cb39eb 100644 --- a/sc/source/ui/vba/vbaaxistitle.hxx +++ b/sc/source/ui/vba/vbaaxistitle.hxx @@ -32,14 +32,14 @@ #include "vbatitle.hxx" #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XAxisTitle.hpp> +#include <ooo/vba/excel/XAxisTitle.hpp> -typedef TitleImpl< cppu::WeakImplHelper1< oo::excel::XAxisTitle > > AxisTitleBase; +typedef TitleImpl< cppu::WeakImplHelper1< ov::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 ); + ScVbaAxisTitle( const css::uno::Reference< ov::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(); diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx index bbebf20ce6af..2344481dc18a 100644 --- a/sc/source/ui/vba/vbaborders.cxx +++ b/sc/source/ui/vba/vbaborders.cxx @@ -30,10 +30,10 @@ #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 <ooo/vba/excel/XlBordersIndex.hpp> +#include <ooo/vba/excel/XlBorderWeight.hpp> +#include <ooo/vba/excel/XlLineStyle.hpp> +#include <ooo/vba/excel/XlColorIndex.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/table/TableBorder.hpp> #include <com/sun/star/table/XColumnRowRange.hpp> @@ -41,8 +41,8 @@ #include "vbapalette.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; -using namespace ::org::openoffice::excel; +using namespace ::ooo::vba; +using namespace ::ooo::vba::excel; typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base; @@ -165,12 +165,12 @@ protected: if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Border" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.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 ) {} + ScVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, ScVbaPalette& rPalette) : ScVbaBorder_Base( uno::Reference< XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {} // XBorder uno::Any SAL_CALL getColor() throw (uno::RuntimeException) @@ -383,7 +383,7 @@ public: } }; -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 ) +ScVbaBorders::ScVbaBorders( const uno::Reference< 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 ) @@ -571,7 +571,7 @@ ScVbaBorders::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Borders" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Borders" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaborders.hxx b/sc/source/ui/vba/vbaborders.hxx index e343ee6a20f7..bcaecff05aff 100644 --- a/sc/source/ui/vba/vbaborders.hxx +++ b/sc/source/ui/vba/vbaborders.hxx @@ -31,7 +31,7 @@ #define SC_VBA_BORDERS_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XBorders.hpp> +#include <ooo/vba/excel/XBorders.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/table/XCellRange.hpp> @@ -40,7 +40,7 @@ #include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< oo::excel::XBorders > ScVbaBorders_BASE; +typedef CollTestImplHelper< ov::excel::XBorders > ScVbaBorders_BASE; class ScVbaPalette; class ScVbaBorders : public ScVbaBorders_BASE { @@ -49,7 +49,7 @@ class ScVbaBorders : public ScVbaBorders_BASE 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 ); + ScVbaBorders( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::table::XCellRange >& xRange, ScVbaPalette& rPalette ); virtual ~ScVbaBorders() {} // XEnumerationAccess diff --git a/sc/source/ui/vba/vbabutton.cxx b/sc/source/ui/vba/vbabutton.cxx index d765f5e79313..4c21c70c88b5 100644 --- a/sc/source/ui/vba/vbabutton.cxx +++ b/sc/source/ui/vba/vbabutton.cxx @@ -31,11 +31,11 @@ #include <vector> using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; 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 ) +ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) { } @@ -53,3 +53,22 @@ ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star { m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); } + +rtl::OUString& +ScVbaButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbabutton.hxx b/sc/source/ui/vba/vbabutton.hxx index fc176a5b0e0b..a2ce28b3ba53 100644 --- a/sc/source/ui/vba/vbabutton.hxx +++ b/sc/source/ui/vba/vbabutton.hxx @@ -30,20 +30,22 @@ #ifndef SC_VBA_BUTTON_HXX #define SC_VBA_BUTTON_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/msforms/XButton.hpp> +#include <ooo/vba/msforms/XButton.hpp> #include "vbacontrol.hxx" #include "vbahelper.hxx" -typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XButton > ButtonImpl_BASE; +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::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 ); + ScVbaButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); // Attributes virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_BUTTON_HXX diff --git a/sc/source/ui/vba/vbacharacters.cxx b/sc/source/ui/vba/vbacharacters.cxx index f26ebdc5adf1..59fe5cf0dde4 100644 --- a/sc/source/ui/vba/vbacharacters.cxx +++ b/sc/source/ui/vba/vbacharacters.cxx @@ -33,10 +33,10 @@ #include "vbafont.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +ScVbaCharacters::ScVbaCharacters( const uno::Reference< 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 ) @@ -46,7 +46,12 @@ ScVbaCharacters::ScVbaCharacters( const uno::Reference< vba::XHelperInterface >& uno::Reference< text::XTextCursor > xTextCursor( m_xSimpleText->createTextCursor(), uno::UNO_QUERY_THROW ); xTextCursor->collapseToStart(); if ( nStart ) + { + if ( ( nStart + 1 ) > m_xSimpleText->getString().getLength() ) + //nStart = m_xSimpleText->getString().getLength(); + xTextCursor->gotoEnd( sal_False ); xTextCursor->goRight( nStart, sal_False ); + } if ( nLength < 0 ) // expand to end xTextCursor->gotoEnd( sal_True ); else @@ -127,7 +132,7 @@ ScVbaCharacters::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Characters" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Characters" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbacharacters.hxx b/sc/source/ui/vba/vbacharacters.hxx index da75775a0521..10fcfc5bbddf 100644 --- a/sc/source/ui/vba/vbacharacters.hxx +++ b/sc/source/ui/vba/vbacharacters.hxx @@ -32,13 +32,13 @@ #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XCharacters.hpp> +#include <ooo/vba/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; +typedef InheritedHelperInterfaceImpl1< ov::excel::XCharacters > ScVbaCharacters_BASE; class ScVbaCharacters : public ScVbaCharacters_BASE { @@ -51,7 +51,7 @@ private: // 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 ); + ScVbaCharacters( const css::uno::Reference< ov::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 @@ -60,8 +60,8 @@ public: 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); + virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFont( const css::uno::Reference< ov::excel::XFont >& _font ) throw (css::uno::RuntimeException); // Methods virtual void SAL_CALL Insert( const ::rtl::OUString& String ) throw (css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx index c2df3de3bf1d..22f9a6a1afdc 100644 --- a/sc/source/ui/vba/vbachart.cxx +++ b/sc/source/ui/vba/vbachart.cxx @@ -40,10 +40,10 @@ #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 <ooo/vba/excel/XlChartType.hpp> +#include <ooo/vba/excel/XlRowCol.hpp> +#include <ooo/vba/excel/XlAxisType.hpp> +#include <ooo/vba/excel/XlAxisGroup.hpp> #include <basic/sberrors.hxx> #include "vbachartobject.hxx" @@ -52,11 +52,11 @@ #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; +using namespace ::ooo::vba; +using namespace ::ooo::vba::excel::XlChartType; +using namespace ::ooo::vba::excel::XlRowCol; +using namespace ::ooo::vba::excel::XlAxisType; +using namespace ::ooo::vba::excel::XlAxisGroup; const rtl::OUString CHART_NAME( RTL_CONSTASCII_USTRINGPARAM("Name") ); // #TODO move this constant to vbaseries.[ch]xx ( when it exists ) @@ -77,7 +77,7 @@ 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 ) +ScVbaChart::ScVbaChart( const css::uno::Reference< ov::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 @@ -562,7 +562,7 @@ ScVbaChart::Activate() throw (script::BasicErrorException, uno::RuntimeException // 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() ); + uno::Reference< XHelperInterface > xParent( getParent() ); ScVbaChartObject* pChartObj = static_cast< ScVbaChartObject* >( xParent.get() ); if ( pChartObj ) pChartObj->Activate(); @@ -571,7 +571,7 @@ ScVbaChart::Activate() throw (script::BasicErrorException, uno::RuntimeException } 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) +ScVbaChart::setSourceData( const css::uno::Reference< ::ooo::vba::excel::XRange >& _xCalcRange, const css::uno::Any& _aPlotBy ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { try { @@ -1156,7 +1156,7 @@ ScVbaChart::getValuesCount(sal_Int32 _seriesIndex) throw ( script::BasicErrorExc uno::Reference< excel::XDataLabels > -ScVbaChart::DataLabels( const uno::Reference< oo::excel::XSeries > /*_oSeries*/ ) throw ( css::script::BasicErrorException ) +ScVbaChart::DataLabels( const uno::Reference< ov::excel::XSeries > /*_oSeries*/ ) throw ( css::script::BasicErrorException ) { if ( true ) throw script::BasicErrorException( rtl::OUString(), uno::Reference< uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() ); @@ -1249,7 +1249,7 @@ ScVbaChart::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Chart" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Chart" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbachart.hxx b/sc/source/ui/vba/vbachart.hxx index 634d751ead86..19efc430f2fd 100644 --- a/sc/source/ui/vba/vbachart.hxx +++ b/sc/source/ui/vba/vbachart.hxx @@ -38,12 +38,12 @@ #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 <ooo/vba/excel/XChart.hpp> +#include <ooo/vba/excel/XDataLabels.hpp> +#include <ooo/vba/excel/XSeries.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1<oo::excel::XChart > ChartImpl_BASE; +typedef InheritedHelperInterfaceImpl1<ov::excel::XChart > ChartImpl_BASE; class ScVbaChart : public ChartImpl_BASE { @@ -73,7 +73,7 @@ friend class ScVbaAxis; 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 ); + ScVbaChart( const css::uno::Reference< ov::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; } @@ -85,7 +85,7 @@ public: 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 ); + css::uno::Reference< ov::excel::XDataLabels > DataLabels( const css::uno::Reference< ov::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 ); @@ -96,7 +96,7 @@ public: 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 void SAL_CALL setSourceData( const css::uno::Reference< ::ooo::vba::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); @@ -106,7 +106,7 @@ public: 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::Reference< ov::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(); diff --git a/sc/source/ui/vba/vbachartobject.cxx b/sc/source/ui/vba/vbachartobject.cxx index c3c4375ca8f3..feecb7182d97 100644 --- a/sc/source/ui/vba/vbachartobject.cxx +++ b/sc/source/ui/vba/vbachartobject.cxx @@ -37,12 +37,12 @@ #include "vbachartobjects.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +ScVbaChartObject::ScVbaChartObject( const css::uno::Reference< ov::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 ); @@ -152,7 +152,7 @@ ScVbaChartObject::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.ChartObject" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.ChartObject" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbachartobject.hxx b/sc/source/ui/vba/vbachartobject.hxx index 9d6bb49feaf7..3b2b6b3469ec 100644 --- a/sc/source/ui/vba/vbachartobject.hxx +++ b/sc/source/ui/vba/vbachartobject.hxx @@ -35,11 +35,11 @@ #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 <ooo/vba/excel/XChartObject.hpp> #include "vbahelperinterface.hxx" #include <memory> -typedef InheritedHelperInterfaceImpl1<oo::excel::XChartObject > ChartObjectImpl_BASE; +typedef InheritedHelperInterfaceImpl1<ov::excel::XChartObject > ChartObjectImpl_BASE; class ScVbaChartObject : public ChartObjectImpl_BASE { @@ -52,15 +52,15 @@ class ScVbaChartObject : public ChartObjectImpl_BASE css::uno::Reference< css::drawing::XShape > xShape; css::uno::Reference< css::container::XNamed > xNamed; rtl::OUString sPersistName; - std::auto_ptr<oo::ShapeHelper> oShapeHelper; + std::auto_ptr<ov::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 ); + ScVbaChartObject( const css::uno::Reference< ov::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 css::uno::Reference< ov::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 diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx index b0b2d6e739ac..7985a1c7c7d7 100644 --- a/sc/source/ui/vba/vbachartobjects.cxx +++ b/sc/source/ui/vba/vbachartobjects.cxx @@ -33,7 +33,7 @@ #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 <ooo/vba/excel/XlChartType.hpp> #include "vbachartobjects.hxx" @@ -44,17 +44,17 @@ #include <basic/sberrors.hxx> using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; class ChartObjectEnumerationImpl : public EnumerationHelperImpl { uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier; - uno::Reference< vba::XHelperInterface > xParent; + uno::Reference< 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 ) {} + ChartObjectEnumerationImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< drawing::XDrawPageSupplier >& _xDrawPageSupplier, const uno::Reference< 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 ); @@ -64,7 +64,7 @@ public: }; -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 ) +ScVbaChartObjects::ScVbaChartObjects( const css::uno::Reference< ov::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 ) { } @@ -191,7 +191,7 @@ ScVbaChartObjects::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.ChartObjects") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.ChartObjects") ); } return sNames; } diff --git a/sc/source/ui/vba/vbachartobjects.hxx b/sc/source/ui/vba/vbachartobjects.hxx index 5a9db61d9979..a966dbb66518 100644 --- a/sc/source/ui/vba/vbachartobjects.hxx +++ b/sc/source/ui/vba/vbachartobjects.hxx @@ -29,8 +29,8 @@ ************************************************************************/ #ifndef SC_VBA_CHARTOBJECTS_HXX #define SC_VBA_CHARTOBJECTS_HXX -#include <org/openoffice/excel/XChartObjects.hpp> -#include <org/openoffice/excel/XChartObject.hpp> +#include <ooo/vba/excel/XChartObjects.hpp> +#include <ooo/vba/excel/XChartObject.hpp> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/table/XTableCharts.hpp> @@ -40,10 +40,10 @@ #include "vbahelper.hxx" #include <hash_map> -typedef CollTestImplHelper< oo::excel::XChartObjects > ChartObjects_BASE; +typedef CollTestImplHelper< ov::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 >, +css::uno::Reference< ov::excel::XChartObject >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > aHashTable; */ @@ -54,9 +54,9 @@ 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 ); + //css::uno::Reference< ov::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 ); + ScVbaChartObjects( const css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbacharts.cxx b/sc/source/ui/vba/vbacharts.cxx index 24993579478b..73be2b84e6c6 100644 --- a/sc/source/ui/vba/vbacharts.cxx +++ b/sc/source/ui/vba/vbacharts.cxx @@ -32,10 +32,10 @@ #include <com/sun/star/table/XTableChartsSupplier.hpp> using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; -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 >() ) +ScVbaCharts::ScVbaCharts( const css::uno::Reference< ov::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 ) @@ -118,7 +118,7 @@ ScVbaCharts::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Charts") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Charts") ); } return sNames; } diff --git a/sc/source/ui/vba/vbacharts.hxx b/sc/source/ui/vba/vbacharts.hxx index ae0bb353e4a1..f3bbf80f8d16 100644 --- a/sc/source/ui/vba/vbacharts.hxx +++ b/sc/source/ui/vba/vbacharts.hxx @@ -29,30 +29,30 @@ ************************************************************************/ #ifndef SC_VBA_CHARTS_HXX #define SC_VBA_CHARTS_HXX -#include <org/openoffice/excel/XCharts.hpp> +#include <ooo/vba/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; +typedef CollTestImplHelper< ov::excel::XCharts > Charts_BASE; class ScVbaCharts : public Charts_BASE { - css::uno::Reference< oo::excel::XChart > xActiveChart; + css::uno::Reference< ov::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 ); + ScVbaCharts( const css::uno::Reference< ov::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); + virtual css::uno::Reference< ov::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); } + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) { return ov::excel::XChart::static_type(0); } // ScVbaCollectionBaseImpl virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); // Charts_BASE or HelperInterface diff --git a/sc/source/ui/vba/vbacharttitle.cxx b/sc/source/ui/vba/vbacharttitle.cxx index 32492de637b2..7c90ea8edce0 100644 --- a/sc/source/ui/vba/vbacharttitle.cxx +++ b/sc/source/ui/vba/vbacharttitle.cxx @@ -29,10 +29,10 @@ ************************************************************************/ #include "vbacharttitle.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +ScVbaChartTitle::ScVbaChartTitle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& _xTitleShape ) : ChartTitleBase( xParent, xContext, _xTitleShape ) { } @@ -51,7 +51,7 @@ ScVbaChartTitle::getServiceNames() { uno::Sequence< rtl::OUString > BaseServiceNames = ChartTitleBase::getServiceNames(); aServiceNames.realloc( BaseServiceNames.getLength() + 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Chart" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Chart" ) ); for ( sal_Int32 index = 1; index < (BaseServiceNames.getLength() + 1); ++index ) aServiceNames[ index ] = BaseServiceNames[ index ]; } diff --git a/sc/source/ui/vba/vbacharttitle.hxx b/sc/source/ui/vba/vbacharttitle.hxx index 56dc2add7995..6108c9b0ae93 100644 --- a/sc/source/ui/vba/vbacharttitle.hxx +++ b/sc/source/ui/vba/vbacharttitle.hxx @@ -31,15 +31,15 @@ #define SC_VBA_CHARTTITLE_HXX #include "vbatitle.hxx" #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XChartTitle.hpp> +#include <ooo/vba/excel/XChartTitle.hpp> -typedef TitleImpl< cppu::WeakImplHelper1< oo::excel::XChartTitle > > ChartTitleBase; +typedef TitleImpl< cppu::WeakImplHelper1< ov::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 ); + ScVbaChartTitle( const css::uno::Reference< ov::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(); diff --git a/sc/source/ui/vba/vbacheckbox.cxx b/sc/source/ui/vba/vbacheckbox.cxx new file mode 100644 index 000000000000..0a53d05f985f --- /dev/null +++ b/sc/source/ui/vba/vbacheckbox.cxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 "vbacheckbox.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); +ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaCheckbox::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +uno::Any SAL_CALL +ScVbaCheckbox::getValue() throw (css::uno::RuntimeException) +{ + sal_Int16 nValue = -1; + m_xProps->getPropertyValue( STATE ) >>= nValue; + if( nValue != 0 ) + nValue = -1; +// return uno::makeAny( nValue ); +// I must be missing something MSO says value should be -1 if selected, 0 if not +// selected + return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); +} + +void SAL_CALL +ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException) +{ + sal_Int16 nValue = 0; + sal_Bool bValue = false; + if( _value >>= nValue ) + { + if( nValue == -1) + nValue = 1; + } + else if ( _value >>= bValue ) + { + if ( bValue ) + nValue = 1; + } + m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); +} +rtl::OUString& +ScVbaCheckbox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaCheckbox::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbacheckbox.hxx b/sc/source/ui/vba/vbacheckbox.hxx new file mode 100644 index 000000000000..58805c6b4b7c --- /dev/null +++ b/sc/source/ui/vba/vbacheckbox.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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_CHECKBOX_HXX +#define SC_VBA_CHECKBOX_HXX +#include <cppuhelper/implbase2.hxx> +#include <ooo/vba/msforms/XRadioButton.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE; + +class ScVbaCheckbox : public CheckBoxImpl_BASE +{ +public: + ScVbaCheckbox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif //SC_VBA_CHECKBOX_HXX diff --git a/sc/source/ui/vba/vbacollectionimpl.cxx b/sc/source/ui/vba/vbacollectionimpl.cxx index 20205b63803c..fdf7a2ebc976 100644 --- a/sc/source/ui/vba/vbacollectionimpl.cxx +++ b/sc/source/ui/vba/vbacollectionimpl.cxx @@ -30,7 +30,7 @@ #include <vbacollectionimpl.hxx> #include "vbaglobals.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; ScVbaCollectionBaseImpl::ScVbaCollectionBaseImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : m_xContext( xContext ), m_xIndexAccess( xIndexAccess ) diff --git a/sc/source/ui/vba/vbacollectionimpl.hxx b/sc/source/ui/vba/vbacollectionimpl.hxx index ce12ba7f9c60..14fceb1b5f71 100644 --- a/sc/source/ui/vba/vbacollectionimpl.hxx +++ b/sc/source/ui/vba/vbacollectionimpl.hxx @@ -30,8 +30,8 @@ #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 <ooo/vba/XCollection.hpp> +//#include <ooo/vba/XCollectionTest.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/script/XDefaultMethod.hpp> @@ -187,7 +187,7 @@ protected: 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); } + ScVbaCollectionBase( const css::uno::Reference< ov::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) { @@ -235,14 +235,14 @@ public: }; -typedef ::cppu::WeakImplHelper1<oo::vba::XCollection> XCollection_InterfacesBASE; +typedef ::cppu::WeakImplHelper1<ov::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){} + ScVbaCollectionBaseImpl( const css::uno::Reference< ov::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){} }; @@ -252,7 +252,7 @@ class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< 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 ) {} + CollTestImplHelper( const css::uno::Reference< ov::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 ) {} }; diff --git a/sc/source/ui/vba/vbacolorformat.cxx b/sc/source/ui/vba/vbacolorformat.cxx index f2e3a5b891c0..df918e9d15fc 100644 --- a/sc/source/ui/vba/vbacolorformat.cxx +++ b/sc/source/ui/vba/vbacolorformat.cxx @@ -28,10 +28,10 @@ * ************************************************************************/ #include <com/sun/star/beans/XPropertySet.hpp> -#include <org/openoffice/msforms/XLineFormat.hpp> +#include <ooo/vba/msforms/XLineFormat.hpp> #include "vbacolorformat.hxx" -using namespace org::openoffice; +using namespace ooo::vba; using namespace com::sun::star; sal_Int32 @@ -51,13 +51,13 @@ MsoColorIndizes::getColorIndex( sal_Int32 nIndex ) }; 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 ) +ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< 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 ); + uno::Reference< ov::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW ); m_pFillFormat = ( ScVbaFillFormat* )( xFillFormat.get() ); }catch ( uno::RuntimeException e ) { @@ -183,7 +183,7 @@ ScVbaColorFormat::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msforms.ColorFormat" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ColorFormat" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbacolorformat.hxx b/sc/source/ui/vba/vbacolorformat.hxx index da48d3824ced..cff4f7c3719d 100644 --- a/sc/source/ui/vba/vbacolorformat.hxx +++ b/sc/source/ui/vba/vbacolorformat.hxx @@ -31,12 +31,12 @@ #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 <ooo/vba/msforms/XColorFormat.hpp> +#include <ooo/vba/msforms/XFillFormat.hpp> #include "vbahelperinterface.hxx" #include "vbafillformat.hxx" -typedef InheritedHelperInterfaceImpl1< oo::msforms::XColorFormat > ScVbaColorFormat_BASE; +typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE; class ColorFormatType { @@ -104,7 +104,7 @@ struct MsoColorIndizes class ScVbaColorFormat : public ScVbaColorFormat_BASE { private: - css::uno::Reference< oo::vba::XHelperInterface > m_xInternalParent; + css::uno::Reference< ov::XHelperInterface > m_xInternalParent; css::uno::Reference< css::drawing::XShape > m_xShape; css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; ScVbaFillFormat *m_pFillFormat; @@ -115,7 +115,7 @@ protected: 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 ); + ScVbaColorFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbacombobox.cxx b/sc/source/ui/vba/vbacombobox.cxx index bf2183dc82e5..e13ab7d7bf2d 100644 --- a/sc/source/ui/vba/vbacombobox.cxx +++ b/sc/source/ui/vba/vbacombobox.cxx @@ -31,25 +31,29 @@ #include <vector> using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; -const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") ); +//SelectedItems list of integer indexes +//StringItemList list of items + +const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") ); +const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ); const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); +const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") ); -ScVbaComboBox::ScVbaComboBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : ComboBoxImpl_BASE( xContext, xControlShape ) +ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType ) { + mpListHelper.reset( new ListControlHelper( m_xProps ) ); // grab the default value property name m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName; } -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 -// Attributes +// Value, [read] e.g. getValue returns the value of ooo Text propery e.g. the value in +// the drop down uno::Any SAL_CALL ScVbaComboBox::getValue() throw (uno::RuntimeException) { @@ -57,11 +61,48 @@ ScVbaComboBox::getValue() throw (uno::RuntimeException) } void SAL_CALL +ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException) +{ + uno::Sequence< sal_Int16 > sSelection(1); + _value >>= sSelection[ 0 ]; + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) ); +} + +uno::Any SAL_CALL +ScVbaComboBox::getListIndex() throw (uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > sItems; + m_xProps->getPropertyValue( ITEMS ) >>= sItems; + // should really return the item that has focus regardless of + // it been selected + if ( sItems.getLength() > 0 ) + { + rtl::OUString sText = getText(); + sal_Int32 nLen = sItems.getLength(); + for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index ) + { + if ( sItems[ index ].equals( sText ) ) + { + OSL_TRACE("getListIndex returning %d", index ); + return uno::makeAny( index ); + } + + } + } + OSL_TRACE("getListIndex returning %d", -1 ); + return uno::makeAny( sal_Int32( -1 ) ); +} + +// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one +// of the values in the list then the selection is also set +void SAL_CALL ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) { m_xProps->setPropertyValue( sSourceName, _value ); } +// see Value + ::rtl::OUString SAL_CALL ScVbaComboBox::getText() throw (uno::RuntimeException) { @@ -80,63 +121,55 @@ ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeExcept void SAL_CALL ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException) { + mpListHelper->AddItem( pvargItem, pvargIndex ); +} - if ( pvargItem.hasValue() ) +void SAL_CALL +ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException) { - 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; + mpListHelper->removeItem( index ); +} - // 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() ) +void SAL_CALL +ScVbaComboBox::Clear( ) throw (uno::RuntimeException) { - sal_Int32 nOldSize = sList.getLength(); - sList.realloc( nOldSize + 1 ); - sList[ nOldSize ] = sString; + mpListHelper->Clear(); } - 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; - // + +void SAL_CALL +ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException) +{ + ScVbaControl::setRowSource( _rowsource ); + mpListHelper->setRowSource( _rowsource ); } - m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); +sal_Int32 SAL_CALL +ScVbaComboBox::getListCount() throw (uno::RuntimeException) +{ + return mpListHelper->getListCount(); +} +uno::Any SAL_CALL +ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) +{ + return mpListHelper->List( pvargIndex, pvarColumn ); } + +rtl::OUString& +ScVbaComboBox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") ); + return sImplName; } -void SAL_CALL -ScVbaComboBox::Clear( ) throw (uno::RuntimeException) +uno::Sequence< rtl::OUString > +ScVbaComboBox::getServiceNames() { - setValue( uno::makeAny( rtl::OUString() ) ); - m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) ); + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ComboBox" ) ); + } + return aServiceNames; } diff --git a/sc/source/ui/vba/vbacombobox.hxx b/sc/source/ui/vba/vbacombobox.hxx index bf56570ea45b..d1cf47c9c7b2 100644 --- a/sc/source/ui/vba/vbacombobox.hxx +++ b/sc/source/ui/vba/vbacombobox.hxx @@ -33,33 +33,30 @@ #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 <ooo/vba/msforms/XComboBox.hpp> #include <comphelper/proparrhlp.hxx> #include <comphelper/propertycontainer.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include "vbacontrol.hxx" +#include "vbalistcontrolhelper.hxx" #include "vbahelper.hxx" -typedef cppu::ImplInheritanceHelper2<ScVbaControl, oo::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE; +typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::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; + std::auto_ptr< ListControlHelper > mpListHelper; rtl::OUString sSourceName; rtl::OUString msDftPropName; - + bool mbDialogType; 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 ); - + ScVbaComboBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialogType = false ); // Attributes + virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); + virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); @@ -67,10 +64,17 @@ public: // Methods virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); + // XControl + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); // XDefaultProperty ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif // diff --git a/sc/source/ui/vba/vbacommandbar.cxx b/sc/source/ui/vba/vbacommandbar.cxx new file mode 100644 index 000000000000..ca463a4f746b --- /dev/null +++ b/sc/source/ui/vba/vbacommandbar.cxx @@ -0,0 +1,329 @@ +/************************************************************************* + * + * 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/ui/XModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include "vbacommandbar.hxx" +#include "vbacommandbarcontrols.hxx" +#include "vbahelper.hxx" + + +using namespace com::sun::star; +using namespace ooo::vba; + +ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ) +{ + // it's a menu bar + // only supporting factory menus ( no custom menus ) + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); + initCommandBar(); + switch( nModuleType ) + { + case 0: + m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ); + break; + case 1: + m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ); + break; + default: + m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ); + } + getMenuSettings(); + m_bIsMenu = sal_True; + m_bCustom = sal_False; +} +ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ) +{ + // it's a tool bar + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); + initCommandBar(); + m_bTemporary = bTemporary; + m_bCreate = bCreate; + // get OOo ToolBarName + CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() ); + if( iter != mCommandBarNameMap.end() ) + { + m_sToolBarName = iter->second; + } + else + { + m_sToolBarName = sToolBarName; + } + m_sUIName = m_sToolBarName; + m_bIsMenu = sal_False; + getToolBarSettings( m_sToolBarName ); +} +void +ScVbaCommandBar::initCommandBar() throw (uno::RuntimeException) +{ + m_pScVbaCommandBars = dynamic_cast< ScVbaCommandBars* >( m_xParentHardRef.get() ); + if ( !m_pScVbaCommandBars ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBars"), uno::Reference< uno::XInterface >() ); + m_bIsMenu = sal_False; + m_bCustom = sal_False; + m_bTemporary = sal_True; + m_sToolBarName = rtl::OUString::createFromAscii(""); + m_sUIName = rtl::OUString::createFromAscii(""); + m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ); +} +void +ScVbaCommandBar::getToolBarSettings( rtl::OUString sToolBarName ) throw( uno::RuntimeException ) +{ + rtl::OUString sFactoryToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/") + sToolBarName.toAsciiLowerCase(); + rtl::OUString sCustomToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/custom_toolbar_") + sToolBarName; + uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW ); + m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_pScVbaCommandBars->GetModuleName() ), uno::UNO_QUERY_THROW ); + m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW ); + if( m_xUICfgManager->hasSettings( sFactoryToolBar ) ) + { + // exsiting standard ToolBar + m_xBarSettings.set( m_xUICfgManager->getSettings( sFactoryToolBar, sal_True ), uno::UNO_QUERY_THROW ); + m_sToolBarName = sFactoryToolBar; + } + else if( m_xUICfgManager->hasSettings( sCustomToolBar ) ) + { + // exisiting custom ToolBar + m_xBarSettings.set( m_xUICfgManager->getSettings( sCustomToolBar, sal_True ), uno::UNO_QUERY_THROW ); + m_sToolBarName = sCustomToolBar; + m_bCustom = sal_True; + } + else if( m_bCreate ) + { + // new custom ToolBar + m_xBarSettings.set( m_xUICfgManager->createSettings(), uno::UNO_QUERY_THROW ); + m_sToolBarName = sCustomToolBar; + m_bCustom = sal_True; + addCustomBar(); + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii("ToolBar do not exist"), uno::Reference< uno::XInterface >() ); + if( m_pScVbaCommandBars->GetWindows()->hasByName( m_sToolBarName ) ) + { + uno::Any aToolBar = m_pScVbaCommandBars->GetWindows()->getByName( m_sToolBarName ); + aToolBar >>= m_aToolBar; + } +} +void +ScVbaCommandBar::addCustomBar() +{ + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); + xPropertySet->setPropertyValue(rtl::OUString::createFromAscii("UIName"), uno::makeAny( m_sUIName )); + + if( m_xUICfgManager->hasSettings(m_sToolBarName) ) + { + m_xUICfgManager->replaceSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + else + { + m_xUICfgManager->insertSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } +} +void +ScVbaCommandBar::getMenuSettings() +{ + try + { + rtl::OUString sMenuBar = rtl::OUString::createFromAscii( "private:resource/menubar/menubar" ); + uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW ); + m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_sMenuModuleName ), uno::UNO_QUERY_THROW ); + m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW ); + m_xBarSettings.set( m_xUICfgManager->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW ); + } + catch ( uno::Exception e) + { + OSL_TRACE( "getMenuSetting got a error\n" ); + } +} +::rtl::OUString SAL_CALL +ScVbaCommandBar::getName() throw ( uno::RuntimeException ) +{ + // This will get a "NULL length string" when Name is not set. + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); + uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ); + rtl::OUString sName; + aName >>= sName; + if( sName.getLength() < 1 && !m_bIsMenu ) + { + uno::Reference< container::XNameAccess > xNameAccess( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW ); + if( xNameAccess->hasByName( m_sToolBarName ) ) + { + beans::PropertyValues aToolBar; + xNameAccess->getByName( m_sToolBarName ) >>= aToolBar; + sal_Int32 nCount = aToolBar.getLength(); + beans::PropertyValue aPropertyValue; + for( sal_Int32 i = 0; i < nCount; i++ ) + { + aPropertyValue = aToolBar[i]; + if( aPropertyValue.Name.equals( rtl::OUString::createFromAscii("UIName") ) ) + { + aPropertyValue.Value >>= sName; + return sName; + } + } + } + } + return sName; +} +void SAL_CALL +ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); + xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) ); + uno::Reference< container::XIndexAccess > xIndexAccess( m_xBarSettings, uno::UNO_QUERY_THROW ); + + if( m_xUICfgManager->hasSettings( m_sToolBarName ) ) + { + m_xUICfgManager->replaceSettings( m_sToolBarName, xIndexAccess ); + } + else + { + // toolbar not found + } + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } +} +::sal_Bool SAL_CALL +ScVbaCommandBar::getVisible() throw (uno::RuntimeException) +{ + sal_Bool bVisible = sal_False; + try + { + sal_Int32 i = 0; + while( !m_aToolBar[i].Name.equals( rtl::OUString::createFromAscii( "Visible" ) ) ) + { + i++; + } + m_aToolBar[i].Value >>= bVisible; + } + catch ( uno::Exception e ) + { + } + return bVisible; +} +void SAL_CALL +ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) +{ + try + { + uno::Reference< frame::XFrame > xFrame( getCurrentDocument()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW ); + uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW ); + if( _visible ) + { + xLayoutManager->createElement( m_sToolBarName ); + xLayoutManager->showElement( m_sToolBarName ); + } + else + { + xLayoutManager->hideElement( m_sToolBarName ); + xLayoutManager->destroyElement( m_sToolBarName ); + } + } + catch( uno::Exception e ) + { + OSL_TRACE( "SetVisible get an exception\n" ); + } +} +void SAL_CALL +ScVbaCommandBar::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) +{ + if( m_bCustom ) + { + if( m_xUICfgManager->hasSettings( m_sToolBarName ) ) + { + m_xUICfgManager->removeSettings(m_sToolBarName); + // make it permanent + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } + } + else + { + // toolbar not found + // TODO throw Error + } + uno::Reference< container::XNameContainer > xNameContainer( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW ); + if( xNameContainer->hasByName( m_sToolBarName ) ) + { + xNameContainer->removeByName( m_sToolBarName ); + } + } +} +uno::Any SAL_CALL +ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException) +{ + sal_Int32 nIndex; + uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) ); + if( aIndex.hasValue() ) + { + if( aIndex >>= nIndex ) + { + uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW ); + return uno::makeAny( xCommandBarControl ); + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() ); + } + return uno::makeAny( xCommandBarControls ); +} +rtl::OUString& +ScVbaCommandBar::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") ); + return sImplName; +} +uno::Sequence<rtl::OUString> +ScVbaCommandBar::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBar" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbacommandbar.hxx b/sc/source/ui/vba/vbacommandbar.hxx new file mode 100644 index 000000000000..303dc0ada798 --- /dev/null +++ b/sc/source/ui/vba/vbacommandbar.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * 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_COMMANDBAR_HXX +#define SC_VBA_COMMANDBAR_HXX + +#include <ooo/vba/XCommandBar.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> + +#include "vbahelperinterface.hxx" +#include "vbacommandbars.hxx" + +#include <map> +typedef std::map< const rtl::OUString, rtl::OUString > CommandBarNameMap; +typedef std::pair< const rtl::OUString, rtl::OUString > CommandBarNamePair; +const CommandBarNamePair namePair[] = { + CommandBarNamePair( rtl::OUString::createFromAscii("standard"), rtl::OUString::createFromAscii("standardbar") ), + CommandBarNamePair( rtl::OUString::createFromAscii("formatting"), rtl::OUString::createFromAscii("formatobjectbar") ), +}; +static const CommandBarNameMap mCommandBarNameMap( namePair, ( namePair + sizeof(namePair) / sizeof(namePair[0]) ) ); + + +typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE; + +class ScVbaCommandBar : public CommandBar_BASE +{ +private: + rtl::OUString m_sToolBarName; + rtl::OUString m_sMenuModuleName; + rtl::OUString m_sUIName; + sal_Bool m_bTemporary; + sal_Bool m_bIsMenu; + sal_Bool m_bCustom; + sal_Bool m_bCreate; + ScVbaCommandBars* m_pScVbaCommandBars; + css::beans::PropertyValues m_aToolBar; + // hard reference for parent + css::uno::Reference< ov::XHelperInterface > m_xParentHardRef; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager; + css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers; + css::uno::Reference< css::container::XIndexContainer > m_xBarSettings; + void initCommandBar() throw( css::uno::RuntimeException ); +protected: + void getToolBarSettings( rtl::OUString sToolBarName ) throw( css::uno::RuntimeException ); + void getMenuSettings(); + void addCustomBar(); +public: + ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw( css::uno::RuntimeException ); + ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw( css::uno::RuntimeException ); + + sal_Bool IsMenu() { return m_bIsMenu; }; + css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; }; + css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; }; + css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; }; + rtl::OUString GetToolBarName() { return m_sToolBarName; }; + + // 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 ::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::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif//SC_VBA_COMMANDBAR_HXX diff --git a/sc/source/ui/vba/vbacommandbarcontrol.cxx b/sc/source/ui/vba/vbacommandbarcontrol.cxx new file mode 100644 index 000000000000..74e38bffb81c --- /dev/null +++ b/sc/source/ui/vba/vbacommandbarcontrol.cxx @@ -0,0 +1,403 @@ +/************************************************************************* + * + * 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 "vbacommandbarcontrol.hxx" + +using namespace com::sun::star; +using namespace ooo::vba; + +uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName ) +{ + sal_Int32 nCount = aPropertyValues.getLength(); + for( sal_Int32 i = 0; i < nCount; i++ ) + { + if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) ) + { + return aPropertyValues[i].Value; + } + } + return uno::Any(); +} + +beans::PropertyValues lcl_repalcePropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName, uno::Any aValue ) +{ + sal_Int32 nCount = aPropertyValues.getLength(); + for( sal_Int32 i = 0; i < nCount; i++ ) + { + if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) ) + { + aPropertyValues[i].Value = aValue; + return aPropertyValues; + } + } + return aPropertyValues; +} + +ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ) +{ + // exsiting CommandBarBarControl + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); + initObjects(); + if( m_xBarSettings->hasElements() ) + { + ScVbaCommandBarControl* pParentCommandBarControl = m_pCommandBarControls->GetParentCommandBarControl(); + if( pParentCommandBarControl ) + { + beans::PropertyValues aPropertyValues; + pParentCommandBarControl->GetCurrentSettings()->getByIndex( pParentCommandBarControl->GetPosition() ) >>= aPropertyValues; + pParentCommandBarControl->SetPropertyValues( aPropertyValues ); + m_xCurrentSettings.set( lcl_getPropertyValue( pParentCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY_THROW ); + } + if( !m_xCurrentSettings.is() ) + { + m_xCurrentSettings.set( m_xUICfgManager->getSettings( m_pCommandBarControls->GetParentToolBarName(), sal_True ), uno::UNO_QUERY_THROW ); + } + for( sal_Int32 i = 0; i < m_xCurrentSettings->getCount(); i++ ) + { + beans::PropertyValues aPropertyValuesTemp; + m_xCurrentSettings->getByIndex( i ) >>= aPropertyValuesTemp; + // Label always empty in OOo + rtl::OUString sLabel; + lcl_getPropertyValue( aPropertyValuesTemp, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel; + if( sLabel.equalsIgnoreAsciiCase( sName ) ) + { + m_nPosition = i; + break; + } + // using CammandURL to find + rtl::OUString sCommandURL; + lcl_getPropertyValue( aPropertyValuesTemp, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL; + sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") ); + if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sCommandURL.getLength() ) ) + { + sCommandURL = sCommandURL.copy( nLastIndex + 1 ); + } + if( sCommandURL.equalsIgnoreAsciiCase( sName ) ) + { + m_nPosition = i; + break; + } + } + if( m_nPosition == -1 ) + throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() ); + } + if( m_bIsMenu ) + { + m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar"); + } + else + { + m_sBarName = m_pCommandBarControls->GetParentToolBarName(); + } + m_bTemporary = sal_True; +} +ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, rtl::OUString sCommand, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ) +{ + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); + initObjects(); + if( sName.getLength() > 0 ) + { + m_sName = sName; + } + if( sCommand.getLength() > 0 ) + { + m_sCommand = sCommand; + } + else + { + m_sCommand = rtl::OUString::createFromAscii("vnd.openoffice.org:") + sName; + } + if( m_bIsMenu ) + { + m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar"); + createNewMenuBarControl(); + } + else + { + m_sBarName = m_pCommandBarControls->GetParentToolBarName(); + createNewToolBarControl(); + } +} + +void +ScVbaCommandBarControl::initObjects() throw (uno::RuntimeException) +{ + m_pCommandBarControls = dynamic_cast< ScVbaCommandBarControls* >( m_xParentHardRef.get() ); + if( !m_pCommandBarControls ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBarControls"), uno::Reference< uno::XInterface >() ); + m_xUICfgManager.set( m_pCommandBarControls->GetUICfgManager(), uno::UNO_QUERY_THROW ); + m_xUICfgPers.set( m_pCommandBarControls->GetUICfgPers(), uno::UNO_QUERY_THROW ); + m_xBarSettings.set( m_pCommandBarControls->GetBarSettings(), uno::UNO_QUERY_THROW ); + m_bIsMenu = m_pCommandBarControls->IsMenu(); + m_sName = rtl::OUString::createFromAscii( "Custom" ); + m_nPosition = -1; +} + +void +ScVbaCommandBarControl::createNewMenuBarControl() +{ + uno::Sequence< beans::PropertyValue > aPropertys(4); + aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL"); + aPropertys[0].Value <<= m_sCommand; + aPropertys[1].Name = rtl::OUString::createFromAscii("Label"); + aPropertys[1].Value <<= m_sName; + aPropertys[2].Name = rtl::OUString::createFromAscii("Type"); + aPropertys[2].Value <<= m_nType; + aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer"); + + m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) ); + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); + rtl::OUString sUIName; + xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ) >>= sUIName; + + uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW ); + if( m_pCommandBarControls->GetParentCommandBar() != NULL ) + { + // create a new menu + m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) ); + m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW ); + } + else if( m_pCommandBarControls->GetParentCommandBarControl() != NULL ) + { + // create a new menu entry + // change the parent MenuItem to a PopupMenu + ScVbaCommandBarControl* pPc = m_pCommandBarControls->GetParentCommandBarControl(); + beans::PropertyValues aPropertyValues; + pPc->GetCurrentSettings()->getByIndex( pPc->GetPosition() ) >>= aPropertyValues; + pPc->SetPropertyValues( aPropertyValues ); + + // has the property already been set? + if( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ).hasValue() ) + { + lcl_repalcePropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer"), uno::makeAny( xMenuMSF->createInstanceWithContext( mxContext ) ) ); + pPc->GetCurrentSettings()->replaceByIndex( pPc->GetPosition(), uno::makeAny( pPc->GetPropertyValues() ) ); + } + m_xCurrentSettings.set( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY_THROW ); + m_xCurrentSettings->insertByIndex( m_nPosition, uno::makeAny( m_aPropertyValues ) ); + } + if( m_xUICfgManager->hasSettings( m_sBarName ) ) + { + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + else + { + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } +} + +void +ScVbaCommandBarControl::createNewToolBarControl() +{ + uno::Sequence< beans::PropertyValue > aPropertys(4); + aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL"); + aPropertys[0].Value <<= m_sCommand; + aPropertys[1].Name = rtl::OUString::createFromAscii("Label"); + aPropertys[1].Value <<= m_sName; + aPropertys[2].Name = rtl::OUString::createFromAscii("Type"); + aPropertys[2].Value <<= m_nType; + aPropertys[3].Name = rtl::OUString::createFromAscii("IsVisible"); + aPropertys[3].Value <<= sal_True; + + m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) ); + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW ); + rtl::OUString sUIName; + xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ) >>= sUIName; + + m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW ); + if( m_xUICfgManager->hasSettings( m_sBarName ) ) + { + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + else + { + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } +} + +::rtl::OUString SAL_CALL +ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException ) +{ + // "Label" always empty + rtl::OUString sCaption; + beans::PropertyValues aPropertyValues; + if( m_xCurrentSettings.is() ) + { + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption; + } + else if( m_xBarSettings.is() ) + { + m_xBarSettings->getByIndex( m_nPosition ) >>= aPropertyValues; + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption; + } + return sCaption; +} +void SAL_CALL +ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException) +{ + if( m_xCurrentSettings.is() ) + { + beans::PropertyValues aPropertyValues; + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; + beans::PropertyValues aNewPropertyValues; + aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( _caption ) ); + m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) ); + if( m_xUICfgManager->hasSettings( m_sBarName ) ) + { + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + else + { + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + // make it permanent + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } + } +} +::rtl::OUString SAL_CALL +ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException) +{ + if( m_xCurrentSettings.is() ) + { + beans::PropertyValues aPropertyValues; + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; + rtl::OUString sCommandURL; + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL; + return sCommandURL; + } + return ::rtl::OUString(); +} +void SAL_CALL +ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException) +{ + if( m_xCurrentSettings.is() ) + { + beans::PropertyValues aPropertyValues; + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues; + beans::PropertyValues aNewPropertyValues; + aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( _onaction ) ); + m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) ); + if( m_xUICfgManager->hasSettings( m_sBarName ) ) + { + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + else + { + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + // make it permanent + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } + } +} +::sal_Bool SAL_CALL +ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException) +{ + // not possible in UNO? + return sal_True; +} +void SAL_CALL +ScVbaCommandBarControl::setVisible( ::sal_Bool /*_visible*/ ) throw (uno::RuntimeException) +{ + // "IsVisilbe" +} +void SAL_CALL +ScVbaCommandBarControl::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) +{ + if( m_xCurrentSettings.is() ) + { + m_xCurrentSettings->removeByIndex( m_nPosition ); + + if( m_xUICfgManager->hasSettings( m_sBarName ) ) + { + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + else + { + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) ); + } + // make it permanent + if( !m_bTemporary ) + { + m_xUICfgPers->store(); + } + } +} +uno::Any SAL_CALL +ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException) +{ + sal_Int32 nIndex; + uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) ); + if( aIndex.hasValue() ) + { + if( aIndex >>= nIndex ) + { + uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW ); + return uno::makeAny( xCommandBarControl ); + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() ); + } + return uno::makeAny( xCommandBarControls ); +} +rtl::OUString& +ScVbaCommandBarControl::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControl") ); + return sImplName; +} +uno::Sequence<rtl::OUString> +ScVbaCommandBarControl::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControl" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbacommandbarcontrol.hxx b/sc/source/ui/vba/vbacommandbarcontrol.hxx new file mode 100644 index 000000000000..a77c4b64b56f --- /dev/null +++ b/sc/source/ui/vba/vbacommandbarcontrol.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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_COMMANDBARCONTROL_HXX +#define SC_VBA_COMMANDBARCONTROL_HXX + +#include <ooo/vba/XCommandBarControl.hpp> + +#include "vbahelperinterface.hxx" +#include "vbacommandbarcontrols.hxx" + +typedef InheritedHelperInterfaceImpl1< ov::XCommandBarControl > CommandBarControl_BASE; + +class ScVbaCommandBarControl : public CommandBarControl_BASE +{ +private: + rtl::OUString m_sName; + rtl::OUString m_sBarName; + rtl::OUString m_sCommand; + sal_Int32 m_nType; + sal_Int32 m_nPosition; + sal_Bool m_bTemporary; + sal_Bool m_bIsMenu; + ScVbaCommandBarControls* m_pCommandBarControls; + css::uno::Reference< ov::XHelperInterface > m_xParentHardRef; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager; + css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers; + css::uno::Reference< css::container::XIndexContainer > m_xBarSettings; + css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings; + css::beans::PropertyValues m_aPropertyValues; + + void initObjects() throw (css::uno::RuntimeException); + void createNewMenuBarControl(); + void createNewToolBarControl(); +public: + ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName ) throw (css::uno::RuntimeException); + ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, rtl::OUString sCommand, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException); + sal_Int32 GetPosition() { return m_nPosition; }; + css::uno::Reference< css::container::XIndexContainer > GetCurrentSettings() { return m_xCurrentSettings; }; + css::beans::PropertyValues GetPropertyValues() { return m_aPropertyValues; }; + void SetPropertyValues( css::beans::PropertyValues aPropertyValues ) { m_aPropertyValues = aPropertyValues; }; + + // 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 ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException); + virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) 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::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif//SC_VBA_COMMANDBARCONTROL_HXX diff --git a/sc/source/ui/vba/vbacommandbarcontrols.cxx b/sc/source/ui/vba/vbacommandbarcontrols.cxx new file mode 100644 index 000000000000..40b0a7b493a0 --- /dev/null +++ b/sc/source/ui/vba/vbacommandbarcontrols.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * 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 "vbacommandbarcontrols.hxx" +#include "vbacommandbarcontrol.hxx" + +using namespace com::sun::star; +using namespace ooo::vba; + +typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE; +class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE +{ + //uno::Reference< uno::XComponentContext > m_xContext; + ScVbaCommandBarControls* m_pCommandBarControls; + sal_Int32 m_nCurrentPosition; +public: + CommandBarControlEnumeration( ScVbaCommandBarControls* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {} + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException ) + { + if( m_nCurrentPosition < m_pCommandBarControls->getCount() ) + return sal_True; + return sal_False; + } + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) + { + if( hasMoreElements() ) + { + rtl::OUString sName = m_pCommandBarControls->GetControlNameByIndex( m_nCurrentPosition ); + m_nCurrentPosition = m_nCurrentPosition + 1; + if( sName.getLength() > 0 ) + return m_pCommandBarControls->createCollectionObject( uno::makeAny( sName ) ); + else + return nextElement(); + } + else + throw container::NoSuchElementException(); + return uno::Any(); + } +}; + +ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess> xIndexAccess ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ) +{ + m_bIsMenu = sal_False; + m_bHasElements = sal_False; + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW ); + m_pCommandBar = dynamic_cast< ScVbaCommandBar* >( m_xParentHardRef.get() ); + m_pCommandBarControl = dynamic_cast< ScVbaCommandBarControl* >( m_xParentHardRef.get() ); + if( m_pCommandBar ) + { + m_xUICfgManager.set( m_pCommandBar->GetUICfgManager(), uno::UNO_QUERY_THROW ); + m_xUICfgPers.set( m_pCommandBar->GetUICfgPers(), uno::UNO_QUERY_THROW ); + m_xBarSettings.set( m_pCommandBar->GetBarSettings(), uno::UNO_QUERY_THROW ); + m_bIsMenu = m_pCommandBar->IsMenu(); + if( m_xBarSettings->hasElements() ) + { + m_bHasElements = sal_True; + } + } + else if( m_pCommandBarControl ) + { + } + else + { + throw uno::RuntimeException( rtl::OUString::createFromAscii("Parent needs to be a ScVbaCommandBar or a ScVbaCommandBarControl"), uno::Reference< uno::XInterface >() ); + } +} +rtl::OUString +ScVbaCommandBarControls::GetControlNameByIndex( const sal_Int32 nIndex ) throw ( uno::RuntimeException ) +{ + sal_Int32 nCount = 0; + if( m_bHasElements ) + { + sal_Int32 nBarSettingsCount = m_xBarSettings->getCount(); + for( sal_Int32 i = 0; i < nBarSettingsCount; i++ ) + { + beans::PropertyValues aMenuValues; + m_xBarSettings->getByIndex( i ) >>= aMenuValues; + for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ ) + { + if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) ) + { + nCount++; + if( nIndex == nCount ) + { + rtl::OUString sCommandURL; + aMenuValues[j].Value >>= sCommandURL; + sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") ); + if( ( nLastIndex != -1 ) && ( ( nLastIndex +1 ) < sCommandURL.getLength() ) ) + { + sCommandURL = sCommandURL.copy( nLastIndex + 1 ); + return sCommandURL; + } + } + } + } + } + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Out of bound" ), uno::Reference< uno::XInterface >() ); + return rtl::OUString(); +} + +// Attributes +sal_Int32 SAL_CALL +ScVbaCommandBarControls::getCount() throw (uno::RuntimeException) +{ + sal_Int32 nCount = 0; + if( m_bHasElements ) + { + sal_Int32 nBarSettingsCount = m_xBarSettings->getCount(); + for( sal_Int32 i = 0; i < nBarSettingsCount; i++ ) + { + beans::PropertyValues aMenuValues; + m_xBarSettings->getByIndex( i ) >>= aMenuValues; + for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ ) + { + if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) ) + { + nCount++; + } + } + } + } + return nCount; +} +// XEnumerationAccess +uno::Type SAL_CALL +ScVbaCommandBarControls::getElementType() throw ( uno::RuntimeException ) +{ + return XCommandBarControls::static_type( 0 ); +} +uno::Reference< container::XEnumeration > +ScVbaCommandBarControls::createEnumeration() throw ( uno::RuntimeException ) +{ + return uno::Reference< container::XEnumeration >( new CommandBarControlEnumeration( this ) ); +} +uno::Any +ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource ) +{ + // only surport the aSource as a name string, because this class is a API wrapper + rtl::OUString sName; + if( aSource >>= sName ) + return uno::makeAny( uno::Reference< XCommandBarControl > ( new ScVbaCommandBarControl( this, mxContext, sName ) ) ); + return uno::Any(); +} + +// Methods +uno::Any SAL_CALL +ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException) +{ + if( aIndex.getValueTypeClass() == uno::TypeClass_STRING ) + { + return createCollectionObject( aIndex ); + } + sal_Int32 nIndex = 0; + if( aIndex >>= nIndex ) + { + return createCollectionObject( uno::makeAny( GetControlNameByIndex( nIndex ) ) ); + } + + return uno::Any(); +} +uno::Reference< XCommandBarControl > SAL_CALL +ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const uno::Any& /*Parameter*/, const uno::Any& Before, const uno::Any& Temporary ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // Parameter is not supported + // the following name needs to be individually created; + rtl::OUString sCaption( rtl::OUString::createFromAscii("custom Control") ); + rtl::OUString sCommand( rtl::OUString::createFromAscii("macro:///Standard.Module1.Test()") ); + sal_Int32 nType =0; + sal_Int32 nPosition = 0; + sal_Int32 nId; + sal_Bool bTemporary = sal_True; + + if( Type.hasValue() ) + if( Type >>= nType ) + { + // evalute the type of the new control + } + if( Id.hasValue() ) + if( Id >>= nId ) + { + // evalute the action of the new control + } + if( Before.hasValue() ) + if( Before >>= nPosition ) + { + // evalute the position of the new Control + } + if( Temporary.hasValue() ) + if( Temporary >>= bTemporary ) + { + // evalute the temporary of the new Control + } + return uno::Reference< XCommandBarControl > ( new ScVbaCommandBarControl( this, mxContext, sCaption, sCommand, nPosition, bTemporary ) ); +} + +// XHelperInterface +rtl::OUString& +ScVbaCommandBarControls::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") ); + return sImplName; +} +uno::Sequence<rtl::OUString> +ScVbaCommandBarControls::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControls" ) ); + } + return aServiceNames; +} + diff --git a/sc/source/ui/vba/vbacommandbarcontrols.hxx b/sc/source/ui/vba/vbacommandbarcontrols.hxx new file mode 100644 index 000000000000..9243d55697d7 --- /dev/null +++ b/sc/source/ui/vba/vbacommandbarcontrols.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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_COMMANDBARCONTROLS_HXX +#define SC_VBA_COMMANDBARCONTROLS_HXX + +#include <ooo/vba/XCommandBarControls.hpp> + +#include "vbahelperinterface.hxx" +#include "vbacommandbar.hxx" +#include "vbacollectionimpl.hxx" + +class ScVbaCommandBarControl; + +typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE; + +class ScVbaCommandBarControls : public CommandBarControls_BASE +{ +private: + sal_Bool m_bIsMenu; + sal_Bool m_bHasElements; + ScVbaCommandBar* m_pCommandBar; + ScVbaCommandBarControl* m_pCommandBarControl; + css::uno::Reference< ov::XHelperInterface > m_xParentHardRef; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager; + css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers; + css::uno::Reference< css::container::XIndexContainer > m_xBarSettings; + +public: + ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess ) throw( css::uno::RuntimeException ); + css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; }; + css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; }; + css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; }; + sal_Bool IsMenu() { return m_bIsMenu; }; + ScVbaCommandBar* GetParentCommandBar() { return m_pCommandBar; }; + ScVbaCommandBarControl* GetParentCommandBarControl() { return m_pCommandBarControl; }; + rtl::OUString GetParentToolBarName() + { + if( m_pCommandBar ) return m_pCommandBar->GetToolBarName(); + else return rtl::OUString(); + } + rtl::OUString GetControlNameByIndex( const sal_Int32 nIndex ) throw ( css::uno::RuntimeException ); + + // Attributes + virtual ::sal_Int32 SAL_CALL getCount() 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); + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + + // Methods + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif//SC_VBA_COMMANDBARCONTROLS_HXX diff --git a/sc/source/ui/vba/vbacommandbars.cxx b/sc/source/ui/vba/vbacommandbars.cxx new file mode 100644 index 000000000000..101b62902460 --- /dev/null +++ b/sc/source/ui/vba/vbacommandbars.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * 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/lang/XServiceInfo.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +#include "vbacommandbars.hxx" +#include "vbacommandbar.hxx" + +using namespace com::sun::star; +using namespace ooo::vba; + +typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarEnumeration_BASE; + +static rtl::OUString sSpreadsheetDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ); +static rtl::OUString sTextDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) ); +static rtl::OUString sWindowStateConfUrl( rtl::OUString::createFromAscii( "com.sun.star.ui.WindowStateConfiguration" ) ); + +class CommandBarEnumeration : public CommandBarEnumeration_BASE +{ + uno::Reference< uno::XComponentContext > m_xContext; + uno::Reference< XCommandBars > m_xCommandBars; + uno::Sequence< rtl::OUString > m_sNames; + sal_Int32 m_nCurrentPosition; +public: + CommandBarEnumeration( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBars > xCommandBars, const uno::Sequence< rtl::OUString > sNames ) : m_xContext( xContext ), m_xCommandBars( xCommandBars ), m_sNames( sNames ), m_nCurrentPosition( 0 ) + { + } + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException ) + { + if( m_nCurrentPosition < m_sNames.getLength() ) + return sal_True; + return sal_False; + } + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) + { + if( hasMoreElements() ) + { + rtl::OUString sName( m_sNames[ m_nCurrentPosition ] ); + m_nCurrentPosition = m_nCurrentPosition + 1; + if( sName.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) + { + sal_Int32 nLastIndex = sName.lastIndexOf( rtl::OUString::createFromAscii( "/" ) ); + if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sName.getLength() ) ) + { + sName = sName.copy( nLastIndex + 1); + if( sName.getLength() > 0 ) + { + uno::Reference< XHelperInterface > xHelperInterface( m_xCommandBars, uno::UNO_QUERY_THROW ); + uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( xHelperInterface, m_xContext, sName, sal_True, sal_False ) ); + if( xCommandBar.is() ) + return uno::makeAny( xCommandBar ); + else + return nextElement(); + } + else + return nextElement(); + } + } + else + return nextElement(); + } + else + throw container::NoSuchElementException(); + return uno::Any(); + } +}; + + +ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess ) : CommandBars_BASE( xParent, xContext, xIndexAccess ) +{ + retrieveObjects(); +} +void +ScVbaCommandBars::retrieveObjects() throw ( uno::RuntimeException ) +{ + uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( sSpreadsheetDocumentUrl ) ) + { + m_sModuleName = sSpreadsheetDocumentUrl; + } + else if( xServiceInfo->supportsService( sTextDocumentUrl ) ) + { + m_sModuleName = sTextDocumentUrl; + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Unsupported Document" ), uno::Reference< uno::XInterface >() ); + + uno::Reference < lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference < container::XNameAccess > xNameAccess( xMSF->createInstance( sWindowStateConfUrl ), uno::UNO_QUERY_THROW ); + m_xNameAccess.set( xNameAccess->getByName( m_sModuleName ), uno::UNO_QUERY_THROW ); +} + +// XEnumerationAccess +uno::Type SAL_CALL +ScVbaCommandBars::getElementType() throw ( uno::RuntimeException ) +{ + return XCommandBars::static_type( 0 ); +} +uno::Reference< container::XEnumeration > +ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException ) +{ + return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames() ) ); +} + +uno::Any +ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) +{ + // aSource should be a name at this time, because of the class is API wrapper. + rtl::OUString sToolBarName; + if( aSource >>= sToolBarName ) + { + sToolBarName = sToolBarName.toAsciiLowerCase(); + if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) ) + { + return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 0 ) ) ); + } + else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) ) + { + return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 1 ) ) ); + } + else if( checkToolBarExist( sToolBarName ) ) + { + return uno::makeAny( uno::Reference< XCommandBar > (new ScVbaCommandBar( this, mxContext, sToolBarName, sal_True, sal_False ) ) ); + } + } + return uno::Any(); +} + +// XCommandBars +uno::Reference< XCommandBar > SAL_CALL +ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Position*/, const css::uno::Any& /*MenuBar*/, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException) +{ + // Position - MsoBar MenuBar - sal_Bool + // Currently only the Name is supported. + rtl::OUString sName; + if( !( Name >>= sName ) ) + { + sName = rtl::OUString::createFromAscii("Custom1"); + } + sal_Bool bTemporary = false; + if( !( Temporary >>= bTemporary ) ) + { + bTemporary = sal_True; + } + return uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, sName.toAsciiLowerCase(), bTemporary, sal_True ) ); +} +sal_Int32 SAL_CALL +ScVbaCommandBars::getCount() throw(css::uno::RuntimeException) +{ + // Filter out all toolbars from the window collection + sal_Int32 nCount = 0; + uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); + for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) + { + if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) + { + nCount++; + } + } + return nCount; +} + +// ScVbaCollectionBaseImpl +uno::Any SAL_CALL +ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException ) +{ + if( aIndex.getValueTypeClass() == uno::TypeClass_STRING ) + { + return createCollectionObject( aIndex ); + } + return uno::Any(); +} + +sal_Bool +ScVbaCommandBars::checkToolBarExist( rtl::OUString sToolBarName ) +{ + CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() ); + if( iter != mCommandBarNameMap.end() ) + { + return sal_True; + } + uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); + for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) + { + if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 ) + { + if( allNames[i].indexOf( sToolBarName ) != -1 ) + { + return sal_True; + } + } + } + return sal_False; +} + +// XHelperInterface +rtl::OUString& +ScVbaCommandBars::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBars") ); + return sImplName; +} +uno::Sequence<rtl::OUString> +ScVbaCommandBars::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBars" ) ); + } + return aServiceNames; +} + diff --git a/sc/source/ui/vba/vbacommandbars.hxx b/sc/source/ui/vba/vbacommandbars.hxx new file mode 100644 index 000000000000..b9de44ee79d6 --- /dev/null +++ b/sc/source/ui/vba/vbacommandbars.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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_COMMANDBARS_HXX +#define SC_VBA_COMMANDBARS_HXX + +#include <ooo/vba/XCommandBar.hpp> +#include <ooo/vba/XCommandBars.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +#include <cppuhelper/implbase1.hxx> + +#include "vbahelperinterface.hxx" +#include "vbacollectionimpl.hxx" + +typedef CollTestImplHelper< ov::XCommandBars > CommandBars_BASE; + +class ScVbaCommandBars : public CommandBars_BASE +{ +private: + css::uno::Reference< css::container::XNameAccess > m_xNameAccess; + rtl::OUString m_sModuleName; + void retrieveObjects() throw( css::uno::RuntimeException ); +public: + ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess ); + + sal_Bool checkToolBarExist( rtl::OUString sToolBarName ); + rtl::OUString GetModuleName(){ return m_sModuleName; }; + css::uno::Reference< css::container::XNameAccess > GetWindows() + { + retrieveObjects(); + return m_xNameAccess; + }; + // XCommandBars + virtual css::uno::Reference< ov::XCommandBar > SAL_CALL Add( const css::uno::Any& Name, const css::uno::Any& Position, const css::uno::Any& MenuBar, const css::uno::Any& Temporary ) 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& aSource ); + + virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& /*aIndex2*/ ) throw( css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif//SC_VBA_COMMANDBARS_HXX diff --git a/sc/source/ui/vba/vbacomment.cxx b/sc/source/ui/vba/vbacomment.cxx index 3127091fb317..9bda95e3429b 100644 --- a/sc/source/ui/vba/vbacomment.cxx +++ b/sc/source/ui/vba/vbacomment.cxx @@ -29,7 +29,7 @@ ************************************************************************/ #include "vbacomment.hxx" -#include <org/openoffice/excel/XlCreator.hpp> +#include <ooo/vba/excel/XlCreator.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp> #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp> @@ -42,10 +42,10 @@ #include "vbacomments.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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::ScVbaComment( const uno::Reference< 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() ) @@ -103,7 +103,7 @@ 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 ) ); + uno::Reference< XCollection > xColl( new ScVbaComments( getParent()->getParent(), mxContext, xIndexAccess ) ); return uno::Reference< excel::XComment > ( xColl->Item( uno::makeAny( Index ), uno::Any() ), uno::UNO_QUERY_THROW ); } @@ -213,7 +213,7 @@ ScVbaComment::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.ScVbaComment" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.ScVbaComment" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbacomment.hxx b/sc/source/ui/vba/vbacomment.hxx index ea4b776fa0e3..6676d09bd660 100644 --- a/sc/source/ui/vba/vbacomment.hxx +++ b/sc/source/ui/vba/vbacomment.hxx @@ -32,8 +32,8 @@ #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XComment.hpp> -#include <org/openoffice/excel/XApplication.hpp> +#include <ooo/vba/excel/XComment.hpp> +#include <ooo/vba/excel/XApplication.hpp> #include <com/sun/star/sheet/XSheetAnnotations.hpp> #include <com/sun/star/sheet/XSheetAnnotation.hpp> #include <com/sun/star/table/XCellRange.hpp> @@ -41,7 +41,7 @@ #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XComment > ScVbaComment_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XComment > ScVbaComment_BASE; class ScVbaComment : public ScVbaComment_BASE { @@ -51,9 +51,9 @@ 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); + css::uno::Reference< ov::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 ); + ScVbaComment( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XCellRange >& xRange ) throw ( css::lang::IllegalArgumentException ); virtual ~ScVbaComment() {} @@ -65,8 +65,8 @@ public: // 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 css::uno::Reference< ov::excel::XComment > SAL_CALL Next() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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(); diff --git a/sc/source/ui/vba/vbacomments.cxx b/sc/source/ui/vba/vbacomments.cxx index 7cb0f512e34e..fdc8a3d886df 100644 --- a/sc/source/ui/vba/vbacomments.cxx +++ b/sc/source/ui/vba/vbacomments.cxx @@ -34,7 +34,7 @@ #include "vbaglobals.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; uno::Any AnnotationToComment( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext ) @@ -44,7 +44,7 @@ uno::Any AnnotationToComment( const uno::Any& aSource, uno::Reference< uno::XCom 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 ) ) ); + return uno::makeAny( uno::Reference< excel::XComment > ( new ScVbaComment( uno::Reference< XHelperInterface >(), xContext, xCellRange ) ) ); } class CommentEnumeration : public EnumerationHelperImpl @@ -59,7 +59,7 @@ public: }; -ScVbaComments::ScVbaComments( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) +ScVbaComments::ScVbaComments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : ScVbaComments_BASE( xParent, xContext, xIndexAccess ) { } @@ -100,7 +100,7 @@ ScVbaComments::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Comments") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Comments") ); } return sNames; } diff --git a/sc/source/ui/vba/vbacomments.hxx b/sc/source/ui/vba/vbacomments.hxx index 18f7781e5f77..098dfd5153a3 100644 --- a/sc/source/ui/vba/vbacomments.hxx +++ b/sc/source/ui/vba/vbacomments.hxx @@ -32,18 +32,18 @@ #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XComments.hpp> +#include <ooo/vba/excel/XComments.hpp> #include "vbahelper.hxx" #include "vbacollectionimpl.hxx" #include "vbacomment.hxx" -typedef CollTestImplHelper< oo::excel::XComments > ScVbaComments_BASE; +typedef CollTestImplHelper< ov::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 ); + ScVbaComments( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); virtual ~ScVbaComments() {} diff --git a/sc/source/ui/vba/vbacondition.cxx b/sc/source/ui/vba/vbacondition.cxx index 1fca9613bc2e..6a9aff4ce0ac 100644 --- a/sc/source/ui/vba/vbacondition.cxx +++ b/sc/source/ui/vba/vbacondition.cxx @@ -29,18 +29,18 @@ ************************************************************************/ #include "vbacondition.hxx" -#include <org/openoffice/excel/XlFormatConditionOperator.hpp> -#include <org/openoffice/excel/XFormatCondition.hpp> +#include <ooo/vba/excel/XlFormatConditionOperator.hpp> +#include <ooo/vba/excel/XFormatCondition.hpp> #include <com/sun/star/table/XCellRange.hpp> #include <com/sun/star/sheet/XCellRangeAddressable.hpp> -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +ScVbaCondition< Ifc1 >::ScVbaCondition( const uno::Reference< 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 ); } diff --git a/sc/source/ui/vba/vbacondition.hxx b/sc/source/ui/vba/vbacondition.hxx index 05cbee79ba34..ac44130e5127 100644 --- a/sc/source/ui/vba/vbacondition.hxx +++ b/sc/source/ui/vba/vbacondition.hxx @@ -42,7 +42,7 @@ 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 ); + ScVbaCondition( const css::uno::Reference< ov::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 ); diff --git a/sc/source/ui/vba/vbacontrol.cxx b/sc/source/ui/vba/vbacontrol.cxx index 4c868ec365d6..ddb4b39a91a5 100644 --- a/sc/source/ui/vba/vbacontrol.cxx +++ b/sc/source/ui/vba/vbacontrol.cxx @@ -36,7 +36,13 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/view/XControlAccess.hpp> #include <com/sun/star/container/XChild.hpp> - +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#ifdef VBA_OOBUILD_HACK +#include <svtools/bindablecontrolhelper.hxx> +#endif #include"vbacontrol.hxx" #include"vbacombobox.hxx" #include "vbabutton.hxx" @@ -44,35 +50,48 @@ #include "vbatextbox.hxx" #include "vbaradiobutton.hxx" #include "vbalistbox.hxx" +#include "vbatogglebutton.hxx" +#include "vbacheckbox.hxx" +#include "vbaframe.hxx" +#include "vbascrollbar.hxx" +#include "vbaprogressbar.hxx" +#include "vbamultipage.hxx" +#include "vbaspinbutton.hxx" +#include "vbaimage.hxx" using namespace com::sun::star; -using namespace org::openoffice; - -sal_Int32 pt2mm( double pt ); -double mm2pt( sal_Int32 mm ); +using namespace ooo::vba; 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; +ScVbaControl::getWindowPeer() throw (uno::RuntimeException) +{ + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); + + uno::Reference< awt::XControlModel > xControlModel; + uno::Reference< css::awt::XWindowPeer > xWinPeer; + if ( !xControlShape.is() ) + { + // would seem to be a Userform control + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW ); + xWinPeer = xControl->getPeer(); + return xWinPeer; + } + // form control + xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + + uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW ); try { - xControl.set( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY ); + uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY ); + xWinPeer = xControl->getPeer(); } catch( uno::Exception ) { throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ), uno::Reference< uno::XInterface >() ); } - return xControl->getPeer(); + return xWinPeer; } //ScVbaControlListener @@ -106,67 +125,44 @@ ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeE //ScVbaControl -ScVbaControl::ScVbaControl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::drawing::XControlShape >& xControlShape ) : m_xContext( xContext ), m_xControlShape( xControlShape ) +ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel ) { - //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 ); + setGeometryHelper( pGeomHelper ); + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); xComponent->addEventListener( m_xEventListener ); + + //init m_xProps + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ; + uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ; + if ( xControlShape.is() ) // form control + m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + else if ( xUserFormControl.is() ) // userform control + m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW ); } 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 ) + if( m_xControl.is() ) { - uno::Reference< lang::XComponent > xComponent( m_xControlShape, uno::UNO_QUERY_THROW ); + uno::Reference< lang::XComponent > xComponent( m_xControl, 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 ) +void +ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper ) { - 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; + mpGeometryHelper.reset( pHelper ); } -void ScVbaControl::SetControl( const uno::Reference< uno::XComponentContext > xContext, - const uno::Reference< beans::XPropertySet > xProps, - const uno::Reference< drawing::XControlShape > xControlShape ) +void ScVbaControl::removeResouce() throw( uno::RuntimeException ) { - 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 ); + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW ); + xComponent->removeEventListener( m_xEventListener ); + m_xControl= NULL; + m_xProps = NULL; } //In design model has different behavior @@ -189,132 +185,283 @@ void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeE sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException) { - uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer( m_xControlShape ), uno::UNO_QUERY_THROW ); + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), 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 ); + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), 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; + return mpGeometryHelper->getHeight(); } 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 ); + mpGeometryHelper->setHeight( _height ); } 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; + return mpGeometryHelper->getWidth(); } 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 ); + mpGeometryHelper->setWidth( _width ); } 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 ); + return mpGeometryHelper->getLeft(); } 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 ); + mpGeometryHelper->setLeft( _left ); } 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 ); + return mpGeometryHelper->getTop(); } 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 ); + mpGeometryHelper->setTop( _top ); } -//ScVbaControlFactory +uno::Reference< uno::XInterface > SAL_CALL +ScVbaControl::getObject() throw (uno::RuntimeException) +{ + uno::Reference< msforms::XControl > xRet( this ); + return xRet; +} -ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XControlShape >& xControlShape ): m_xContext( xContext ), m_xControlShape( xControlShape ) +void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException) { - 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 ); + uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW ); + xWin->setFocus(); } -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 ) +rtl::OUString SAL_CALL +ScVbaControl::getControlSource() throw (uno::RuntimeException) { +// #FIXME I *hate* having these upstream differences +// but this is necessary until I manage to upstream other +// dependant parts +#ifdef VBA_OOBUILD_HACK + rtl::OUString sControlSource; + uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY ); + if ( xBindable.is() ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW ); + table::CellAddress aAddress; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress; + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) ); + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource; + } + catch( uno::Exception& ) + { + } + } + return sControlSource; +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported +#endif } -ScVbaControl* ScVbaControlFactory::createControl( const sal_Int16 nClassId ) throw (uno::RuntimeException) +void SAL_CALL +ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException) { - switch( nClassId ) +#ifdef VBA_OOBUILD_HACK + rtl::OUString sEmpty; + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty ); +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +rtl::OUString SAL_CALL +ScVbaControl::getRowSource() throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sRowSource; + uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY ); + if ( xListSink.is() ) { - 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 >() ); + try + { + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY ); + + uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW ); + table::CellRangeAddress aAddress; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress; + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) ); + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource; + } + catch( uno::Exception& ) + { + } } + return sRowSource; +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +void SAL_CALL +ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) +{ +#ifdef VBA_OOBUILD_HACK + rtl::OUString sEmpty; + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource ); +#else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported +#endif +} + +rtl::OUString SAL_CALL +ScVbaControl::getName() throw (uno::RuntimeException) +{ + rtl::OUString sName; + m_xProps->getPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; + return sName; + +} + +void SAL_CALL +ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) ); + } +//ScVbaControlFactory + +ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel ) +{ } ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException) { + return createControl( m_xModel ); +} +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) +{ + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ); + if ( xControlShape.is() ) // form controls + return createControl( xControlShape, xParent ); + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ); + if ( !xControl.is() ) + throw uno::RuntimeException(); // really we should be more informative + return createControl( xControl, xParent ); + +} + +ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW ); sal_Int32 nClassId = -1; const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") ); - m_xProps->getPropertyValue( sClassId ) >>= nClassId; + xProps->getPropertyValue( sClassId ) >>= nClassId; + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess switch( nClassId ) { case form::FormComponentType::COMBOBOX: - return new ScVbaComboBox( m_xContext, m_xControlShape ); + return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); case form::FormComponentType::COMMANDBUTTON: - return new ScVbaButton( m_xContext, m_xControlShape ); + return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); case form::FormComponentType::FIXEDTEXT: - return new ScVbaLabel( m_xContext, m_xControlShape ); + return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); case form::FormComponentType::TEXTFIELD: - return new ScVbaTextBox( m_xContext, m_xControlShape ); + return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); case form::FormComponentType::RADIOBUTTON: - return new ScVbaRadioButton( m_xContext, m_xControlShape ); + return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); case form::FormComponentType::LISTBOX: - return new ScVbaListBox( m_xContext, m_xControlShape ); + return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::SPINBUTTON: + return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); + case form::FormComponentType::IMAGECONTROL: + return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) ); default: throw uno::RuntimeException( rtl::OUString::createFromAscii( - "Donot surpport this Control Type." ), uno::Reference< uno::XInterface >() ); + "Donot support this Control Type." ), uno::Reference< uno::XInterface >() ); + } +} + +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW ); + uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW ); + ScVbaControl* pControl = NULL; + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess + if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) ) + pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) ) + pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) ) + pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) ) + { + sal_Bool bToggle = sal_False; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle; + if ( bToggle ) + pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else + pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); } + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) ) + pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) ) + pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) + pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) ) + pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) ) + pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) ) + pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) ) + pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) + pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent ); + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) ) + pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) ); + else + throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() ); + return pControl; } + +rtl::OUString& +ScVbaControl::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaControl::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) ); + } + return aServiceNames; +} + + diff --git a/sc/source/ui/vba/vbacontrol.hxx b/sc/source/ui/vba/vbacontrol.hxx index 0c563e397e52..02f340ac05ee 100644 --- a/sc/source/ui/vba/vbacontrol.hxx +++ b/sc/source/ui/vba/vbacontrol.hxx @@ -35,40 +35,34 @@ #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/XControl.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> -#include <org/openoffice/msforms/XControl.hpp> +#include <ooo/vba/msforms/XControl.hpp> #include "vbahelper.hxx" +#include "vbahelperinterface.hxx" -typedef ::cppu::WeakImplHelper1< oo::msforms::XControl > ControlImpl_BASE; +//typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE; +typedef InheritedHelperInterfaceImpl1< ov::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; + std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper; 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 ); + css::uno::Reference< css::uno::XInterface > m_xControl; + css::uno::Reference< css::frame::XModel > m_xModel; + + virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException); 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 ); + ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper ); virtual ~ScVbaControl(); + // This class will own the helper, so make sure it is allocated from + // the heap + void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper ); // XControl virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException); virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException); @@ -82,9 +76,20 @@ public: 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 void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException); - //remove resouce because org.openoffice.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException); + virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); + //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape virtual void removeResouce() throw( css::uno::RuntimeException ); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; @@ -92,16 +97,15 @@ 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 ); + const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel ); ScVbaControl* createControl() throw ( css::uno::RuntimeException ); + ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException ); private: + ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException ); + ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException ); css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::beans::XPropertySet > m_xProps; - css::uno::Reference< css::drawing::XControlShape > m_xControlShape; + css::uno::Reference< css::uno::XInterface > m_xControl; + css::uno::Reference< css::frame::XModel > m_xModel; }; #endif//SC_VBA_CONTROL_HXX diff --git a/sc/source/ui/vba/vbacontrols.cxx b/sc/source/ui/vba/vbacontrols.cxx new file mode 100644 index 000000000000..6faf418df206 --- /dev/null +++ b/sc/source/ui/vba/vbacontrols.cxx @@ -0,0 +1,227 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "vbacontrols.hxx" +#include "vbacontrol.hxx" +#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/awt/XControlContainer.hpp> +#include <hash_map> + +using namespace com::sun::star; +using namespace ooo::vba; + + +typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > ArrayWrapImpl; + +typedef std::hash_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash, + ::std::equal_to< ::rtl::OUString > > ControlIndexMap; +typedef std::vector< uno::Reference< awt::XControl > > ControlVec; + +class ControlArrayWrapper : public ArrayWrapImpl +{ + uno::Reference< awt::XControlContainer > mxDialog; + uno::Sequence< ::rtl::OUString > msNames; + ControlVec mControls; + ControlIndexMap mIndices; + + rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl ) + { + uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY ); + rtl::OUString sName; + xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName; + return sName; + } + +public: + + ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog ) + { + mxDialog.set( xDialog, uno::UNO_QUERY_THROW ); + uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls(); + + msNames.realloc( sXControls.getLength() ); + for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i ) + { + uno::Reference< awt::XControl > xCtrl = sXControls[ i ]; + msNames[ i ] = getControlName( xCtrl ); + mControls.push_back( xCtrl ); + mIndices[ msNames[ i ] ] = i; + } + } + + // XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return awt::XControl::static_type(0); + } + + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return ( mControls.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 getByIndex( mIndices[ aName ] ); + } + + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) + { + return msNames; + } + + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException) + { + ControlIndexMap::iterator it = mIndices.find( aName ); + return it != mIndices.end(); + } + + // XElementAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) + { + return mControls.size(); + } + + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) + { + if ( Index < 0 || Index >= static_cast< sal_Int32 >( mControls.size() ) ) + throw lang::IndexOutOfBoundsException(); + return uno::makeAny( mControls[ Index ] ); + } +}; + + +class ControlsEnumWrapper : public EnumerationHelper_BASE +{ + uno::Reference<XHelperInterface > m_xParent; + uno::Reference<uno::XComponentContext > m_xContext; + uno::Reference<container::XIndexAccess > m_xIndexAccess; + uno::Reference<awt::XControl > m_xDlg; + sal_Int32 nIndex; + +public: + + ControlsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< awt::XControl >& xDlg ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), m_xDlg( xDlg ), nIndex( 0 ) {} + + 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< frame::XModel > xModel; + uno::Reference< uno::XInterface > xControl; + m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl; + // Create control from awt::XControl + ScVbaControlFactory aFac( m_xContext, xControl, xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( m_xDlg->getModel() ) ); + return uno::makeAny( xVBAControl ); + } + throw container::NoSuchElementException(); + } + +}; + + +uno::Reference<container::XIndexAccess > +lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg ) +{ + return new ControlArrayWrapper( xDlg ); +} + +ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, + const css::uno::Reference< awt::XControl >& xDialog ) + : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) ) +{ + mxDialog.set( xDialog, uno::UNO_QUERY_THROW ); +} + +uno::Reference< container::XEnumeration > +ScVbaControls::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog ) ); + if ( !xEnum.is() ) + throw uno::RuntimeException(); + return xEnum; +} + +uno::Any +ScVbaControls::createCollectionObject( const css::uno::Any& aSource ) +{ + // Create control from awt::XControl + uno::Reference< awt::XControl > xControl; + aSource >>= xControl; + uno::Reference< frame::XModel > xModel; + ScVbaControlFactory aFac( mxContext, xControl, xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( mxDialog->getModel() ) ); + return uno::makeAny( xVBAControl ); +} + +void SAL_CALL +ScVbaControls::Move( double cx, double cy ) throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumeration > xEnum( createEnumeration() ); + while ( xEnum->hasMoreElements() ) + { + uno::Reference< msforms::XControl > xControl( xEnum->nextElement(), uno::UNO_QUERY_THROW ); + xControl->setLeft( xControl->getLeft() + cx ); + xControl->setTop( xControl->getTop() + cy ); + } +} + +uno::Type +ScVbaControls::getElementType() throw (uno::RuntimeException) +{ + return ooo::vba::msforms::XControl::static_type(0); +} +rtl::OUString& +ScVbaControls::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControls") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaControls::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Controls" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbacontrols.hxx b/sc/source/ui/vba/vbacontrols.hxx new file mode 100644 index 000000000000..bdb25ff3d5d2 --- /dev/null +++ b/sc/source/ui/vba/vbacontrols.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_CONTROLS_HXX +#define SC_VBA_CONTROLS_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XControls.hpp> +#include <com/sun/star/awt/XControl.hpp> + +#include "vbacollectionimpl.hxx" +#include "vbahelper.hxx" + +typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE; + +class ScVbaControls : public ControlsImpl_BASE +{ + css::uno::Reference< css::awt::XControl > mxDialog; +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +public: + ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::awt::XControl >& xDialog ); + // XControls + virtual void SAL_CALL Move( double cx, double cy ) 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_OLEOBJECTS_HXX + diff --git a/sc/source/ui/vba/vbadialog.cxx b/sc/source/ui/vba/vbadialog.cxx index 4da657ea7168..eb0cdfa6386e 100644 --- a/sc/source/ui/vba/vbadialog.cxx +++ b/sc/source/ui/vba/vbadialog.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <org/openoffice/excel/XApplication.hpp> +#include <ooo/vba/excel/XApplication.hpp> #include <tools/string.hxx> @@ -39,7 +39,7 @@ #include "vbadialog.hxx" #include "vbaglobals.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; // fails silently @@ -113,7 +113,7 @@ ScVbaDialog::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotTable" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotTable" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbadialog.hxx b/sc/source/ui/vba/vbadialog.hxx index 40c132f03bc0..8b488abebb19 100644 --- a/sc/source/ui/vba/vbadialog.hxx +++ b/sc/source/ui/vba/vbadialog.hxx @@ -33,20 +33,20 @@ #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 <ooo/vba/XGlobals.hpp> +#include <ooo/vba/excel/XApplication.hpp> +#include <ooo/vba/excel/XDialog.hpp> #include "vbahelperinterface.hxx" #include "vbadialog.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XDialog > ScVbaDialog_BASE; +typedef InheritedHelperInterfaceImpl1< ov::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 ) {} + ScVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, sal_Int32 nIndex, const css::uno::Reference< css::uno::XComponentContext > xContext ):ScVbaDialog_BASE( xParent, xContext ), mnIndex( nIndex ) {} virtual ~ScVbaDialog() {} // Methods diff --git a/sc/source/ui/vba/vbadialogs.cxx b/sc/source/ui/vba/vbadialogs.cxx index c7ae21f4ec96..1dca41d5d1e1 100644 --- a/sc/source/ui/vba/vbadialogs.cxx +++ b/sc/source/ui/vba/vbadialogs.cxx @@ -31,8 +31,8 @@ #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 <ooo/vba/excel/XApplication.hpp> +#include <ooo/vba/excel/XDialog.hpp> #include <tools/string.hxx> @@ -41,7 +41,7 @@ #include "vbaglobals.hxx" #include "vbadialog.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; void @@ -62,7 +62,7 @@ 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 ) ); + uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), nIndex, mxContext ) ); return uno::Any( aDialog ); } rtl::OUString& @@ -79,7 +79,7 @@ ScVbaDialogs::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbadialogs.hxx b/sc/source/ui/vba/vbadialogs.hxx index 29f2896efd4b..40eeb78663a2 100644 --- a/sc/source/ui/vba/vbadialogs.hxx +++ b/sc/source/ui/vba/vbadialogs.hxx @@ -33,18 +33,18 @@ #include <cppuhelper/implbase1.hxx> #include <com/sun/star/uno/XComponentContext.hpp> -#include <org/openoffice/excel/XDialogs.hpp> -#include <org/openoffice/vba/XCollection.hpp> +#include <ooo/vba/excel/XDialogs.hpp> +#include <ooo/vba/XCollection.hpp> #include "vbahelperinterface.hxx" class ScModelObj; -typedef InheritedHelperInterfaceImpl1< oo::excel::XDialogs > ScVbaDialogs_BASE; +typedef InheritedHelperInterfaceImpl1< ov::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 ) {} + ScVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): ScVbaDialogs_BASE( xParent, xContext ) {} virtual ~ScVbaDialogs() {} // XCollection diff --git a/sc/source/ui/vba/vbafillformat.cxx b/sc/source/ui/vba/vbafillformat.cxx index cbacd8a31100..3b25efcb614a 100644 --- a/sc/source/ui/vba/vbafillformat.cxx +++ b/sc/source/ui/vba/vbafillformat.cxx @@ -30,14 +30,14 @@ #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 <ooo/vba/office/MsoGradientStyle.hpp> #include "vbafillformat.hxx" #include "vbacolorformat.hxx" -using namespace org::openoffice; +using namespace ooo::vba; 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 ) +ScVbaFillFormat::ScVbaFillFormat( const uno::Reference< 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; @@ -195,7 +195,7 @@ ScVbaFillFormat::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msforms.FillFormat" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.FillFormat" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbafillformat.hxx b/sc/source/ui/vba/vbafillformat.hxx index a5307fd5ba22..03029c89dbe4 100644 --- a/sc/source/ui/vba/vbafillformat.hxx +++ b/sc/source/ui/vba/vbafillformat.hxx @@ -32,17 +32,17 @@ #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/FillStyle.hpp> -#include <org/openoffice/msforms/XFillFormat.hpp> +#include <ooo/vba/msforms/XFillFormat.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::msforms::XFillFormat > ScVbaFillFormat_BASE; +typedef InheritedHelperInterfaceImpl1< ov::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::uno::Reference< ov::msforms::XColorFormat > m_xColorFormat; css::drawing::FillStyle m_nFillStyle; sal_Int32 m_nForeColor; sal_Int32 m_nBackColor; @@ -54,7 +54,7 @@ protected: 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 ); + ScVbaFillFormat( const css::uno::Reference< ov::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 @@ -66,8 +66,8 @@ public: // 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); + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); }; diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx index c05ad2c0410c..9855d5e056af 100644 --- a/sc/source/ui/vba/vbafont.cxx +++ b/sc/source/ui/vba/vbafont.cxx @@ -32,13 +32,18 @@ #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 <com/sun/star/text/XSimpleText.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include <ooo/vba/excel/XlColorIndex.hpp> +#include <ooo/vba/excel/XlUnderlineStyle.hpp> #include <svtools/itemset.hxx> #include "vbafont.hxx" #include "scitems.hxx" +#include "cellsuno.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; // use local constants there is no need to expose these constants @@ -64,14 +69,58 @@ 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 ) +ScVbaFont::ScVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, uno::Reference< beans::XPropertySet > xPropertySet, ScCellRangeObj* pRangeObj ) throw ( uno::RuntimeException ) : ScVbaFont_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mPalette( dPalette ), mpRangeObj( pRangeObj ) { } +SfxItemSet* +ScVbaFont::GetDataSet() +{ + SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( mpRangeObj ); + return pDataSet; +} + +ScVbaFont::~ScVbaFont() +{ +} + + +uno::Reference< beans::XPropertySet > lcl_TextProperties( uno::Reference< table::XCell >& xIf ) throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xTxtRange( xIf, uno::UNO_QUERY_THROW ); + uno::Reference< text::XSimpleText > xTxt( xTxtRange->getText(), uno::UNO_QUERY_THROW ) ; + uno::Reference< beans::XPropertySet > xProps( xTxt->createTextCursor(), uno::UNO_QUERY_THROW ); + return xProps; +} void SAL_CALL ScVbaFont::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeException ) { + // #FIXEME create some sort of generic get/set code where + // you can pass a functor + // get/set - Super/sub script code is exactly the same + // except for the call applied at each cell position + uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); + uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); + if ( !xCell.is() ) + { + uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); + sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); + sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); + for ( sal_Int32 col = 0; col < nCols; ++col ) + { + for ( sal_Int32 row = 0; row < nRows; ++row ) + { + uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW ); + ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); + aFont.setSuperscript( aValue ); + } + } + return; + } + xCell.set( xCellRange->getCellByPosition( 0,0 ) ); + + uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); sal_Bool bValue = sal_False; aValue >>= bValue; sal_Int16 nValue = NORMAL; @@ -82,21 +131,68 @@ ScVbaFont::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExceptio 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 ); + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); } uno::Any SAL_CALL ScVbaFont::getSuperscript() throw ( uno::RuntimeException ) { + uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); + uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); + if ( !xCell.is() ) + { + uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); + sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); + sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); + uno::Any aRes; + for ( sal_Int32 col = 0; col < nCols; ++col ) + { + for ( sal_Int32 row = 0; row < nRows; ++row ) + { + uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW ); + ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); + if ( !col && !row ) + aRes = aFont.getSuperscript(); + else if ( aRes != aFont.getSuperscript() ) + return aNULL(); + } + } + return aRes; + + } + xCell.set( xCellRange->getCellByPosition( 0,0 ) ); + uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); short nValue = 0; - mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; + xProps->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 ) { + uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); + uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); + if ( !xCell.is() ) + { + uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); + sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); + sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); + for ( sal_Int32 col = 0; col < nCols; ++col ) + { + for ( sal_Int32 row = 0; row < nRows; ++row ) + { + uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW ); + ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); + aFont.setSubscript( aValue ); + } + } + return; + + } + xCell.set( xCellRange->getCellByPosition( 0,0 ) ); + uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); + sal_Bool bValue = sal_False; aValue >>= bValue; sal_Int16 nValue = NORMAL; @@ -108,16 +204,42 @@ ScVbaFont::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException nValue2 = SUBSCRIPTHEIGHT; } - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); } uno::Any SAL_CALL ScVbaFont::getSubscript() throw ( uno::RuntimeException ) { + uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); + uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); + if ( !xCell.is() ) + { + uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); + sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); + sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); + uno::Any aRes; + for ( sal_Int32 col = 0; col < nCols; ++col ) + { + for ( sal_Int32 row = 0; row < nRows; ++row ) + { + uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW ); + ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); + if ( !col && !row ) + aRes = aFont.getSubscript(); + else if ( aRes != aFont.getSubscript() ) + return aNULL(); + } + } + return aRes; + + } + xCell.set( xCellRange->getCellByPosition( 0,0 ) ); + uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); + short nValue = NORMAL; - mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; return uno::makeAny( ( nValue == SUBSCRIPT ) ); } @@ -130,8 +252,8 @@ ScVbaFont::setSize( const uno::Any& aValue ) throw( uno::RuntimeException ) uno::Any SAL_CALL ScVbaFont::getSize() throw ( uno::RuntimeException ) { - if ( mpDataSet ) - if ( mpDataSet->GetItemState( ATTR_FONT_HEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT_HEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) ); } @@ -159,8 +281,8 @@ 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 ) + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT_COLOR, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); // getColor returns Xl ColorValue, need to convert it to OO val @@ -224,22 +346,54 @@ ScVbaFont::getStandardFont() throw ( uno::RuntimeException ) } void SAL_CALL -ScVbaFont::setFontStyle( const uno::Any& /*aValue*/ ) throw( uno::RuntimeException ) +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 >() ); + sal_Bool bBold = sal_False; + sal_Bool bItalic = sal_False; + + rtl::OUString aStyles; + aValue >>= aStyles; + + std::vector< rtl::OUString > aTokens; + sal_Int32 nIndex = 0; + do + { + rtl::OUString aToken = aStyles.getToken( 0, ' ', nIndex ); + aTokens.push_back( aToken ); + }while( nIndex >= 0 ); + + std::vector< rtl::OUString >::iterator it; + for( it = aTokens.begin(); it != aTokens.end(); ++it ) + { + if( (*it).equalsIgnoreAsciiCaseAscii( "Bold" ) ) + bBold = sal_True; + + if( (*it).equalsIgnoreAsciiCaseAscii( "Italic" ) ) + bItalic = sal_True; + } + + setBold( uno::makeAny( bBold ) ); + setItalic( uno::makeAny( bItalic ) ); } 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(); + rtl::OUStringBuffer aStyles; + sal_Bool bValue = sal_False; + getBold() >>= bValue; + if( bValue ) + aStyles.appendAscii("Bold"); + + getItalic() >>= bValue; + if( bValue ) + { + if( aStyles.getLength() ) + aStyles.appendAscii(" "); + aStyles.appendAscii("Italic"); + } + return uno::makeAny( aStyles.makeStringAndClear() ); } void SAL_CALL @@ -257,8 +411,8 @@ ScVbaFont::setBold( const uno::Any& aValue ) throw( uno::RuntimeException ) uno::Any SAL_CALL ScVbaFont::getBold() throw ( uno::RuntimeException ) { - if ( mpDataSet ) - if ( mpDataSet->GetItemState( ATTR_FONT_WEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT_WEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); double fValue = 0.0; @@ -303,8 +457,8 @@ ScVbaFont::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException uno::Any SAL_CALL ScVbaFont::getUnderline() throw ( uno::RuntimeException ) { - if ( mpDataSet ) - if ( mpDataSet->GetItemState( ATTR_FONT_UNDERLINE, TRUE, NULL) == SFX_ITEM_DONTCARE ) + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT_UNDERLINE, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); sal_Int32 nValue = awt::FontUnderline::NONE; @@ -341,8 +495,8 @@ ScVbaFont::setStrikethrough( const uno::Any& aValue ) throw ( uno::RuntimeExcept uno::Any SAL_CALL ScVbaFont::getStrikethrough() throw ( uno::RuntimeException ) { - if ( mpDataSet ) - if ( mpDataSet->GetItemState( ATTR_FONT_CROSSEDOUT, TRUE, NULL) == SFX_ITEM_DONTCARE ) + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT_CROSSEDOUT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); short nValue = 0; mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue; @@ -358,8 +512,8 @@ ScVbaFont::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException ) uno::Any SAL_CALL ScVbaFont::getShadow() throw (uno::RuntimeException) { - if ( mpDataSet ) - if ( mpDataSet->GetItemState( ATTR_FONT_SHADOWED, TRUE, NULL) == SFX_ITEM_DONTCARE ) + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT_SHADOWED, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); } @@ -378,13 +532,13 @@ ScVbaFont::setItalic( const uno::Any& aValue ) throw ( uno::RuntimeException ) uno::Any SAL_CALL ScVbaFont::getItalic() throw ( uno::RuntimeException ) { - if ( mpDataSet ) - if ( mpDataSet->GetItemState( ATTR_FONT_POSTURE, TRUE, NULL) == SFX_ITEM_DONTCARE ) + if ( GetDataSet() ) + if ( GetDataSet()->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 ); + awt::FontSlant aFS; + mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= aFS; + return uno::makeAny( aFS == awt::FontSlant_ITALIC ); } void SAL_CALL @@ -398,8 +552,8 @@ ScVbaFont::setName( const uno::Any& aValue ) throw ( uno::RuntimeException ) uno::Any SAL_CALL ScVbaFont::getName() throw ( uno::RuntimeException ) { - if ( mpDataSet ) - if ( mpDataSet->GetItemState( ATTR_FONT, TRUE, NULL) == SFX_ITEM_DONTCARE ) + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT, TRUE, NULL) == SFX_ITEM_DONTCARE ) return aNULL(); return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) ); } @@ -416,6 +570,22 @@ ScVbaFont::setColor( const uno::Any& _color ) throw (uno::RuntimeException) { mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color)); } + +void SAL_CALL +ScVbaFont::setOutlineFont( const uno::Any& aValue ) throw ( uno::RuntimeException ) +{ + mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharContoured" ) ), aValue ); +} + +uno::Any SAL_CALL +ScVbaFont::getOutlineFont() throw (uno::RuntimeException) +{ + if ( GetDataSet() ) + if ( GetDataSet()->GetItemState( ATTR_FONT_CONTOUR, TRUE, NULL) == SFX_ITEM_DONTCARE ) + return aNULL(); + return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharContoured" ) ) ); +} + rtl::OUString& ScVbaFont::getServiceImplName() { @@ -430,7 +600,7 @@ ScVbaFont::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Font" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Font" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbafont.hxx b/sc/source/ui/vba/vbafont.hxx index 259894b0bc2f..a0b9b2ebf140 100644 --- a/sc/source/ui/vba/vbafont.hxx +++ b/sc/source/ui/vba/vbafont.hxx @@ -32,23 +32,25 @@ #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XFont.hpp> +#include <ooo/vba/excel/XFont.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include "vbahelperinterface.hxx" #include "vbapalette.hxx" class ScTableSheetsObj; +class ScCellRangeObj; -typedef InheritedHelperInterfaceImpl1< oo::excel::XFont > ScVbaFont_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XFont > ScVbaFont_BASE; class ScVbaFont : public ScVbaFont_BASE { css::uno::Reference< css::beans::XPropertySet > mxFont; ScVbaPalette mPalette; - SfxItemSet* mpDataSet; + ScCellRangeObj* mpRangeObj; + SfxItemSet* GetDataSet(); 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() {} + ScVbaFont( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet, ScCellRangeObj* pRangeObj = NULL ) throw ( css::uno::RuntimeException ); + virtual ~ScVbaFont();// {} // Attributes virtual css::uno::Any SAL_CALL getSize() throw (css::uno::RuntimeException); @@ -79,6 +81,8 @@ public: 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) ; + virtual css::uno::Any SAL_CALL getOutlineFont() throw (css::uno::RuntimeException) ; + virtual void SAL_CALL setOutlineFont( const css::uno::Any& _outlinefont ) throw (css::uno::RuntimeException) ; // XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx index 6a8c31771110..a627ed3a4d92 100644 --- a/sc/source/ui/vba/vbaformat.cxx +++ b/sc/source/ui/vba/vbaformat.cxx @@ -28,11 +28,11 @@ * ************************************************************************/ #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 <ooo/vba/excel/XStyle.hpp> +#include <ooo/vba/excel/XlVAlign.hpp> +#include <ooo/vba/excel/XlHAlign.hpp> +#include <ooo/vba/excel/XlOrientation.hpp> +#include <ooo/vba/excel/Constants.hpp> #include <com/sun/star/table/CellVertJustify.hpp> #include <com/sun/star/table/CellHoriJustify.hpp> #include <com/sun/star/table/CellOrientation.hpp> @@ -49,14 +49,14 @@ #include "unonames.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; #define FORMATSTRING "FormatString" #define LOCALE "Locale" 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 ) +ScVbaFormat< Ifc1 >::ScVbaFormat( const uno::Reference< 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 { @@ -342,7 +342,7 @@ 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 ); + uno::Reference< XCollection > xColl = new ScVbaBorders( thisHelperIface(), ScVbaFormat_BASE::mxContext, uno::Reference< table::XCellRange >( mxPropertySet, uno::UNO_QUERY_THROW ), aPalette ); if ( Index.hasValue() ) { @@ -791,7 +791,7 @@ ScVbaFormat<Ifc1>::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Format" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Format" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaformat.hxx b/sc/source/ui/vba/vbaformat.hxx index 1e81fabb4bf1..afb5e5a45c29 100644 --- a/sc/source/ui/vba/vbaformat.hxx +++ b/sc/source/ui/vba/vbaformat.hxx @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef SC_VBA_FORMAT_HXX #define SC_VBA_FORMAT_HXX -#include <org/openoffice/excel/XFormat.hpp> +#include <ooo/vba/excel/XFormat.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/util/XNumberFormats.hpp> @@ -64,16 +64,16 @@ protected: 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 ); + ScVbaFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const css::uno::Reference< css::frame::XModel >& xModel, bool bCheckAmbiguoity ) throw ( css::script::BasicErrorException ); virtual ~ScVbaFormat() {} - virtual css::uno::Reference< oo::vba::XHelperInterface > thisHelperIface() = 0; + virtual css::uno::Reference< ov::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 css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ::ooo::vba::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); diff --git a/sc/source/ui/vba/vbaformatcondition.cxx b/sc/source/ui/vba/vbaformatcondition.cxx index 50227c28c248..285ea0ea3370 100644 --- a/sc/source/ui/vba/vbaformatcondition.cxx +++ b/sc/source/ui/vba/vbaformatcondition.cxx @@ -29,9 +29,9 @@ ************************************************************************/ #include "vbaformatcondition.hxx" #include "vbaformatconditions.hxx" -#include <org/openoffice/excel/XlFormatConditionType.hpp> +#include <ooo/vba/excel/XlFormatConditionType.hpp> -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; ScVbaFormatConditions* @@ -42,7 +42,7 @@ lcl_getScVbaFormatConditionsPtr( const uno::Reference< excel::XFormatConditions 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 ) +ScVbaFormatCondition::ScVbaFormatCondition( const uno::Reference< 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(); @@ -173,7 +173,7 @@ ScVbaFormatCondition::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.FormatCondition" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.FormatCondition" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaformatcondition.hxx b/sc/source/ui/vba/vbaformatcondition.hxx index 5a686a4e50b5..853b925020bb 100644 --- a/sc/source/ui/vba/vbaformatcondition.hxx +++ b/sc/source/ui/vba/vbaformatcondition.hxx @@ -29,9 +29,9 @@ ************************************************************************/ #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 <ooo/vba/excel/XFormatCondition.hpp> +#include <ooo/vba/excel/XFormatConditions.hpp> +#include <ooo/vba/excel/XStyle.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/sheet/XSheetConditionalEntries.hpp> #include <com/sun/star/sheet/XSheetConditionalEntry.hpp> @@ -39,18 +39,18 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include "vbacondition.hxx" -typedef ScVbaCondition< oo::excel::XFormatCondition > ScVbaFormatCondition_BASE; +typedef ScVbaCondition< ov::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< ov::excel::XFormatConditions> moFormatConditions; + css::uno::Reference< ov::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 ); + ScVbaFormatCondition( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::sheet::XSheetConditionalEntry >& _xSheetConditionalEntry, const css::uno::Reference< ov::excel::XStyle >&, const css::uno::Reference< ov::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 ); @@ -63,9 +63,9 @@ public: 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::Reference< ::ooo::vba::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); + virtual css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); // XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); diff --git a/sc/source/ui/vba/vbaformatconditions.cxx b/sc/source/ui/vba/vbaformatconditions.cxx index b9594f25309c..06067d470177 100644 --- a/sc/source/ui/vba/vbaformatconditions.cxx +++ b/sc/source/ui/vba/vbaformatconditions.cxx @@ -28,7 +28,7 @@ * ************************************************************************/ -#include <org/openoffice/excel/XRange.hpp> +#include <ooo/vba/excel/XRange.hpp> #include <com/sun/star/sheet/XCellRangeAddressable.hpp> #include <com/sun/star/sheet/XSheetConditionalEntry.hpp> #include <vector> @@ -36,7 +36,7 @@ #include "vbaformatcondition.hxx" #include "vbaworkbook.hxx" #include "vbastyles.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; typedef std::vector< beans::PropertyValue > VecPropValues; @@ -47,10 +47,10 @@ 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 ) +ScVbaFormatConditions::ScVbaFormatConditions( const uno::Reference< 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 ); + uno::Reference< excel::XWorkbook > xWorkbook = new ScVbaWorkbook( uno::Reference< 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 ); @@ -89,7 +89,7 @@ ScVbaFormatConditions::getElementType() throw (css::uno::RuntimeException) } -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::Any xSheetConditionToFormatCondition( const uno::Reference< 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; @@ -102,7 +102,7 @@ uno::Any xSheetConditionToFormatCondition( const uno::Reference< vba::XHelperInt uno::Any ScVbaFormatConditions::createCollectionObject(const uno::Any& aObject ) { - return xSheetConditionToFormatCondition( uno::Reference< vba::XHelperInterface >( mxRangeParent, uno::UNO_QUERY_THROW ), mxContext, mxStyles, this, mxParentRangePropertySet, aObject ); + return xSheetConditionToFormatCondition( uno::Reference< XHelperInterface >( mxRangeParent, uno::UNO_QUERY_THROW ), mxContext, mxStyles, this, mxParentRangePropertySet, aObject ); } class EnumWrapper : public EnumerationHelper_BASE @@ -125,7 +125,7 @@ public: 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++ ) ); + return xSheetConditionToFormatCondition( uno::Reference< XHelperInterface >( m_xParentRange, uno::UNO_QUERY_THROW ), m_xContext, m_xStyles, m_xParentCollection, m_xProps, m_xIndexAccess->getByIndex( nIndex++ ) ); throw container::NoSuchElementException(); } }; @@ -199,7 +199,7 @@ ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, cons 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); + xFormatCondition = new ScVbaFormatCondition(uno::Reference< XHelperInterface >( mxRangeParent, uno::UNO_QUERY_THROW ), mxContext, xSheetConditionalEntry, xStyle, this, mxParentRangePropertySet); notifyRange(); return xFormatCondition; } @@ -296,7 +296,7 @@ ScVbaFormatConditions::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.FormatConditions" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.FormatConditions" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaformatconditions.hxx b/sc/source/ui/vba/vbaformatconditions.hxx index 72ba21fd59cd..e5524a746638 100644 --- a/sc/source/ui/vba/vbaformatconditions.hxx +++ b/sc/source/ui/vba/vbaformatconditions.hxx @@ -29,33 +29,33 @@ ************************************************************************/ #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 <ooo/vba/excel/XFormatConditions.hpp> +#include <ooo/vba/excel/XStyles.hpp> +#include <ooo/vba/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; +typedef CollTestImplHelper< ov::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< ov::excel::XStyles > mxStyles; + css::uno::Reference< ov::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 >& ); + ScVbaFormatConditions( const css::uno::Reference< ov::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); + virtual css::uno::Reference< ov::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< ov::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); + virtual css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbaframe.cxx b/sc/source/ui/vba/vbaframe.cxx new file mode 100644 index 000000000000..24f8884e4d3b --- /dev/null +++ b/sc/source/ui/vba/vbaframe.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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 "vbaframe.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaFrame::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +uno::Any SAL_CALL +ScVbaFrame::getValue() throw (css::uno::RuntimeException) +{ + return uno::makeAny( getCaption() ); +} + +void SAL_CALL +ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sCaption; + _value >>= sCaption; + setCaption( sCaption ); +} + +rtl::OUString& +ScVbaFrame::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaFrame::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbaframe.hxx b/sc/source/ui/vba/vbaframe.hxx new file mode 100644 index 000000000000..60204571c749 --- /dev/null +++ b/sc/source/ui/vba/vbaframe.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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_FRAME_HXX +#define SC_VBA_FRAME_HXX +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XLabel.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE; + +class ScVbaFrame : public FrameImpl_BASE +{ +public: + ScVbaFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx index bfbe55a570ef..216a8a3d1f70 100644 --- a/sc/source/ui/vba/vbaglobals.cxx +++ b/sc/source/ui/vba/vbaglobals.cxx @@ -41,7 +41,7 @@ #include <cppuhelper/bootstrap.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -using namespace ::org::openoffice; +using namespace ::ooo::vba; @@ -62,12 +62,12 @@ ScVbaGlobals::~ScVbaGlobals() } // Will throw if singleton can't be accessed -uno::Reference< vba::XGlobals > +uno::Reference< XGlobals > ScVbaGlobals::getGlobalsImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) { - uno::Reference< vba::XGlobals > xGlobals( + uno::Reference< XGlobals > xGlobals( xContext->getValueByName( ::rtl::OUString::createFromAscii( - "/singletons/org.openoffice.vba.theGlobals") ), uno::UNO_QUERY); + "/singletons/ooo.vba.theGlobals") ), uno::UNO_QUERY); if ( !xGlobals.is() ) { @@ -153,9 +153,9 @@ ScVbaGlobals::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno:: } uno::Any SAL_CALL -ScVbaGlobals::Names( ) throw ( uno::RuntimeException ) +ScVbaGlobals::Names( const css::uno::Any& aIndex ) throw ( uno::RuntimeException ) { - return getApplication()->Names(); + return getApplication()->Names( aIndex ); } namespace globals @@ -165,6 +165,6 @@ sdecl::class_<ScVbaGlobals, sdecl::with_args<false> > serviceImpl; extern sdecl::ServiceDecl const serviceDecl( serviceImpl, "ScVbaGlobals", - "org.openoffice.vba.Globals" ); + "ooo.vba.Globals" ); } diff --git a/sc/source/ui/vba/vbaglobals.hxx b/sc/source/ui/vba/vbaglobals.hxx index af5ea1586052..f24032d14ad9 100644 --- a/sc/source/ui/vba/vbaglobals.hxx +++ b/sc/source/ui/vba/vbaglobals.hxx @@ -33,7 +33,7 @@ #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 <ooo/vba/XGlobals.hpp> #include <cppuhelper/implbase1.hxx> #include "vbahelper.hxx" @@ -43,33 +43,33 @@ // ============================================================================= typedef ::cppu::WeakImplHelper1< - oo::vba::XGlobals > ScVbaGlobals_BASE; + ov::XGlobals > ScVbaGlobals_BASE; class ScVbaGlobals : public ScVbaGlobals_BASE { private: css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< oo::excel::XApplication > mxApplication; + css::uno::Reference< ov::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); + static css::uno::Reference< ov::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException); // XGlobals virtual css::uno::Reference< - oo::excel::XApplication > SAL_CALL getApplication() + ov::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::Reference< ov::excel::XWorkbook > SAL_CALL getActiveWorkbook() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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( ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw ( css::uno::RuntimeException ); }; #endif // diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx index 5b5ce2645c21..1ab2ea102891 100644 --- a/sc/source/ui/vba/vbahelper.cxx +++ b/sc/source/ui/vba/vbahelper.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XIntrospection.hpp> #include <comphelper/processfactory.hxx> @@ -57,9 +58,11 @@ #include "tabvwsh.hxx" #include "transobj.hxx" #include "scmod.hxx" - +#include "vbashape.hxx" +#include "unonames.hxx" +#include "cellsuno.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; #define POINTTO100THMILLIMETERFACTOR 35.27778 void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue ); @@ -67,13 +70,25 @@ void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue ); uno::Any sbxToUnoValue( SbxVariable* pVar ); -namespace org +namespace ooo { -namespace openoffice +namespace vba { const double Millimeter::factor = 35.27778; +uno::Reference< beans::XIntrospectionAccess > +getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) +{ + static uno::Reference< beans::XIntrospection > xIntrospection; + if( !xIntrospection.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW ); + } + return xIntrospection->inspect( aObject ); +} + uno::Reference< script::XTypeConverter > getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) { @@ -215,11 +230,27 @@ dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl) } +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(); + ScTabViewShell* pViewShell = getCurrentBestViewShell(); if ( pViewShell ) { pViewShell->PasteFromSystem(); @@ -515,6 +546,11 @@ void PrintOutHelper( const uno::Any& From, const uno::Any& To, const uno::Any& C // 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(); @@ -728,5 +764,65 @@ double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR; } +ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) +{ + m_xShape = new ScVbaShape( xContext, xShape ); +} + +#define VBA_LEFT "PositionX" +#define VBA_TOP "PositionY" +UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl ) +{ + mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW ); +} + double UserFormGeometryHelper::getLeft() + { + sal_Int32 nLeft = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft; + return Millimeter::getInPoints( nLeft ); + } + void UserFormGeometryHelper::setLeft( double nLeft ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) ); + } + double UserFormGeometryHelper::getTop() + { + sal_Int32 nTop = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop; + return Millimeter::getInPoints( nTop ); + } + void UserFormGeometryHelper::setTop( double nTop ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) ); + } + double UserFormGeometryHelper::getHeight() + { + sal_Int32 nHeight = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ) ) >>= nHeight; + return Millimeter::getInPoints( nHeight ); + } + void UserFormGeometryHelper::setHeight( double nHeight ) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) ); + } + double UserFormGeometryHelper::getWidth() + { + sal_Int32 nWidth = 0; + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ) ) >>= nWidth; + return Millimeter::getInPoints( nWidth ); + } + void UserFormGeometryHelper::setWidth( double nWidth) + { + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) ); + } + +SfxItemSet* +ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj ) +{ + SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ; + return pDataSet; + +} + } // openoffice } //org diff --git a/sc/source/ui/vba/vbahelper.hxx b/sc/source/ui/vba/vbahelper.hxx index ed55d490b371..3def6b078096 100644 --- a/sc/source/ui/vba/vbahelper.hxx +++ b/sc/source/ui/vba/vbahelper.hxx @@ -31,20 +31,25 @@ #define SC_VBA_HELPER_HXX #include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/beans/XIntrospectionAccess.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/XControl.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> +#include <ooo/vba/msforms/XShape.hpp> +#include "cellsuno.hxx" namespace css = ::com::sun::star; -namespace org +namespace ooo { - namespace openoffice + namespace vba { 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) @@ -56,10 +61,12 @@ namespace org throw css::lang::IllegalArgumentException(); return aSomething; } + css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException); 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(); @@ -79,6 +86,7 @@ namespace org // 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 ) @@ -86,6 +94,13 @@ namespace org 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 ScVbaCellRangeAccess +{ +public: + static SfxItemSet* GetDataSet( ScCellRangeObj* pRangeObj ); +}; + class Millimeter { //Factor to translate between points and hundredths of millimeters: @@ -136,6 +151,80 @@ public: return points; } }; + +class AbstractGeometryAttributes // probably should replace the ShapeHelper below +{ +public: + virtual ~AbstractGeometryAttributes() {} + virtual double getLeft() = 0; + virtual void setLeft( double ) = 0; + virtual double getTop() = 0; + virtual void setTop( double ) = 0; + virtual double getHeight() = 0; + virtual void setHeight( double ) = 0; + virtual double getWidth() = 0; + virtual void setWidth( double ) = 0; +}; + +class ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes +{ +public: + css::uno::Reference< ooo::vba::msforms::XShape > m_xShape; + ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ); + virtual double getLeft() + { + return m_xShape->getLeft(); + } + virtual void setLeft( double nLeft ) + { + m_xShape->setLeft( nLeft ); + } + virtual double getTop() + { + return m_xShape->getTop(); + } + virtual void setTop( double nTop ) + { + m_xShape->setTop( nTop ); + } + + virtual double getHeight() + { + return m_xShape->getHeight(); + } + virtual void setHeight( double nHeight ) + { + m_xShape->setHeight( nHeight ); + } + virtual double getWidth() + { + return m_xShape->getWidth(); + } + virtual void setWidth( double nWidth) + { + m_xShape->setHeight( nWidth ); + } + + +}; +#define VBA_LEFT "PositionX" +#define VBA_TOP "PositionY" +class UserFormGeometryHelper : public AbstractGeometryAttributes +{ + + css::uno::Reference< css::beans::XPropertySet > mxModel; +public: + UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); + virtual double getLeft(); + virtual void setLeft( double nLeft ); + virtual double getTop(); + virtual void setTop( double nTop ); + virtual double getHeight(); + virtual void setHeight( double nHeight ); + virtual double getWidth(); + virtual void setWidth( double nWidth); +}; + class ShapeHelper { protected: @@ -250,7 +339,7 @@ public: } // openoffice } // org -namespace oo = org::openoffice; +namespace ov = ooo::vba; #ifdef DEBUG # define SC_VBA_FIXME(a) OSL_TRACE( a ) diff --git a/sc/source/ui/vba/vbahelperinterface.hxx b/sc/source/ui/vba/vbahelperinterface.hxx index 36877a631fd6..567741cfafbc 100644 --- a/sc/source/ui/vba/vbahelperinterface.hxx +++ b/sc/source/ui/vba/vbahelperinterface.hxx @@ -31,7 +31,7 @@ #define SC_VBA_HELPERINTERFACE_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/vba/XHelperInterface.hpp> +#include <ooo/vba/XHelperInterface.hpp> #include "vbahelper.hxx" #include "vbaglobals.hxx" @@ -61,17 +61,17 @@ // virtual OUString getName(); // } // -const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.HelperServiceBase" ) ); +const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) ); template< typename Ifc1 > class InheritedHelperInterfaceImpl : public Ifc1 { protected: - css::uno::WeakReference< oo::vba::XHelperInterface > mxParent; + css::uno::WeakReference< ov::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 ) {} + InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {} virtual rtl::OUString& getServiceImplName() = 0; virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0; @@ -80,7 +80,7 @@ public: { return 0x53756E4F; } - virtual css::uno::Reference< oo::vba::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; } + virtual css::uno::Reference< ov::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() ); } @@ -110,7 +110,7 @@ class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cpp { 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 ) {} + InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {} }; #endif diff --git a/sc/source/ui/vba/vbahyperlink.cxx b/sc/source/ui/vba/vbahyperlink.cxx new file mode 100644 index 000000000000..27bcfaa28145 --- /dev/null +++ b/sc/source/ui/vba/vbahyperlink.cxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * 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 "vbahyperlink.hxx" +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/text/XTextFieldsSupplier.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include "vbarange.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +ScVbaHyperlink::ScVbaHyperlink( uno::Sequence< uno::Any> const & args, + uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : HyperlinkImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxCell( getXSomethingFromArgs< table::XCell >( args, 1, false ) ) +{ + mxCell = getXSomethingFromArgs< table::XCell >( args, 1, false ); + uno::Reference< text::XTextFieldsSupplier > xTextFields( mxCell, uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndex( xTextFields->getTextFields(), uno::UNO_QUERY_THROW ); + mxTextField.set( xIndex->getByIndex(0), uno::UNO_QUERY_THROW ); +} + +ScVbaHyperlink::~ScVbaHyperlink() +{ +} + +::rtl::OUString +ScVbaHyperlink::getAddress() throw (css::uno::RuntimeException) +{ + rtl::OUString aAddress; + uno::Any aValue = mxTextField->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ); + aValue >>= aAddress; + return aAddress; +} + +void +ScVbaHyperlink::setAddress( const ::rtl::OUString & rAddress ) throw (css::uno::RuntimeException) +{ + uno::Any aValue; + aValue <<= rAddress; + mxTextField->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ), aValue ); +} + +::rtl::OUString +ScVbaHyperlink::getName() throw (css::uno::RuntimeException) +{ + // it seems this attribute is same as TextToDisplay + return getTextToDisplay(); +} + +void +ScVbaHyperlink::setName( const ::rtl::OUString & rName ) throw (css::uno::RuntimeException) +{ + setTextToDisplay( rName ); +} + +::rtl::OUString +ScVbaHyperlink::getTextToDisplay() throw (css::uno::RuntimeException) +{ + rtl::OUString aTextToDisplay; + uno::Any aValue = mxTextField->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Representation" ) ) ); + aValue >>= aTextToDisplay; + return aTextToDisplay; +} + +void +ScVbaHyperlink::setTextToDisplay( const ::rtl::OUString & rTextToDisplay ) throw (css::uno::RuntimeException) +{ + uno::Any aValue; + aValue <<= rTextToDisplay; + mxTextField->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Representation" ) ), aValue ); +} + +css::uno::Reference< ov::excel::XRange > SAL_CALL ScVbaHyperlink::Range() throw (css::uno::RuntimeException) +{ + uno::Reference< table::XCellRange > xRange( mxCell,uno::UNO_QUERY_THROW ); + // FIXME: need to pass current worksheet as the parent of XRange. + return uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface > (), mxContext, xRange ) ); +} + +rtl::OUString& +ScVbaHyperlink::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaHyperlink") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaHyperlink::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Hyperlink" ) ); + } + return aServiceNames; +} + +namespace hyperlink +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_<ScVbaHyperlink, sdecl::with_args<true> > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ScVbaHyperlink", + "ooo.vba.excel.Hyperlink" ); +} diff --git a/sc/source/ui/vba/vbahyperlink.hxx b/sc/source/ui/vba/vbahyperlink.hxx new file mode 100644 index 000000000000..2789b4d133b2 --- /dev/null +++ b/sc/source/ui/vba/vbahyperlink.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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_HYPERLINK_HXX +#define SC_VBA_HYPERLINK_HXX + +#include <ooo/vba/excel/XHyperlink.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <ooo/vba/excel/XRange.hpp> + +#include "vbahelperinterface.hxx" + +typedef InheritedHelperInterfaceImpl1< ov::excel::XHyperlink > HyperlinkImpl_BASE; + +class ScVbaHyperlink : public HyperlinkImpl_BASE +{ + css::uno::Reference< css::table::XCell > mxCell; + css::uno::Reference< css::beans::XPropertySet > mxTextField; + +public: + ScVbaHyperlink( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext ) throw ( css::lang::IllegalArgumentException ); + virtual ~ScVbaHyperlink(); + + // Attributes + virtual ::rtl::OUString SAL_CALL getAddress() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAddress( const ::rtl::OUString &rAddress ) throw (css::uno::RuntimeException); + 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 getTextToDisplay() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTextToDisplay( const ::rtl::OUString &rTextToDisplay ) throw (css::uno::RuntimeException); + + // Methods + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Range() throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SC_VBA_HYPERLINK_HXX */ + diff --git a/sc/source/ui/vba/vbaimage.cxx b/sc/source/ui/vba/vbaimage.cxx new file mode 100644 index 000000000000..7e6cd34c191e --- /dev/null +++ b/sc/source/ui/vba/vbaimage.cxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaimage.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +ScVbaImage::ScVbaImage( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ImageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +rtl::OUString& +ScVbaImage::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaImage") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaImage::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Image" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbaimage.hxx b/sc/source/ui/vba/vbaimage.hxx new file mode 100644 index 000000000000..9d4b33818663 --- /dev/null +++ b/sc/source/ui/vba/vbaimage.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_IMAGE_HXX +#define SC_VBA_IMAGE_HXX +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XImage.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE; + +class ScVbaImage : public ImageImpl_BASE +{ +public: + ScVbaImage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif //SC_VBA_IMAGE_HXX diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx index 381600ad8d81..bb85b6c21922 100644 --- a/sc/source/ui/vba/vbainterior.cxx +++ b/sc/source/ui/vba/vbainterior.cxx @@ -34,8 +34,11 @@ #include <com/sun/star/beans/XIntrospectionAccess.hpp> #include <com/sun/star/reflection/XIdlMethod.hpp> #include <com/sun/star/beans/MethodConcept.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/xml/AttributeData.hpp> -#include <org/openoffice/excel/XlColorIndex.hpp> +#include <ooo/vba/excel/XlColorIndex.hpp> +#include <ooo/vba/excel/XlPattern.hpp> #include <comphelper/processfactory.hxx> #include <cppuhelper/queryinterface.hxx> @@ -44,12 +47,53 @@ #include "vbainterior.hxx" #include "vbapalette.hxx" + +#define STATIC_TABLE_SIZE( array ) (sizeof(array)/sizeof(*(array))) +#define COLORMAST 0xFFFFFF +const sal_uInt16 EXC_COLOR_WINDOWBACK = 65; +typedef std::map< sal_Int32, sal_Int32 > PatternMap; +typedef std::pair< sal_Int32, sal_Int32 > PatternPair; using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; +using namespace ::ooo::vba::excel::XlPattern; static const rtl::OUString BACKCOLOR( RTL_CONSTASCII_USTRINGPARAM( "CellBackColor" ) ); +static const rtl::OUString PATTERN( RTL_CONSTASCII_USTRINGPARAM( "Pattern" ) ); +static const rtl::OUString PATTERNCOLOR( RTL_CONSTASCII_USTRINGPARAM( "PatternColor" ) ); -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 ) +PatternMap lcl_getPatternMap() { + PatternMap aPatternMap; + aPatternMap.insert( PatternPair( xlPatternAutomatic, 0 ) ); + aPatternMap.insert( PatternPair( xlPatternChecker, 9 ) ); + aPatternMap.insert( PatternPair( xlPatternCrissCross, 16 ) ); + aPatternMap.insert( PatternPair( xlPatternDown, 7 ) ); + aPatternMap.insert( PatternPair( xlPatternGray16, 17 ) ); + aPatternMap.insert( PatternPair( xlPatternGray25, 4 ) ); + aPatternMap.insert( PatternPair( xlPatternGray50, 2 ) ); + aPatternMap.insert( PatternPair( xlPatternGray75, 3 ) ); + aPatternMap.insert( PatternPair( xlPatternGray8, 18 ) ); + aPatternMap.insert( PatternPair( xlPatternGrid, 15 ) ); + aPatternMap.insert( PatternPair( xlPatternHorizontal, 5 ) ); + aPatternMap.insert( PatternPair( xlPatternLightDown, 13 ) ); + aPatternMap.insert( PatternPair( xlPatternLightHorizontal, 11 ) ); + aPatternMap.insert( PatternPair( xlPatternLightUp, 14 ) ); + aPatternMap.insert( PatternPair( xlPatternLightVertical, 12 ) ); + aPatternMap.insert( PatternPair( xlPatternNone, 0 ) ); + aPatternMap.insert( PatternPair( xlPatternSemiGray75, 10 ) ); + aPatternMap.insert( PatternPair( xlPatternSolid, 0 ) ); + aPatternMap.insert( PatternPair( xlPatternUp, 8 ) ); + aPatternMap.insert( PatternPair( xlPatternVertical, 6 ) ); + return aPatternMap; +} + +static PatternMap aPatternMap( lcl_getPatternMap() ); + +ScVbaInterior::ScVbaInterior( const uno::Reference< 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 ) +{ + // auto color + //m_aPattColor.SetColor( (sal_uInt32)0xFFFFFFFF ); + m_aPattColor.SetColor( (sal_uInt32)0x0 ); + m_nPattern = 0L; if ( !m_xProps.is() ) throw lang::IllegalArgumentException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "properties") ), uno::Reference< uno::XInterface >(), 2 ); } @@ -57,15 +101,50 @@ ScVbaInterior::ScVbaInterior( const uno::Reference< vba::XHelperInterface >& xPa uno::Any ScVbaInterior::getColor() throw (uno::RuntimeException) { - uno::Any aAny; - aAny = OORGBToXLRGB( m_xProps->getPropertyValue( BACKCOLOR ) ); - return aAny; + Color aBackColor( GetBackColor() ); + return uno::makeAny( OORGBToXLRGB( aBackColor.GetColor() ) ); } void ScVbaInterior::setColor( const uno::Any& _color ) throw (uno::RuntimeException) { - m_xProps->setPropertyValue( BACKCOLOR , XLRGBToOORGB(_color)); + sal_Int32 nColor = 0; + if( _color >>= nColor ) + { + SetUserDefinedAttributes( BACKCOLOR, SetAttributeData( XLRGBToOORGB( nColor ) ) ); + //m_xProps->setPropertyValue( BACKCOLOR , XLRGBToOORGB(_color)); + SetMixedColor(); + } +} + +void +ScVbaInterior::SetMixedColor() +{ + // pattern + uno::Any aPattern = GetUserDefinedAttributes( PATTERN ); + if( aPattern.hasValue() ) + { + m_nPattern = GetAttributeData( aPattern ); + } + sal_Int32 nPattern = aPatternMap[ m_nPattern ]; + // pattern color + uno::Any aPatternColor = GetUserDefinedAttributes( PATTERNCOLOR ); + if( aPatternColor.hasValue() ) + { + sal_uInt32 nPatternColor = GetAttributeData( aPatternColor ); + m_aPattColor.SetColor( nPatternColor ); + } + sal_Int32 nPatternColor = m_aPattColor.GetColor(); + // back color + Color aBackColor( GetBackColor() ); + // set mixed color + Color aMixedColor; + if( nPattern > 0 ) + aMixedColor = GetPatternColor( Color(nPatternColor), aBackColor, (sal_uInt32)nPattern ); + else + aMixedColor = GetPatternColor( aBackColor, aBackColor, (sal_uInt32)nPattern ); + sal_Int32 nMixedColor = aMixedColor.GetColor() & COLORMAST; + m_xProps->setPropertyValue( BACKCOLOR , uno::makeAny( nMixedColor ) ); } uno::Reference< container::XIndexAccess > @@ -83,28 +162,28 @@ ScVbaInterior::setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno { sal_Int32 nIndex = 0; _colorindex >>= nIndex; + + // 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( GetIndexColor( nIndex ) ) ); +} +uno::Any +ScVbaInterior::GetIndexColor( const sal_Int32& nColorIndex ) +{ + sal_Int32 nIndex = nColorIndex; // #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 )) ); + return xIndex->getByIndex( nIndex ); } -uno::Any SAL_CALL -ScVbaInterior::getColorIndex() throw ( css::uno::RuntimeException ) +sal_Int32 +ScVbaInterior::GetColorIndex( const sal_Int32 nColor ) { - 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; @@ -118,7 +197,187 @@ ScVbaInterior::getColorIndex() throw ( css::uno::RuntimeException ) break; } } - return uno::makeAny( nIndex ); + return 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; + + return uno::makeAny( GetIndexColor( nColor ) ); +} +Color +ScVbaInterior::GetPatternColor( const Color& rPattColor, const Color& rBackColor, sal_uInt32 nXclPattern ) +{ + // 0x00 == 0% transparence (full rPattColor) + // 0x80 == 100% transparence (full rBackColor) + static const sal_uInt8 pnRatioTable[] = + { + 0x80, 0x00, 0x40, 0x20, 0x60, 0x40, 0x40, 0x40, // 00 - 07 + 0x40, 0x40, 0x20, 0x60, 0x60, 0x60, 0x60, 0x48, // 08 - 15 + 0x50, 0x70, 0x78 // 16 - 18 + }; + return ( nXclPattern < STATIC_TABLE_SIZE( pnRatioTable ) ) ? + GetMixedColor( rPattColor, rBackColor, pnRatioTable[ nXclPattern ] ) : rPattColor; +} +Color +ScVbaInterior::GetMixedColor( const Color& rFore, const Color& rBack, sal_uInt8 nTrans ) +{ + return Color( + nTrans, + GetMixedColorComp( rFore.GetRed(), rBack.GetRed(), nTrans ), + GetMixedColorComp( rFore.GetGreen(), rBack.GetGreen(), nTrans ), + GetMixedColorComp( rFore.GetBlue(), rBack.GetBlue(), nTrans )); +} +sal_uInt8 +ScVbaInterior::GetMixedColorComp( sal_uInt8 nFore, sal_uInt8 nBack, sal_uInt8 nTrans ) +{ + sal_uInt32 nTemp = ((static_cast< sal_Int32 >( nBack ) - nFore) * nTrans) / 0x80 + nFore; + return static_cast< sal_uInt8 >( nTemp ); +} +uno::Reference< container::XNameContainer > +ScVbaInterior::GetAttributeContainer() +{ + return uno::Reference < container::XNameContainer > ( m_xProps->getPropertyValue( rtl::OUString::createFromAscii( "UserDefinedAttributes" ) ), uno::UNO_QUERY_THROW ); +} +sal_Int32 +ScVbaInterior::GetAttributeData( uno::Any aValue ) +{ + xml::AttributeData aDataValue; + if( aValue >>= aDataValue ) + { + return aDataValue.Value.toInt32(); + } + return sal_Int32( 0 ); +} +uno::Any +ScVbaInterior::SetAttributeData( sal_Int32 nValue ) +{ + xml::AttributeData aAttributeData; + //aAttributeData.Namespace = rtl::OUString::createFromAscii( "ooo.vba.excel.CellPatten"); + aAttributeData.Type = rtl::OUString::createFromAscii( "sal_Int32" ); + aAttributeData.Value = rtl::OUString::valueOf( nValue ); + return uno::makeAny( aAttributeData ); +} +uno::Any +ScVbaInterior::GetUserDefinedAttributes( const rtl::OUString& sName ) +{ + uno::Reference< container::XNameContainer > xNameContainer( GetAttributeContainer(), uno::UNO_QUERY_THROW ); + if( xNameContainer->hasByName( sName ) ) + { + return xNameContainer->getByName( sName ); + } + return uno::Any(); +} +void +ScVbaInterior::SetUserDefinedAttributes( const rtl::OUString& sName, const uno::Any& aValue ) +{ + if( aValue.hasValue() ) + { + uno::Reference< container::XNameContainer > xNameContainer( GetAttributeContainer(), uno::UNO_QUERY_THROW ); + if( xNameContainer->hasByName( sName ) ) + xNameContainer->removeByName( sName ); + xNameContainer->insertByName( sName, aValue ); + m_xProps->setPropertyValue( rtl::OUString::createFromAscii( "UserDefinedAttributes" ), uno::makeAny( xNameContainer ) ); + } +} +// OOo do not support below API +uno::Any SAL_CALL +ScVbaInterior::getPattern() throw (uno::RuntimeException) +{ + // XlPattern + uno::Any aPattern = GetUserDefinedAttributes( PATTERN ); + if( aPattern.hasValue() ) + return uno::makeAny( GetAttributeData( aPattern ) ); + return uno::makeAny( excel::XlPattern::xlPatternNone ); +} +void SAL_CALL +ScVbaInterior::setPattern( const uno::Any& _pattern ) throw (uno::RuntimeException) +{ + if( _pattern >>= m_nPattern ) + { + SetUserDefinedAttributes( PATTERN, SetAttributeData( m_nPattern ) ); + SetMixedColor(); + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Pattern index" ), uno::Reference< uno::XInterface >() ); +} +Color +ScVbaInterior::GetBackColor() +{ + sal_Int32 nColor = 0; + Color aBackColor; + uno::Any aColor = GetUserDefinedAttributes( BACKCOLOR ); + if( aColor.hasValue() ) + { + nColor = GetAttributeData( aColor ); + aBackColor.SetColor( nColor ); + } + else + { + uno::Any aAny; + aAny = OORGBToXLRGB( m_xProps->getPropertyValue( BACKCOLOR ) ); + if( aAny >>= nColor ) + { + nColor = XLRGBToOORGB( nColor ); + aBackColor.SetColor( nColor ); + SetUserDefinedAttributes( BACKCOLOR, SetAttributeData( nColor ) ); + } + } + return aBackColor; +} +uno::Any SAL_CALL +ScVbaInterior::getPatternColor() throw (uno::RuntimeException) +{ + // 0 is the default color. no filled. + uno::Any aPatternColor = GetUserDefinedAttributes( PATTERNCOLOR ); + if( aPatternColor.hasValue() ) + { + sal_uInt32 nPatternColor = GetAttributeData( aPatternColor ); + return uno::makeAny( OORGBToXLRGB( nPatternColor ) ); + } + return uno::makeAny( sal_Int32( 0 ) ); +} +void SAL_CALL +ScVbaInterior::setPatternColor( const uno::Any& _patterncolor ) throw (uno::RuntimeException) +{ + sal_Int32 nPattColor = 0; + if( _patterncolor >>= nPattColor ) + { + SetUserDefinedAttributes( PATTERNCOLOR, SetAttributeData( XLRGBToOORGB( nPattColor ) ) ); + SetMixedColor(); + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Pattern Color" ), uno::Reference< uno::XInterface >() ); +} +uno::Any SAL_CALL +ScVbaInterior::getPatternColorIndex() throw (uno::RuntimeException) +{ + sal_Int32 nColor = 0; + XLRGBToOORGB( getPatternColor() ) >>= nColor; + + return uno::makeAny( GetIndexColor( nColor ) ); +} +void SAL_CALL +ScVbaInterior::setPatternColorIndex( const uno::Any& _patterncolorindex ) throw (uno::RuntimeException) +{ + sal_Int32 nColorIndex = 0; + if( _patterncolorindex >>= nColorIndex ) + { + if( nColorIndex == 0 ) + return; + sal_Int32 nPattColor = 0; + GetIndexColor( nColorIndex ) >>= nPattColor; + setPatternColor( uno::makeAny( OORGBToXLRGB( nPattColor ) ) ); + } + else + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Pattern Color" ), uno::Reference< uno::XInterface >() ); } rtl::OUString& @@ -135,7 +394,7 @@ ScVbaInterior::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Interior" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Interior" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbainterior.hxx b/sc/source/ui/vba/vbainterior.hxx index 566bed86c6b7..1184d33e6cd9 100644 --- a/sc/source/ui/vba/vbainterior.hxx +++ b/sc/source/ui/vba/vbainterior.hxx @@ -30,7 +30,7 @@ #ifndef SC_VBA_INTERIOR_HXX #define SC_VBA_INTERIOR_HXX -#include <org/openoffice/excel/XInterior.hpp> +#include <ooo/vba/excel/XInterior.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XIndexAccess.hpp> @@ -40,16 +40,31 @@ class ScDocument; -typedef InheritedHelperInterfaceImpl1< oo::excel::XInterior > ScVbaInterior_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XInterior > ScVbaInterior_BASE; class ScVbaInterior : public ScVbaInterior_BASE { css::uno::Reference< css::beans::XPropertySet > m_xProps; ScDocument* m_pScDoc; + Color m_aPattColor; + sal_Int32 m_nPattern; css::uno::Reference< css::container::XIndexAccess > getPalette(); + css::uno::Reference< css::container::XNameContainer > GetAttributeContainer(); + css::uno::Any SetAttributeData( sal_Int32 nValue ); + sal_Int32 GetAttributeData( css::uno::Any aValue ); + Color GetBackColor(); +protected: + Color GetPatternColor( const Color& rPattColor, const Color& rBackColor, sal_uInt32 nXclPattern ); + Color GetMixedColor( const Color& rFore, const Color& rBack, sal_uInt8 nTrans ); + sal_uInt8 GetMixedColorComp( sal_uInt8 nFore, sal_uInt8 nBack, sal_uInt8 nTrans ); + css::uno::Any GetIndexColor( const sal_Int32& nColorIndex ); + sal_Int32 GetColorIndex( const sal_Int32 nColor ); + css::uno::Any GetUserDefinedAttributes( const rtl::OUString& sName ); + void SetUserDefinedAttributes( const rtl::OUString& sName, const css::uno::Any& aValue ); + void SetMixedColor(); public: - ScVbaInterior( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, + ScVbaInterior( const css::uno::Reference< ov::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(){} @@ -59,6 +74,12 @@ public: 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 getPattern() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPattern( const css::uno::Any& _pattern ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getPatternColor() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPatternColor( const css::uno::Any& _patterncolor ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getPatternColorIndex() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPatternColorIndex( const css::uno::Any& _patterncolorindex ) throw (css::uno::RuntimeException); //XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); diff --git a/sc/source/ui/vba/vbalabel.cxx b/sc/source/ui/vba/vbalabel.cxx index 58141b53eeee..0a7614ee4eb0 100644 --- a/sc/source/ui/vba/vbalabel.cxx +++ b/sc/source/ui/vba/vbalabel.cxx @@ -31,11 +31,11 @@ #include <vector> using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; 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 ) +ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) { } @@ -53,3 +53,36 @@ ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star: { m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); } +uno::Any SAL_CALL +ScVbaLabel::getValue() throw (css::uno::RuntimeException) +{ + return uno::makeAny( getCaption() ); +} + +void SAL_CALL +ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sCaption; + _value >>= sCaption; + setCaption( sCaption ); +} + + +rtl::OUString& +ScVbaLabel::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaLabel::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbalabel.hxx b/sc/source/ui/vba/vbalabel.hxx index d2b9bfd15e24..7ced8b65f731 100644 --- a/sc/source/ui/vba/vbalabel.hxx +++ b/sc/source/ui/vba/vbalabel.hxx @@ -30,20 +30,27 @@ #ifndef SC_VBA_LABEL_HXX #define SC_VBA_LABEL_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/msforms/XLabel.hpp> +#include <ooo/vba/msforms/XLabel.hpp> #include "vbacontrol.hxx" #include "vbahelper.hxx" +#include <cppuhelper/implbase2.hxx> -typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XLabel > LabelImpl_BASE; +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty > 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 ); + ScVbaLabel( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } }; #endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbalineformat.cxx b/sc/source/ui/vba/vbalineformat.cxx index bcb001fbe0c3..8e99086f74da 100644 --- a/sc/source/ui/vba/vbalineformat.cxx +++ b/sc/source/ui/vba/vbalineformat.cxx @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#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 <ooo/vba/office/MsoArrowheadStyle.hpp> +#include <ooo/vba/office/MsoArrowheadLength.hpp> +#include <ooo/vba/office/MsoArrowheadWidth.hpp> +#include <ooo/vba/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 ooo::vba; 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 ) +ScVbaLineFormat::ScVbaLineFormat( const uno::Reference< ov::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; @@ -450,7 +450,7 @@ ScVbaLineFormat::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.LineFormat" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.LineFormat" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbalineformat.hxx b/sc/source/ui/vba/vbalineformat.hxx index 2a6cfacc7849..70a950ebb2a1 100644 --- a/sc/source/ui/vba/vbalineformat.hxx +++ b/sc/source/ui/vba/vbalineformat.hxx @@ -32,10 +32,10 @@ #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <org/openoffice/msforms/XLineFormat.hpp> +#include <ooo/vba/msforms/XLineFormat.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::msforms::XLineFormat > ScVbaLineFormat_BASE; +typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE; class ScVbaLineFormat : public ScVbaLineFormat_BASE { @@ -51,7 +51,7 @@ protected: 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 ); + ScVbaLineFormat( const css::uno::Reference< ov::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); @@ -78,8 +78,8 @@ public: 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); + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); }; #endif//SC_VBA_XLINEFORMAT_HXX diff --git a/sc/source/ui/vba/vbalistbox.cxx b/sc/source/ui/vba/vbalistbox.cxx index 151d05387915..d50653ebb844 100644 --- a/sc/source/ui/vba/vbalistbox.cxx +++ b/sc/source/ui/vba/vbalistbox.cxx @@ -33,35 +33,54 @@ #include "vbapropvalue.hxx" #include <vector> #include <comphelper/anytostring.hxx> +#include <com/sun/star/script/ArrayWrapper.hpp> using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; -const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") ); +const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") ); +const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ); 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 ) +ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ListBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) { - // grab the default value property name - m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName; + mpListHelper.reset( new ListControlHelper( m_xProps ) ); } -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 ) +// Attributes +void SAL_CALL +ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException) { - m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName; + sal_Int32 nIndex = 0; + _value >>= nIndex; + Selected( nIndex ); } +uno::Any SAL_CALL +ScVbaListBox::getListIndex() throw (uno::RuntimeException) +{ + uno::Sequence< sal_Int16 > sSelection; + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; + if ( sSelection.getLength() == 0 ) + return uno::Any( sal_Int32( -1 ) ); + return uno::Any( sSelection[ 0 ] ); +} -// Attributes uno::Any SAL_CALL ScVbaListBox::getValue() throw (uno::RuntimeException) { + uno::Sequence< sal_Int16 > sSelection; + uno::Sequence< rtl::OUString > sItems; + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; + m_xProps->getPropertyValue( ITEMS ) >>= sItems; 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(); + uno::Any aRet; + if ( sSelection.getLength() ) + aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] ); + return aRet; } void SAL_CALL @@ -91,18 +110,17 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException) 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 ) ); + uno::Sequence< sal_Int16 > nSelectedIndices(1); + nSelectedIndices[ 0 ] = nValue; + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) ); + m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); } ::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; + getValue() >>= result; return result; } @@ -125,106 +143,45 @@ ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeEx { 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 ) + // no choice but to do a horror cast as internally + // the indices are but sal_Int16 + sal_Int16 nIndex = static_cast< sal_Int16 >( index ); + if( nIndex < 0 || nIndex >= nLength ) 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 ) ) ); + m_nIndex = nIndex; + return uno::makeAny( uno::Reference< 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; + mpListHelper->AddItem( pvargItem, pvargIndex ); } - 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::removeItem( const uno::Any& index ) throw (uno::RuntimeException) +{ + mpListHelper->removeItem( index ); } 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 >() ) ); + mpListHelper->Clear(); } + +// this is called when something like the following vba code is used +// to set the selected state of particular entries in the Listbox +// ListBox1.Selected( 3 ) = false //PropListener void ScVbaListBox::setValueEvent( const uno::Any& value ) @@ -234,7 +191,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value ) 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; + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList; sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() ); sal_Int16 nIndex = m_nIndex; for( sal_Int16 i = 0; i < nLength; i++ ) @@ -250,7 +207,8 @@ ScVbaListBox::setValueEvent( const uno::Any& value ) nList[i] = nList[i + 1]; } nList.realloc( nLength - 1 ); - m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); + //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); return; } } @@ -271,6 +229,10 @@ ScVbaListBox::setValueEvent( const uno::Any& value ) } } +// this is called when something like the following vba code is used +// to determine the selected state of particular entries in the Listbox +// msgbox ListBox1.Selected( 3 ) + css::uno::Any ScVbaListBox::getValueEvent() { @@ -287,3 +249,41 @@ ScVbaListBox::getValueEvent() return uno::makeAny( sal_False ); } + +void SAL_CALL +ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) +{ + ScVbaControl::setRowSource( _rowsource ); + mpListHelper->setRowSource( _rowsource ); +} + +sal_Int32 SAL_CALL +ScVbaListBox::getListCount() throw (uno::RuntimeException) +{ + return mpListHelper->getListCount(); +} + +uno::Any SAL_CALL +ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) +{ + return mpListHelper->List( pvargIndex, pvarColumn ); +} + +rtl::OUString& +ScVbaListBox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaListBox::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ScVbaListBox" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbalistbox.hxx b/sc/source/ui/vba/vbalistbox.hxx index 54124693e146..69697d3ae623 100644 --- a/sc/source/ui/vba/vbalistbox.hxx +++ b/sc/source/ui/vba/vbalistbox.hxx @@ -32,31 +32,31 @@ #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 <ooo/vba/msforms/XListBox.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include "vbacontrol.hxx" #include "vbapropvalue.hxx" +#include "vbalistcontrolhelper.hxx" #include "vbahelper.hxx" -typedef cppu::ImplInheritanceHelper2<ScVbaControl, oo::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE; +typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE; class ScVbaListBox : public ListBoxImpl_BASE ,public PropListener { + std::auto_ptr< ListControlHelper > mpListHelper; 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 ); - + ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); // Attributes + virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException); + virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); @@ -67,12 +67,19 @@ public: // Methods virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); - + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); + // XControl + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); // XDefaultProperty rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + //PropListener virtual void setValueEvent( const css::uno::Any& value ); virtual css::uno::Any getValueEvent(); diff --git a/sc/source/ui/vba/vbalistcontrolhelper.cxx b/sc/source/ui/vba/vbalistcontrolhelper.cxx new file mode 100644 index 000000000000..e51b751290ac --- /dev/null +++ b/sc/source/ui/vba/vbalistcontrolhelper.cxx @@ -0,0 +1,145 @@ +#include <vbalistcontrolhelper.hxx> + +using namespace com::sun::star; +using namespace ooo::vba; + +const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ); + +void SAL_CALL +ListControlHelper::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 +ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException) +{ + sal_Int32 nIndex = 0; + // for int index + if ( index >>= nIndex ) + { + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () ); + if( sList.hasElements() ) + { + if( sList.getLength() == 1 ) + { + Clear(); + return; + } + for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ ) + { + sList[i] = sList[i+1]; + } + sList.realloc( sList.getLength() - 1 ); + } + + m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); + } +} + +void SAL_CALL +ListControlHelper::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 >() ) ); +} + +void SAL_CALL +ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException) +{ + if ( _rowsource.getLength() == 0 ) + Clear(); +} + +sal_Int32 SAL_CALL +ListControlHelper::getListCount() throw (uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + return sList.getLength(); +} + +uno::Any SAL_CALL +ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException) +{ + uno::Sequence< rtl::OUString > sList; + m_xProps->getPropertyValue( ITEMS ) >>= sList; + sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); + uno::Any aRet; + if ( pvargIndex.hasValue() ) + { + sal_Int16 nIndex = -1; + pvargIndex >>= nIndex; + if( nIndex < 0 || nIndex >= nLength ) + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Bad row Index" ), uno::Reference< uno::XInterface >() ); + aRet <<= sList[ nIndex ]; + } + else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad + throw uno::RuntimeException( rtl::OUString::createFromAscii( + "Bad column Index" ), uno::Reference< uno::XInterface >() ); + else // List() ( e.g. no args ) + { + uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength ); + for ( sal_Int32 i = 0; i < nLength; ++i ) + { + sReturnArray[ i ].realloc( 10 ); + sReturnArray[ i ][ 0 ] = sList[ i ]; + } + aRet = uno::makeAny( sReturnArray ); + } + return aRet; +} diff --git a/sc/source/ui/vba/vbalistcontrolhelper.hxx b/sc/source/ui/vba/vbalistcontrolhelper.hxx new file mode 100644 index 000000000000..f1ebe117733f --- /dev/null +++ b/sc/source/ui/vba/vbalistcontrolhelper.hxx @@ -0,0 +1,20 @@ +#ifndef SC_VBA_LISTCONTROLHELPER +#define SC_VBA_LISTCONTROLHELPER + +#include "vbahelper.hxx" + +class ListControlHelper +{ + css::uno::Reference< css::beans::XPropertySet > m_xProps; + +public: + ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){} + virtual ~ListControlHelper() {} + virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); +}; +#endif diff --git a/sc/source/ui/vba/vbamultipage.cxx b/sc/source/ui/vba/vbamultipage.cxx new file mode 100644 index 000000000000..69410dbadc64 --- /dev/null +++ b/sc/source/ui/vba/vbamultipage.cxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * 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 "vbamultipage.hxx" +#include <ooo/vba/XCollection.hpp> +#include "vbapages.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + +// uno servicename com.sun.star.awt.UnoControlProgressBarMode +const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ); +const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ); +const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") ); + +typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base; +class PagesImpl : public PagesImpl_Base +{ + sal_Int32 mnPages; +public: + PagesImpl( sal_Int32 nPages ) : mnPages( nPages ) {} + virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mnPages; } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException) + { + if ( Index < 0 || Index > mnPages ) + throw lang::IndexOutOfBoundsException(); + return uno::makeAny( uno::Reference< uno::XInterface >() ); + } + // XElementAccess + virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException) + { + // no Pages object yet #FIXME + //return msforms::XPage::static_type(0); + return uno::XInterface::static_type(0); + } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return ( mnPages > 0 ); + } +}; +uno::Reference< container::XIndexAccess > +ScVbaMultiPage::getPages( sal_Int32 nPages ) +{ + return new PagesImpl( nPages ); +} + +ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ + mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW ); + // set dialog step to value of multipage pseudo model + setValue(getValue()); +} + +// Attributes +sal_Int32 SAL_CALL +ScVbaMultiPage::getValue() throw (css::uno::RuntimeException) +{ + sal_Int32 nValue = 0; + m_xProps->getPropertyValue( SVALUE ) >>= nValue; + return nValue; +} + +void SAL_CALL +ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) +{ + // track change in dialog ( dialog value is 1 based, 0 is a special value ) + m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) ); + mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) ); +} + + +rtl::OUString& +ScVbaMultiPage::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMultiPage") ); + return sImplName; +} + +uno::Any SAL_CALL +ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException) +{ + sal_Int32 nValue = 0; + m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue; + uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) ); + if ( !index.hasValue() ) + return uno::makeAny( xColl ); + return xColl->Item( uno::makeAny( index ), uno::Any() ); +} + +uno::Sequence< rtl::OUString > +ScVbaMultiPage::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.MultiPage" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbamultipage.hxx b/sc/source/ui/vba/vbamultipage.hxx new file mode 100644 index 000000000000..03db35dff790 --- /dev/null +++ b/sc/source/ui/vba/vbamultipage.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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_MULTIPAGE_HXX +#define SC_VBA_MULTIPAGE_HXX +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XMultiPage.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" +//#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase1.hxx> + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE; + +class ScVbaMultiPage : public MultiPageImpl_BASE +{ + css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages ); + css::uno::Reference< css::beans::XPropertySet > mxDialogProps; +public: + ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog ); + // Attributes + virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( sal_Int32 _value ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Pages( const css::uno::Any& index ) throw (css::uno::RuntimeException); + + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbaname.cxx b/sc/source/ui/vba/vbaname.cxx index 0d8bc5852aec..72ef5afb3b7f 100644 --- a/sc/source/ui/vba/vbaname.cxx +++ b/sc/source/ui/vba/vbaname.cxx @@ -31,6 +31,7 @@ #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" @@ -41,10 +42,10 @@ #include "tabvwsh.hxx" #include "viewdata.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; -ScVbaName::ScVbaName(const css::uno::Reference< oo::vba::XHelperInterface >& xParent, +ScVbaName::ScVbaName(const css::uno::Reference< ov::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, @@ -60,7 +61,7 @@ ScVbaName::~ScVbaName() { } -css::uno::Reference< oo::excel::XWorksheet > +css::uno::Reference< ov::excel::XWorksheet > ScVbaName::getWorkSheet() throw (css::uno::RuntimeException) { return ScVbaGlobals::getGlobalsImpl( mxContext )->getActiveSheet(); @@ -110,17 +111,37 @@ ScVbaName::getValue() throw (css::uno::RuntimeException) { ::rtl::OUString sValue = mxNamedRange->getContent(); ::rtl::OUString sSheetName = getWorkSheet()->getName(); - if ( sValue.toChar() == '$' ) + ::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 sTmp = sValue.copy(1); - sValue = sTmp; + ::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; } - sValue = sValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii(".")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("!")); - if (sValue.indexOf('=') != 0) + if (sResult.indexOf('=') != 0) { - sValue = ::rtl::OUString::createFromAscii("=") + sValue; + sResult = ::rtl::OUString::createFromAscii("=") + sResult; } - return sValue; + return sResult; } void @@ -128,17 +149,38 @@ ScVbaName::setValue( const ::rtl::OUString & rValue ) throw (css::uno::RuntimeEx { ::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; } - if (sValue.copy(0, sSheetName.getLength()).equals(sSheetName)) + 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)) { - sValue = ::rtl::OUString::createFromAscii("$") + sSheetName; + sTmpValue = ::rtl::OUString::createFromAscii("$") + sTmpValue; } - sValue = sValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii("!")).getLength(), sSheetName + ::rtl::OUString::createFromAscii(".")); - mxNamedRange->setContent(sValue); + sResult += sTmpValue; + mxNamedRange->setContent(sResult); } ::rtl::OUString @@ -189,15 +231,15 @@ ScVbaName::setRefersToR1C1Local( const ::rtl::OUString & rRefersTo ) throw (css: setRefersTo( rRefersTo ); } -css::uno::Reference< oo::excel::XRange > +css::uno::Reference< ov::excel::XRange > ScVbaName::getRefersToRange() throw (css::uno::RuntimeException) { - css::uno::Reference< oo::excel::XRange > xRange; + uno::Reference< ov::excel::XRange > xRange = ScVbaRange::getRangeObjectForName( mxContext, mxNamedRange->getName(), getDocShell( mxModel ), formula::FormulaGrammar::CONV_XL_R1C1 ); return xRange; } void -ScVbaName::setRefersToRange( const css::uno::Reference< oo::excel::XRange > /*rRange*/ ) throw (css::uno::RuntimeException) +ScVbaName::setRefersToRange( const css::uno::Reference< ov::excel::XRange > /*rRange*/ ) throw (css::uno::RuntimeException) { } @@ -221,7 +263,7 @@ ScVbaName::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Name" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Name" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaname.hxx b/sc/source/ui/vba/vbaname.hxx index ec00a6b97441..691a882cb3e1 100644 --- a/sc/source/ui/vba/vbaname.hxx +++ b/sc/source/ui/vba/vbaname.hxx @@ -30,13 +30,13 @@ #ifndef SC_VBA_NAME_HXX #define SC_VBA_NAME_HXX -#include <org/openoffice/excel/XName.hpp> +#include <ooo/vba/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; +typedef InheritedHelperInterfaceImpl1< ov::excel::XName > NameImpl_BASE; class ScVbaName : public NameImpl_BASE { @@ -48,10 +48,10 @@ class ScVbaName : public NameImpl_BASE protected: virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; } - virtual css::uno::Reference< oo::excel::XWorksheet > getWorkSheet() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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 ); + ScVbaName( const css::uno::Reference< ov::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 @@ -71,8 +71,8 @@ public: 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); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getRefersToRange() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRefersToRange( const css::uno::Reference< ov::excel::XRange > xRange ) throw (css::uno::RuntimeException); // Methods virtual void SAL_CALL Delete() throw (css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index a2b614062457..1bd3a2359377 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -42,16 +42,16 @@ #include "tabvwsh.hxx" #include "viewdata.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; class NamesEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > m_xModel; - uno::WeakReference< vba::XHelperInterface > m_xParent; + uno::WeakReference< 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 ) {} + NamesEnumeration( const uno::Reference< 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) { @@ -62,7 +62,7 @@ public: }; -ScVbaNames::ScVbaNames(const css::uno::Reference< oo::vba::XHelperInterface >& xParent, +ScVbaNames::ScVbaNames(const css::uno::Reference< ov::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 ): @@ -70,6 +70,7 @@ ScVbaNames::ScVbaNames(const css::uno::Reference< oo::vba::XHelperInterface >& x mxModel( xModel ), mxNames( xNames ) { + m_xNameAccess.set( xNames, uno::UNO_QUERY_THROW ); } ScVbaNames::~ScVbaNames() @@ -169,7 +170,7 @@ ScVbaNames::Add( const css::uno::Any& Name , css::uno::Type ScVbaNames::getElementType() throw( css::uno::RuntimeException ) { - return oo::excel::XName::static_type(0); + return ov::excel::XName::static_type(0); } uno::Reference< container::XEnumeration > @@ -205,7 +206,7 @@ ScVbaNames::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.NamedRanges" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.NamedRanges" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbanames.hxx b/sc/source/ui/vba/vbanames.hxx index 728e85421580..02a86da325b5 100644 --- a/sc/source/ui/vba/vbanames.hxx +++ b/sc/source/ui/vba/vbanames.hxx @@ -30,13 +30,13 @@ #ifndef SC_VBA_NAMES_HXX #define SC_VBA_NAMES_HXX -#include <org/openoffice/excel/XNames.hpp> -#include <org/openoffice/vba/XCollection.hpp> +#include <ooo/vba/excel/XNames.hpp> +#include <ooo/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; +typedef CollTestImplHelper< ov::excel::XNames > ScVbaNames_BASE; class ScVbaNames : public ScVbaNames_BASE { @@ -47,7 +47,7 @@ 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 ); + ScVbaNames( const css::uno::Reference< ov::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(); diff --git a/sc/source/ui/vba/vbaoleobject.cxx b/sc/source/ui/vba/vbaoleobject.cxx index db25ad5aad33..455141cf03fd 100644 --- a/sc/source/ui/vba/vbaoleobject.cxx +++ b/sc/source/ui/vba/vbaoleobject.cxx @@ -37,7 +37,7 @@ #include "vbaoleobject.hxx" using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; sal_Int32 pt2mm( double pt ) //1/100mm @@ -51,7 +51,7 @@ double mm2pt( sal_Int32 mm ) } -ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, +ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XControlShape > xControlShape ) : OLEObjectImpl_BASE( xParent, xContext ), m_xControlShape( xControlShape ) { @@ -181,7 +181,7 @@ ScVbaOLEObject::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.OLEObject" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.OLEObject" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaoleobject.hxx b/sc/source/ui/vba/vbaoleobject.hxx index 9201ffff3b44..1b900aacf916 100644 --- a/sc/source/ui/vba/vbaoleobject.hxx +++ b/sc/source/ui/vba/vbaoleobject.hxx @@ -33,11 +33,11 @@ #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 <ooo/vba/excel/XOLEObject.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XOLEObject > OLEObjectImpl_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XOLEObject > OLEObjectImpl_BASE; class ScVbaOLEObject : public OLEObjectImpl_BASE { @@ -47,7 +47,7 @@ protected: 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, + ScVbaOLEObject( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XControlShape > xControlShape ); // XOLEObject Attributes diff --git a/sc/source/ui/vba/vbaoleobjects.cxx b/sc/source/ui/vba/vbaoleobjects.cxx index 42682a31aeea..d00ecf5e207d 100644 --- a/sc/source/ui/vba/vbaoleobjects.cxx +++ b/sc/source/ui/vba/vbaoleobjects.cxx @@ -31,13 +31,13 @@ #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 <ooo/vba/excel/XOLEObject.hpp> #include "vbaoleobject.hxx" #include "vbaoleobjects.hxx" using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE; @@ -85,12 +85,12 @@ public: class EnumWrapper : public EnumerationHelper_BASE { - uno::Reference<vba::XHelperInterface > m_xParent; + uno::Reference<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 ) {} + EnumWrapper( const uno::Reference< 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) { @@ -102,7 +102,7 @@ public: 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 ) ) ); + return uno::makeAny( uno::Reference< ov::excel::XOLEObject >( new ScVbaOLEObject( m_xParent, m_xContext, xControlShape ) ) ); } throw container::NoSuchElementException(); } @@ -113,7 +113,7 @@ uno::Reference< container::XIndexAccess > oleObjectIndexWrapper( const uno::Refe return new IndexAccessWrapper( xIndexAccess ); } -ScVbaOLEObjects::ScVbaOLEObjects( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, +ScVbaOLEObjects::ScVbaOLEObjects( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : OLEObjectsImpl_BASE( xParent, xContext, oleObjectIndexWrapper( xIndexAccess ) ) { @@ -131,7 +131,7 @@ ScVbaOLEObjects::createCollectionObject( const css::uno::Any& aSource ) { 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::makeAny( uno::Reference< ov::excel::XOLEObject >( new ScVbaOLEObject( getParent(), mxContext, xControlShape ) ) ); } return uno::Any(); } @@ -166,7 +166,7 @@ ScVbaOLEObjects::getItemByStringIndex( const rtl::OUString& sIndex ) throw (uno: uno::Type ScVbaOLEObjects::getElementType() throw (uno::RuntimeException) { - return org::openoffice::excel::XOLEObject::static_type(0); + return ooo::vba::excel::XOLEObject::static_type(0); } rtl::OUString& ScVbaOLEObjects::getServiceImplName() @@ -182,7 +182,7 @@ ScVbaOLEObjects::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.OLEObjects" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.OLEObjects" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaoleobjects.hxx b/sc/source/ui/vba/vbaoleobjects.hxx index 74eed528f214..3d2c1b82c6a5 100644 --- a/sc/source/ui/vba/vbaoleobjects.hxx +++ b/sc/source/ui/vba/vbaoleobjects.hxx @@ -31,12 +31,12 @@ #define SC_VBA_OLEOBJECTS_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XOLEObjects.hpp> +#include <ooo/vba/excel/XOLEObjects.hpp> #include "vbacollectionimpl.hxx" #include "vbahelper.hxx" -typedef CollTestImplHelper< oo::excel::XOLEObjects > OLEObjectsImpl_BASE; +typedef CollTestImplHelper< ov::excel::XOLEObjects > OLEObjectsImpl_BASE; class ScVbaOLEObjects : public OLEObjectsImpl_BASE { @@ -45,7 +45,7 @@ protected: 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, + ScVbaOLEObjects( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); // XEnumerationAccess diff --git a/sc/source/ui/vba/vbaoutline.cxx b/sc/source/ui/vba/vbaoutline.cxx index a6c027da3aea..2e6b0f63731a 100644 --- a/sc/source/ui/vba/vbaoutline.cxx +++ b/sc/source/ui/vba/vbaoutline.cxx @@ -29,7 +29,7 @@ ************************************************************************/ #include "vbaoutline.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; void ScVbaOutline::ShowLevels( const uno::Any& RowLevels, const uno::Any& ColumnLevels ) throw (uno::RuntimeException) @@ -62,7 +62,7 @@ ScVbaOutline::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Outline" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Outline" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbaoutline.hxx b/sc/source/ui/vba/vbaoutline.hxx index ffdd3125e970..346ca973f021 100644 --- a/sc/source/ui/vba/vbaoutline.hxx +++ b/sc/source/ui/vba/vbaoutline.hxx @@ -32,17 +32,17 @@ #include <com/sun/star/sheet/XSheetOutline.hpp> #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XOutline.hpp> +#include <ooo/vba/excel/XOutline.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XOutline > ScVbaOutline_BASE; +typedef InheritedHelperInterfaceImpl1< ov::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, + ScVbaOutline( const css::uno::Reference< ov::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(){} diff --git a/sc/source/ui/vba/vbapagebreak.cxx b/sc/source/ui/vba/vbapagebreak.cxx new file mode 100644 index 000000000000..83fd0687c4c7 --- /dev/null +++ b/sc/source/ui/vba/vbapagebreak.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbapagebreak.hxx" +#include "vbarange.hxx" +#include <ooo/vba/excel/XlPageBreak.hpp> +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +template< typename Ifc1 > +ScVbaPageBreak<Ifc1>::ScVbaPageBreak( const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext, + uno::Reference< beans::XPropertySet >& xProps, + sheet::TablePageBreakData aTablePageBreakData) throw (uno::RuntimeException): + ScVbaPageBreak_BASE( xParent, xContext ), + mxRowColPropertySet( xProps ), + maTablePageBreakData( aTablePageBreakData ) +{ +} + +template< typename Ifc1 > +sal_Int32 ScVbaPageBreak<Ifc1>::getType() throw (uno::RuntimeException) +{ + uno::Any aValue = mxRowColPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" ))); + sal_Bool hasPageBreak = sal_False; + aValue >>= hasPageBreak; + + if( !hasPageBreak ) + return excel::XlPageBreak::xlPageBreakNone; + + if( maTablePageBreakData.ManualBreak ) + return excel::XlPageBreak::xlPageBreakManual; + + return excel::XlPageBreak::xlPageBreakAutomatic; +} + +template< typename Ifc1 > +void ScVbaPageBreak<Ifc1>::setType(sal_Int32 type) throw (uno::RuntimeException) +{ + if( (type != excel::XlPageBreak::xlPageBreakNone) && + (type != excel::XlPageBreak::xlPageBreakManual) && + (type != excel::XlPageBreak::xlPageBreakAutomatic) ) + { + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + + if( type == excel::XlPageBreak::xlPageBreakNone ) + { + mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False)); + return; + } + + mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_True)); + if( type == excel::XlPageBreak::xlPageBreakManual ) + maTablePageBreakData.ManualBreak = sal_True; + else + maTablePageBreakData.ManualBreak = sal_False; +} + +template< typename Ifc1 > +void ScVbaPageBreak<Ifc1>::Delete() throw ( script::BasicErrorException, uno::RuntimeException) +{ + mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False)); +} + +template< typename Ifc1 > +uno::Reference< excel::XRange> ScVbaPageBreak<Ifc1>::Location() throw ( script::BasicErrorException, uno::RuntimeException) +{ + uno::Reference< table::XCellRange > xRange( mxRowColPropertySet, uno::UNO_QUERY_THROW ); + return new ScVbaRange( ScVbaPageBreak_BASE::getParent(), ScVbaPageBreak_BASE::mxContext, xRange); +} + +template< typename Ifc1 > +rtl::OUString& +ScVbaPageBreak<Ifc1>::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPageBreak") ); + return sImplName; +} + +template< typename Ifc1 > +uno::Sequence< rtl::OUString > +ScVbaPageBreak<Ifc1>::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PageBreak" ) ); + } + return aServiceNames; +} + +template class ScVbaPageBreak< excel::XHPageBreak >; + +/* class ScVbaHPageBreak */ +rtl::OUString& +ScVbaHPageBreak::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaHPageBreak") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaHPageBreak::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.HPageBreak" ) ); + } + return aServiceNames; +} + diff --git a/sc/source/ui/vba/vbapagebreak.hxx b/sc/source/ui/vba/vbapagebreak.hxx new file mode 100644 index 000000000000..0b05c8895711 --- /dev/null +++ b/sc/source/ui/vba/vbapagebreak.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_PAGEBREAK_HXX +#define SC_VBA_PAGEBREAK_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/excel/XPageBreak.hpp> +#include <ooo/vba/excel/XHPageBreak.hpp> +#include <ooo/vba/excel/XRange.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/script/BasicErrorException.hpp> +#include <com/sun/star/sheet/TablePageBreakData.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include "vbahelperinterface.hxx" + +template< typename Ifc1 > +class ScVbaPageBreak : public InheritedHelperInterfaceImpl1< Ifc1 > +{ +typedef InheritedHelperInterfaceImpl1< Ifc1 > ScVbaPageBreak_BASE; +protected: + css::uno::Reference< css::beans::XPropertySet > mxRowColPropertySet; + css::sheet::TablePageBreakData maTablePageBreakData; +public: + ScVbaPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + css::uno::Reference< css::beans::XPropertySet >& xProps, + css::sheet::TablePageBreakData aTablePageBreakData) throw (css::uno::RuntimeException); + virtual ~ScVbaPageBreak(){} + + virtual sal_Int32 SAL_CALL getType( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setType(sal_Int32 type) throw (css::uno::RuntimeException); + + virtual void SAL_CALL Delete() throw ( css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange> SAL_CALL Location() throw ( css::script::BasicErrorException, css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + + +typedef ScVbaPageBreak < ov::excel::XHPageBreak > ScVbaHPageBreak_BASE; + +class ScVbaHPageBreak : public ScVbaHPageBreak_BASE +{ +public: + ScVbaHPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + css::uno::Reference< css::beans::XPropertySet >& xProps, + css::sheet::TablePageBreakData aTablePageBreakData) throw (css::uno::RuntimeException): + ScVbaHPageBreak_BASE( xParent,xContext,xProps,aTablePageBreakData ){} + + virtual ~ScVbaHPageBreak(){} + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx new file mode 100644 index 000000000000..7e04b982b530 --- /dev/null +++ b/sc/source/ui/vba/vbapagebreaks.cxx @@ -0,0 +1,269 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbapagebreaks.hxx" +#include "vbapagebreak.hxx" +#include <ooo/vba/excel/XWorksheet.hpp> +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangePageBreaks_Base; +class RangePageBreaks : public RangePageBreaks_Base +{ +private: + uno::Reference< XHelperInterface > mxParent; + uno::Reference< uno::XComponentContext > mxContext; + uno::Reference< sheet::XSheetPageBreak > mxSheetPageBreak; + sal_Bool m_bColumn; + +public: + RangePageBreaks( const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext, + uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak, + sal_Bool bColumn ) : mxParent( xParent ), mxContext( xContext ), mxSheetPageBreak( xSheetPageBreak ), m_bColumn( bColumn ) + { + } + + sal_Int32 getAPIStartofRange( const uno::Reference< excel::XRange >& xRange ) throw (css::uno::RuntimeException) + { + if( m_bColumn ) + return xRange->getColumn() - 1; + return xRange->getRow() - 1; + } + + sal_Int32 getAPIEndIndexofRange( const uno::Reference< excel::XRange >& xRange, sal_Int32 nUsedStart ) throw (uno::RuntimeException) + { + if( m_bColumn ) + return nUsedStart + xRange->Columns( uno::Any() )->getCount(); + return nUsedStart + xRange->Rows( uno::Any() )->getCount(); + } + + uno::Sequence<sheet::TablePageBreakData> getAllPageBreaks() throw (uno::RuntimeException) + { + if( m_bColumn ) + return mxSheetPageBreak->getColumnPageBreaks(); + return mxSheetPageBreak->getRowPageBreaks(); + } + + uno::Reference<container::XIndexAccess> getRowColContainer() throw (uno::RuntimeException) + { + uno::Reference< table::XColumnRowRange > xColumnRowRange( mxSheetPageBreak, uno::UNO_QUERY_THROW ); + uno::Reference<container::XIndexAccess> xIndexAccess; + if( m_bColumn ) + xIndexAccess.set( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW ); + else + xIndexAccess.set( xColumnRowRange->getRows(), uno::UNO_QUERY_THROW ); + return xIndexAccess; + } + + sheet::TablePageBreakData getTablePageBreakData( sal_Int32 nAPIItemIndex ) throw ( script::BasicErrorException, uno::RuntimeException); + uno::Any Add( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException); + virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException); + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + //if( m_bColumn ) + // return excel::XVPageBreak::static_type(0); + return excel::XHPageBreak::static_type(0); + } + virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return sal_True; + } +}; + +/** @TODO Unlike MS Excel this method only considers the pagebreaks that intersect the used range +* To become completely compatible the print area has to be considered. As far as I found out this printarea +* also considers the position and sizes of shapes and manually inserted page breaks +* Note: In MS there is a limit of 1026 horizontal page breaks per sheet. +*/ +sal_Int32 SAL_CALL RangePageBreaks::getCount( ) throw (uno::RuntimeException) +{ + sal_Int32 nCount = 0; + uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW ); + uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange(); + sal_Int32 nUsedStart = getAPIStartofRange( xRange ); + sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart ); + uno::Sequence<sheet::TablePageBreakData> aTablePageBreakData = getAllPageBreaks(); + + sal_Int32 nLength = aTablePageBreakData.getLength(); + for( sal_Int32 i=0; i<nLength; i++ ) + { + sal_Int32 nPos = aTablePageBreakData[i].Position; + if( nPos > nUsedEnd ) + return nCount; + if( nPos >= nUsedStart ) + nCount++; + } + + return nCount; +} + +uno::Any SAL_CALL RangePageBreaks::getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) +{ + if( (Index < getCount()) && ( Index >= 0 )) + { + sheet::TablePageBreakData aTablePageBreakData = getTablePageBreakData( Index ); + uno::Reference< container::XIndexAccess > xIndexAccess = getRowColContainer(); + sal_Int32 nPos = aTablePageBreakData.Position; + if( (nPos < xIndexAccess->getCount()) && (nPos > -1) ) + { + uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nPos), uno::UNO_QUERY_THROW ); + //if( m_bColumn ) + // return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); + return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); + } + } + throw lang::IndexOutOfBoundsException(); +} + +sheet::TablePageBreakData RangePageBreaks::getTablePageBreakData( sal_Int32 nAPIItemIndex ) throw ( script::BasicErrorException, uno::RuntimeException) +{ + sal_Int32 index = -1; + sheet::TablePageBreakData aTablePageBreakData; + uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW ); + uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange(); + sal_Int32 nUsedStart = getAPIStartofRange( xRange ); + sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart ); + uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks(); + + sal_Int32 nLength = aTablePageBreakDataList.getLength(); + for( sal_Int32 i=0; i<nLength; i++ ) + { + aTablePageBreakData = aTablePageBreakDataList[i]; + sal_Int32 nPos = aTablePageBreakData.Position; + if( nPos >= nUsedStart ) + index++; + if( nPos > nUsedEnd ) + DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString()); + if( index == nAPIItemIndex ) + return aTablePageBreakData; + } + + return aTablePageBreakData; +} + +uno::Any RangePageBreaks::Add( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException) +{ + uno::Reference< excel::XRange > xRange; + Before >>= xRange; + if( !xRange.is() ) + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + } + + sal_Int32 nAPIRowColIndex = getAPIStartofRange( xRange ); + uno::Reference< container::XIndexAccess > xIndexAccess = getRowColContainer(); + uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nAPIRowColIndex), uno::UNO_QUERY_THROW ); + xRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_True)); + sheet::TablePageBreakData aTablePageBreakData; + aTablePageBreakData.ManualBreak = sal_True; + aTablePageBreakData.Position = nAPIRowColIndex; + //if( m_bColumn ) + // return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); + return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); +} + + +class RangePageBreaksEnumWrapper : public EnumerationHelper_BASE +{ + uno::Reference<container::XIndexAccess > m_xIndexAccess; + sal_Int32 nIndex; +public: + RangePageBreaksEnumWrapper( 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(); + } +}; + +ScVbaHPageBreaks::ScVbaHPageBreaks( const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext, + uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak) throw (uno::RuntimeException): + ScVbaHPageBreaks_BASE( xParent,xContext, new RangePageBreaks( xParent, xContext, xSheetPageBreak, sal_False )), + mxSheetPageBreak( xSheetPageBreak ) +{ +} + +uno::Any SAL_CALL ScVbaHPageBreaks::Add( const uno::Any& Before) throw ( script::BasicErrorException, uno::RuntimeException) +{ + RangePageBreaks* pPageBreaks = dynamic_cast< RangePageBreaks* >( m_xIndexAccess.get() ); + if( pPageBreaks ) + { + return pPageBreaks->Add( Before ); + } + return uno::Any(); +} + +uno::Reference< container::XEnumeration > +ScVbaHPageBreaks::createEnumeration() throw (uno::RuntimeException) +{ + return new RangePageBreaksEnumWrapper( m_xIndexAccess ); +} + +uno::Any +ScVbaHPageBreaks::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; // its already a pagebreak object +} + +uno::Type +ScVbaHPageBreaks::getElementType() throw (uno::RuntimeException) +{ + return excel::XHPageBreak::static_type(0); +} + +rtl::OUString& +ScVbaHPageBreaks::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaHPageBreaks") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaHPageBreaks::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.HPageBreaks" ) ); + } + return aServiceNames; +} + diff --git a/sc/source/ui/vba/vbapagebreaks.hxx b/sc/source/ui/vba/vbapagebreaks.hxx new file mode 100644 index 000000000000..26d3e6961297 --- /dev/null +++ b/sc/source/ui/vba/vbapagebreaks.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_PAGEBREAKS_HXX +#define SC_VBA_PAGEBREAKS_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/excel/XHPageBreaks.hpp> +#include <ooo/vba/excel/XHPageBreak.hpp> +#include <ooo/vba/excel/XRange.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/script/BasicErrorException.hpp> +#include <com/sun/star/sheet/XSheetPageBreak.hpp> +#include <com/sun/star/sheet/TablePageBreakData.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include "vbahelperinterface.hxx" +#include "vbacollectionimpl.hxx" + +typedef CollTestImplHelper< ov::excel::XHPageBreaks > ScVbaHPageBreaks_BASE; + +class ScVbaHPageBreaks : public ScVbaHPageBreaks_BASE +{ + css::uno::Reference< css::sheet::XSheetPageBreak > mxSheetPageBreak; +public: + ScVbaHPageBreaks( const css::uno::Reference< ov::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + css::uno::Reference< css::sheet::XSheetPageBreak >& xSheetPageBreak) throw (css::uno::RuntimeException); + virtual ~ScVbaHPageBreaks(){} + + // XHPageBreaks + virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Before) 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/sc/source/ui/vba/vbapages.cxx b/sc/source/ui/vba/vbapages.cxx new file mode 100644 index 000000000000..19f89aaefeed --- /dev/null +++ b/sc/source/ui/vba/vbapages.cxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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 "vbapages.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; +using namespace ::vos; + +ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages ) +{ +} + +uno::Type SAL_CALL +ScVbaPages::getElementType() throw (uno::RuntimeException) +{ + // return msforms::XPage::static_type(0); + return uno::XInterface::static_type(0); +} + +uno::Any +ScVbaPages::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; +} + +rtl::OUString& +ScVbaPages::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPages") ); + return sImplName; +} + +uno::Reference< container::XEnumeration > SAL_CALL +ScVbaPages::createEnumeration() throw (uno::RuntimeException) +{ + return uno::Reference< container::XEnumeration >(); +} + +uno::Sequence< rtl::OUString > +ScVbaPages::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Pages" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbapages.hxx b/sc/source/ui/vba/vbapages.hxx new file mode 100644 index 000000000000..45ad882d759c --- /dev/null +++ b/sc/source/ui/vba/vbapages.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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_PAGES_HXX +#define SC_VBA_PAGES_HXX + +#include <ooo/vba/office/MsoShapeType.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <ooo/vba/msforms/XPages.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase1.hxx> + +#include "vbacollectionimpl.hxx" +typedef CollTestImplHelper< +ov::msforms::XPages > ScVbaPages_BASE; + +class ScVbaPages : public ScVbaPages_BASE +{ +protected: + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +public: + ScVbaPages( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPages ) throw ( css::lang::IllegalArgumentException ); + virtual ~ScVbaPages() {} + // 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); + // ScVbaPages_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + +}; +#endif//SC_VBA_SHAPE_HXX diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx new file mode 100644 index 000000000000..2e7dd57a7afd --- /dev/null +++ b/sc/source/ui/vba/vbapagesetup.cxx @@ -0,0 +1,892 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbapagesetup.hxx" +#include "cellsuno.hxx" +#include "convuno.hxx" +#include "rangelst.hxx" +#include <com/sun/star/sheet/XPrintAreas.hpp> +#include <com/sun/star/sheet/XHeaderFooterContent.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <ooo/vba/excel/XlPageOrientation.hpp> +#include <ooo/vba/excel/XlOrder.hpp> +#include <ooo/vba/excel/Constants.hpp> + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +#define ZOOM_IN 10 +#define ZOOM_MAX 400 + +bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, ScRange& refRange, ScRangeList& aCellRanges, formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1 ) throw ( uno::RuntimeException ); + +ScVbaPageSetup::ScVbaPageSetup(const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext, + const uno::Reference< sheet::XSpreadsheet >& xSheet, + const uno::Reference< frame::XModel >& xModel) throw (uno::RuntimeException): + ScVbaPageSetup_BASE( xParent, xContext ), + mxSheet( xSheet ), mxModel( xModel ) +{ + // query for current page style + uno::Reference< beans::XPropertySet > xSheetProps( mxSheet, uno::UNO_QUERY_THROW ); + uno::Any aValue = xSheetProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageStyle" ))); + rtl::OUString aStyleName; + aValue >>= aStyleName; + + uno::Reference< style::XStyleFamiliesSupplier > xStyleFamiliesSup( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xStyleFamilies = xStyleFamiliesSup->getStyleFamilies(); + uno::Reference< container::XNameAccess > xPageStyle( xStyleFamilies->getByName(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles"))), uno::UNO_QUERY_THROW ); + mxPageProps.set( xPageStyle->getByName(aStyleName), uno::UNO_QUERY_THROW ); +} + +rtl::OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeException) +{ + String aPrintArea; + uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW ); + uno::Sequence< table::CellRangeAddress > aSeq = xPrintAreas->getPrintAreas(); + sal_Int32 nCount = aSeq.getLength(); + if( nCount ) + { + ScAddress::Details aDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 ); + USHORT nFlags = SCA_VALID; + nFlags |= ( SCA_TAB_ABSOLUTE | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE ); + ScRangeList aRangeList; + for( sal_Int32 i=0; i<nCount; i++ ) + { + ScRange aRange; + ScUnoConversion::FillScRange( aRange, aSeq[i] ); + aRangeList.Append( aRange ); + } + ScDocument* pDoc = getDocShell( mxModel )->GetDocument(); + aRangeList.Format( aPrintArea, nFlags, pDoc, formula::FormulaGrammar::CONV_XL_A1, ',' ); + } + + return aPrintArea; +} + +void SAL_CALL ScVbaPageSetup::setPrintArea( const rtl::OUString& rAreas ) throw (css::uno::RuntimeException) +{ + uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW ); + if( rAreas.getLength() == 0 || + rAreas.equalsIgnoreAsciiCase ( rtl::OUString::createFromAscii("FALSE") ) ) + { + // print the whole sheet + uno::Sequence< table::CellRangeAddress > aSeq; + xPrintAreas->setPrintAreas( aSeq ); + } + else + { + ScRangeList aCellRanges; + ScRange aRange; + if( getScRangeListForAddress( rAreas, getDocShell( mxModel ) , aRange, aCellRanges ) ) + { + uno::Sequence< table::CellRangeAddress > aSeq( aCellRanges.Count() ); + USHORT i=0; + for( ScRange* pRange = aCellRanges.First(); pRange; pRange = aCellRanges.Next() ) + { + table::CellRangeAddress aRangeAddress; + ScUnoConversion::FillApiRange( aRangeAddress, *pRange ); + aSeq[ i++ ] = aRangeAddress; + } + xPrintAreas->setPrintAreas( aSeq ); + } + } +} + +double SAL_CALL ScVbaPageSetup::getTopMargin() throw (css::uno::RuntimeException) +{ + sal_Bool headerOn = sal_False; + sal_Int32 topMargin = 0; + sal_Int32 headerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); + aValue >>= headerOn; + + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); + aValue >>= topMargin; + + if( headerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); + aValue >>= headerHeight; + topMargin += headerHeight; + } + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( topMargin ); +} + +void SAL_CALL ScVbaPageSetup::setTopMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 topMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + sal_Bool headerOn = sal_False; + sal_Int32 headerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))); + aValue >>= headerOn; + + if( headerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))); + aValue >>= headerHeight; + topMargin -= headerHeight; + } + + aValue <<= topMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL ScVbaPageSetup::getBottomMargin() throw (css::uno::RuntimeException) +{ + sal_Bool footerOn = sal_False; + sal_Int32 bottomMargin = 0; + sal_Int32 footerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); + aValue >>= footerOn; + + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); + aValue >>= bottomMargin; + + if( footerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); + aValue >>= footerHeight; + bottomMargin += footerHeight; + } + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( bottomMargin ); +} + +void SAL_CALL ScVbaPageSetup::setBottomMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 bottomMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + sal_Bool footerOn = sal_False; + sal_Int32 footerHeight = 0; + + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))); + aValue >>= footerOn; + + if( footerOn ) + { + aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))); + aValue >>= footerHeight; + bottomMargin -= footerHeight; + } + + aValue <<= bottomMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL ScVbaPageSetup::getRightMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 rightMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))); + aValue >>= rightMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( rightMargin );; +} + +void SAL_CALL ScVbaPageSetup::setRightMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 rightMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= rightMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin")), aValue ); + } + catch( uno::Exception& ) + { + } + +} + +double SAL_CALL ScVbaPageSetup::getLeftMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 leftMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))); + aValue >>= leftMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( leftMargin );; +} + +void SAL_CALL ScVbaPageSetup::setLeftMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 leftMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= leftMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL ScVbaPageSetup::getHeaderMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 headerMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))); + aValue >>= headerMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( headerMargin );; +} + +void SAL_CALL ScVbaPageSetup::setHeaderMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 headerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= headerMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +double SAL_CALL ScVbaPageSetup::getFooterMargin() throw (css::uno::RuntimeException) +{ + sal_Int32 footerMargin = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))); + aValue >>= footerMargin; + } + catch( uno::Exception& ) + { + } + + return Millimeter::getInPoints( footerMargin );; +} + +void SAL_CALL ScVbaPageSetup::setFooterMargin( double margin ) throw (css::uno::RuntimeException) +{ + sal_Int32 footerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); + try + { + uno::Any aValue; + aValue <<= footerMargin; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +sal_Int32 SAL_CALL ScVbaPageSetup::getOrientation() throw (css::uno::RuntimeException) +{ + sal_Int32 orientation = excel::XlPageOrientation::xlPortrait; + try + { + sal_Bool isLandscape = sal_False; + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); + aValue >>= isLandscape; + + if( isLandscape ) + { + orientation = excel::XlPageOrientation::xlLandscape; + } + } + catch( uno::Exception& ) + { + } + return orientation; +} + +void SAL_CALL ScVbaPageSetup::setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException) +{ + if( ( orientation != excel::XlPageOrientation::xlPortrait ) && + ( orientation != excel::XlPageOrientation::xlLandscape ) ) + { + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + + try + { + sal_Bool isLandscape = sal_False; + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); + aValue >>= isLandscape; + + sal_Bool switchOrientation = sal_False; + if(( isLandscape && orientation != excel::XlPageOrientation::xlLandscape ) || + ( !isLandscape && orientation != excel::XlPageOrientation::xlPortrait )) + { + switchOrientation = sal_True; + } + + if( switchOrientation ) + { + aValue <<= !isLandscape; + uno::Any aHeight = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height"))); + uno::Any aWidth = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")), aValue ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")), aHeight ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height")), aWidth ); + } + + if( isLandscape ) + { + orientation = excel::XlPageOrientation::xlLandscape; + } + } + catch( uno::Exception& ) + { + } +} + +uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesTall() throw (css::uno::RuntimeException) +{ + return mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesY"))); +} + +void SAL_CALL ScVbaPageSetup::setFitToPagesTall( const uno::Any& fitToPagesTall) throw (css::uno::RuntimeException) +{ + USHORT scaleToPageY = 0; + try + { + sal_Bool aValue; + if( fitToPagesTall.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesTall >>= aValue)) + { + fitToPagesTall >>= scaleToPageY; + } + + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesY")), uno::makeAny( scaleToPageY )); + } + catch( uno::Exception& ) + { + } +} + +uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesWide() throw (css::uno::RuntimeException) +{ + return mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesX"))); +} + +void SAL_CALL ScVbaPageSetup::setFitToPagesWide( const uno::Any& fitToPagesWide) throw (css::uno::RuntimeException) +{ + USHORT scaleToPageX = 0; + try + { + sal_Bool aValue = sal_False; + if( fitToPagesWide.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesWide >>= aValue)) + { + fitToPagesWide >>= scaleToPageX; + } + + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesX")), uno::makeAny( scaleToPageX )); + } + catch( uno::Exception& ) + { + } +} + +uno::Any SAL_CALL ScVbaPageSetup::getZoom() throw (css::uno::RuntimeException) +{ + return mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageScale"))); +} + +void SAL_CALL ScVbaPageSetup::setZoom( const uno::Any& zoom) throw (css::uno::RuntimeException) +{ + USHORT pageScale = 0; + try + { + if( zoom.getValueTypeClass() == uno::TypeClass_BOOLEAN ) + { + sal_Bool aValue = sal_False; + zoom >>= aValue; + if( aValue ) + { + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + } + else + { + zoom >>= pageScale; + if(( pageScale < ZOOM_IN )||( pageScale > ZOOM_MAX )) + { + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + } + + // these only exist in S08 + USHORT nScale = 0; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPages")), uno::makeAny( nScale )); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesX")), uno::makeAny( nScale )); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesY")), uno::makeAny( nScale )); + } + catch( beans::UnknownPropertyException& ) + { + if( pageScale == 0 ) + { + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + } + catch( uno::Exception& ) + { + } + + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageScale")), uno::makeAny( pageScale )); +} + +rtl::OUString SAL_CALL ScVbaPageSetup::getLeftHeader() throw (css::uno::RuntimeException) +{ + rtl::OUString leftHeader; + try + { + uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW); + if( xHeaderContent.is() ) + { + uno::Reference< text::XText > xText = xHeaderContent->getLeftText(); + leftHeader = xText->getString(); + } + } + catch( uno::Exception& ) + { + } + + return leftHeader; +} + +void SAL_CALL ScVbaPageSetup::setLeftHeader( const rtl::OUString& leftHeader) throw (css::uno::RuntimeException) +{ + try + { + uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW); + if( xHeaderContent.is() ) + { + uno::Reference< text::XText > xText = xHeaderContent->getLeftText(); + xText->setString( leftHeader ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent")), uno::makeAny(xHeaderContent) ); + } + } + catch( uno::Exception& ) + { + } +} + +rtl::OUString SAL_CALL ScVbaPageSetup::getCenterHeader() throw (css::uno::RuntimeException) +{ + rtl::OUString centerHeader; + try + { + uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW); + if( xHeaderContent.is() ) + { + uno::Reference< text::XText > xText = xHeaderContent->getCenterText(); + centerHeader = xText->getString(); + } + } + catch( uno::Exception& ) + { + } + + return centerHeader; +} + +void SAL_CALL ScVbaPageSetup::setCenterHeader( const rtl::OUString& centerHeader) throw (css::uno::RuntimeException) +{ + try + { + uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW); + if( xHeaderContent.is() ) + { + uno::Reference< text::XText > xText = xHeaderContent->getCenterText(); + xText->setString( centerHeader ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent")), uno::makeAny(xHeaderContent) ); + } + } + catch( uno::Exception& ) + { + } +} + +rtl::OUString SAL_CALL ScVbaPageSetup::getRightHeader() throw (css::uno::RuntimeException) +{ + rtl::OUString rightHeader; + try + { + uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW); + if( xHeaderContent.is() ) + { + uno::Reference< text::XText > xText = xHeaderContent->getRightText(); + rightHeader = xText->getString(); + } + } + catch( uno::Exception& ) + { + } + + return rightHeader; +} + +void SAL_CALL ScVbaPageSetup::setRightHeader( const rtl::OUString& rightHeader) throw (css::uno::RuntimeException) +{ + try + { + uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW); + if( xHeaderContent.is() ) + { + uno::Reference< text::XText > xText = xHeaderContent->getRightText(); + xText->setString( rightHeader ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent")), uno::makeAny(xHeaderContent) ); + } + } + catch( uno::Exception& ) + { + } +} + +rtl::OUString SAL_CALL ScVbaPageSetup::getLeftFooter() throw (css::uno::RuntimeException) +{ + rtl::OUString leftFooter; + try + { + uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW); + if( xFooterContent.is() ) + { + uno::Reference< text::XText > xText = xFooterContent->getLeftText(); + leftFooter = xText->getString(); + } + } + catch( uno::Exception& ) + { + } + + return leftFooter; +} + +void SAL_CALL ScVbaPageSetup::setLeftFooter( const rtl::OUString& leftFooter) throw (css::uno::RuntimeException) +{ + try + { + uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW); + if( xFooterContent.is() ) + { + uno::Reference< text::XText > xText = xFooterContent->getLeftText(); + xText->setString( leftFooter ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent")), uno::makeAny(xFooterContent) ); + } + } + catch( uno::Exception& ) + { + } +} + +rtl::OUString SAL_CALL ScVbaPageSetup::getCenterFooter() throw (css::uno::RuntimeException) +{ + rtl::OUString centerFooter; + try + { + uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW); + if( xFooterContent.is() ) + { + uno::Reference< text::XText > xText = xFooterContent->getCenterText(); + centerFooter = xText->getString(); + } + } + catch( uno::Exception& ) + { + } + + return centerFooter; +} + +void SAL_CALL ScVbaPageSetup::setCenterFooter( const rtl::OUString& centerFooter) throw (css::uno::RuntimeException) +{ + try + { + uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW); + if( xFooterContent.is() ) + { + uno::Reference< text::XText > xText = xFooterContent->getCenterText(); + xText->setString( centerFooter ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent")), uno::makeAny(xFooterContent) ); + } + } + catch( uno::Exception& ) + { + } + +} + +rtl::OUString SAL_CALL ScVbaPageSetup::getRightFooter() throw (css::uno::RuntimeException) +{ + rtl::OUString rightFooter; + try + { + uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW); + if( xFooterContent.is() ) + { + uno::Reference< text::XText > xText = xFooterContent->getRightText(); + rightFooter = xText->getString(); + } + } + catch( uno::Exception& ) + { + } + + return rightFooter; +} + +void SAL_CALL ScVbaPageSetup::setRightFooter( const rtl::OUString& rightFooter) throw (css::uno::RuntimeException) +{ + try + { + uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW); + if( xFooterContent.is() ) + { + uno::Reference< text::XText > xText = xFooterContent->getRightText(); + xText->setString( rightFooter ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent")), uno::makeAny(xFooterContent) ); + } + } + catch( uno::Exception& ) + { + } +} + +sal_Int32 SAL_CALL ScVbaPageSetup::getOrder() throw (css::uno::RuntimeException) +{ + sal_Int32 order = excel::XlOrder::xlDownThenOver; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintDownFirst"))); + sal_Bool bPrintDownFirst = sal_False; + aValue >>= bPrintDownFirst; + if( !bPrintDownFirst ) + order = excel::XlOrder::xlOverThenDown; + } + catch( uno::Exception& ) + { + } + + return order; +} + +void SAL_CALL ScVbaPageSetup::setOrder( sal_Int32 order) throw (css::uno::RuntimeException) +{ + sal_Bool bOrder = sal_True; + switch( order ) + { + case excel::XlOrder::xlDownThenOver: + break; + case excel::XlOrder::xlOverThenDown: + bOrder = sal_False; + break; + default: + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + } + + try + { + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintDownFirst")), uno::makeAny( bOrder )); + } + catch( uno::Exception& ) + { + } +} + +sal_Int32 SAL_CALL ScVbaPageSetup::getFirstPageNumber() throw (css::uno::RuntimeException) +{ + sal_Int16 number = 0; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstPageNumber"))); + aValue >>= number; + } + catch( uno::Exception& ) + { + } + + if( number ==0 ) + { + number = excel::Constants::xlAutomatic; + } + + return number; +} + +void SAL_CALL ScVbaPageSetup::setFirstPageNumber( sal_Int32 firstPageNumber) throw (css::uno::RuntimeException) +{ + if( firstPageNumber < 0 ) + DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); + if( firstPageNumber == excel::Constants::xlAutomatic ) + firstPageNumber = 0; + + try + { + uno::Any aValue; + aValue <<= (sal_Int16)firstPageNumber; + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstPageNumber")), aValue ); + } + catch( uno::Exception& ) + { + } +} + +sal_Bool SAL_CALL ScVbaPageSetup::getCenterVertically() throw (css::uno::RuntimeException) +{ + sal_Bool centerVertically = sal_False; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterVertically"))); + aValue >>= centerVertically; + } + catch( uno::Exception& ) + { + } + return centerVertically; +} + +void SAL_CALL ScVbaPageSetup::setCenterVertically( sal_Bool centerVertically) throw (css::uno::RuntimeException) +{ + try + { + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterVertically")), uno::makeAny( centerVertically )); + } + catch( uno::Exception& ) + { + } +} + +sal_Bool SAL_CALL ScVbaPageSetup::getCenterHorizontally() throw (css::uno::RuntimeException) +{ + sal_Bool centerHorizontally = sal_False; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterHorizontally"))); + aValue >>= centerHorizontally; + } + catch( uno::Exception& ) + { + } + return centerHorizontally; +} + +void SAL_CALL ScVbaPageSetup::setCenterHorizontally( sal_Bool centerHorizontally) throw (css::uno::RuntimeException) +{ + try + { + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterHorizontally")), uno::makeAny( centerHorizontally )); + } + catch( uno::Exception& ) + { + } +} + +sal_Bool SAL_CALL ScVbaPageSetup::getPrintHeadings() throw (css::uno::RuntimeException) +{ + sal_Bool printHeadings = sal_False; + try + { + uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintHeaders"))); + aValue >>= printHeadings; + } + catch( uno::Exception& ) + { + } + return printHeadings; +} + +void SAL_CALL ScVbaPageSetup::setPrintHeadings( sal_Bool printHeadings) throw (css::uno::RuntimeException) +{ + try + { + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintHeaders")), uno::makeAny( printHeadings )); + } + catch( uno::Exception& ) + { + } +} + +rtl::OUString& +ScVbaPageSetup::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPageSetup") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaPageSetup::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PageSetup" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbapagesetup.hxx b/sc/source/ui/vba/vbapagesetup.hxx new file mode 100644 index 000000000000..e3cafc9fb78d --- /dev/null +++ b/sc/source/ui/vba/vbapagesetup.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_PAGESETUP_HXX +#define SC_VBA_PAGESETUP_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/excel/XPageSetup.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include "vbahelperinterface.hxx" + +typedef InheritedHelperInterfaceImpl1< ov::excel::XPageSetup > ScVbaPageSetup_BASE; + +class ScVbaPageSetup : public ScVbaPageSetup_BASE +{ + css::uno::Reference< css::sheet::XSpreadsheet > mxSheet; + css::uno::Reference< css::beans::XPropertySet > mxPageProps; + css::uno::Reference< css::frame::XModel > mxModel; +public: + ScVbaPageSetup( const css::uno::Reference< ov::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 >& xModlel) throw (css::uno::RuntimeException); + virtual ~ScVbaPageSetup(){} + + // Attribute + virtual rtl::OUString SAL_CALL getPrintArea() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPrintArea( const rtl::OUString& rAreas ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getTopMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTopMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getBottomMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setBottomMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getRightMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRightMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getLeftMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeftMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getHeaderMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setHeaderMargin( double margin ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getFooterMargin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFooterMargin( double margin ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getOrientation() throw (css::uno::RuntimeException); + virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getFitToPagesTall() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFitToPagesTall( const css::uno::Any& fitToPagesTall ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getFitToPagesWide() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFitToPagesWide( const css::uno::Any& fitToPagesWide ) 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); + virtual rtl::OUString SAL_CALL getLeftHeader() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeftHeader( const rtl::OUString& leftHeader ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getCenterHeader() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCenterHeader( const rtl::OUString& centerHeader ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getRightHeader() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRightHeader( const rtl::OUString& rightHeader ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getLeftFooter() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeftFooter( const rtl::OUString& leftFooter ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getCenterFooter() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCenterFooter( const rtl::OUString& centerFooter ) throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getRightFooter() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRightFooter( const rtl::OUString& rightFooter ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getOrder() throw (css::uno::RuntimeException); + virtual void SAL_CALL setOrder( sal_Int32 order ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getFirstPageNumber() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFirstPageNumber( sal_Int32 firstPageNumber ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getCenterVertically() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCenterVertically( sal_Bool centerVertically ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getCenterHorizontally() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCenterHorizontally( sal_Bool centerHorizontally ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getPrintHeadings() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPrintHeadings( sal_Bool printHeadings ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif diff --git a/sc/source/ui/vba/vbapalette.cxx b/sc/source/ui/vba/vbapalette.cxx index 1b59fa73380a..d3bbbd6ae121 100644 --- a/sc/source/ui/vba/vbapalette.cxx +++ b/sc/source/ui/vba/vbapalette.cxx @@ -33,7 +33,7 @@ using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; /** Standard EGA colors, bright. */ #define EXC_PALETTE_EGA_COLORS_LIGHT \ diff --git a/sc/source/ui/vba/vbapane.cxx b/sc/source/ui/vba/vbapane.cxx index abc539c7a386..1ec6b2a2e642 100644 --- a/sc/source/ui/vba/vbapane.cxx +++ b/sc/source/ui/vba/vbapane.cxx @@ -31,7 +31,7 @@ #include<vbapane.hxx> using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; /* ScVbaPane::ScVbaPane( uno::Reference< uno::XComponentContext > xContext, uno::Refrence< sheet::XViewPane > xViewPane ) diff --git a/sc/source/ui/vba/vbapane.hxx b/sc/source/ui/vba/vbapane.hxx index 916b90ed5fa9..0f67bbf6038c 100644 --- a/sc/source/ui/vba/vbapane.hxx +++ b/sc/source/ui/vba/vbapane.hxx @@ -32,11 +32,11 @@ #include<cppuhelper/implbase1.hxx> #include<com/sun/star/sheet/XViewPane.hpp> -#include<org/openoffice/excel/XPane.hpp> +#include<ooo/vba/excel/XPane.hpp> #include"vbahelper.hxx" -typedef cppu::WeakImplHelper1< oo::excel::XPane > PaneImpl_Base; +typedef cppu::WeakImplHelper1< ov::excel::XPane > PaneImpl_Base; class ScVbaPane : public PaneImpl_Base { diff --git a/sc/source/ui/vba/vbapictureformat.cxx b/sc/source/ui/vba/vbapictureformat.cxx index 38eca3bbf7ee..0d79fc173d50 100644 --- a/sc/source/ui/vba/vbapictureformat.cxx +++ b/sc/source/ui/vba/vbapictureformat.cxx @@ -29,10 +29,10 @@ ************************************************************************/ #include "vbapictureformat.hxx" -using namespace org::openoffice; +using namespace ooo::vba; using namespace com::sun::star; -ScVbaPictureFormat::ScVbaPictureFormat( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, +ScVbaPictureFormat::ScVbaPictureFormat( const css::uno::Reference< ov::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 ) @@ -141,7 +141,7 @@ ScVbaPictureFormat::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.PictureFormat" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.PictureFormat" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbapictureformat.hxx b/sc/source/ui/vba/vbapictureformat.hxx index 4aca43ed2a20..f7b63f94fcbd 100644 --- a/sc/source/ui/vba/vbapictureformat.hxx +++ b/sc/source/ui/vba/vbapictureformat.hxx @@ -32,10 +32,10 @@ #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <org/openoffice/msforms/XPictureFormat.hpp> +#include <ooo/vba/msforms/XPictureFormat.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::msforms::XPictureFormat > ScVbaPictureFormat_BASE; +typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE; class ScVbaPictureFormat : public ScVbaPictureFormat_BASE { @@ -48,7 +48,7 @@ protected: 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 ); + ScVbaPictureFormat( const css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbapivotcache.cxx b/sc/source/ui/vba/vbapivotcache.cxx index 47e1a5a55be3..b87a279ac842 100644 --- a/sc/source/ui/vba/vbapivotcache.cxx +++ b/sc/source/ui/vba/vbapivotcache.cxx @@ -31,9 +31,9 @@ using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; -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 ) +ScVbaPivotCache::ScVbaPivotCache( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XDataPilotTable >& xTable ) : PivotCacheImpl_BASE( xParent, xContext ), m_xTable( xTable ) { } @@ -56,7 +56,7 @@ ScVbaPivotCache::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotCache" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotCache" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbapivotcache.hxx b/sc/source/ui/vba/vbapivotcache.hxx index e640dce154f1..8a57401d2ff9 100644 --- a/sc/source/ui/vba/vbapivotcache.hxx +++ b/sc/source/ui/vba/vbapivotcache.hxx @@ -33,16 +33,16 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/sheet/XDataPilotTable.hpp> -#include <org/openoffice/excel/XPivotCache.hpp> +#include <ooo/vba/excel/XPivotCache.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1<oo::excel::XPivotCache > PivotCacheImpl_BASE; +typedef InheritedHelperInterfaceImpl1<ov::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 ); + ScVbaPivotCache( const css::uno::Reference< ov::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(); diff --git a/sc/source/ui/vba/vbapivottable.cxx b/sc/source/ui/vba/vbapivottable.cxx index a31f47c32747..b4050c9ca4f8 100644 --- a/sc/source/ui/vba/vbapivottable.cxx +++ b/sc/source/ui/vba/vbapivottable.cxx @@ -32,9 +32,9 @@ using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; -ScVbaPivotTable::ScVbaPivotTable( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XDataPilotTable >& xTable ) : PivotTableImpl_BASE( uno::Reference< vba::XHelperInterface >(), xContext), m_xTable( xTable ) +ScVbaPivotTable::ScVbaPivotTable( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XDataPilotTable >& xTable ) : PivotTableImpl_BASE( uno::Reference< XHelperInterface >(), xContext), m_xTable( xTable ) { } @@ -43,7 +43,7 @@ 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 ); + return new ScVbaPivotCache( uno::Reference< XHelperInterface >(), mxContext, m_xTable ); } rtl::OUString& @@ -60,7 +60,7 @@ ScVbaPivotTable::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotTable" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotTable" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbapivottable.hxx b/sc/source/ui/vba/vbapivottable.hxx index 68e2099d8add..55f32a36e60d 100644 --- a/sc/source/ui/vba/vbapivottable.hxx +++ b/sc/source/ui/vba/vbapivottable.hxx @@ -32,18 +32,18 @@ #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 <ooo/vba/excel/XPivotTable.hpp> #include "vbahelper.hxx" #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XPivotTable > PivotTableImpl_BASE; +typedef InheritedHelperInterfaceImpl1< ov::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); + virtual css::uno::Reference< ov::excel::XPivotCache > SAL_CALL PivotCache( ) throw (css::uno::RuntimeException); // XHelperInterface virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence<rtl::OUString> getServiceNames(); diff --git a/sc/source/ui/vba/vbapivottables.cxx b/sc/source/ui/vba/vbapivottables.cxx index e10b5068f2c2..c03d347c1ba0 100644 --- a/sc/source/ui/vba/vbapivottables.cxx +++ b/sc/source/ui/vba/vbapivottables.cxx @@ -30,11 +30,11 @@ #include "vbapivottables.hxx" #include "vbapivottable.hxx" #include <com/sun/star/sheet/XDataPilotTable.hpp> -#include <org/openoffice/excel/XPivotTable.hpp> +#include <ooo/vba/excel/XPivotTable.hpp> using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; uno::Any DataPilotToPivotTable( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext ) { @@ -54,7 +54,7 @@ public: }; -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 ) +ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xParent, xContext, xIndexAccess ) { } @@ -91,7 +91,7 @@ ScVbaPivotTables::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PivotTables") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotTables") ); } return sNames; } diff --git a/sc/source/ui/vba/vbapivottables.hxx b/sc/source/ui/vba/vbapivottables.hxx index b5c85b8395e9..6a6d5afb67a5 100644 --- a/sc/source/ui/vba/vbapivottables.hxx +++ b/sc/source/ui/vba/vbapivottables.hxx @@ -32,7 +32,7 @@ #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XPivotTables.hpp> +#include <ooo/vba/excel/XPivotTables.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -41,14 +41,14 @@ #include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< oo::excel::XPivotTables > ScVbaPivotTables_BASE; +typedef CollTestImplHelper< ov::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 ); + ScVbaPivotTables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); virtual ~ScVbaPivotTables() {} // XEnumerationAccess diff --git a/sc/source/ui/vba/vbaprogressbar.cxx b/sc/source/ui/vba/vbaprogressbar.cxx new file mode 100644 index 000000000000..27f425f9b808 --- /dev/null +++ b/sc/source/ui/vba/vbaprogressbar.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 "vbaprogressbar.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + +// uno servicename com.sun.star.awt.UnoControlProgressBarMode +const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ); + +ScVbaProgressBar::ScVbaProgressBar( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ProgressBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +uno::Any SAL_CALL +ScVbaProgressBar::getValue() throw (css::uno::RuntimeException) +{ + return m_xProps->getPropertyValue( SVALUE ); +} + +void SAL_CALL +ScVbaProgressBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( SVALUE, _value ); +} + +rtl::OUString& +ScVbaProgressBar::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaProgressBar") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaProgressBar::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbaprogressbar.hxx b/sc/source/ui/vba/vbaprogressbar.hxx new file mode 100644 index 000000000000..d040f08f98d6 --- /dev/null +++ b/sc/source/ui/vba/vbaprogressbar.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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_PROGRESSBAR_HXX +#define SC_VBA_PROGRESSBAR_HXX +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XProgressBar.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" +#include <cppuhelper/implbase2.hxx> + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty > ProgressBarImpl_BASE; + +class ScVbaProgressBar : public ProgressBarImpl_BASE +{ +public: + ScVbaProgressBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbapropvalue.hxx b/sc/source/ui/vba/vbapropvalue.hxx index 2fb9ca9d9281..d6ddb33505e1 100644 --- a/sc/source/ui/vba/vbapropvalue.hxx +++ b/sc/source/ui/vba/vbapropvalue.hxx @@ -29,12 +29,12 @@ ************************************************************************/ #ifndef SC_VBA_PROPVALULE_HXX #define SC_VBA_PROPVALULE_HXX -#include <org/openoffice/vba/XPropValue.hpp> +#include <ooo/vba/XPropValue.hpp> #include <cppuhelper/implbase1.hxx> #include "vbahelper.hxx" -typedef ::cppu::WeakImplHelper1< oo::vba::XPropValue > PropValueImpl_BASE; +typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE; class PropListener { diff --git a/sc/source/ui/vba/vbaradiobutton.cxx b/sc/source/ui/vba/vbaradiobutton.cxx index abdeb66c5334..3ce00bfd862b 100644 --- a/sc/source/ui/vba/vbaradiobutton.cxx +++ b/sc/source/ui/vba/vbaradiobutton.cxx @@ -31,12 +31,12 @@ #include <vector> using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; 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 ) +ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) { } @@ -55,22 +55,53 @@ ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun: m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); } -sal_Bool SAL_CALL +uno::Any 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; + nValue = -1; +// return uno::makeAny( nValue ); +// I must be missing something MSO says value should be -1 if selected, 0 if not +// selected + return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False ); + } void SAL_CALL -ScVbaRadioButton::setValue( sal_Bool _value ) throw (css::uno::RuntimeException) +ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) { sal_Int16 nValue = 0; - if( _value ) + sal_Bool bValue = sal_False; + if( _value >>= nValue ) + { + if( nValue == -1) nValue = 1; + } + else if ( _value >>= bValue ) + { + if ( bValue ) + nValue = 1; + } m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); } + +rtl::OUString& +ScVbaRadioButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaRadioButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.RadioButton" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbaradiobutton.hxx b/sc/source/ui/vba/vbaradiobutton.hxx index 33372f2fe505..f840030863dc 100644 --- a/sc/source/ui/vba/vbaradiobutton.hxx +++ b/sc/source/ui/vba/vbaradiobutton.hxx @@ -29,24 +29,27 @@ ************************************************************************/ #ifndef SC_VBA_RADIOBUTTON_HXX #define SC_VBA_RADIOBUTTON_HXX -#include <cppuhelper/implbase1.hxx> -#include <org/openoffice/msforms/XRadioButton.hpp> - +#include <ooo/vba/msforms/XRadioButton.hpp> #include "vbacontrol.hxx" #include "vbahelper.hxx" +#include <cppuhelper/implbase2.hxx> -typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XRadioButton > RadioButtonImpl_BASE; +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > 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 ); + ScVbaRadioButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); // Attributes virtual 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); + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } }; #endif //SC_VBA_RADIOBUTTON_HXX diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 6f5902f91447..5019167b4374 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -91,30 +91,31 @@ #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 <ooo/vba/excel/XlPasteSpecialOperation.hpp> +#include <ooo/vba/excel/XlPasteType.hpp> +#include <ooo/vba/excel/Constants.hpp> +#include <ooo/vba/excel/XlFindLookIn.hpp> +#include <ooo/vba/excel/XlLookAt.hpp> +#include <ooo/vba/excel/XlSearchOrder.hpp> +#include <ooo/vba/excel/XlSortOrder.hpp> +#include <ooo/vba/excel/XlYesNoGuess.hpp> +#include <ooo/vba/excel/XlSortOrientation.hpp> +#include <ooo/vba/excel/XlSortMethod.hpp> +#include <ooo/vba/excel/XlDirection.hpp> +#include <ooo/vba/excel/XlSortDataOption.hpp> +#include <ooo/vba/excel/XlDeleteShiftDirection.hpp> +#include <ooo/vba/excel/XlInsertShiftDirection.hpp> +#include <ooo/vba/excel/XlReferenceStyle.hpp> +#include <ooo/vba/excel/XlBordersIndex.hpp> +#include <ooo/vba/excel/XlPageBreak.hpp> +#include <ooo/vba/excel/XlAutoFilterOperator.hpp> +#include <ooo/vba/excel/XlAutoFillType.hpp> +#include <ooo/vba/excel/XlTextParsingType.hpp> +#include <ooo/vba/excel/XlTextQualifier.hpp> +#include <ooo/vba/excel/XlCellType.hpp> +#include <ooo/vba/excel/XlSpecialCellsValue.hpp> +#include <ooo/vba/excel/XlConsolidationFunction.hpp> +#include <ooo/vba/excel/XlSearchDirection.hpp> #include <scitems.hxx> #include <svx/srchitem.hxx> @@ -150,6 +151,7 @@ #include "undodat.hxx" #include "dbdocfun.hxx" #include "patattr.hxx" +#include "olinetab.hxx" #include <comphelper/anytostring.hxx> #include <global.hxx> @@ -162,10 +164,10 @@ #include <com/sun/star/sheet/FunctionArgument.hpp> // end test includes -#include <org/openoffice/excel/Range.hpp> +#include <ooo/vba/excel/Range.hpp> #include <com/sun/star/bridge/oleautomation/Date.hpp> -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; using ::std::vector; @@ -203,15 +205,17 @@ uno::Any lcl_makeRange( uno::Reference< uno::XComponentContext >& xContext, cons { 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 ) ) ); + return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< 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 > lcl_makeXRangeFromSheetCellRanges( const uno::Reference< 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(); + if ( nLen ) + { for ( sal_Int32 index = 0; index < nLen; ++index ) { ScRange refRange; @@ -231,10 +235,11 @@ uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges( const uno::Re // #FIXME need proper (WorkSheet) parent xRange = new ScVbaRange( xParent, xContext, xRanges ); } + } return xRange; } -SfxItemSet* ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException ) +ScCellRangeObj* ScVbaRange::getCellRangeObj() throw ( uno::RuntimeException ) { uno::Reference< uno::XInterface > xIf; if ( mxRanges.is() ) @@ -242,8 +247,13 @@ SfxItemSet* ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException ) else xIf.set( mxRange, uno::UNO_QUERY_THROW ); ScCellRangeObj* pUnoCellRange = dynamic_cast< ScCellRangeObj* >( xIf.get() ); - SfxItemSet* pDataSet = pUnoCellRange ? pUnoCellRange->GetCurrentDataSet( true ) : NULL ; + return pUnoCellRange; +} +SfxItemSet* ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException ) +{ + ScCellRangeObj* pUnoCellRange = getCellRangeObj(); + SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( pUnoCellRange ); if ( !pDataSet ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't access Itemset for range" ) ), uno::Reference< uno::XInterface >() ); return pDataSet; @@ -317,7 +327,7 @@ 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 ) {} + ScVbaRangeAreas( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, bool bIsRows, bool bIsColumns ) : ScVbaCollectionBaseImpl( uno::Reference< XHelperInterface >(), xContext, xIndexAccess ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {} // XEnumerationAccess virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration() throw (uno::RuntimeException); @@ -460,7 +470,7 @@ public: if ( pUnoCellRange ) { - SfxItemSet* pDataSet = pUnoCellRange->GetCurrentDataSet( true ); + SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( pUnoCellRange ); 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 @@ -527,10 +537,38 @@ sal_Int32 m_nArea; typedef ::cppu::WeakImplHelper1< container::XEnumeration > CellsEnumeration_BASE; typedef ::std::vector< CellPos > vCellPos; +// #FIXME - QUICK +// we could probably could and should modify CellsEnumeration below +// to handle rows and columns ( but I do this seperately for now +// and.. this class only handles singe areas ( does it have to handle +// multi area ranges?? ) +class ColumnsRowEnumeration: public CellsEnumeration_BASE +{ + uno::Reference< uno::XComponentContext > mxContext; + uno::Reference< excel::XRange > mxRange; + sal_Int32 mMaxElems; + sal_Int32 mCurElem; + +public: + ColumnsRowEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< excel::XRange >& xRange, sal_Int32 nElems ) : mxContext( xContext ), mxRange( xRange ), mMaxElems( nElems ), mCurElem( 0 ) + { + } + + virtual ::sal_Bool SAL_CALL hasMoreElements() throw (::uno::RuntimeException){ return mCurElem < mMaxElems; } + + virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasMoreElements() ) + throw container::NoSuchElementException(); + sal_Int32 vbaIndex = 1 + mCurElem++; + return uno::makeAny( mxRange->Item( uno::makeAny( vbaIndex ), uno::Any() ) ); + } +}; + class CellsEnumeration : public CellsEnumeration_BASE { uno::Reference< uno::XComponentContext > mxContext; - uno::Reference< vba::XCollection > m_xAreas; + uno::Reference< XCollection > m_xAreas; vCellPos m_CellPositions; vCellPos::const_iterator m_it; uno::Reference< table::XCellRange > getArea( sal_Int32 nVBAIndex ) throw ( uno::RuntimeException ) @@ -559,7 +597,7 @@ class CellsEnumeration : public CellsEnumeration_BASE } } public: - CellsEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< vba::XCollection >& xAreas ): mxContext( xContext ), m_xAreas( xAreas ) + CellsEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCollection >& xAreas ): mxContext( xContext ), m_xAreas( xAreas ) { sal_Int32 nItems = m_xAreas->getCount(); for ( sal_Int32 index=1; index <= nItems; ++index ) @@ -579,7 +617,7 @@ public: 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 ) ) ); + return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, xCellRange ) ) ); } }; @@ -751,6 +789,7 @@ protected: bool processValue( const uno::Any& aValue, const uno::Reference< table::XCell >& xCell ) { rtl::OUString sFormula; + double aDblValue = 0.0; if ( aValue >>= sFormula ) { // convert to CONV_OOO style formula string because XCell::setFormula @@ -778,6 +817,11 @@ protected: xCell->setFormula( sFormula ); return true; } + else if ( aValue >>= aDblValue ) + { + xCell->setValue( aDblValue ); + return true; + } return false; } @@ -939,9 +983,9 @@ public: class AreasVisitor { private: - uno::Reference< vba::XCollection > m_Areas; + uno::Reference< XCollection > m_Areas; public: - AreasVisitor( const uno::Reference< vba::XCollection >& rAreas ):m_Areas( rAreas ){} + AreasVisitor( const uno::Reference< XCollection >& rAreas ):m_Areas( rAreas ){} void visit( RangeProcessor& processor ) { @@ -1000,7 +1044,7 @@ public: 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, + return uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xRange->getCellRangeByPosition( xCellRangeAddressable->getRangeAddress().StartColumn + nStartColOffset, xCellRangeAddressable->getRangeAddress().StartRow + nStartRowOffset, @@ -1098,12 +1142,12 @@ getRangeForName( const uno::Reference< uno::XComponentContext >& xContext, const { uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pDocSh, *aCellRanges.First() ) ); // #FIXME need proper (WorkSheet) parent - return new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xRange ); + return new ScVbaRange( uno::Reference< 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 ); + return new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xRanges ); } css::uno::Reference< excel::XRange > @@ -1151,27 +1195,36 @@ table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam, } -uno::Reference< vba::XCollection > +uno::Reference< 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 ); + uno::Reference< 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 ) ); + uno::Reference< 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 ) + uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), getModelFromXIf( getXSomethingFromArgs< uno::XInterface >( 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 ) ); + mxRange.set( mxPropertySet, uno::UNO_QUERY ); + mxRanges.set( mxPropertySet, uno::UNO_QUERY ); + uno::Reference< container::XIndexAccess > xIndex; + if ( mxRange.is() ) + { + xIndex = new SingleRangeIndexAccess( mxContext, mxRange ); + } + else if ( mxRanges.is() ) + { + xIndex.set( mxRanges, uno::UNO_QUERY_THROW ); + } 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::ScVbaRange( const uno::Reference< 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 ) @@ -1186,7 +1239,7 @@ ScVbaRange::ScVbaRange( const uno::Reference< vba::XHelperInterface >& xParent, } -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::ScVbaRange( const uno::Reference< 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 ) { @@ -1199,7 +1252,7 @@ ScVbaRange::~ScVbaRange() { } -uno::Reference< vba::XCollection >& ScVbaRange::getBorders() +uno::Reference< XCollection >& ScVbaRange::getBorders() { if ( !m_Borders.is() ) { @@ -1532,7 +1585,7 @@ ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFi if ( m_Areas->getCount() > 1 ) { // Multi-Area Range - uno::Reference< vba::XCollection > xCollection( m_Areas, uno::UNO_QUERY_THROW ); + uno::Reference< 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 ); @@ -1739,7 +1792,7 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut { // Multi-Area Range rtl::OUString sAddress; - uno::Reference< vba::XCollection > xCollection( m_Areas, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xCollection( m_Areas, uno::UNO_QUERY_THROW ); uno::Any aExternalCopy = External; for ( sal_Int32 index = 1; index <= xCollection->getCount(); ++index ) { @@ -1822,15 +1875,15 @@ ScVbaRange::Font() throw ( script::BasicErrorException, uno::RuntimeException) 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; + ScCellRangeObj* pRangeObj = NULL; try { - pSet = getCurrentDataSet(); + pRangeObj = getCellRangeObj(); } catch( uno::Exception& ) { } - return new ScVbaFont( this, mxContext, aPalette, xProps, pSet ); + return new ScVbaFont( this, mxContext, aPalette, xProps, pRangeObj ); } uno::Reference< excel::XRange > @@ -1847,14 +1900,43 @@ ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) thr } sal_Int32 nRow = 0, nColumn = 0; - sal_Bool bIsIndex = nRowIndex >>= nRow, bIsColumnIndex = nColumnIndex >>= nColumn; + + sal_Bool bIsIndex = nRowIndex.hasValue(); + sal_Bool bIsColumnIndex = nColumnIndex.hasValue(); + + // Sometimes we might get a float or a double or whatever + // set in the Any, we should convert as appropriate + // #FIXME - perhaps worth turning this into some sort of + // convertion routine e.g. bSuccess = getValueFromAny( nRow, nRowIndex, getCppuType((sal_Int32*)0) ) + if ( nRowIndex.hasValue() && !( nRowIndex >>= nRow ) ) + { + uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext ); + uno::Any aConverted; + try + { + aConverted = xConverter->convertTo( nRowIndex, getCppuType((sal_Int32*)0) ); + bIsIndex = ( aConverted >>= nRow ); + } + catch( uno::Exception& ) {} // silence any errors + } + if ( bIsColumnIndex && !( nColumnIndex >>= nColumn ) ) + { + uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext ); + uno::Any aConverted; + try + { + aConverted = xConverter->convertTo( nColumnIndex, getCppuType((sal_Int32*)0) ); + bIsColumnIndex = ( aConverted >>= nColumn ); + } + catch( uno::Exception& ) {} // silence any errors + } 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 ) ); + return uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, mxRange ) ); sal_Int32 nIndex = --nRow; if( bIsIndex && !bIsColumnIndex ) // .Cells(n) @@ -1890,6 +1972,19 @@ ScVbaRange::Select() throw (uno::RuntimeException) xSelection->select( uno::makeAny( mxRanges ) ); else xSelection->select( uno::makeAny( mxRange ) ); + // set focus on document e.g. + // ThisComponent.CurrentController.Frame.getContainerWindow.SetFocus + try + { + uno::Reference< frame::XController > xController( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_QUERY_THROW ); + uno::Reference< awt::XWindow > xWin( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW ); + xWin->setFocus(); + } + catch( uno::Exception& ) + { + } + } } @@ -2687,6 +2782,167 @@ ScVbaRange::Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replace return sal_True; // always } +uno::Reference< excel::XRange > SAL_CALL +ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& LookIn, const uno::Any& LookAt, const uno::Any& SearchOrder, const uno::Any& SearchDirection, const uno::Any& MatchCase, const uno::Any& /*MatchByte*/, const uno::Any& /*SearchFormat*/ ) throw (uno::RuntimeException) +{ + // return a Range object that represents the first cell where that information is found. + rtl::OUString sWhat; + sal_Int32 nWhat = 0; + float fWhat = 0.0; + + // string. + if( What >>= sWhat ) + { + if( !sWhat.getLength() ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Find, missing params" )) , uno::Reference< uno::XInterface >() ); + } + else if( What >>= nWhat ) + { + sWhat = rtl::OUString::valueOf( nWhat ); + } + else if( What >>= fWhat ) + { + sWhat = rtl::OUString::valueOf( fWhat ); + } + else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Find, missing params" )) , uno::Reference< uno::XInterface >() ); + + rtl::OUString sSearch = VBAToRegexp( sWhat ); + + const SvxSearchItem& globalSearchOptions = ScGlobal::GetSearchItem(); + SvxSearchItem newOptions( globalSearchOptions ); + + sal_Int16 nLookAt = globalSearchOptions.GetWordOnly() ? excel::XlLookAt::xlPart : excel::XlLookAt::xlWhole; + sal_Int16 nSearchOrder = globalSearchOptions.GetRowDirection() ? excel::XlSearchOrder::xlByRows : excel::XlSearchOrder::xlByColumns; + + uno::Reference< util::XSearchable > xSearch( mxRange, uno::UNO_QUERY ); + if( xSearch.is() ) + { + uno::Reference< util::XSearchDescriptor > xDescriptor = xSearch->createSearchDescriptor(); + xDescriptor->setSearchString( sSearch ); + + uno::Reference< excel::XRange > xAfterRange; + uno::Reference< table::XCellRange > xStartCell; + if( After >>= xAfterRange ) + { + // After must be a single cell in the range + if( xAfterRange->getCount() > 1 ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("After must be a single cell." )) , uno::Reference< uno::XInterface >() ); + uno::Reference< excel::XRange > xCell( Cells( uno::makeAny( xAfterRange->getRow() ), uno::makeAny( xAfterRange->getColumn() ) ), uno::UNO_QUERY ); + if( !xCell.is() ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("After must be in range." )) , uno::Reference< uno::XInterface >() ); + xStartCell.set( xAfterRange->getCellRange(), uno::UNO_QUERY_THROW ); + } + + // LookIn + if( LookIn.hasValue() ) + { + sal_Int32 nLookIn = 0; + if( LookIn >>= nLookIn ) + { + sal_Int16 nSearchType = 0; + switch( nLookIn ) + { + case excel::XlFindLookIn::xlComments : + nSearchType = SVX_SEARCHIN_NOTE; // Notes + break; + case excel::XlFindLookIn::xlFormulas : + nSearchType = SVX_SEARCHIN_FORMULA; + break; + case excel::XlFindLookIn::xlValues : + nSearchType = SVX_SEARCHIN_VALUE; + break; + default: + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for LookIn." )) , uno::Reference< uno::XInterface >() ); + } + newOptions.SetCellType( nSearchType ); + xDescriptor->setPropertyValue( rtl::OUString::createFromAscii( "SearchType" ), uno::makeAny( nSearchType ) ); + } + } + + // LookAt + if ( LookAt.hasValue() ) + { + nLookAt = ::comphelper::getINT16( LookAt ); + sal_Bool bSearchWords = sal_False; + if ( nLookAt == excel::XlLookAt::xlPart ) + bSearchWords = sal_False; + else if ( nLookAt == 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 >() ); + newOptions.SetWordOnly( bSearchWords ); + xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHWORDS ) ), uno::makeAny( bSearchWords ) ); + } + + // SearchOrder + 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 ) ); + } + + // SearchDirection + if ( SearchDirection.hasValue() ) + { + sal_Int32 nSearchDirection = 0; + if( SearchDirection >>= nSearchDirection ) + { + sal_Bool bSearchBackwards = sal_False; + if ( nSearchDirection == excel::XlSearchDirection::xlNext ) + bSearchBackwards = sal_False; + else if( nSearchDirection == excel::XlSearchDirection::xlPrevious ) + bSearchBackwards = sal_True; + else + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for SearchDirection" )) , uno::Reference< uno::XInterface >() ); + newOptions.SetBackward( bSearchBackwards ); + xDescriptor->setPropertyValue( rtl::OUString::createFromAscii( "SearchBackwards" ), uno::makeAny( bSearchBackwards ) ); + } + } + + // MatchCase + sal_Bool bMatchCase = sal_False; + if ( MatchCase.hasValue() ) + { + // SearchCaseSensitive + if( !( MatchCase >>= bMatchCase ) ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for MatchCase" )) , uno::Reference< uno::XInterface >() ); + } + xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHCASE ) ), uno::makeAny( bMatchCase ) ); + + // MatchByte + // SearchFormat + // ignore + + ScGlobal::SetSearchItem( newOptions ); + + uno::Reference< util::XSearchDescriptor > xSearchDescriptor( xDescriptor, uno::UNO_QUERY ); + uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xSearchDescriptor) : xSearch->findFirst( xSearchDescriptor ); + uno::Reference< table::XCellRange > xCellRange( xInterface, uno::UNO_QUERY ); + if ( xCellRange.is() ) + { + uno::Reference< excel::XRange > xResultRange = new ScVbaRange( this, mxContext, xCellRange ); + if( xResultRange.is() ) + { + xResultRange->Select(); + return xResultRange; + } + } + + } + + return uno::Reference< excel::XRange >(); +} + uno::Reference< table::XCellRange > processKey( const uno::Any& Key, uno::Reference< uno::XComponentContext >& xContext, ScDocShell* pDocSh ) { uno::Reference< excel::XRange > xKeyRange; @@ -2740,10 +2996,10 @@ void updateTableSortField( const uno::Reference< table::XCellRange >& xParentRan // make sure that upper left poing of key range is within the // parent range - if ( colRowKeyAddress.StartColumn >= parentRangeAddress.StartColumn && - colRowKeyAddress.StartColumn <= parentRangeAddress.EndColumn && + if ( ( !bIsSortColumn && colRowKeyAddress.StartColumn >= parentRangeAddress.StartColumn && + colRowKeyAddress.StartColumn <= parentRangeAddress.EndColumn ) || ( bIsSortColumn && colRowKeyAddress.StartRow >= parentRangeAddress.StartRow && - colRowKeyAddress.StartRow <= parentRangeAddress.EndRow ) + colRowKeyAddress.StartRow <= parentRangeAddress.EndRow ) ) { //determine col/row index if ( bIsSortColumn ) @@ -2799,7 +3055,7 @@ ScVbaRange::Sort( const uno::Any& Key1, const uno::Any& Order1, const uno::Any& /* if ( isSingleCellRange() ) { - uno::Reference< vba::XRange > xCurrent = CurrentRegion(); + uno::Reference< XRange > xCurrent = CurrentRegion(); xCurrent->Sort( Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2, DataOption3 ); return; } @@ -3117,6 +3373,18 @@ ScVbaRange::hasElements() throw (uno::RuntimeException) uno::Reference< container::XEnumeration > SAL_CALL ScVbaRange::createEnumeration() throw (uno::RuntimeException) { + if ( mbIsColumns || mbIsRows ) + { + uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY ); + uno::Reference< excel::XRange > xRange( m_Areas->Item( uno::makeAny( sal_Int32(1) ), uno::Any() ), uno::UNO_QUERY_THROW ); + sal_Int32 nElems = 0; + if ( mbIsColumns ) + nElems = xColumnRowRange->getColumns()->getCount(); + else + nElems = xColumnRowRange->getRows()->getCount(); + return new ColumnsRowEnumeration( mxContext, xRange, nElems ); + + } return new CellsEnumeration( mxContext, m_Areas ); } @@ -3364,26 +3632,32 @@ ScVbaRange::getRowHeight() throw (uno::RuntimeException) return xRange->getRowHeight(); } - // if this range is a 'Rows' range, then if any row's RowHeight in the + // 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 ); + USHORT nRowTwips = 0; // #TODO probably possible to use the SfxItemSet ( and see if // SFX_ITEM_DONTCARE is set ) to improve performance - if ( mbIsRows ) +// #CHECKME looks like this is general behaviour not just row Range specific +// if ( mbIsRows ) + ScDocShell* pShell = getScDocShell(); + if ( pShell ) { for ( sal_Int32 nRow = nStartRow ; nRow <= nEndRow; ++nRow ) { thisAddress.StartRow = nRow; - double nCurHeight = getCalcRowHeight( thisAddress ); - if ( nHeight != nCurHeight ) + USHORT nCurTwips = pShell->GetDocument()->GetOriginalHeight( thisAddress.StartRow, thisAddress.Sheet ); + if ( nRow == nStartRow ) + nRowTwips = nCurTwips; + if ( nRowTwips != nCurTwips ) return aNULL(); } } + double nHeight = lcl_Round2DecPlaces( lcl_TwipsToPoints( nRowTwips ) ); return uno::makeAny( nHeight ); } @@ -3555,7 +3829,7 @@ ScVbaRange::getWorksheet() throw (uno::RuntimeException) ScDocShell* pDocShell = getDocShellFromRange(xRange); RangeHelper rHelper(xRange); // parent should be Thisworkbook - xSheet.set( new ScVbaWorksheet( uno::Reference< vba::XHelperInterface >(), mxContext,rHelper.getSpreadSheet(),pDocShell->GetModel()) ); + xSheet.set( new ScVbaWorksheet( uno::Reference< XHelperInterface >(), mxContext,rHelper.getSpreadSheet(),pDocShell->GetModel()) ); } return xSheet; } @@ -3622,14 +3896,14 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC if ( xRange.is() ) { // #FIXME need proper (WorkSheet) parent - uno::Reference< excel::XRange > xVbRange = new ScVbaRange( uno::Reference< vba::XHelperInterface >(), xContext, xRange ); + uno::Reference< excel::XRange > xVbRange = new ScVbaRange( uno::Reference< 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 ); + ScVbaRange* pRange = new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xSheetRange ); uno::Reference< excel::XRange > xVbSheetRange( pRange ); return pRange->Range( Cell1, Cell2, true ); } @@ -4120,7 +4394,7 @@ ScVbaRange::Autofit() throw (uno::RuntimeException) // if the range is a not a row or column range autofit will // throw an error - if ( !mbIsColumns ) + if ( !( mbIsColumns || mbIsRows ) ) DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString()); ScDocShell* pDocShell = getDocShellFromRange( mxRange ); if ( pDocShell ) @@ -4299,6 +4573,113 @@ void ScVbaRange::setFormulaHidden(const uno::Any& Hidden) throw ( script::BasicE xProps->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLPRO)), uno::makeAny(rCellAttr)); } +uno::Any ScVbaRange::getShowDetail() throw ( css::uno::RuntimeException) +{ + // #FIXME, If the specified range is in a PivotTable report + + // In MSO VBA, the specified range must be a single summary column or row in an outline. otherwise throw exception + if( m_Areas->getCount() > 1 ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not get Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() ); + + sal_Bool bShowDetail = sal_False; + + RangeHelper helper( mxRange ); + uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = helper.getSheetCellCursor(); + xSheetCellCursor->collapseToCurrentRegion(); + uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW); + table::CellRangeAddress aOutlineAddress = xCellRangeAddressable->getRangeAddress(); + + // check if the specified range is a single summary column or row. + table::CellRangeAddress thisAddress = helper.getCellRangeAddressable()->getRangeAddress(); + if( (thisAddress.StartRow == thisAddress.EndRow && thisAddress.EndRow == aOutlineAddress.EndRow ) || + (thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn )) + { + sal_Bool bColumn =thisAddress.StartRow == thisAddress.EndRow ? sal_False:sal_True; + ScDocument* pDoc = getDocumentFromRange( mxRange ); + ScOutlineTable* pOutlineTable = pDoc->GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), sal_True); + const ScOutlineArray* pOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray(); + if( pOutlineArray ) + { + SCCOLROW nPos = bColumn ? (SCCOLROW)(thisAddress.EndColumn-1):(SCCOLROW)(thisAddress.EndRow-1); + ScOutlineEntry* pEntry = pOutlineArray->GetEntryByPos( 0, nPos ); + if( pEntry ) + { + bShowDetail = !pEntry->IsHidden(); + return uno::makeAny( bShowDetail ); + } + } + } + else + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not set Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() ); + } + return aNULL(); +} + +void ScVbaRange::setShowDetail(const uno::Any& aShowDetail) throw ( css::uno::RuntimeException) +{ + // #FIXME, If the specified range is in a PivotTable report + + // In MSO VBA, the specified range must be a single summary column or row in an outline. otherwise throw exception + if( m_Areas->getCount() > 1 ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not set Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() ); + + sal_Bool bShowDetail = sal_False; + aShowDetail >>= bShowDetail; + + RangeHelper helper( mxRange ); + uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = helper.getSheetCellCursor(); + xSheetCellCursor->collapseToCurrentRegion(); + uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW); + table::CellRangeAddress aOutlineAddress = xCellRangeAddressable->getRangeAddress(); + + // check if the specified range is a single summary column or row. + table::CellRangeAddress thisAddress = helper.getCellRangeAddressable()->getRangeAddress(); + if( (thisAddress.StartRow == thisAddress.EndRow && thisAddress.EndRow == aOutlineAddress.EndRow ) || + (thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn )) + { + // #FIXME, seems there is a different behavior between MSO and OOo. + // In OOo, the showDetail will show all the level entrys, while only show the first level entry in MSO + uno::Reference< sheet::XSheetOutline > xSheetOutline( helper.getSpreadSheet(), uno::UNO_QUERY_THROW ); + if( bShowDetail ) + xSheetOutline->showDetail( aOutlineAddress ); + else + xSheetOutline->hideDetail( aOutlineAddress ); + } + else + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not set Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() ); + } +} + +uno::Reference< excel::XRange > SAL_CALL +ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeException) +{ + uno::Reference< sheet::XSheetCellRange > xMergeShellCellRange(mxRange->getCellRangeByPosition(0,0,0,0), uno::UNO_QUERY_THROW); + uno::Reference< sheet::XSheetCellCursor > xMergeSheetCursor(xMergeShellCellRange->getSpreadsheet()->createCursorByRange( xMergeShellCellRange ), uno::UNO_QUERY_THROW); + if( xMergeSheetCursor.is() ) + { + xMergeSheetCursor->collapseToMergedArea(); + uno::Reference<sheet::XCellRangeAddressable> xMergeCellAddress(xMergeSheetCursor, uno::UNO_QUERY_THROW); + if( xMergeCellAddress.is() ) + { + table::CellRangeAddress aCellAddress = xMergeCellAddress->getRangeAddress(); + if( aCellAddress.StartColumn ==0 && aCellAddress.EndColumn==0 && + aCellAddress.StartRow==0 && aCellAddress.EndRow==0) + { + return new ScVbaRange( getParent(),mxContext,mxRange ); + } + else + { + ScRange refRange( static_cast< SCCOL >( aCellAddress.StartColumn ), static_cast< SCROW >( aCellAddress.StartRow ), static_cast< SCTAB >( aCellAddress.Sheet ), + static_cast< SCCOL >( aCellAddress.EndColumn ), static_cast< SCROW >( aCellAddress.EndRow ), static_cast< SCTAB >( aCellAddress.Sheet ) ); + uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell() , refRange ) ); + return new ScVbaRange( getParent(),mxContext,xRange ); + } + } + } + return new ScVbaRange( getParent(),mxContext,mxRange ); +} 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) @@ -4517,7 +4898,7 @@ ScVbaRange::AutoOutline( ) throw (script::BasicErrorException, uno::RuntimeExce { // #TODO #FIXME needs to check for summary row/col ( whatever they are ) // not valid for multi Area Addresses - if ( m_Areas->getCount() ) + if ( m_Areas->getCount() > 1 ) 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 ) @@ -4735,6 +5116,7 @@ ScVbaRange::SpecialCells( const uno::Any& _oType, const uno::Any& _oValue) throw case excel::XlCellType::xlCellTypeConstants: case excel::XlCellType::xlCellTypeFormulas: case excel::XlCellType::xlCellTypeVisible: + case excel::XlCellType::xlCellTypeLastCell: { if ( bIsMultiArea ) { @@ -4895,7 +5277,7 @@ ScVbaRange::Subtotal( ::sal_Int32 _nGroupBy, ::sal_Int32 _nFunction, const uno:: sal_Bool bAddPageBreaks = sal_False; PageBreaks >>= bAddPageBreaks; - uno::Reference< sheet::XSubTotalCalculatable> xSub; + uno::Reference< sheet::XSubTotalCalculatable> xSub(mxRange, uno::UNO_QUERY_THROW ); 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)); @@ -4956,27 +5338,6 @@ ScVbaRange::Subtotal( ::sal_Int32 _nGroupBy, ::sal_Int32 _nFunction, const uno:: } } -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() { @@ -4991,7 +5352,7 @@ ScVbaRange::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Range" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Range" ) ); } return aServiceNames; } @@ -5003,5 +5364,5 @@ sdecl::vba_service_class_<ScVbaRange, sdecl::with_args<true> > serviceImpl; extern sdecl::ServiceDecl const serviceDecl( serviceImpl, "SvVbaRange", - "org.openoffice.excel.Range" ); + "ooo.vba.excel.Range" ); } diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx index 37702bcf16a8..abc2f608bb62 100644 --- a/sc/source/ui/vba/vbarange.hxx +++ b/sc/source/ui/vba/vbarange.hxx @@ -1,275 +1,282 @@ -/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vbarange.hxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef 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( formula::FormulaGrammar::Grammar ) throw (css::uno::RuntimeException);
- virtual void setFormulaValue( const css::uno::Any& aValue, formula::FormulaGrammar::Grammar ) throw ( css::uno::RuntimeException);
- css::uno::Reference< 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, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::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);
- using ScVbaRange_BASE::setNumberFormat;
- 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 */
-
+/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbarange.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SC_VBA_RANGE_HXX +#define SC_VBA_RANGE_HXX + +#include <cppuhelper/implbase4.hxx> +#include <com/sun/star/container/XEnumerationAccess.hpp> + +#include <ooo/vba/excel/XRange.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <ooo/vba/excel/XFont.hpp> +#include <ooo/vba/excel/XComment.hpp> +#include <ooo/vba/XCollection.hpp> +#include <ooo/vba/excel/XlPasteType.hdl> +#include <ooo/vba/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; +class ScCellRangeObj; + +//typedef InheritedHelperInterfaceImpl1< ov::excel::XRange > ScVbaRange_BASE; +typedef ScVbaFormat< ov::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< ov::XCollection > m_Areas; + css::uno::Reference< ov::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< ov::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< ov::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( formula::FormulaGrammar::Grammar ) throw (css::uno::RuntimeException); + virtual void setFormulaValue( const css::uno::Any& aValue, formula::FormulaGrammar::Grammar ) throw ( css::uno::RuntimeException); + css::uno::Reference< ov::excel::XRange > getArea( sal_Int32 nIndex ) throw( css::uno::RuntimeException ); + ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException ); + ScCellRangeObj* getCellRangeObj( ) throw ( css::uno::RuntimeException ); + SfxItemSet* getCurrentDataSet( ) throw ( css::uno::RuntimeException ); + css::uno::Reference< ov::XCollection >& getBorders(); + void groupUnGroup( bool bUnGroup = false ) throw ( css::script::BasicErrorException, css::uno::RuntimeException ); + css::uno::Reference< ov::excel::XRange > PreviousNext( bool bIsPrevious ); + css::uno::Reference< ov::excel::XRange > SpecialCellsImpl( sal_Int32 nType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException ); + css::awt::Point getPosition() throw ( css::uno::RuntimeException ); +public: + ScVbaRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XCellRange >& xRange, sal_Bool bIsRows = false, sal_Bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException ); + ScVbaRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges, sal_Bool bIsRows = false, sal_Bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException ); + 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< ov::XHelperInterface > thisHelperIface() { return this; } + bool isSingleCellRange(); + static css::uno::Reference< ov::excel::XRange > getRangeObjectForName( const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sRangeName, ScDocShell* pDocSh, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::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); + using ScVbaRange_BASE::setNumberFormat; + 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< ov::excel::XRange > SAL_CALL getEntireRow() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getEntireColumn() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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< ov::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< ov::excel::XValidation > SAL_CALL getValidation() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getFormulaHidden() throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual void SAL_CALL setFormulaHidden(const css::uno::Any& aHidden) throw (css::script::BasicErrorException, css::uno::RuntimeException); + //virtual css::uno::Any SAL_CALL getLocked() throw (css::script::BasicErrorException, css::uno::RuntimeException); + //virtual void SAL_CALL setLocked(const css::uno::Any& aLocked) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getShowDetail() throw (css::uno::RuntimeException); + virtual void SAL_CALL setShowDetail(const css::uno::Any& aShowDetail) throw (css::uno::RuntimeException); + // Methods + sal_Bool IsRows() { return mbIsRows; } + sal_Bool IsColumns() { return mbIsColumns; } + virtual css::uno::Reference< ov::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< ov::excel::XRange > SAL_CALL Offset( const css::uno::Any &nRowOffset, const css::uno::Any &nColOffset ) + throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL CurrentRegion() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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< ov::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< ov::excel::XRange > SAL_CALL Rows( const css::uno::Any& nIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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< ov::excel::XRange > SAL_CALL Resize( const css::uno::Any& RowSize, const css::uno::Any& ColumnSize ) + throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XFont > SAL_CALL Font() throw ( css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XInterior > SAL_CALL Interior( ) throw ( css::script::BasicErrorException, css::uno::RuntimeException) ; + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Range( const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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 css::uno::Reference< ov::excel::XRange > SAL_CALL Find( const css::uno::Any& What, const css::uno::Any& After, const css::uno::Any& LookIn, const css::uno::Any& LookAt, const css::uno::Any& SearchOrder, const css::uno::Any& SearchDirection, const css::uno::Any& MatchCase, const css::uno::Any& MatchByte, const css::uno::Any& SearchFormat ) 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< ov::excel::XRange > SAL_CALL End( ::sal_Int32 Direction ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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< ov::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< ov::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< ov::excel::XRange > SAL_CALL Next() throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ov::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 css::uno::Reference< ov::excel::XRange > SAL_CALL MergeArea() 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 ov::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< ov::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< ov::excel::XRange >& ChangingCell ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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/sc/source/ui/vba/vbascrollbar.cxx b/sc/source/ui/vba/vbascrollbar.cxx new file mode 100644 index 000000000000..3da3230a8761 --- /dev/null +++ b/sc/source/ui/vba/vbascrollbar.cxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * 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 "vbascrollbar.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ); +const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ); +const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); +const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ); +const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ); +const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") ); + +ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +uno::Any SAL_CALL +ScVbaScrollBar::getValue() throw (css::uno::RuntimeException) +{ + return m_xProps->getPropertyValue( SCROLLVALUE ); +} + +void SAL_CALL +ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( SCROLLVALUE, _value ); +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getMax() throw (uno::RuntimeException) +{ + sal_Int32 nMax = 0; + m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax; + return nMax; +} + +void SAL_CALL +ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) ); +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getMin() throw (uno::RuntimeException) +{ + sal_Int32 nVal = 0; + m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal; + return nVal; +} + +void SAL_CALL +ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) ); +} + +void SAL_CALL +ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) ); +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException) +{ + sal_Int32 nVal = 0; + m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal; + return nVal; +} + +::sal_Int32 SAL_CALL +ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException) +{ + sal_Int32 nSmallChange = 0; + m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange; + return nSmallChange; +} + +void SAL_CALL +ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) ); +} + +rtl::OUString& +ScVbaScrollBar::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaScrollBar::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbascrollbar.hxx b/sc/source/ui/vba/vbascrollbar.hxx new file mode 100644 index 000000000000..04c4853cdbe4 --- /dev/null +++ b/sc/source/ui/vba/vbascrollbar.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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_SCROLLBAR_HXX +#define SC_VBA_SCROLLBAR_HXX +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XScrollBar.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE; + +class ScVbaScrollBar : public ScrollBarImpl_BASE +{ +public: + ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getLargeChange() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLargeChange( ::sal_Int32 _largechange ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getSmallChange() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSmallChange( ::sal_Int32 _smallchange ) throw (css::uno::RuntimeException); + + + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif //SC_VBA_LABEL_HXX diff --git a/sc/source/ui/vba/vbaseriescollection.cxx b/sc/source/ui/vba/vbaseriescollection.cxx index ac8b78c22083..8c6c07703ac7 100644 --- a/sc/source/ui/vba/vbaseriescollection.cxx +++ b/sc/source/ui/vba/vbaseriescollection.cxx @@ -28,14 +28,14 @@ * ************************************************************************/ #include "vbaseriescollection.hxx" -#include <org/openoffice/excel/XSeries.hpp> +#include <ooo/vba/excel/XSeries.hpp> #include "vbaglobals.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; -ScVbaSeriesCollection::ScVbaSeriesCollection( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SeriesCollection_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ) +ScVbaSeriesCollection::ScVbaSeriesCollection( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SeriesCollection_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ) { } @@ -76,7 +76,7 @@ ScVbaSeriesCollection::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.SeriesCollection") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.SeriesCollection") ); } return sNames; } diff --git a/sc/source/ui/vba/vbaseriescollection.hxx b/sc/source/ui/vba/vbaseriescollection.hxx index dbb5a1a70e72..ccd544fe4f26 100644 --- a/sc/source/ui/vba/vbaseriescollection.hxx +++ b/sc/source/ui/vba/vbaseriescollection.hxx @@ -30,20 +30,20 @@ #ifndef SC_VBA_SERIESCOLLECTION_HXX #define SC_VBA_SERIESCOLLECTION_HXX -#include <org/openoffice/excel/XSeriesCollection.hpp> +#include <ooo/vba/excel/XSeriesCollection.hpp> #include "vbahelperinterface.hxx" #include "vbacollectionimpl.hxx" #include "vbahelper.hxx" -typedef CollTestImplHelper< oo::excel::XSeriesCollection > SeriesCollection_BASE; +typedef CollTestImplHelper< ov::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 ); + ScVbaSeriesCollection( const css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbashape.cxx b/sc/source/ui/vba/vbashape.cxx index 6abed79a14b3..7b81682cb393 100644 --- a/sc/source/ui/vba/vbashape.cxx +++ b/sc/source/ui/vba/vbashape.cxx @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include<org/openoffice/office/MsoZOrderCmd.hpp> -#include<org/openoffice/office/MsoScaleFrom.hpp> +#include<ooo/vba/office/MsoZOrderCmd.hpp> +#include<ooo/vba/office/MsoScaleFrom.hpp> #include<com/sun/star/container/XNamed.hpp> #include<com/sun/star/drawing/ConnectorType.hpp> #include <com/sun/star/lang/XEventListener.hpp> @@ -46,17 +46,17 @@ #include "vbafillformat.hxx" #include "vbapictureformat.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +ScVbaShape::ScVbaShape( const uno::Reference< 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 ) +ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xShape( xShape ) { // add listener addListeners(); @@ -474,7 +474,7 @@ ScVbaShape::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.Shape" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shape" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbashape.hxx b/sc/source/ui/vba/vbashape.hxx index ea004431b668..5ae35500381d 100644 --- a/sc/source/ui/vba/vbashape.hxx +++ b/sc/source/ui/vba/vbashape.hxx @@ -30,38 +30,39 @@ #ifndef SC_VBA_SHAPE_HXX #define SC_VBA_SHAPE_HXX -#include <org/openoffice/office/MsoShapeType.hpp> +#include <ooo/vba/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 <ooo/vba/msforms/XShape.hpp> +#include <ooo/vba/msforms/XLineFormat.hpp> #include <cppuhelper/implbase2.hxx> #include "vbahelperinterface.hxx" -typedef ::cppu::WeakImplHelper2< oo::msforms::XShape, css::lang::XEventListener > ListeningShape; +typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape; typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE; class ScVbaShape : public ScVbaShape_BASE { +friend class ConcreteXShapeHelper; // perhaps an accessor would be better private: +protected: 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 ); + ScVbaShape( const css::uno::Reference< ov::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; }; @@ -85,12 +86,12 @@ public: 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); + virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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 css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbashaperange.cxx b/sc/source/ui/vba/vbashaperange.cxx index 4a13ea24676c..2298c65bae6f 100644 --- a/sc/source/ui/vba/vbashaperange.cxx +++ b/sc/source/ui/vba/vbashaperange.cxx @@ -33,16 +33,16 @@ #include "vbashaperange.hxx" #include "vbashape.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; class VbShapeRangeEnumHelper : public EnumerationHelper_BASE { - uno::Reference< vba::XCollection > m_xParent; + uno::Reference< 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 ) {} + VbShapeRangeEnumHelper( const uno::Reference< 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() ); @@ -57,7 +57,7 @@ public: }; -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) +ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< 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) { } @@ -146,7 +146,7 @@ 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 ) ) ); + uno::Reference< msforms::XShape > xVbShape( new ScVbaShape( uno::Reference< XHelperInterface >(), mxContext, xShape, getShapes(), ScVbaShape::getType( xShape ) ) ); return uno::makeAny( xVbShape ); } @@ -164,7 +164,7 @@ ScVbaShapeRange::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.ShapeRange" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.ShapeRange" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbashaperange.hxx b/sc/source/ui/vba/vbashaperange.hxx index 9f5ecd7512dd..27915d559e85 100644 --- a/sc/source/ui/vba/vbashaperange.hxx +++ b/sc/source/ui/vba/vbashaperange.hxx @@ -31,11 +31,11 @@ #define SC_VBA_SHAPERANGE_HXX #include <com/sun/star/drawing/XShapes.hpp> -#include <org/openoffice/msforms/XShapeRange.hpp> +#include <ooo/vba/msforms/XShapeRange.hpp> #include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< oo::msforms::XShapeRange > ScVbaShapeRange_BASE; +typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE; class ScVbaShapeRange : public ScVbaShapeRange_BASE { @@ -48,11 +48,11 @@ protected: 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 ); + ScVbaShapeRange( const css::uno::Reference< ov::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 css::uno::Reference< ::ooo::vba::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); diff --git a/sc/source/ui/vba/vbashapes.cxx b/sc/source/ui/vba/vbashapes.cxx index 3bdb72a4ded1..8aac090d0337 100644 --- a/sc/source/ui/vba/vbashapes.cxx +++ b/sc/source/ui/vba/vbashapes.cxx @@ -30,14 +30,14 @@ #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 <ooo/vba/msforms/XShapeRange.hpp> +#include <ooo/vba/office/MsoAutoShapeType.hpp> #include "vbashapes.hxx" #include "vbashape.hxx" #include "vbashaperange.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; class VbShapeEnumHelper : public EnumerationHelper_BASE @@ -76,7 +76,7 @@ void ScVbaShapes::initBaseCollection() 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) +ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::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 ); @@ -103,7 +103,7 @@ ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) uno::Type ScVbaShapes::getElementType() throw (uno::RuntimeException) { - return org::openoffice::msforms::XShape::static_type(0); + return ooo::vba::msforms::XShape::static_type(0); } rtl::OUString& ScVbaShapes::getServiceImplName() @@ -119,7 +119,7 @@ ScVbaShapes::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msform.Shapes" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shapes" ) ); } return aServiceNames; } @@ -172,7 +172,7 @@ ScVbaShapes::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::R { uno::Reference< container::XIndexAccess > xIndexAccess( getShapesByArrayIndices( Index ) ); // return new collection instance - uno::Reference< vba::XCollection > xShapesCollection( new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) ); + uno::Reference< XCollection > xShapesCollection( new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) ); return uno::makeAny( xShapesCollection ); } */ @@ -385,7 +385,7 @@ ScVbaShapes::createName( rtl::OUString sName ) #if 0 //TODO helperapi using a writer document awt::Point -calculateTopLeftMargin( uno::Reference< vba::XHelperInterface > xDocument ) +calculateTopLeftMargin( uno::Reference< XHelperInterface > xDocument ) { awt::Point aPoint( 0, 0 ); uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW ); diff --git a/sc/source/ui/vba/vbashapes.hxx b/sc/source/ui/vba/vbashapes.hxx index 01c7144bf191..94f68ff6718b 100644 --- a/sc/source/ui/vba/vbashapes.hxx +++ b/sc/source/ui/vba/vbashapes.hxx @@ -33,13 +33,13 @@ #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 <ooo/vba/msforms/XShapes.hpp> #include "vbahelperinterface.hxx" #include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< oo::msforms::XShapes > ScVbaShapes_BASE; +typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE; class ScVbaShapes : public ScVbaShapes_BASE { @@ -57,10 +57,10 @@ protected: 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 ); //TODO helperapi using a writer document - //css::awt::Point calculateTopLeftMargin( css::uno::Reference< oo::vba::XHelperInterface > xDocument ); + //css::awt::Point calculateTopLeftMargin( css::uno::Reference< ov::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 ); + ScVbaShapes( const css::uno::Reference< ov::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 @@ -71,7 +71,7 @@ public: //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); + virtual css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbaspinbutton.cxx b/sc/source/ui/vba/vbaspinbutton.cxx new file mode 100644 index 000000000000..c9da8cf8827c --- /dev/null +++ b/sc/source/ui/vba/vbaspinbutton.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 "vbaspinbutton.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") ); +const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ); +const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ); +const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") ); + +ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ +} + +// Attributes +uno::Any SAL_CALL +ScVbaSpinButton::getValue() throw (css::uno::RuntimeException) +{ + return m_xProps->getPropertyValue( SPINVALUE ); +} + +void SAL_CALL +ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( SPINVALUE, _value ); +} + +::sal_Int32 SAL_CALL +ScVbaSpinButton::getMax() throw (uno::RuntimeException) +{ + sal_Int32 nMax = 0; + m_xProps->getPropertyValue( SPINMAX ) >>= nMax; + return nMax; +} + +void SAL_CALL +ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); +} + +::sal_Int32 SAL_CALL +ScVbaSpinButton::getMin() throw (uno::RuntimeException) +{ + sal_Int32 nVal = 0; + m_xProps->getPropertyValue( SPINMIN ) >>= nVal; + return nVal; +} + +void SAL_CALL +ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException) +{ + m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); +} + +rtl::OUString& +ScVbaSpinButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaSpinButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbaspinbutton.hxx b/sc/source/ui/vba/vbaspinbutton.hxx new file mode 100644 index 000000000000..338d71f34dec --- /dev/null +++ b/sc/source/ui/vba/vbaspinbutton.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * 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_SPINBUTTON_HXX +#define SC_VBA_SPINBUTTON_HXX +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XSpinButton.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" + +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE; + +class ScVbaSpinButton : public SpinButtonImpl_BASE +{ +public: + ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException); + + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif //SC_VBA_SPINBUTTON_HXX diff --git a/sc/source/ui/vba/vbastyle.cxx b/sc/source/ui/vba/vbastyle.cxx index 4a66967b5a8b..fbcfb0b97f65 100644 --- a/sc/source/ui/vba/vbastyle.cxx +++ b/sc/source/ui/vba/vbastyle.cxx @@ -31,7 +31,7 @@ #include "vbastyle.hxx" #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; static rtl::OUString DISPLAYNAME( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ); @@ -71,7 +71,7 @@ void ScVbaStyle::initialise() throw ( uno::RuntimeException ) } -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 ) +ScVbaStyle::ScVbaStyle( const uno::Reference< ov::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 { @@ -83,7 +83,7 @@ ScVbaStyle::ScVbaStyle( const uno::Reference< oo::vba::XHelperInterface >& xPare } } -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 ) +ScVbaStyle::ScVbaStyle( const uno::Reference< 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 { @@ -183,7 +183,7 @@ ScVbaStyle::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.XStyle" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.XStyle" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbastyle.hxx b/sc/source/ui/vba/vbastyle.hxx index fb80cbf0422f..cc8bda0a0537 100644 --- a/sc/source/ui/vba/vbastyle.hxx +++ b/sc/source/ui/vba/vbastyle.hxx @@ -29,14 +29,14 @@ ************************************************************************/ #ifndef SC_VBA_STYLE_HXX #define SC_VBA_STYLE_HXX -#include <org/openoffice/excel/XStyle.hpp> +#include <ooo/vba/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; +typedef ScVbaFormat< ov::excel::XStyle > ScVbaStyle_BASE; class ScVbaStyle : public ScVbaStyle_BASE { @@ -46,11 +46,11 @@ protected: 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 ); + ScVbaStyle( const css::uno::Reference< ov::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< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const css::uno::Reference< css::frame::XModel >& _xModel ) 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; }; + virtual css::uno::Reference< ov::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); @@ -63,9 +63,9 @@ public: 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 css::uno::Reference< ::ooo::vba::excel::XBorders > SAL_CALL Borders( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);; + virtual css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);; + virtual css::uno::Reference< ::ooo::vba::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);; diff --git a/sc/source/ui/vba/vbastyles.cxx b/sc/source/ui/vba/vbastyles.cxx index 7856900ca970..18111fc5eae7 100644 --- a/sc/source/ui/vba/vbastyles.cxx +++ b/sc/source/ui/vba/vbastyles.cxx @@ -30,12 +30,12 @@ #include "vbastyles.hxx" #include "vbastyle.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Reference< 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 ) ); @@ -43,7 +43,7 @@ lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Referenc } -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 ) +ScVbaStyles::ScVbaStyles( const uno::Reference< 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 { @@ -78,13 +78,13 @@ ScVbaStyles::getElementType() throw (uno::RuntimeException) class EnumWrapper : public EnumerationHelper_BASE { uno::Reference<container::XIndexAccess > m_xIndexAccess; - uno::Reference<vba::XHelperInterface > m_xParent; + uno::Reference<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 ) {} + EnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference<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() ); @@ -178,7 +178,7 @@ ScVbaStyles::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.XStyles" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.XStyles" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbastyles.hxx b/sc/source/ui/vba/vbastyles.hxx index f626a1feef03..4ad8980fe201 100644 --- a/sc/source/ui/vba/vbastyles.hxx +++ b/sc/source/ui/vba/vbastyles.hxx @@ -29,25 +29,25 @@ ************************************************************************/ #ifndef SC_VBA_STYLES_HXX #define SC_VBA_STYLES_HXX -#include <org/openoffice/excel/XStyles.hpp> +#include <ooo/vba/excel/XStyles.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< oo::excel::XStyles > ScVbaStyles_BASE; +typedef CollTestImplHelper< ov::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< ov::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 ); + ScVbaStyles( const css::uno::Reference< ov::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); + virtual css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbatextbox.cxx b/sc/source/ui/vba/vbatextbox.cxx index 8eefe472ed4d..f6574550c0c9 100644 --- a/sc/source/ui/vba/vbatextbox.cxx +++ b/sc/source/ui/vba/vbatextbox.cxx @@ -33,15 +33,28 @@ #include <vector> using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; -ScVbaTextBox::ScVbaTextBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : TextBoxImpl_BASE( xContext, xControlShape ) +ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog ) { } // Attributes +uno::Any SAL_CALL +ScVbaTextBox::getValue() throw (css::uno::RuntimeException) +{ + return uno::makeAny( getText() ); +} + +void SAL_CALL +ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException) +{ + rtl::OUString sVal = getAnyAsString( _value ); + setText( sVal ); +} + //getString() will cause some imfo lose. rtl::OUString SAL_CALL ScVbaTextBox::getText() throw (css::uno::RuntimeException) @@ -57,9 +70,14 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException) void SAL_CALL ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException) { + if ( !mbDialog ) + { uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW ); xTextRange->setString( _text ); } + else + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) ); +} sal_Int32 SAL_CALL ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException) @@ -98,3 +116,22 @@ ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeExcept m_xProps->setPropertyValue (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue); } + +rtl::OUString& +ScVbaTextBox::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaTextBox::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextBox" ) ); + } + return aServiceNames; +} diff --git a/sc/source/ui/vba/vbatextbox.hxx b/sc/source/ui/vba/vbatextbox.hxx index efc67987c1ea..b9d22ced414c 100644 --- a/sc/source/ui/vba/vbatextbox.hxx +++ b/sc/source/ui/vba/vbatextbox.hxx @@ -30,24 +30,28 @@ #ifndef SC_VBA_TEXTBOX_HXX #define SC_VBA_TEXTBOX_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/msforms/XTextBox.hpp> +#include <ooo/vba/msforms/XTextBox.hpp> #include "vbacontrol.hxx" #include "vbahelper.hxx" -typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XTextBox > TextBoxImpl_BASE; +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE; class ScVbaTextBox : public TextBoxImpl_BASE { + bool mbDialog; public: - ScVbaTextBox( const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Reference< css::drawing::XControlShape >& xControlShape ); + ScVbaTextBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialog = false ); // 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_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); - + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); }; #endif //SC_VBA_TEXTBOX_HXX diff --git a/sc/source/ui/vba/vbatextboxshape.cxx b/sc/source/ui/vba/vbatextboxshape.cxx new file mode 100644 index 000000000000..82af63e5754e --- /dev/null +++ b/sc/source/ui/vba/vbatextboxshape.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 "vbatextboxshape.hxx" +#include "vbacharacters.hxx" +#include <com/sun/star/text/XSimpleText.hpp> +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + +ScVbaTextBoxShape::ScVbaTextBoxShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel ) : TextBoxShapeImpl_BASE( uno::Reference< XHelperInterface >(), xContext, xShape, xShapes, ScVbaShape::getType( xShape ) ) +{ + m_xTextRange.set( xShape , uno::UNO_QUERY_THROW ); + m_xModel.set( xModel ); +} + +rtl::OUString SAL_CALL +ScVbaTextBoxShape::getText() throw (css::uno::RuntimeException) +{ + return m_xTextRange->getString(); +} + +void SAL_CALL +ScVbaTextBoxShape::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException) +{ + m_xTextRange->setString( _text ); +} + +uno::Reference< excel::XCharacters > SAL_CALL +ScVbaTextBoxShape::characters( const uno::Any& Start, const uno::Any& Length ) throw (uno::RuntimeException) +{ + ScDocShell* pDocShell = getDocShell( m_xModel ); + ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL; + + if ( !pDoc ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() ); + uno::Reference< text::XSimpleText > xSimple( m_xTextRange, uno::UNO_QUERY_THROW ); + + ScVbaPalette aPalette( pDoc->GetDocumentShell() ); + return new ScVbaCharacters( this, mxContext, aPalette, xSimple, Start, Length, sal_True ); +} diff --git a/sc/source/ui/vba/vbatextboxshape.hxx b/sc/source/ui/vba/vbatextboxshape.hxx new file mode 100644 index 000000000000..c8c79b626069 --- /dev/null +++ b/sc/source/ui/vba/vbatextboxshape.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 <com/sun/star/text/XTextRange.hpp> +#include <ooo/vba/msforms/XTextBoxShape.hpp> +#include "vbashape.hxx" +#include "vbahelper.hxx" +#include "vbacharacters.hxx" + +typedef cppu::ImplInheritanceHelper1< ScVbaShape, ov::msforms::XTextBoxShape > TextBoxShapeImpl_BASE; + +class ScVbaTextBoxShape : public TextBoxShapeImpl_BASE +{ + css::uno::Reference< css::text::XTextRange > m_xTextRange; + css::uno::Reference< css::frame::XModel > m_xModel; +public: + ScVbaTextBoxShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel ); + + // 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 css::uno::Reference< ov::excel::XCharacters > SAL_CALL characters( const css::uno::Any& Start, const css::uno::Any& Length ) throw (css::uno::RuntimeException); +}; +#endif //SC_VBA_TEXTBOX_HXX diff --git a/sc/source/ui/vba/vbatextframe.cxx b/sc/source/ui/vba/vbatextframe.cxx index 97d73296d0fe..f66d83c22c2d 100644 --- a/sc/source/ui/vba/vbatextframe.cxx +++ b/sc/source/ui/vba/vbatextframe.cxx @@ -32,10 +32,10 @@ #include "vbatextframe.hxx" #include "vbacharacters.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +ScVbaTextFrame::ScVbaTextFrame( const uno::Reference< 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 ); } @@ -142,14 +142,14 @@ ScVbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeExceptio // Methods -uno::Reference< oo::excel::XCharacters > SAL_CALL +uno::Reference< ov::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 ) ); + return uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ); } rtl::OUString& @@ -166,7 +166,7 @@ ScVbaTextFrame::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.TextFrame" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbatextframe.hxx b/sc/source/ui/vba/vbatextframe.hxx index 5ac51ad11ca6..6bb75551c00c 100644 --- a/sc/source/ui/vba/vbatextframe.hxx +++ b/sc/source/ui/vba/vbatextframe.hxx @@ -31,18 +31,18 @@ #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 <ooo/vba/excel/XCharacters.hpp> +#include <ooo/vba/excel/XTextFrame.hpp> #include "vbahelperinterface.hxx" #include "vbapalette.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XTextFrame > ScVbaTextFrame_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE; class ScVbaTextFrame : public ScVbaTextFrame_BASE { private: - css::uno::Reference< oo::excel::XCharacters > m_xCharacters; + css::uno::Reference< ov::excel::XCharacters > m_xCharacters; css::uno::Reference< css::drawing::XShape > m_xShape; css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; protected: @@ -52,7 +52,7 @@ protected: 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); + ScVbaTextFrame( const css::uno::Reference< ov::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); @@ -67,7 +67,7 @@ public: 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); + virtual css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters( ) throw (css::uno::RuntimeException); }; diff --git a/sc/source/ui/vba/vbatitle.hxx b/sc/source/ui/vba/vbatitle.hxx index 89622b939ad7..3d6c597bc67a 100644 --- a/sc/source/ui/vba/vbatitle.hxx +++ b/sc/source/ui/vba/vbatitle.hxx @@ -37,7 +37,7 @@ #include "vbapalette.hxx" #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <org/openoffice/excel/XTitle.hpp> +#include <ooo/vba/excel/XTitle.hpp> #include <basic/sberrors.hxx> #include <memory> @@ -49,15 +49,15 @@ 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; + std::auto_ptr<ov::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 ) + TitleImpl( const css::uno::Reference< ov::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) ); + oShapeHelper.reset( new ov::ShapeHelper(xTitleShape) ); } - css::uno::Reference< oo::excel::XInterior > SAL_CALL Interior( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) + css::uno::Reference< ov::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 @@ -65,7 +65,7 @@ public: // 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) + css::uno::Reference< ov::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 @@ -97,12 +97,12 @@ public: return sText; } - css::uno::Reference< oo::excel::XCharacters > SAL_CALL Characters( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) + css::uno::Reference< ov::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 > (); + return css::uno::Reference< ov::excel::XCharacters > (); } void SAL_CALL setTop( double Top ) throw (css::script::BasicErrorException, css::uno::RuntimeException) @@ -157,7 +157,7 @@ public: if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.XTitle" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.XTitle" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbatogglebutton.cxx b/sc/source/ui/vba/vbatogglebutton.cxx new file mode 100644 index 000000000000..d49b2e89affe --- /dev/null +++ b/sc/source/ui/vba/vbatogglebutton.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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 "vbatogglebutton.hxx" +#include <vector> + +using namespace com::sun::star; +using namespace ooo::vba; + + +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); +const static rtl::OUString TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") ); +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") ); +ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) +{ + OSL_TRACE("ScVbaToggleButton(ctor)"); + m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) ); +} + +ScVbaToggleButton::~ScVbaToggleButton() +{ + OSL_TRACE("~ScVbaToggleButton(dtor)"); +} + +// Attributes +rtl::OUString SAL_CALL +ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException) +{ + rtl::OUString Label; + m_xProps->getPropertyValue( LABEL ) >>= Label; + return Label; +} + +void SAL_CALL +ScVbaToggleButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); +} + +uno::Any SAL_CALL +ScVbaToggleButton::getValue() throw (uno::RuntimeException) +{ + sal_Int16 nState = 0; + m_xProps->getPropertyValue( STATE ) >>= nState; + return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) ); +} + +void SAL_CALL +ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException) +{ + sal_Int16 nState = 0; + _value >>= nState; + OSL_TRACE( "nState - %d", nState ); + nState = ( nState == -1 ) ? 1 : 0; + OSL_TRACE( "nState - %d", nState ); + m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) ); +} + +rtl::OUString& +ScVbaToggleButton::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaToggleButton::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) ); + } + return aServiceNames; +} + diff --git a/sc/source/ui/vba/vbatogglebutton.hxx b/sc/source/ui/vba/vbatogglebutton.hxx new file mode 100644 index 000000000000..752eac718b18 --- /dev/null +++ b/sc/source/ui/vba/vbatogglebutton.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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_TOGGLEBUTTON_HXX +#define SC_VBA_TOGGLEBUTTON_HXX +#include <cppuhelper/implbase2.hxx> +#include <ooo/vba/msforms/XToggleButton.hpp> + +#include "vbacontrol.hxx" +#include "vbahelper.hxx" + +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty > ToggleButtonImpl_BASE; + +class ScVbaToggleButton : public ToggleButtonImpl_BASE +{ + rtl::OUString msDftPropName; +public: + ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); + ~ScVbaToggleButton(); + // Attributes + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException); + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + // XDefaultProperty + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } +}; +#endif //SC_VBA_TOGGLEBUTTON_HXX diff --git a/sc/source/ui/vba/vbauserform.cxx b/sc/source/ui/vba/vbauserform.cxx new file mode 100644 index 000000000000..9c50347ad839 --- /dev/null +++ b/sc/source/ui/vba/vbauserform.cxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * 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 "vbauserform.hxx" +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/beans/PropertyConcept.hpp> +#include <basic/sbx.hxx> +#include <basic/sbstar.hxx> +#include <basic/sbmeth.hxx> +#include "unonames.hxx" +#include "vbacontrols.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +// some little notes +// XDialog implementation has the following interesting bits +// a Controls property ( which is an array of the container controls ) +// each item in the controls array is a XControl, where the model is +// basically a property bag +// additionally the XDialog instance has itself a model +// this model has a ControlModels ( array of models ) property +// the models in ControlModels can be accessed by name +// also the XDialog is a XControl ( to access the model above + +ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) : ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), m_pDocShell( 0 ), mbDispose( true ) +{ + m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW ); + m_pDocShell = getDocShell( m_xModel ); + m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW ); + setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) ); +} + +ScVbaUserForm::~ScVbaUserForm() +{ +} + +void SAL_CALL +ScVbaUserForm::Show( ) throw (uno::RuntimeException) +{ + OSL_TRACE("ScVbaUserForm::Show( )"); + short aRet = 0; + if ( m_xDialog.is() ) + aRet = m_xDialog->execute(); + OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); + if ( mbDispose ) + { + try + { + uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW ); + m_xDialog = NULL; + xComp->dispose(); + mbDispose = false; + } + catch( uno::Exception& ) + { + } + } +} + +rtl::OUString SAL_CALL +ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sCaption; + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ) ) >>= sCaption; + return sCaption; +} +void +ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) +{ + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) ); +} + +void SAL_CALL +ScVbaUserForm::Hide( ) throw (uno::RuntimeException) +{ + mbDispose = false; // hide not dispose + if ( m_xDialog.is() ) + m_xDialog->endExecute(); +} + +void SAL_CALL +ScVbaUserForm::RePaint( ) throw (uno::RuntimeException) +{ + // do nothing +} + +void SAL_CALL +ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException) +{ + mbDispose = true; + if ( m_xDialog.is() ) + m_xDialog->endExecute(); +} + +rtl::OUString& +ScVbaUserForm::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaUserForm") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +ScVbaUserForm::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm" ) ); + } + return aServiceNames; +} + +uno::Reference< beans::XIntrospectionAccess > SAL_CALL +ScVbaUserForm::getIntrospection( ) throw (uno::RuntimeException) +{ + return uno::Reference< beans::XIntrospectionAccess >(); +} + +uno::Any SAL_CALL +ScVbaUserForm::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) +{ + throw uno::RuntimeException(); // unsupported operation +} + +void SAL_CALL +ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) +{ + uno::Any aObject = getValue( aPropertyName ); + // The Object *must* support XDefaultProperty here because getValue will + // only return properties that are Objects ( e.g. controls ) + // e.g. Userform1.aControl = something + // 'aControl' has to support XDefaultProperty to make sense here + uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW ); + rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName(); + uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) ); + uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW ); + xPropSet->setPropertyValue( aDfltPropName, aValue ); +} + +uno::Any SAL_CALL +ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) +{ + uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); + ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); + return uno::makeAny( xVBAControl ); +} + +::sal_Bool SAL_CALL +ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException) +{ + return sal_False; +} +uno::Any SAL_CALL +ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) ); + if ( index.hasValue() ) + return uno::makeAny( xControls->Item( index, uno::Any() ) ); + return uno::makeAny( xControls ); +} + +::sal_Bool SAL_CALL +ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) +{ + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY ); + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() ); + if ( xControl.is() ) + { + uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW ); + sal_Bool bRes = xNameAccess->hasByName( aName ); + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes ); + return bRes; + } + return sal_False; +} + +namespace userform +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_<ScVbaUserForm, sdecl::with_args<true> > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ScVbaUserForm", + "ooo.vba.excel.UserForm" ); +} + diff --git a/sc/source/ui/vba/vbauserform.hxx b/sc/source/ui/vba/vbauserform.hxx new file mode 100644 index 000000000000..2c8a1b72f728 --- /dev/null +++ b/sc/source/ui/vba/vbauserform.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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_USERFORM_HXX +#define SC_VBA_USERFORM_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/msforms/XUserForm.hpp> +#include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/frame/XModel.hpp> + +#include "vbahelperinterface.hxx" +#include "vbacontrol.hxx" + +//typedef InheritedHelperInterfaceImpl1< ov::msforms::XUserForm > ScVbaUserForm_BASE; +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XUserForm > ScVbaUserForm_BASE; + +class ScVbaUserForm : public ScVbaUserForm_BASE +{ +private: + css::uno::Reference< css::awt::XDialog > m_xDialog; + ScDocShell* m_pDocShell; + bool mbDispose; +protected: +public: + ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException ); + virtual ~ScVbaUserForm(); + // XUserForm + virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException); + // XIntrospection + virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); + virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCaption() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException); + //XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif diff --git a/sc/source/ui/vba/vbavalidation.cxx b/sc/source/ui/vba/vbavalidation.cxx index 6d776dbbe526..411b002bdb9b 100644 --- a/sc/source/ui/vba/vbavalidation.cxx +++ b/sc/source/ui/vba/vbavalidation.cxx @@ -32,13 +32,13 @@ #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 <ooo/vba/excel/XlDVType.hpp> +#include <ooo/vba/excel/XlFormatConditionOperator.hpp> +#include <ooo/vba/excel/XlDVAlertStyle.hpp> #include "unonames.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; const static rtl::OUString VALIDATION( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_VALIDAT ) ); @@ -330,7 +330,7 @@ ScVbaValidation::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Validation" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Validation" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbavalidation.hxx b/sc/source/ui/vba/vbavalidation.hxx index 9fc00ccd1998..60d24ac0c6c5 100644 --- a/sc/source/ui/vba/vbavalidation.hxx +++ b/sc/source/ui/vba/vbavalidation.hxx @@ -31,18 +31,18 @@ #define SC_VBA_VALIDATION_HXX #include <cppuhelper/implbase1.hxx> #include <com/sun/star/uno/XComponentContext.hpp> -#include <org/openoffice/excel/XValidation.hpp> +#include <ooo/vba/excel/XValidation.hpp> #include <com/sun/star/table/XCellRange.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1<oo::excel::XValidation > ValidationImpl_BASE; +typedef InheritedHelperInterfaceImpl1<ov::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) {} + ScVbaValidation( const css::uno::Reference< ov::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); diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index 8073def13343..a38ba7c9ed46 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -27,6 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#include "helperdecl.hxx" #include "vbawindow.hxx" #include "vbaworksheets.hxx" #include "vbaworksheet.hxx" @@ -36,8 +37,12 @@ #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/Constants.hpp> +#include <ooo/vba/excel/XlWindowState.hpp> +#include <ooo/vba/excel/XlWindowView.hpp> +#include <ooo/vba/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> @@ -49,8 +54,8 @@ #include "unonames.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; -using namespace ::org::openoffice::excel::XlWindowState; +using namespace ::ooo::vba; +using namespace ::ooo::vba::excel::XlWindowState; typedef std::hash_map< rtl::OUString, SCTAB, ::rtl::OUStringHash, @@ -92,7 +97,7 @@ public: 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 ) ) ); + return uno::makeAny( uno::Reference< excel::XWorksheet > ( new ScVbaWorksheet( uno::Reference< XHelperInterface >(), m_xContext, *(m_it++), m_xModel ) ) ); } @@ -197,9 +202,21 @@ public: }; -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 ) +ScVbaWindow::ScVbaWindow( const uno::Reference< 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 ); + init(); +} + +ScVbaWindow::ScVbaWindow( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext ) + : WindowImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), + m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) +{ + init(); +} +void +ScVbaWindow::init() +{ + uno::Reference< frame::XController > xController( m_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 ); @@ -232,10 +249,10 @@ ScVbaWindow::SelectedSheets( const uno::Any& aIndex ) throw (uno::RuntimeExcepti { 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 ) ); + uno::Reference< excel::XWorksheets > xSheets( new ScVbaWorksheets( uno::Reference< XHelperInterface >(), mxContext, xEnumAccess, m_xModel ) ); if ( aIndex.hasValue() ) { - uno::Reference< vba::XCollection > xColl( xSheets, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xColl( xSheets, uno::UNO_QUERY_THROW ); return xColl->Item( aIndex, uno::Any() ); } return uno::makeAny( xSheets ); @@ -289,8 +306,8 @@ ScVbaWindow::getCaption() throw (uno::RuntimeException) if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() ) { sTitle = sTitle.copy( 0, nCrudIndex ); - uno::Reference< oo::vba::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 - ScVbaWorkbook workbook( uno::Reference< vba::XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->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 @@ -427,8 +444,8 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE void ScVbaWindow::Activate() throw (css::uno::RuntimeException) { - uno::Reference< oo::vba::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 - ScVbaWorkbook workbook( uno::Reference< vba::XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); workbook.Activate(); } @@ -436,13 +453,13 @@ ScVbaWindow::Activate() throw (css::uno::RuntimeException) void ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException) { - uno::Reference< oo::vba::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 - ScVbaWorkbook workbook( uno::Reference< vba::XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5 + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); workbook.Close(SaveChanges, FileName, RouteWorkBook ); } -uno::Reference< excel::XPane > -ScVbaWindow::ActivePane() +uno::Reference< excel::XPane > SAL_CALL +ScVbaWindow::ActivePane() throw (script::BasicErrorException, uno::RuntimeException) { return new ScVbaPane( mxContext, m_xViewPane ); } @@ -629,7 +646,8 @@ ScVbaWindow::setSplitColumn( sal_Int32 _splitcolumn ) throw (uno::RuntimeExcepti if( getSplitColumn() != _splitcolumn ) { sal_Bool bFrozen = getFreezePanes(); - m_xViewFreezable->freezeAtPosition( _splitcolumn, 0 ); + sal_Int32 nRow = getSplitRow(); + m_xViewFreezable->freezeAtPosition( _splitcolumn, nRow ); SplitAtDefinedPosition( !bFrozen ); } } @@ -646,13 +664,14 @@ void SAL_CALL ScVbaWindow::setSplitHorizontal( double _splithorizontal ) throw (uno::RuntimeException) { double fHoriPixels = PointsToPixels( m_xDevice, _splithorizontal, sal_True ); - m_xViewSplitable->splitAtPosition( (int) fHoriPixels, 0 ); + m_xViewSplitable->splitAtPosition( static_cast<sal_Int32>( fHoriPixels ), 0 ); } sal_Int32 SAL_CALL ScVbaWindow::getSplitRow() throw (uno::RuntimeException) { - return m_xViewSplitable->getSplitRow(); + sal_Int32 nValue = m_xViewSplitable->getSplitRow(); + return nValue ? nValue - 1 : nValue; } void SAL_CALL @@ -661,7 +680,8 @@ ScVbaWindow::setSplitRow( sal_Int32 _splitrow ) throw (uno::RuntimeException) if( getSplitRow() != _splitrow ) { sal_Bool bFrozen = getFreezePanes(); - m_xViewFreezable->freezeAtPosition( 0, _splitrow ); + sal_Int32 nColumn = getSplitColumn(); + m_xViewFreezable->freezeAtPosition( nColumn , _splitrow ); SplitAtDefinedPosition( !bFrozen ); } } @@ -736,6 +756,184 @@ ScVbaWindow::setZoom( const uno::Any& _zoom ) throw (uno::RuntimeException) } } +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() { @@ -750,7 +948,16 @@ ScVbaWindow::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Window" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Window" ) ); } return aServiceNames; } +namespace window +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_<ScVbaWindow, sdecl::with_args<true> > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "ScVbaWindow", + "ooo.vba.excel.Window" ); +} diff --git a/sc/source/ui/vba/vbawindow.hxx b/sc/source/ui/vba/vbawindow.hxx index cf27e3fee7bf..b32f3b99398a 100644 --- a/sc/source/ui/vba/vbawindow.hxx +++ b/sc/source/ui/vba/vbawindow.hxx @@ -30,19 +30,19 @@ #ifndef SC_VBA_WINDOW_HXX #define SC_VBA_WINDOW_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XWindow.hpp> +#include <ooo/vba/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 <ooo/vba/excel/XPane.hpp> #include <com/sun/star/awt/XDevice.hpp> #include "vbahelperinterface.hxx" #include "vbaworkbook.hxx" -typedef InheritedHelperInterfaceImpl1<oo::excel::XWindow > WindowImpl_BASE; +typedef InheritedHelperInterfaceImpl1<ov::excel::XWindow > WindowImpl_BASE; class ScVbaWindow : public WindowImpl_BASE { @@ -51,16 +51,21 @@ private: 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< ov::excel::XPane > m_xPane; css::uno::Reference< css::awt::XDevice > m_xDevice; + void init(); 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 ); - css::uno::Reference< oo::excel::XPane > ActivePane(); + ScVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ); + ScVbaWindow( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext ); + // XWindow + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL ActiveCell( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XPane > SAL_CALL ActivePane() throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ov::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); @@ -77,6 +82,10 @@ public: 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) ; @@ -91,6 +100,14 @@ public: 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); @@ -103,8 +120,11 @@ public: 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::Reference< oo::excel::XRange > SAL_CALL ActiveCell( ) throw (css::script::BasicErrorException, 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(); diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index c491922d0bc8..b14a31c7c42c 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -40,16 +40,16 @@ //#include "vbaworkbook.hxx" using namespace ::com::sun::star; -using namespace ::org::openoffice; +using namespace ::ooo::vba; 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 ) +uno::Reference< 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 ); + return new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel ); } uno::Any ComponentToWindow( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext ) @@ -139,7 +139,7 @@ public: { m_windows.push_back( xNext ); uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given - uno::Reference< vba::XHelperInterface > xTemp; // temporary needed for g++ 3.3.5 + uno::Reference< XHelperInterface > xTemp; // temporary needed for g++ 3.3.5 ScVbaWindow window( xTemp, m_xContext, xModel ); rtl::OUString sCaption; window.getCaption() >>= sCaption; @@ -208,7 +208,7 @@ public: }; -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 ) +ScVbaWindows::ScVbaWindows( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaWindows_BASE( xParent, xContext, xIndexAccess ) { } @@ -230,11 +230,11 @@ ScVbaWindows::getElementType() throw (uno::RuntimeException) return excel::XWindows::static_type(0); } -uno::Reference< vba::XCollection > +uno::Reference< 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 ); + return new ScVbaWindows( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext , xIndex ); } void SAL_CALL @@ -258,7 +258,7 @@ ScVbaWindows::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Windows") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Windows") ); } return sNames; } diff --git a/sc/source/ui/vba/vbawindows.hxx b/sc/source/ui/vba/vbawindows.hxx index b8bb8ec465db..3c828d4e3355 100644 --- a/sc/source/ui/vba/vbawindows.hxx +++ b/sc/source/ui/vba/vbawindows.hxx @@ -31,7 +31,7 @@ #define SC_VBA_WINDOWS_HXX #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XWindows.hpp> +#include <ooo/vba/excel/XWindows.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -39,12 +39,12 @@ #include "vbacollectionimpl.hxx" -typedef CollTestImplHelper< oo::excel::XWindows > ScVbaWindows_BASE; +typedef CollTestImplHelper< ov::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 ); + ScVbaWindows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); virtual ~ScVbaWindows() {} // XEnumerationAccess @@ -57,7 +57,7 @@ public: // 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 ); + static css::uno::Reference< ov::XCollection > Windows( const css::uno::Reference< css::uno::XComponentContext >& xContext ); // XHelperInterface virtual rtl::OUString& getServiceImplName(); diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index 01443825c065..c89de4c2a10a 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -38,7 +38,7 @@ #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 <ooo/vba/excel/XlFileFormat.hpp> #include "scextopt.hxx" #include "vbaworksheet.hxx" @@ -56,7 +56,7 @@ // Much of the impl. for the equivalend UNO module is // sc/source/ui/unoobj/docuno.cxx, viewuno.cxx -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; class ActiveSheet : public ScVbaWorksheet @@ -80,7 +80,7 @@ protected: return xSheet; } public: - ActiveSheet( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : ScVbaWorksheet( xParent, xContext ) {} + ActiveSheet( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : ScVbaWorksheet( xParent, xContext ) {} }; @@ -192,7 +192,7 @@ 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) +ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::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 @@ -203,13 +203,13 @@ ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< oo::vba::XHelperInter 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 ) +ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::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 ) ) + uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) { init(); @@ -270,7 +270,7 @@ 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 ) ); + uno::Reference< XCollection > xWorkSheets( new ScVbaWorksheets( this, mxContext, xSheets, xModel ) ); if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID ) { return uno::Any( xWorkSheets ); @@ -281,7 +281,7 @@ ScVbaWorkbook::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException uno::Any SAL_CALL ScVbaWorkbook::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException) { - uno::Reference< vba::XCollection > xWindows = ScVbaWindows::Windows( mxContext ); + uno::Reference< XCollection > xWindows = ScVbaWindows::Windows( mxContext ); if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID ) return uno::Any( xWindows ); return uno::Any( xWindows->Item( aIndex, uno::Any() ) ); @@ -420,7 +420,7 @@ 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() ); + uno::Reference< XCollection > dStyles = new ScVbaStyles( uno::Reference< XHelperInterface >(), mxContext, getModel() ); if ( Item.hasValue() ) return dStyles->Item( Item, uno::Any() ); return uno::makeAny( dStyles ); @@ -428,14 +428,18 @@ ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException) // Amelia Wang uno::Any SAL_CALL -ScVbaWorkbook::Names( ) throw (uno::RuntimeException) +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 )); + uno::Reference< 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() @@ -451,7 +455,7 @@ ScVbaWorkbook::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbook" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook" ) ); } return aServiceNames; } @@ -494,5 +498,5 @@ sdecl::vba_service_class_<ScVbaWorkbook, sdecl::with_args<true> > serviceImpl; extern sdecl::ServiceDecl const serviceDecl( serviceImpl, "ScVbaWorkbook", - "org.openoffice.excel.Workbook" ); + "ooo.vba.excel.Workbook" ); } diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx index ddd397339472..67d14dac148c 100644 --- a/sc/source/ui/vba/vbaworkbook.hxx +++ b/sc/source/ui/vba/vbaworkbook.hxx @@ -31,12 +31,12 @@ #define SC_VBA_WORKBOOK_HXX #include <com/sun/star/frame/XModel.hpp> -#include <org/openoffice/excel/XWorkbook.hpp> +#include <ooo/vba/excel/XWorkbook.hpp> #include "vbahelperinterface.hxx" class ScModelObj; -typedef InheritedHelperInterfaceImpl1< oo::excel::XWorkbook > ScVbaWorkbook_BASE; +typedef InheritedHelperInterfaceImpl1< ov::excel::XWorkbook > ScVbaWorkbook_BASE; class ScVbaWorkbook : public ScVbaWorkbook_BASE { @@ -47,9 +47,9 @@ class ScVbaWorkbook : public ScVbaWorkbook_BASE 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); + ScVbaWorkbook( const css::uno::Reference< ov::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, + ScVbaWorkbook( const css::uno::Reference< ov::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() {} @@ -59,7 +59,7 @@ public: 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 css::uno::Reference< ov::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); @@ -75,7 +75,7 @@ public: 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( ) throw (css::uno::RuntimeException); + 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); diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index 0f103abf07a7..40c8370f4aec 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -60,7 +60,7 @@ #include <hash_map> #include <osl/file.hxx> -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; const sal_Int16 CUSTOM_CHAR = 5; @@ -81,7 +81,7 @@ getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Refe if( !xModel.is() ) return uno::Any(); - ScVbaWorkbook *pWb = new ScVbaWorkbook( uno::Reference< vba::XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel ); + ScVbaWorkbook *pWb = new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel ); return uno::Any( uno::Reference< excel::XWorkbook > (pWb) ); } @@ -238,7 +238,7 @@ public: }; -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 ) ) ) +ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new WorkBooksAccessImpl( xContext ) ) ) { } // XEnumerationAccess @@ -459,7 +459,7 @@ ScVbaWorkbooks::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbooks") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbooks") ); } return sNames; } diff --git a/sc/source/ui/vba/vbaworkbooks.hxx b/sc/source/ui/vba/vbaworkbooks.hxx index 42e14d3c729e..cf766b04e688 100644 --- a/sc/source/ui/vba/vbaworkbooks.hxx +++ b/sc/source/ui/vba/vbaworkbooks.hxx @@ -32,26 +32,26 @@ #include "vbacollectionimpl.hxx" -#include <org/openoffice/vba/XGlobals.hpp> -#include <org/openoffice/excel/XWorkbooks.hpp> +#include <ooo/vba/XGlobals.hpp> +#include <ooo/vba/excel/XWorkbooks.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include "vbahelper.hxx" class ScModelObj; -typedef CollTestImplHelper< oo::excel::XWorkbooks > ScVbaWorkbooks_BASE; +typedef CollTestImplHelper< ov::excel::XWorkbooks > ScVbaWorkbooks_BASE; class ScVbaWorkbooks : public ScVbaWorkbooks_BASE { private: - css::uno::Reference< oo::vba::XGlobals > getGlobals() throw (css::uno::RuntimeException); + css::uno::Reference< ov::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 ); + ScVbaWorkbooks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ); virtual ~ScVbaWorkbooks() {} // XEnumerationAccess diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 03b72b37b6d8..cd75ebd9af40 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -47,6 +47,7 @@ #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/XSheetPageBreak.hpp> #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -56,6 +57,7 @@ #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/form/FormComponentType.hpp> +#include <com/sun/star/form/XFormsSupplier.hpp> #include <comphelper/processfactory.hxx> @@ -84,12 +86,14 @@ #include "vbaoleobject.hxx" #include "vbaoleobjects.hxx" #include "vbashapes.hxx" +#include "vbapagesetup.hxx" +#include "vbapagebreaks.hxx" #define STANDARDWIDTH 2267 #define STANDARDHEIGHT 427 #define DOESNOTEXIST -1 using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; static bool nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException ) { @@ -190,17 +194,17 @@ openNewDoc(rtl::OUString aSheetName ) 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< 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, +ScVbaWorksheet::ScVbaWorksheet(const uno::Reference< 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 ) ) + uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : WorksheetImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ) { if ( args.getLength() < 2 ) throw lang::IllegalArgumentException(); @@ -247,6 +251,12 @@ ScVbaWorksheet::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ), aValue); } +sal_Int16 +ScVbaWorksheet::getIndex() throw (uno::RuntimeException) +{ + return getSheetID() + 1; +} + uno::Reference< excel::XRange > ScVbaWorksheet::getUsedRange() throw (uno::RuntimeException) { @@ -266,6 +276,22 @@ ScVbaWorksheet::Outline( ) throw (uno::RuntimeException) return new ScVbaOutline( this, mxContext, xOutline); } +uno::Reference< excel::XPageSetup > +ScVbaWorksheet::PageSetup( ) throw (uno::RuntimeException) +{ + return new ScVbaPageSetup( this, mxContext, getSheet(), getModel() ); +} + +uno::Any +ScVbaWorksheet::HPageBreaks( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(getSheet(),uno::UNO_QUERY_THROW); + uno::Reference< excel::XHPageBreaks > xHPageBreaks( new ScVbaHPageBreaks( this, mxContext, xSheetPageBreak)); + if ( aIndex.hasValue() ) + return xHPageBreaks->Item( aIndex, uno::Any()); + return uno::makeAny( xHPageBreaks ); +} + sal_Int32 ScVbaWorksheet::getStandardWidth() throw (uno::RuntimeException) { @@ -416,6 +442,7 @@ ScVbaWorksheet::Delete() throw (uno::RuntimeException) uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW); xNameContainer->removeByName(aSheetName); + mxSheet.clear(); } } @@ -536,7 +563,7 @@ ScVbaWorksheet::ChartObjects( const uno::Any& Index ) throw (uno::RuntimeExcepti } if ( Index.hasValue() ) { - uno::Reference< vba::XCollection > xColl( mxCharts, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xColl( mxCharts, uno::UNO_QUERY_THROW ); return xColl->Item( Index, uno::Any() ); } else @@ -551,7 +578,7 @@ ScVbaWorksheet::PivotTables( const uno::Any& Index ) throw (uno::RuntimeExceptio 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 ) ); + uno::Reference< XCollection > xColl( new ScVbaPivotTables( this, mxContext, xIndexAccess ) ); if ( Index.hasValue() ) return xColl->Item( Index, uno::Any() ); return uno::makeAny( xColl ); @@ -564,7 +591,7 @@ ScVbaWorksheet::Comments( const uno::Any& Index ) throw (uno::RuntimeException) 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 ) ); + uno::Reference< XCollection > xColl( new ScVbaComments( this, mxContext, xIndexAccess ) ); if ( Index.hasValue() ) return xColl->Item( Index, uno::Any() ); return uno::makeAny( xColl ); @@ -656,29 +683,10 @@ ScVbaWorksheet::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::A 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() ); + ScVbaControlFactory controlFactory( mxContext, xControlShape, getModel() ); + uno::Reference< msforms::XControl > xControl( controlFactory.createControl( getModel() ) ); return uno::makeAny( xControl ); -// return aProp; } ::sal_Bool SAL_CALL @@ -686,82 +694,67 @@ ScVbaWorksheet::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::Runtim { return sal_False; } -::sal_Bool SAL_CALL -ScVbaWorksheet::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) + +uno::Reference< container::XNameAccess > +ScVbaWorksheet::getFormControls() { + uno::Reference< container::XNameAccess > xFormControls; try { - if ( getControl( aName ).hasValue() ) - return sal_True; + uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW ); + uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW ); + // get the www-standard container ( maybe we should access the + // 'www-standard' by name rather than index, this seems an + // implementation detail + xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW ); + } 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 xFormControls; - return uno::Any(); + } +::sal_Bool SAL_CALL +ScVbaWorksheet::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) +{ + uno::Reference< container::XNameAccess > xFormControls( getFormControls() ); + if ( xFormControls.is() ) + return xFormControls->hasByName( aName ); + return sal_False; } 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 ); + // ideally we would get an XControl object but it appears an XControl + // implementation only exists for a Control implementation optained from the + // view ( e.g. in basic you would get this from + // thiscomponent.currentcontroller.getControl( controlModel ) ) + // and the thing to realise is that it is only possible to get an XControl + // for a currently displayed control :-( often we would want to modify + // a control not on the active sheet. But.. you can always access the + // XControlShape from the DrawPage whether that is the active drawpage or not + + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), 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 ); + // It seems there are some drawing objects that can not query into Control shapes? + uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY ); + if( xControlShape.is() ) + { + uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW ); if( sName.equals( xNamed->getName() )) { return aUnoObj; } - + } } return uno::Any(); } @@ -793,7 +786,7 @@ ScVbaWorksheet::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet" ) ); } return aServiceNames; } @@ -856,6 +849,29 @@ ScVbaWorksheet::getSheetID() throw (uno::RuntimeException) 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 { @@ -864,5 +880,5 @@ sdecl::vba_service_class_<ScVbaWorksheet, sdecl::with_args<true> > serviceImpl; extern sdecl::ServiceDecl const serviceDecl( serviceImpl, "ScVbaWorksheet", - "org.openoffice.excel.Worksheet" ); + "ooo.vba.excel.Worksheet" ); } diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx index ac1a1d63422b..8fdee639c7c1 100644 --- a/sc/source/ui/vba/vbaworksheet.hxx +++ b/sc/source/ui/vba/vbaworksheet.hxx @@ -35,35 +35,37 @@ #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 <ooo/vba/excel/XWorksheet.hpp> +#include <ooo/vba/excel/XComments.hpp> +#include <ooo/vba/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 <ooo/vba/excel/XOutline.hpp> +#include <ooo/vba/excel/XPageSetup.hpp> +#include <ooo/vba/excel/XHPageBreaks.hpp> +#include <ooo/vba/excel/XChartObjects.hpp> #include "vbahelperinterface.hxx" -typedef InheritedHelperInterfaceImpl1< oo::excel::XWorksheet > WorksheetImpl_BASE; +typedef InheritedHelperInterfaceImpl1< ov::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< ov::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::Reference< ov::excel::XWorksheet > getSheetAtOffset(SCTAB offset) throw (css::uno::RuntimeException); + css::uno::Reference< ov::excel::XRange > getSheetRange() throw (css::uno::RuntimeException); - css::uno::Any getControl( const rtl::OUString& sName ); + css::uno::Reference< css::container::XNameAccess > getFormControls(); 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 ); + ScVbaWorksheet( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ); public: - ScVbaWorksheet( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, + ScVbaWorksheet( const css::uno::Reference< ov::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) ; @@ -86,16 +88,19 @@ public: 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::Reference< ov::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); + virtual css::uno::Reference< ov::excel::XOutline > SAL_CALL Outline( ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XPageSetup > SAL_CALL PageSetup( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL HPageBreaks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getNext() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getPrevious() throw (css::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getIndex() 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 css::uno::Reference< ov::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); @@ -106,9 +111,9 @@ public: 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::Reference< ov::excel::XRange > SAL_CALL Cells( const css::uno::Any &nRow, const css::uno::Any &nCol ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Rows(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::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); @@ -131,6 +136,7 @@ public: 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(); diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index d568331fdc81..546eda854056 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -48,7 +48,7 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <org/openoffice/excel/XApplication.hpp> +#include <ooo/vba/excel/XApplication.hpp> #include <tools/string.hxx> #include "tabvwsh.hxx" @@ -56,7 +56,7 @@ #include "vbaworksheet.hxx" #include "vbaworkbook.hxx" -using namespace ::org::openoffice; +using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -148,9 +148,9 @@ public: class SheetsEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > m_xModel; - uno::WeakReference< vba::XHelperInterface > m_xParent; + uno::WeakReference< 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 ) {} + SheetsEnumeration( const uno::Reference< 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) { @@ -160,11 +160,11 @@ public: }; -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< 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) +ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< 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) { } @@ -393,7 +393,7 @@ ScVbaWorksheets::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (u } } uno::Reference< container::XIndexAccess > xIndexAccess = new SheetCollectionHelper( mSheets ); - uno::Reference< vba::XCollection > xSelectedSheets( new ScVbaWorksheets( this->getParent(), mxContext, xIndexAccess, mxModel ) ); + uno::Reference< XCollection > xSelectedSheets( new ScVbaWorksheets( this->getParent(), mxContext, xIndexAccess, mxModel ) ); return uno::makeAny( xSelectedSheets ); } return ScVbaWorksheets_BASE::Item( Index, Index2 ); @@ -419,7 +419,7 @@ ScVbaWorksheets::getServiceNames() if ( sNames.getLength() == 0 ) { sNames.realloc( 1 ); - sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheets") ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheets") ); } return sNames; } diff --git a/sc/source/ui/vba/vbaworksheets.hxx b/sc/source/ui/vba/vbaworksheets.hxx index a4b2cece97f9..0cb2a4f33971 100644 --- a/sc/source/ui/vba/vbaworksheets.hxx +++ b/sc/source/ui/vba/vbaworksheets.hxx @@ -32,18 +32,18 @@ #include <cppuhelper/implbase1.hxx> -#include <org/openoffice/excel/XWorksheets.hpp> +#include <ooo/vba/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 <ooo/vba/XGlobals.hpp> #include "vbacollectionimpl.hxx" class ScModelObj; -typedef CollTestImplHelper< oo::excel::XWorksheets > ScVbaWorksheets_BASE; +typedef CollTestImplHelper< ov::excel::XWorksheets > ScVbaWorksheets_BASE; class ScVbaWorksheets : public ScVbaWorksheets_BASE { @@ -53,8 +53,8 @@ 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 ); + ScVbaWorksheets( const css::uno::Reference< ov::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< ov::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(); diff --git a/sc/source/ui/vba/vbawsfunction.cxx b/sc/source/ui/vba/vbawsfunction.cxx index 608dae304825..f7fe703cec35 100644 --- a/sc/source/ui/vba/vbawsfunction.cxx +++ b/sc/source/ui/vba/vbawsfunction.cxx @@ -42,13 +42,13 @@ #include <comphelper/anytostring.hxx> #include "vbawsfunction.hxx" +#include "compiler.hxx" using namespace com::sun::star; -using namespace org::openoffice; +using namespace ooo::vba; -ScVbaWSFunction::ScVbaWSFunction( const uno::Reference< vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext): ScVbaWSFunction_BASE( xParent, xContext ) +ScVbaWSFunction::ScVbaWSFunction( const uno::Reference< 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 ); } @@ -86,7 +86,25 @@ ScVbaWSFunction::invoke(const rtl::OUString& FunctionName, const uno::Sequence< 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); + + uno::Any aRet = xFunctionAccess->callFunction(FunctionName,aParamTemp); + // MATCH function should alwayse return a double value, but currently if the first argument is XCellRange, MATCH function returns an array instead of a double value. Don't know why? + // To fix this issue in safe, current solution is to convert this array to a double value just for MATCH function. + String aUpper( FunctionName ); + ScCompiler aCompiler( NULL, ScAddress() ); + OpCode eOp = aCompiler.GetEnglishOpCode( aUpper.ToUpperAscii() ); + if( eOp == ocMatch ) + { + double fVal = 0.0; + if( aRet >>= fVal ) + return aRet; + uno::Sequence< uno::Sequence< uno::Any > > aSequence; + if( !( ( aRet >>= aSequence ) && ( aSequence.getLength() > 0 ) && + ( aSequence[0].getLength() > 0 ) && ( aSequence[0][0] >>= fVal ) ) ) + throw uno::RuntimeException(); + aRet <<= fVal; + } + return aRet; } void SAL_CALL @@ -107,7 +125,11 @@ ScVbaWSFunction::hasMethod(const rtl::OUString& Name) throw(uno::RuntimeExcepti sal_Bool bIsFound = sal_False; try { - if ( m_xNameAccess->hasByName( Name ) ) + // the function name contained in the com.sun.star.sheet.FunctionDescription service is alwayse localized. + // but the function name used in WorksheetFunction is a programmatic name (seems English). + // So m_xNameAccess->hasByName( Name ) may fail to find name when a function name has a localized name. + ScCompiler aCompiler( NULL, ScAddress() ); + if( aCompiler.IsEnglishSymbol( Name ) ) bIsFound = sal_True; } catch( uno::Exception& /*e*/ ) @@ -146,7 +168,7 @@ ScVbaWSFunction::getServiceNames() if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.WorksheetFunction" ) ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.WorksheetFunction" ) ); } return aServiceNames; } diff --git a/sc/source/ui/vba/vbawsfunction.hxx b/sc/source/ui/vba/vbawsfunction.hxx index c8f3f1882049..d3f8b105d29c 100644 --- a/sc/source/ui/vba/vbawsfunction.hxx +++ b/sc/source/ui/vba/vbawsfunction.hxx @@ -30,20 +30,19 @@ #ifndef SC_VBA_INTERIOR_HXX #define SC_VBA_INTERIOR_HXX -#include <org/openoffice/excel/XWorksheetFunction.hpp> +#include <ooo/vba/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; +typedef InheritedHelperInterfaceImpl1< ov::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); + ScVbaWSFunction( const css::uno::Reference< ov::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); |