summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2012-09-11 08:48:02 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-09-12 12:49:49 +0100
commit4597483e00bffcc4e30d379dcf6fad42bc565e56 (patch)
treeb590428b0e3ae3c7056e6c18f008d7179dc5ba38
parentc414499bbd456389ac6cacf677327bff9e6b43f9 (diff)
targetted VBA re-work.
-rw-r--r--basic/source/classes/sbunoobj.cxx26
-rw-r--r--basic/source/classes/sbxmod.cxx11
-rw-r--r--basic/source/runtime/methods.cxx42
-rw-r--r--extensions/source/ole/oleobjw.cxx17
-rw-r--r--forms/source/misc/InterfaceContainer.cxx9
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--oovbaapi/UnoApi_oovbaapi.mk13
-rwxr-xr-xoovbaapi/genconstidl/api-to-idl.pl3
-rw-r--r--oovbaapi/ooo/vba/XDialogBase.idl2
-rw-r--r--oovbaapi/ooo/vba/XFileDialog.idl50
-rw-r--r--oovbaapi/ooo/vba/XFileDialogSelectedItems.idl47
-rw-r--r--oovbaapi/ooo/vba/XFileSearch.idl56
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl17
-rw-r--r--oovbaapi/ooo/vba/excel/XName.idl2
-rw-r--r--oovbaapi/ooo/vba/excel/XPageSetup.idl2
-rw-r--r--oovbaapi/ooo/vba/excel/XPivotCache.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XQueryTable.idl50
-rw-r--r--oovbaapi/ooo/vba/excel/XRange.idl9
-rw-r--r--oovbaapi/ooo/vba/excel/XWorkbook.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl10
-rw-r--r--oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl39
-rw-r--r--oovbaapi/ooo/vba/msforms/ReturnBoolean.idl24
-rw-r--r--oovbaapi/ooo/vba/msforms/ReturnEffect.idl25
-rw-r--r--oovbaapi/ooo/vba/msforms/ReturnInteger.idl24
-rw-r--r--oovbaapi/ooo/vba/msforms/ReturnSingle.idl24
-rw-r--r--oovbaapi/ooo/vba/msforms/XListBox.idl2
-rw-r--r--oovbaapi/ooo/vba/msforms/XReturnBoolean.idl53
-rw-r--r--oovbaapi/ooo/vba/msforms/XReturnInteger.idl53
-rw-r--r--oovbaapi/ooo/vba/msforms/XShape.idl1
-rw-r--r--sc/Library_vbaobj.mk4
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/scmod.hxx4
-rw-r--r--sc/inc/viewuno.hxx5
-rw-r--r--sc/source/core/data/document.cxx34
-rw-r--r--sc/source/ui/inc/asciiopt.hxx2
-rw-r--r--sc/source/ui/inc/impex.hxx2
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx116
-rw-r--r--sc/source/ui/vba/excelvbahelper.cxx125
-rw-r--r--sc/source/ui/vba/excelvbahelper.hxx9
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx559
-rw-r--r--sc/source/ui/vba/vbaapplication.hxx19
-rw-r--r--sc/source/ui/vba/vbacomment.cxx10
-rw-r--r--sc/source/ui/vba/vbadialog.cxx77
-rw-r--r--sc/source/ui/vba/vbadialog.hxx1
-rw-r--r--sc/source/ui/vba/vbadialogs.cxx9
-rw-r--r--sc/source/ui/vba/vbadialogs.hxx1
-rw-r--r--sc/source/ui/vba/vbafiledialog.cxx174
-rw-r--r--sc/source/ui/vba/vbafiledialog.hxx63
-rw-r--r--sc/source/ui/vba/vbafiledialogselecteditems.cxx156
-rw-r--r--sc/source/ui/vba/vbafiledialogselecteditems.hxx90
-rw-r--r--sc/source/ui/vba/vbafilesearch.cxx244
-rw-r--r--sc/source/ui/vba/vbafilesearch.hxx80
-rw-r--r--sc/source/ui/vba/vbaname.cxx87
-rw-r--r--sc/source/ui/vba/vbaname.hxx4
-rw-r--r--sc/source/ui/vba/vbanames.cxx85
-rw-r--r--sc/source/ui/vba/vbaoleobject.cxx2
-rw-r--r--sc/source/ui/vba/vbapagebreaks.cxx26
-rw-r--r--sc/source/ui/vba/vbapagesetup.cxx101
-rw-r--r--sc/source/ui/vba/vbapagesetup.hxx2
-rw-r--r--sc/source/ui/vba/vbapivotcache.cxx11
-rw-r--r--sc/source/ui/vba/vbapivotcache.hxx3
-rw-r--r--sc/source/ui/vba/vbaquerytable.cxx90
-rw-r--r--sc/source/ui/vba/vbaquerytable.hxx62
-rw-r--r--sc/source/ui/vba/vbarange.cxx1030
-rw-r--r--sc/source/ui/vba/vbarange.hxx16
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx63
-rw-r--r--sc/source/ui/vba/vbaworkbook.hxx3
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx69
-rw-r--r--sc/source/ui/vba/vbaworksheet.hxx6
-rw-r--r--sc/source/ui/view/viewfun3.cxx10
-rw-r--r--scripting/source/vbaevents/eventhelper.cxx79
-rw-r--r--scripting/source/vbaevents/vbamsformreturntypes.hxx76
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc1
-rw-r--r--sfx2/source/control/unoctitm.cxx13
-rw-r--r--sfx2/source/doc/docmacromode.cxx53
-rw-r--r--sfx2/source/view/viewprn.cxx6
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx6
-rw-r--r--toolkit/source/awt/vclxwindows.cxx32
-rw-r--r--vbahelper/inc/vbahelper/vbadialogbase.hxx2
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx1
-rw-r--r--vbahelper/inc/vbahelper/vbashape.hxx1
-rw-r--r--vbahelper/source/msforms/vbacombobox.cxx23
-rw-r--r--vbahelper/source/msforms/vbaframe.cxx12
-rw-r--r--vbahelper/source/msforms/vbaframe.hxx2
-rw-r--r--vbahelper/source/msforms/vbalistbox.cxx11
-rw-r--r--vbahelper/source/msforms/vbalistbox.hxx4
-rw-r--r--vbahelper/source/msforms/vbatextbox.cxx10
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.cxx23
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx15
-rw-r--r--vbahelper/source/msforms/vbauserform.hxx2
-rw-r--r--vbahelper/source/vbahelper/vbadialogbase.cxx4
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx49
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx10
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx17
-rw-r--r--vbahelper/source/vbahelper/vbapictureformat.cxx8
-rw-r--r--vbahelper/source/vbahelper/vbashape.cxx11
-rw-r--r--vcl/inc/vcl/dialog.hxx4
-rw-r--r--vcl/source/control/combobox.cxx5
-rw-r--r--vcl/source/window/dialog.cxx11
100 files changed, 515 insertions, 4052 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index c4f5fd82ead3..c79263493714 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -437,32 +437,6 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
SbError nError( ERRCODE_BASIC_EXCEPTION );
::rtl::OUStringBuffer aMessageBuf;
- // Add for VBA, to get the correct error code and message.
- if ( SbiRuntime::isVBAEnabled() )
- {
- if ( aExamine >>= aBasicError )
- {
- if ( aBasicError.ErrorCode != 0 )
- {
- nError = StarBASIC::GetSfxFromVBError( (sal_uInt16) aBasicError.ErrorCode );
- if ( nError == 0 )
- {
- nError = (SbError) aBasicError.ErrorCode;
- }
- aMessageBuf.append( aBasicError.ErrorMessageArgument );
- aExamine.clear();
- }
- }
-
- IndexOutOfBoundsException aIdxOutBndsExp;
- if ( aExamine >>= aIdxOutBndsExp )
- {
- nError = SbERR_OUT_OF_RANGE;
- aExamine.clear();
- }
- }
- // End add
-
// strip any other WrappedTargetException instances, but this time preserve the error messages.
WrappedTargetException aWrapped;
sal_Int32 nLevel = 0;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index a70a7eaa413f..f47e352183b2 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2351,15 +2351,6 @@ public:
mpUserForm->triggerMethod( rtl::OUString("Userform_QueryClose" ),
aParams);
- xVbaMethodParameter->setVbaMethodParameter( rtl::OUString( "Cancel"), aParams[0]);
- // If we don't cancel then we want to make sure the dialog
- // really is gone to make sure when we attempt to raise it again
- // it will actually generate an initialise event
- if ( !nCancel )
- {
- removeListener(); // presumably we need to do this
- mpUserForm->ResetApiObj();
- }
return;
}
@@ -2687,7 +2678,7 @@ void SbUserFormModule::InitObject()
aArgs[ 0 ] = uno::Any();
aArgs[ 1 ] <<= m_xDialog;
aArgs[ 2 ] <<= m_xModel;
- aArgs[ 3 ] <<= sProjectName;
+ aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( "ooo.vba.msforms.UserForm"), aArgs ) ) );
uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW );
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index e5e094a682db..1d2835b04749 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -631,36 +631,6 @@ RTLFUNC(MkDir)
{
try
{
- if ( SbiRuntime::isVBAEnabled() )
- {
- // If aPath is the folder name, not a path, then create the folder under current directory.
- INetURLObject aTryPathURL( aPath );
- ::rtl::OUString sPathURL = aTryPathURL.GetMainURL( INetURLObject::NO_DECODE );
- if ( sPathURL.isEmpty() )
- {
- File::getFileURLFromSystemPath( aPath, sPathURL );
- }
- INetURLObject aPathURL( sPathURL );
- if ( aPathURL.GetPath().isEmpty() )
- {
- ::rtl::OUString sCurDirURL;
- SbxArrayRef pPar = new SbxArray;
- SbxVariableRef pVar = new SbxVariable();
- pPar->Put( pVar, 0 );
- SbRtl_CurDir( pBasic, *pPar, sal_False );
- String aCurPath = pPar->Get(0)->GetString();
-
- File::getFileURLFromSystemPath( aCurPath, sCurDirURL );
- INetURLObject aDirURL( sCurDirURL );
- aDirURL.Append( aPath );
- ::rtl::OUString aTmpPath = aDirURL.GetMainURL( INetURLObject::NO_DECODE );
- if ( !aTmpPath.isEmpty() )
- {
- aPath = aTmpPath;
- }
- }
- }
-
xSFI->createFolder( getFullPath( aPath ) );
}
catch(const Exception & )
@@ -3287,20 +3257,10 @@ RTLFUNC(Shell)
pParamList[j] = NULL;
}
- long nResult = 0;
- // We should return the identifier of the executing process when is running VBA, because method Shell(...) returns it in Excel.
- if ( bSucc && SbiRuntime::isVBAEnabled())
- {
- oslProcessInfo aInfo;
- aInfo.Size = sizeof(oslProcessInfo);
- osl_getProcessInfo( pApp, osl_Process_IDENTIFIER, &aInfo );
- nResult = aInfo.Ident;
- }
-
if( !bSucc )
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
else
- rPar.Get(0)->PutLong( nResult );
+ rPar.Get(0)->PutLong( 0 );
}
}
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index d89ae85aa224..5228390e8495 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -48,7 +48,6 @@
#include <com/sun/star/script/XEngine.hpp>
#include <com/sun/star/script/InterruptEngineEvent.hpp>
#include <com/sun/star/script/XLibraryAccess.hpp>
-#include <com/sun/star/script/BasicErrorException.hpp>
#include <com/sun/star/bridge/ModelDependent.hpp>
#include "com/sun/star/bridge/oleautomation/NamedArgument.hpp"
@@ -277,10 +276,6 @@ Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
{
throw;
}
- catch (const InvocationTargetException &)
- {
- throw;
- }
catch (const BridgeRuntimeError & e)
{
throw RuntimeException(e.message, Reference<XInterface>());
@@ -2156,21 +2151,11 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
"DISP_E_BADVARTYPE."), 0);
break;
case DISP_E_EXCEPTION:
- {
message = OUSTR("[automation bridge]: ");
message += OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription),
::SysStringLen(excepinfo.bstrDescription));
- // Add for VBA, to throw an exception with the correct error code and message.
- sal_Int32 nErrorCode = excepinfo.wCode;
- if ( nErrorCode == 0 )
- {
- // The low 16-bit of scode describing the error or warning.
- nErrorCode = ( excepinfo.scode & 0xFFFF );
- }
- BasicErrorException aBasicErrExp(message, Reference<XInterface>(), nErrorCode, message);
- throw InvocationTargetException(message, Reference<XInterface>(), makeAny(aBasicErrExp));
- // End add
+ throw InvocationTargetException(message, Reference<XInterface>(), Any());
}
case DISP_E_MEMBERNOTFOUND:
message = OUSTR("[automation bridge]: A function with the name \"")
diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index f07649fd1215..0965b2b16571 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -158,16 +158,9 @@ void OInterfaceContainer::impl_addVbEvents_nolck_nothrow( const sal_Int32 i_nIn
xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultControl") ) ) >>= sServiceName;
Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( m_xServiceFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VBAToOOEventDesc") ) ), UNO_QUERY_THROW );
- Reference< XInterface > xInterface = m_xServiceFactory->createInstance( sServiceName );
- Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( xInterface, sCodeName );
+ Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( m_xServiceFactory->createInstance( sServiceName ), sCodeName );
// register the vba script events
m_xEventAttacher->registerScriptEvents( i_nIndex, vbaEvents );
-
- Reference< XComponent > xComponent( xInterface, UNO_QUERY );
- if ( xComponent.is() )
- {
- xComponent->dispose();
- }
}
while ( false );
}
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 17b3711cf29c..2179afc1f9e7 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2172,7 +2172,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\
XUndoManager \
XUndoManagerListener \
XUndoManagerSupplier \
- XVbaMethodParameter \
XViewDataSupplier \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/drawing,\
diff --git a/oovbaapi/UnoApi_oovbaapi.mk b/oovbaapi/UnoApi_oovbaapi.mk
index ec8d8f4e68e1..c360af67b53d 100644
--- a/oovbaapi/UnoApi_oovbaapi.mk
+++ b/oovbaapi/UnoApi_oovbaapi.mk
@@ -52,9 +52,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,oovbaapi,oovbaapi/ooo/vba/excel,\
$(eval $(call gb_UnoApi_add_idlfiles_noheader,oovbaapi,oovbaapi/ooo/vba,\
ControlProvider \
))
-$(eval $(call gb_UnoApi_add_idlfiles_noheader,oovbaapi,oovbaapi/ooo/vba/msforms,\
- MSFormReturnTypes \
-))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,oovbaapi,oovbaapi/ooo/vba/excel,\
Button \
SheetObjects \
@@ -97,9 +94,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,oovbaapi,oovbaapi/ooo/vba,\
XDocumentsBase \
XErrObject \
XExecutableDialog \
- XFileDialog \
- XFileDialogSelectedItems \
- XFileSearch \
XFontBase \
XFoundFiles \
XGlobalsBase \
@@ -473,7 +467,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,oovbaapi,oovbaapi/ooo/vba/excel,\
XPivotCache \
XPivotTable \
XPivotTables \
- XQueryTable \
XRange \
XSeries \
XSeriesCollection \
@@ -533,6 +526,10 @@ $(eval $(call gb_UnoApi_add_idlfiles,oovbaapi,oovbaapi/ooo/vba/msforms,\
fmTransitionEffect \
fmVerticalScrollBarSide \
fmZOrder \
+ ReturnBoolean \
+ ReturnEffect \
+ ReturnInteger \
+ ReturnSingle \
XButton \
XCheckBox \
XColorFormat \
@@ -553,8 +550,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,oovbaapi,oovbaapi/ooo/vba/msforms,\
XPictureFormat \
XProgressBar \
XRadioButton \
- XReturnBoolean \
- XReturnInteger \
XScrollBar \
XShape \
XShapeRange \
diff --git a/oovbaapi/genconstidl/api-to-idl.pl b/oovbaapi/genconstidl/api-to-idl.pl
index d04cca73de95..4959e979f89e 100755
--- a/oovbaapi/genconstidl/api-to-idl.pl
+++ b/oovbaapi/genconstidl/api-to-idl.pl
@@ -125,9 +125,6 @@ sub generate_idls($) {
foreach $module ( keys %result ) {
foreach $type ( keys %{$result{$module}} ) {
my $fname = $path . "/" . $type . ".idl";
- if ( uc($module) eq "ADODB" || uc($module) eq "DAO" ) {
- $fname = $path . "/" . uc($module) . "_" . $type . ".idl";
- }
open( IDL, ">$fname" ) || die "Cannot write $fname.";
if( $module eq "vba" ) {
diff --git a/oovbaapi/ooo/vba/XDialogBase.idl b/oovbaapi/ooo/vba/XDialogBase.idl
index 1aa7db0e7f8e..7fd0467d3e6e 100644
--- a/oovbaapi/ooo/vba/XDialogBase.idl
+++ b/oovbaapi/ooo/vba/XDialogBase.idl
@@ -41,7 +41,7 @@ interface XDialogBase
{
interface ::ooo::vba::XHelperInterface;
- boolean Show();
+ void Show();
};
}; };
diff --git a/oovbaapi/ooo/vba/XFileDialog.idl b/oovbaapi/ooo/vba/XFileDialog.idl
deleted file mode 100644
index 6471ae491694..000000000000
--- a/oovbaapi/ooo/vba/XFileDialog.idl
+++ /dev/null
@@ -1,50 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __ooo_vba_excel_XFileDialog_idl__
-#define __ooo_vba_excel_XFileDialog_idl__
-
-#include <com/sun/star/uno/XInterface.idl>
-#include <ooo/vba/XFileDialogSelectedItems.idl>
-
-//=============================================================================
-
-module ooo { module vba {
-
-//=============================================================================
-
-interface XFileDialog : com::sun::star::uno::XInterface
-{
- [attribute, readonly] ooo::vba::XFileDialogSelectedItems SelectedItems;
-
- long Show();
-};
-
-}; };
-
-#endif
diff --git a/oovbaapi/ooo/vba/XFileDialogSelectedItems.idl b/oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
deleted file mode 100644
index 787e4f4f8bb0..000000000000
--- a/oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
+++ /dev/null
@@ -1,47 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef __ooo_vba_excel_XFileDialogSelectedItems_idl__
-#define __ooo_vba_excel_XFileDialogSelectedItems_idl__
-
-#include <ooo/vba/XCollection.idl>
-//=============================================================================
-
-module ooo { module vba {
-
-//=============================================================================
-
-interface XFileDialogSelectedItems
-{
- interface ooo::vba::XCollection;
-};
-
-}; };
-
-#endif
diff --git a/oovbaapi/ooo/vba/XFileSearch.idl b/oovbaapi/ooo/vba/XFileSearch.idl
deleted file mode 100644
index c60284a21d18..000000000000
--- a/oovbaapi/ooo/vba/XFileSearch.idl
+++ /dev/null
@@ -1,56 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __ooo_vba_XFileSearch_idl__
-#define __ooo_vba_XFileSearch_idl__
-
-#include <com/sun/star/uno/XInterface.idl>
-#include <ooo/vba/XFoundFiles.idl>
-
-//=============================================================================
-
-module ooo { module vba {
-//=============================================================================
-
-interface XFileSearch
-{
- interface ::com::sun::star::uno::XInterface;
-
- [attribute] string FileName;
- [attribute] string LookIn;
- [attribute] boolean SearchSubFolders;
- [attribute] boolean MatchTextExactly;
- [attribute, readonly] XFoundFiles FoundFiles;
-
- long Execute();
- void NewSearch();
-};
-
-}; };
-
-#endif
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index baf646879e12..f2d7ff4abdfd 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -31,8 +31,6 @@
#include <com/sun/star/script/XInvocation.idl>
#include <ooo/vba/XHelperInterface.idl>
#include <ooo/vba/XAssistant.idl>
-#include <ooo/vba/XFileDialog.idl>
-#include <ooo/vba/XFileSearch.idl>
module ooo { module vba { module excel {
@@ -43,8 +41,6 @@ interface XWorksheets;
interface XWorksheetFunction;
interface XWindow;
interface XWorksheet;
-interface XFileDialog;
-interface XFileSearch;
interface XApplication
{
@@ -60,10 +56,8 @@ interface XApplication
[attribute, readonly] XWindow ActiveWindow;
[attribute, readonly] XWorksheet ActiveSheet;
[attribute, readonly] ooo::vba::XAssistant Assistant;
- [attribute, readonly] ooo::vba::XFileSearch FileSearch;
[attribute] long Calculation;
[attribute, readonly] XWorkbook ThisWorkbook;
- [attribute, readonly] ooo::vba::XFileDialog FileDialog;
[attribute, readonly] string Name;
[attribute] boolean DisplayAlerts;
[attribute] boolean DisplayFormulaBar;
@@ -71,9 +65,6 @@ interface XApplication
[attribute] any StatusBar;
[attribute] long Cursor;
[attribute] boolean EnableEvents;
- [attribute] boolean Visible;
- [attribute] boolean Iteration;
- [attribute] long EnableCancelKey;
[attribute] boolean DisplayFullScreen;
[attribute] boolean DisplayScrollBars;
[attribute] boolean DisplayExcel4Menus;
@@ -84,8 +75,6 @@ interface XApplication
string getDefaultFilePath() raises(com::sun::star::script::BasicErrorException);
- any GetOpenFilename([in] /*Optional*/ any FileFilter, [in] /*Optional*/ any FilterIndex, [in] /*Optional*/ any Title, [in] /*Optional*/ any ButtonText, [in] /*Optional*/ any MultiSelect); //minz, 2009-07-08
-
string LibraryPath() raises(com::sun::star::script::BasicErrorException);
string TemplatesPath() raises(com::sun::star::script::BasicErrorException);
string PathSeparator() raises(com::sun::star::script::BasicErrorException);
@@ -109,12 +98,6 @@ interface XApplication
void Volatile([in] any Volatile);
any Caller( [in] any Index );
any MenuBars( [in] any aIndex );
- any International([in] long Index);
- any GetSaveAsFilename( [in] any InitialFilename, [in] any FileFilter, [in] any FilterIndex, [in] any Title,[in] any ButtonText);
- void Undo(); //2009-10-11 limingl
- double InchesToPoints([in] double Inches);
- void setSheetsInNewWorkbook( [in] long SheetsInNewWorkbook ) raises(com::sun::star::script::BasicErrorException);
- long getSheetsInNewWorkbook();
};
}; }; };
diff --git a/oovbaapi/ooo/vba/excel/XName.idl b/oovbaapi/ooo/vba/excel/XName.idl
index 09a69ab045b6..b5d625955694 100644
--- a/oovbaapi/ooo/vba/excel/XName.idl
+++ b/oovbaapi/ooo/vba/excel/XName.idl
@@ -45,7 +45,7 @@ interface XName
[attribute] string Name;
[attribute] string NameLocal;
[attribute] boolean Visible;
- [attribute] string Value;
+ [attribute, readonly] string Value;
[attribute, readonly] string RefersTo;
[attribute, readonly] string RefersToLocal;
[attribute, readonly] string RefersToR1C1;
diff --git a/oovbaapi/ooo/vba/excel/XPageSetup.idl b/oovbaapi/ooo/vba/excel/XPageSetup.idl
index 8b12f550e08a..e47771ee42fe 100644
--- a/oovbaapi/ooo/vba/excel/XPageSetup.idl
+++ b/oovbaapi/ooo/vba/excel/XPageSetup.idl
@@ -39,7 +39,6 @@ module ooo { module vba { module excel {
interface XPageSetup : com::sun::star::uno::XInterface
{
-
// interface ::ooo::vba::XHelperInterface;
//Attributes
@@ -60,7 +59,6 @@ interface XPageSetup : com::sun::star::uno::XInterface
[attribute] boolean CenterVertically;
[attribute] boolean CenterHorizontally;
[attribute] boolean PrintHeadings;
- [attribute] long PaperSize;
};
diff --git a/oovbaapi/ooo/vba/excel/XPivotCache.idl b/oovbaapi/ooo/vba/excel/XPivotCache.idl
index 00a4e280524f..f96aafe5f618 100644
--- a/oovbaapi/ooo/vba/excel/XPivotCache.idl
+++ b/oovbaapi/ooo/vba/excel/XPivotCache.idl
@@ -40,7 +40,6 @@ interface XPivotCache
{
interface ::ooo::vba::XHelperInterface;
- [attribute] long MissingItemsLimit;
void Refresh();
};
diff --git a/oovbaapi/ooo/vba/excel/XQueryTable.idl b/oovbaapi/ooo/vba/excel/XQueryTable.idl
deleted file mode 100644
index ca284c418365..000000000000
--- a/oovbaapi/ooo/vba/excel/XQueryTable.idl
+++ /dev/null
@@ -1,50 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __ooo_vba_excel_XQueryTable_idl__
-#define __ooo_vba_excel_XQueryTable_idl__
-
-#include <com/sun/star/uno/XInterface.idl>
-#include <ooo/vba/XHelperInterface.idl>
-
-//=============================================================================
-
-module ooo { module vba { module excel {
-
-//=============================================================================
-
-interface XQueryTable
-{
- interface com::sun::star::uno::XInterface;
- //interface ooo::vba::XHelperInterface;
- boolean Refresh([in] any aBackgroundQuery);
-};
-
-}; }; };
-
-#endif
diff --git a/oovbaapi/ooo/vba/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl
index 015c68c9c90d..c7c1f464d679 100644
--- a/oovbaapi/ooo/vba/excel/XRange.idl
+++ b/oovbaapi/ooo/vba/excel/XRange.idl
@@ -53,8 +53,6 @@ interface XBorders;
interface XValidation;
interface XWorksheet;
-interface XPivotTable;
-interface XQueryTable;
interface XRange
{
interface com::sun::star::container::XEnumerationAccess;
@@ -64,7 +62,6 @@ interface XRange
interface ::ooo::vba::excel::XFormat;
//interface ::ooo::vba::XHelperInterface;
- [attribute] any Name;
[attribute] any Value;
[attribute] any Formula;
[attribute] any FormulaArray;
@@ -90,7 +87,6 @@ interface XRange
[attribute] any Style;
[attribute] any AddIndent;
[attribute] any ShowDetail;
- [attribute, readonly] XQueryTable QueryTable;
XComment AddComment( [in] any Text );
void Clear();
@@ -155,11 +151,6 @@ interface XRange
void Subtotal( [in] long GroupBy, [in] long Function, [in] /*Optional*/ sequence<long> TotalList, [in] /*Optional*/ any Replace, [in] /*Optional*/ any PageBreaks, [in] any SummaryBelowData ) raises ( com::sun::star::script::BasicErrorException );
XRange MergeArea( ) raises ( com::sun::star::script::BasicErrorException );
any Hyperlinks( [in] any Index );
- long CopyFromRecordset([in] any Data, [in] any MaxRows , [in] any MaxColumns) raises ( com::sun::star::script::BasicErrorException );
- XPivotTable PivotTable();
- void TextToColumns([in] any Destination, [in] any DataType, [in] any TextQualifier, [in] any ConsecutiveDelimiter, [in] any Tab, [in] any Semicolon, [in] any Comma,
- [in] any Space, [in] any Other, [in] any OtherChar, [in] any FieldInfo, [in] any DecimalSeparator, [in] any ThousandsSeparator, [in] any TrailingMinusNumbers );
- any AdvancedFilter([in] long Action, [in] any CriteriaRange, [in] any CopyToRange, [in] any Unique) raises ( com::sun::star::script::BasicErrorException );
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl
index 7d4a70fbb1be..1d99f43dc271 100644
--- a/oovbaapi/ooo/vba/excel/XWorkbook.idl
+++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl
@@ -61,7 +61,6 @@ interface XWorkbook
any Colors( [in] any Index ) raises (com::sun::star::script::BasicErrorException);
void SaveCopyAs( [in] string Filename );
void Protect( [in] any Password );
- void SaveAs([in] string FileName, [in]any FileFormat, [in]any CreateBackup);
};
}; }; };
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index e3128181ee61..7975984d54ab 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -62,17 +62,17 @@ interface XWorksheet
[attribute, readonly] XWorksheet Next;
[attribute, readonly] XWorksheet Previous;
[attribute, readonly] string CodeName;
- [attribute, readonly] short Index;
- [attribute] long EnableSelection;
+ [attribute, readonly] short Index;
+ [attribute] long EnableSelection;
[attribute] boolean AutoFilterMode;
void Activate();
- void Calculate( );
- void Select([in] any Replace);
+ void Calculate();
+ void Select();
void Move([in] any Before,[in] any After );
void Copy([in] any Before,[in] any After );
void Paste([in] any Destination,[in] any Link);
- void Delete( );
+ void Delete();
void Protect([in] any Password,[in] any DrawingObjects ,[in] any Contents,[in] any Scenarios,[in] any UserInterfaceOnly);
void Unprotect([in] any Password );
void CheckSpelling([in] any CustomDictionary,[in] any IgnoreUppercase, [in] any AlwaysSuggest,[in] any SpellingLang );
diff --git a/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl b/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
deleted file mode 100644
index c2ca0877ff96..000000000000
--- a/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
+++ /dev/null
@@ -1,39 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-module msforms
-{
- struct ReturnEffect
- {
- //fmDropEffect Value;
- short Value;
- };
-
- struct ReturnSingle
- {
- float Value;
- };
-};
diff --git a/oovbaapi/ooo/vba/msforms/ReturnBoolean.idl b/oovbaapi/ooo/vba/msforms/ReturnBoolean.idl
new file mode 100644
index 000000000000..cd739ddf49a9
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/ReturnBoolean.idl
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+module ooo { module vba { module msforms {
+ struct ReturnBoolean
+ {
+ boolean Value;
+ };
+}; }; };
diff --git a/oovbaapi/ooo/vba/msforms/ReturnEffect.idl b/oovbaapi/ooo/vba/msforms/ReturnEffect.idl
new file mode 100644
index 000000000000..817b0cd41943
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/ReturnEffect.idl
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+module ooo { module vba { module msforms {
+ struct ReturnEffect
+ {
+ //fmDropEffect Value;
+ short Value;
+ };
+}; }; };
diff --git a/oovbaapi/ooo/vba/msforms/ReturnInteger.idl b/oovbaapi/ooo/vba/msforms/ReturnInteger.idl
new file mode 100644
index 000000000000..3b949ad3bfcf
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/ReturnInteger.idl
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+module ooo { module vba { module msforms {
+ struct ReturnInteger
+ {
+ long Value;
+ };
+}; }; };
diff --git a/oovbaapi/ooo/vba/msforms/ReturnSingle.idl b/oovbaapi/ooo/vba/msforms/ReturnSingle.idl
new file mode 100644
index 000000000000..6d2e07b09af6
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/ReturnSingle.idl
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+module ooo { module vba { module msforms {
+ struct ReturnSingle
+ {
+ float Value;
+ };
+}; }; };
diff --git a/oovbaapi/ooo/vba/msforms/XListBox.idl b/oovbaapi/ooo/vba/msforms/XListBox.idl
index 98ce26e68a3e..03f63a099211 100644
--- a/oovbaapi/ooo/vba/msforms/XListBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XListBox.idl
@@ -41,7 +41,7 @@ interface XListBox
{
[attribute] any Value;
[attribute] string Text;
- [attribute] long MultiSelect;
+ [attribute] boolean MultiSelect;
[attribute] any ListIndex;
[attribute, readonly] long ListCount;
[attribute, readonly] XNewFont Font;
diff --git a/oovbaapi/ooo/vba/msforms/XReturnBoolean.idl b/oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
deleted file mode 100644
index c85d7f7df11b..000000000000
--- a/oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
+++ /dev/null
@@ -1,53 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __ooo_vba_msforms_XReturnInteger_idl__
-#define __ooo_vba_msforms_XReturnInteger_idl__
-
-#include <com/sun/star/script/XDefaultProperty.idl>
-//=============================================================================
-
-module ooo
-{
-module vba
-{
-module msforms
-{
-
-//=============================================================================
-interface XReturnBoolean: com::sun::star::script::XDefaultProperty
-{
- [attribute] boolean Value;
-};
-//=============================================================================
-
-};
-};
-};
-
-#endif
diff --git a/oovbaapi/ooo/vba/msforms/XReturnInteger.idl b/oovbaapi/ooo/vba/msforms/XReturnInteger.idl
deleted file mode 100644
index 4b5192e27a76..000000000000
--- a/oovbaapi/ooo/vba/msforms/XReturnInteger.idl
+++ /dev/null
@@ -1,53 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __ooo_vba_msforms_XReturnInteger_idl__
-#define __ooo_vba_msforms_XReturnInteger_idl__
-
-#include <com/sun/star/script/XDefaultProperty.idl>
-//=============================================================================
-
-module ooo
-{
-module vba
-{
-module msforms
-{
-
-//=============================================================================
-interface XReturnInteger: com::sun::star::script::XDefaultProperty
-{
- [attribute] long Value;
-};
-//=============================================================================
-
-};
-};
-};
-
-#endif
diff --git a/oovbaapi/ooo/vba/msforms/XShape.idl b/oovbaapi/ooo/vba/msforms/XShape.idl
index 602b3fdf35bb..1b320d072701 100644
--- a/oovbaapi/ooo/vba/msforms/XShape.idl
+++ b/oovbaapi/ooo/vba/msforms/XShape.idl
@@ -64,7 +64,6 @@ interface XShape : ooo::vba::XHelperInterface
void ScaleHeight( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
void ScaleWidth( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
any ShapeRange( [in] any index ); // only here for convience
- void Copy();
};
}; }; };
diff --git a/sc/Library_vbaobj.mk b/sc/Library_vbaobj.mk
index e8a667a7bb39..fb7e1c34d98c 100644
--- a/sc/Library_vbaobj.mk
+++ b/sc/Library_vbaobj.mk
@@ -81,9 +81,6 @@ $(eval $(call gb_Library_add_exception_objects,vbaobj,\
sc/source/ui/vba/vbadialog \
sc/source/ui/vba/vbadialogs \
sc/source/ui/vba/vbaeventshelper \
- sc/source/ui/vba/vbafiledialog \
- sc/source/ui/vba/vbafiledialogselecteditems \
- sc/source/ui/vba/vbafilesearch \
sc/source/ui/vba/vbafont \
sc/source/ui/vba/vbaformat \
sc/source/ui/vba/vbaformatcondition \
@@ -112,7 +109,6 @@ $(eval $(call gb_Library_add_exception_objects,vbaobj,\
sc/source/ui/vba/vbapivotcache \
sc/source/ui/vba/vbapivottable \
sc/source/ui/vba/vbapivottables \
- sc/source/ui/vba/vbaquerytable \
sc/source/ui/vba/vbarange \
sc/source/ui/vba/vbasheetobject \
sc/source/ui/vba/vbastyle \
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index efe8814ea67c..b12ce261964f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -564,7 +564,6 @@ public:
bool HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow,
SCCOL nEndCol, SCROW nEndRow,
const ScMarkData& rMark ) const;
- bool HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTAB ) const;
bool GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
@@ -956,7 +955,7 @@ public:
SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
ScDirection eDir );
- SC_DLLPUBLIC void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, ScMoveDirection eDirection ) const;
+ void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, ScMoveDirection eDirection ) const;
SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
@@ -1015,7 +1014,7 @@ public:
SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
void SetCutMode( bool bCut );
- SC_DLLPUBLIC bool IsCutMode();
+ bool IsCutMode();
void SetClipArea( const ScRange& rArea, bool bCut = false );
SC_DLLPUBLIC bool IsDocVisible() const { return bIsVisible; }
@@ -1865,7 +1864,6 @@ private: // CLOOK-Impl-methods
const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
- void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, SCTAB nTab);
bool HasPartOfMerged( const ScRange& rRange );
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index bc0ebd9726da..521d8219412a 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -176,14 +176,14 @@ public:
// Options:
const ScViewOptions& GetViewOptions ();
-SC_DLLPUBLIC const ScDocOptions& GetDocOptions ();
+ const ScDocOptions& GetDocOptions ();
SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
SC_DLLPUBLIC const ScDefaultsOptions& GetDefaultsOptions ();
const ScFormulaOptions& GetFormulaOptions ();
const ScInputOptions& GetInputOptions ();
SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
void SetViewOptions ( const ScViewOptions& rOpt );
-SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt );
+ void SetDocOptions ( const ScDocOptions& rOpt );
SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
void SetDefaultsOptions ( const ScDefaultsOptions& rOpt );
void SetFormulaOptions ( const ScFormulaOptions& rOpt );
diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 2aeb6f51d072..135b54016597 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -317,11 +317,6 @@ public:
::com::sun::star::sheet::XSpreadsheet >& xActiveSheet )
throw(::com::sun::star::uno::RuntimeException);
- // support expand (but not replace) the active sheet
- virtual void SAL_CALL selectSheet( const ::com::sun::star::uno::Reference<
- ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet,
- sal_Bool bExpand)
- throw(::com::sun::star::uno::RuntimeException);
//XEnhancedMouseClickBroadcaster
virtual void SAL_CALL addEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference<
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index d660686dbaab..ade6c8e9b051 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1926,9 +1926,9 @@ void ScDocument::CopyToClip(const ScClipParam& rClipParam,
else
pClipDoc->ResetClip(this, pMarks);
- if ( bUseRangeForVBA )
- CopyRangeNamesToClip(pClipDoc, aClipRange, nTab );
- else
+// if ( bUseRangeForVBA )
+// CopyRangeNamesToClip(pClipDoc, aClipRange, nTab );
+// else
CopyRangeNamesToClip(pClipDoc, aClipRange, pMarks, bAllTabs);
for ( ; i < nEndTab; ++i)
@@ -2114,24 +2114,6 @@ void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClip
copyUsedNamesToClip(pClipDoc->GetRangeName(), pRangeName, aUsedNames);
}
-void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, SCTAB nTab)
-{
- if (!pRangeName || pRangeName->empty())
- return;
-
- // Indexes of named ranges that are used in the copied cells
- std::set<sal_uInt16> aUsedNames;
- if ( nTab < static_cast<SCTAB>(maTabs.size()) && nTab < static_cast<SCTAB>(pClipDoc->maTabs.size()) )
- if ( maTabs[nTab] && pClipDoc->maTabs[nTab] )
- {
- maTabs[nTab]->FindRangeNamesInUse(
- rClipRange.aStart.Col(), rClipRange.aStart.Row(),
- rClipRange.aEnd.Col(), rClipRange.aEnd.Row(), aUsedNames );
- }
-
- copyUsedNamesToClip(pClipDoc->GetRangeName(), pRangeName, aUsedNames);
-}
-
ScDocument::NumFmtMergeHandler::NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc) :
mpDoc(pDoc)
{
@@ -4817,16 +4799,6 @@ bool ScDocument::HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRo
return !bOk;
}
-bool ScDocument::HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const
-{
- bool bOk = true;
- if ( nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] && maTabs[nTab]->HasBlockMatrixFragment( nStartCol, nStartRow, nEndCol, nEndRow ) )
- {
- bOk = false;
- }
- return !bOk;
-}
-
bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix )
{
// if rCell is part of a matrix formula, return its complete range
diff --git a/sc/source/ui/inc/asciiopt.hxx b/sc/source/ui/inc/asciiopt.hxx
index 45107c19ad22..868533035ea6 100644
--- a/sc/source/ui/inc/asciiopt.hxx
+++ b/sc/source/ui/inc/asciiopt.hxx
@@ -45,7 +45,7 @@
// ============================================================================
-class SC_DLLPUBLIC ScAsciiOptions
+class ScAsciiOptions
{
private:
sal_Bool bFixedLen;
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index 6bad36293396..84a52229a1b7 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -54,7 +54,7 @@ struct ScExportTextOptions
bool mbAddQuotes;
};
-class SC_DLLPUBLIC ScImportExport
+class ScImportExport
{
ScDocShell* pDocSh;
ScDocument* pDoc;
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 36bdab18c955..10b2b9c1b293 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -295,7 +295,7 @@ public:
void GetSaveState( SfxItemSet& rSet );
void ExecSearch( SfxRequest& rReq );
- SC_DLLPUBLIC void ExecuteUndo(SfxRequest& rReq);
+ void ExecuteUndo(SfxRequest& rReq);
void GetUndoState(SfxItemSet &rSet);
void ExecuteSbx( SfxRequest& rReq );
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 4d7a92786802..4ecc009653a8 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -461,91 +461,6 @@ void SAL_CALL ScViewPaneObj::release() throw()
OWeakObject::release();
}
-// To process sheet compatibile event
-typedef ::cppu::WeakImplHelper2< awt::XEnhancedMouseClickHandler, view::XSelectionChangeListener > TabViewEventListener_BASE;
-class ScTabViewEventListener: public TabViewEventListener_BASE
-{
-private:
- ScTabViewObj* pViewObj;
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper;
- sal_Bool bDelaySelectionEvent;
- sal_Bool bSelectionChangeOccurred;
-
- void fireSelectionChangeEvent();
-
-public:
- ScTabViewEventListener( ScTabViewObj* pObj, uno::Reference< script::vba::XVBAEventProcessor >& rVbaEventsHelper);
- ~ScTabViewEventListener();
- // XEnhancedMouseClickHandler
- virtual sal_Bool SAL_CALL mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
- virtual sal_Bool SAL_CALL mouseReleased( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
-
- // XSelectionChangeListener
- virtual void SAL_CALL selectionChanged( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
- // XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-};
-
-ScTabViewEventListener::ScTabViewEventListener(ScTabViewObj* pObj, uno::Reference< script::vba::XVBAEventProcessor >& rVbaEventsHelper):
- pViewObj( pObj ),xVbaEventsHelper( rVbaEventsHelper ), bDelaySelectionEvent( false ), bSelectionChangeOccurred( false )
-{
-}
-
-ScTabViewEventListener::~ScTabViewEventListener()
-{
-}
-
-void SAL_CALL ScTabViewEventListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-{
-}
-
-void ScTabViewEventListener::fireSelectionChangeEvent()
-{
- if ( xVbaEventsHelper.is() && pViewObj )
- {
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] = pViewObj->getSelection();
- try
- {
- xVbaEventsHelper->processVbaEvent( script::vba::VBAEventId::WORKSHEET_SELECTIONCHANGE, aArgs );
- }
- catch( uno::Exception& )
- {
- }
- }
- bDelaySelectionEvent = false;
- bSelectionChangeOccurred = false;
-}
-
-sal_Bool SAL_CALL ScTabViewEventListener::mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException)
-{
- // Delay to fire the selection change event if clicking the left mouse button to do selection.
- bDelaySelectionEvent = ( e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT ) ? false : sal_True;
- bSelectionChangeOccurred = false;
-
- // ScTabViewObj::MousePressed should handle process BeforeDoubleClick and BeforeRightClick events
- return sal_True;
-}
-
-sal_Bool SAL_CALL ScTabViewEventListener::mouseReleased( const awt::EnhancedMouseEvent&/*e*/) throw (uno::RuntimeException)
-{
- if ( bSelectionChangeOccurred )
- fireSelectionChangeEvent();
- return sal_True;
-}
-
-void SAL_CALL ScTabViewEventListener::selectionChanged( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-{
- if ( !bDelaySelectionEvent )
- {
- fireSelectionChangeEvent();
- }
- else
- {
- bSelectionChangeOccurred = sal_True;
- }
-}
-
//------------------------------------------------------------------------
// Default-ctor wird fuer SMART_REFLECTION_IMPLEMENTATION gebraucht
@@ -559,24 +474,8 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
nPreviousTab( 0 ),
bDrawSelModeSet(false)
{
- if (!pViewSh)
- return;
-
- nPreviousTab = pViewSh->GetViewData()->GetTabNo();
- ScViewData* pViewData = pViewSh->GetViewData();
- if (!pViewData)
- return;
-
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper(
- pViewData->GetDocument()->GetVbaEventProcessor(), uno::UNO_QUERY );
- if (!xVbaEventsHelper.is())
- return;
-
- ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
- uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
- addEnhancedMouseClickHandler( aMouseClickHandler );
- uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
- addSelectionChangeListener( aSelectionChangeListener );
+ if (pViewSh)
+ nPreviousTab = pViewSh->GetViewData()->GetTabNo();
}
ScTabViewObj::~ScTabViewObj()
@@ -1208,16 +1107,7 @@ uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTabViewObj::getActiveSheet()
void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet )
throw(uno::RuntimeException)
{
- selectSheet(xActiveSheet, false);
-}
-
-void SAL_CALL
-ScTabViewObj::selectSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet,
- sal_Bool bExpand)
- throw(uno::RuntimeException)
-{
SolarMutexGuard aGuard;
- sal_Bool bNew = bExpand;
ScTabViewShell* pViewSh = GetViewShell();
if ( pViewSh && xActiveSheet.is() )
@@ -1232,7 +1122,7 @@ ScTabViewObj::selectSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveShe
{
SCTAB nNewTab = rRanges[ 0 ]->aStart.Tab();
if ( pViewSh->GetViewData()->GetDocument()->HasTable(nNewTab) )
- pViewSh->SetTabNo( nNewTab, bNew, bExpand );
+ pViewSh->SetTabNo( nNewTab );
}
}
}
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index 90848f49a858..2da0df5c1a32 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -35,9 +35,6 @@
#include "transobj.hxx"
#include "scmod.hxx"
#include "cellsuno.hxx"
-#include "compiler.hxx"
-#include "token.hxx"
-#include "tokenarray.hxx"
#include <com/sun/star/script/vba/VBAEventId.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -122,16 +119,6 @@ ScDocument* GetDocumentFromRange( const uno::Reference< uno::XInterface >& xRang
return pDocShell->GetDocument();
}
-uno::Reference< frame::XModel > GetModelFromRange( const uno::Reference< uno::XInterface >& xRange ) throw ( uno::RuntimeException )
-{
- ScDocShell* pDocShell = GetDocShellFromRange( xRange );
- if ( !pDocShell )
- {
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying model uno range object" ) ), uno::Reference< uno::XInterface >() );
- }
- return pDocShell->GetModel();
-}
-
void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs )
{
ScTabViewShell* pViewSh = excel::getBestViewShell( xModel );
@@ -262,24 +249,6 @@ void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, sal_uInt16
}
-bool implnCopyRanges( const uno::Reference< frame::XModel>& xModel, ScRangeList& rRangeList )
-{
- bool bResult = false;
- ScTabViewShell* pViewShell = getBestViewShell( xModel );
- if ( pViewShell )
- {
- bResult = pViewShell->CopyToClip( NULL, rRangeList, false, true, true );
- }
- return bResult;
-}
-
-bool implnCopyRange( const uno::Reference< frame::XModel>& xModel, const ScRange& rRange )
-{
- ScRangeList aRanges;
- aRanges.Append( rRange );
- return implnCopyRanges( xModel, aRanges );
-}
-
ScDocShell*
getDocShell( const css::uno::Reference< css::frame::XModel>& xModel )
{
@@ -308,17 +277,13 @@ getCurrentBestViewShell( const uno::Reference< uno::XComponentContext >& xConte
return getBestViewShell( xModel );
}
-sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const rtl::OUString& sRangeStr )
+SfxViewFrame*
+getViewFrame( const uno::Reference< frame::XModel >& xModel )
{
- ScRangeList aCellRanges;
- String sAddress( sRangeStr );
- sal_uInt16 nMask = SCA_VALID;
- sal_uInt16 rResFlags = aCellRanges.Parse( sAddress, pDoc, nMask, formula::FormulaGrammar::CONV_XL_R1C1 );
- if ( rResFlags & SCA_VALID )
- {
- return sal_True;
- }
- return false;
+ ScTabViewShell* pViewShell = getBestViewShell( xModel );
+ if ( pViewShell )
+ return pViewShell->GetViewFrame();
+ return NULL;
}
uno::Reference< vba::XHelperInterface >
@@ -336,84 +301,6 @@ getUnoSheetModuleObj( const uno::Reference< sheet::XSpreadsheet >& xSheet ) thro
return xParent;
}
-formula::FormulaGrammar::Grammar GetFormulaGrammar( ScDocument* pDoc, const ScAddress& sAddress, const css::uno::Any& aFormula )
-{
- formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_NATIVE_XL_A1;
- if ( pDoc && aFormula.hasValue() && aFormula.getValueTypeClass() == uno::TypeClass_STRING )
- {
- rtl::OUString sFormula;
- aFormula >>= sFormula;
-
- ScCompiler aCompiler( pDoc, sAddress );
- aCompiler.SetGrammar( formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
- ScTokenArray* pCode = aCompiler.CompileString( sFormula );
- if ( pCode )
- {
- sal_uInt16 nLen = pCode->GetLen();
- formula::FormulaToken** pTokens = pCode->GetArray();
- for ( sal_uInt16 nPos = 0; nPos < nLen; nPos++ )
- {
- const formula::FormulaToken& rToken = *pTokens[nPos];
- switch ( rToken.GetType() )
- {
- case formula::svSingleRef:
- case formula::svDoubleRef:
- {
- return formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1;
- }
- break;
- default: break;
- }
- }
- }
- }
- return eGrammar;
-}
-
-void CompileExcelFormulaToODF( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula )
-{
- if ( !pDoc )
- {
- return;
- }
- ScCompiler aCompiler( pDoc, ScAddress() );
- aCompiler.SetGrammar( excel::GetFormulaGrammar( pDoc, ScAddress(), uno::Any( rtl::OUString( rOldFormula ) ) ) );
- aCompiler.CompileString( rOldFormula );
- aCompiler.SetGrammar( formula::FormulaGrammar::GRAM_PODF_A1 );
- aCompiler.CreateStringFromTokenArray( rNewFormula );
-}
-
-void CompileODFFormulaToExcel( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula, const formula::FormulaGrammar::Grammar eGrammar )
-{
- // eGrammar can be formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 and formula::FormulaGrammar::GRAM_NATIVE_XL_A1
- if ( !pDoc )
- {
- return;
- }
- ScCompiler aCompiler( pDoc, ScAddress() );
- aCompiler.SetGrammar( formula::FormulaGrammar::GRAM_PODF_A1 );
- ScTokenArray* pCode = aCompiler.CompileString( rOldFormula );
- aCompiler.SetGrammar( eGrammar );
- if ( !pCode )
- {
- return;
- }
- sal_uInt16 nLen = pCode->GetLen();
- formula::FormulaToken** pTokens = pCode->GetArray();
- for ( sal_uInt16 nPos = 0; nPos < nLen && pTokens[nPos]; nPos++ )
- {
- String rFormula;
- formula::FormulaToken* pToken = pTokens[nPos];
- aCompiler.CreateStringFromToken( rFormula, pToken, true );
- if ( pToken->GetOpCode() == ocSep )
- {
- // Excel formula separator is ",".
- rFormula = rtl::OUString(",");
- }
- rNewFormula += rFormula;
- }
-}
-
uno::Reference< XHelperInterface >
getUnoSheetModuleObj( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException )
{
diff --git a/sc/source/ui/vba/excelvbahelper.hxx b/sc/source/ui/vba/excelvbahelper.hxx
index 53f44c997f13..2009cc39a128 100644
--- a/sc/source/ui/vba/excelvbahelper.hxx
+++ b/sc/source/ui/vba/excelvbahelper.hxx
@@ -38,7 +38,6 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <ooo/vba/XHelperInterface.hpp>
-#include <formula/grammar.hxx>
class ScCellRangesBase;
@@ -54,16 +53,11 @@ void implnCopy( const css::uno::Reference< css::frame::XModel>& xModel );
void implnPaste ( const css::uno::Reference< css::frame::XModel>& xModel );
void implnCut( const css::uno::Reference< css::frame::XModel>& xModel );
void implnPasteSpecial( const css::uno::Reference< css::frame::XModel>& xModel, sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
-bool implnCopyRanges( const css::uno::Reference< css::frame::XModel>& xModel, ScRangeList& rRange );
-bool implnCopyRange( const css::uno::Reference< css::frame::XModel>& xModel, const ScRange& rRange );
ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
ScTabViewShell* getCurrentBestViewShell( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+SfxViewFrame* getViewFrame( const css::uno::Reference< css::frame::XModel >& xModel );
-sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const ::rtl::OUString& sRangeStr );
-formula::FormulaGrammar::Grammar GetFormulaGrammar( ScDocument* pDoc, const ScAddress& sAddress, const css::uno::Any& aFormula );
-void CompileExcelFormulaToODF( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula );
-void CompileODFFormulaToExcel( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula, const formula::FormulaGrammar::Grammar eGrammar );
css::uno::Reference< css::sheet::XUnnamedDatabaseRanges > GetUnnamedDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet ) throw ( css::uno::RuntimeException );
@@ -76,7 +70,6 @@ css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const cs
ScDocShell* GetDocShellFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
ScDocShell* GetDocShellFromRanges( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
ScDocument* GetDocumentFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
-css::uno::Reference< css::frame::XModel > GetModelFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
void setUpDocumentModules( const css::uno::Reference< css::sheet::XSpreadsheetDocument >& xDoc );
// ============================================================================
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index d962395b6dd2..b7b53f956392 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -28,14 +28,11 @@
#include <stdio.h>
-#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
#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 <ooo/vba/excel/XlCutCopyMode.hpp>
#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
#include <com/sun/star/sheet/XCalculatable.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -44,17 +41,10 @@
#include <ooo/vba/excel/XlMousePointer.hpp>
#include <com/sun/star/sheet/XNamedRanges.hpp>
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
+#include <ooo/vba/XExecutableDialog.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
-#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include<ooo/vba/XCommandBars.hpp>
-#include <ooo/vba/excel/XlEnableCancelKey.hpp>
-#include <ooo/vba/excel/XlApplicationInternational.hpp>
-#include <unotools/localedatawrapper.hxx>
#include "vbaapplication.hxx"
#include "vbaworkbooks.hxx"
@@ -73,19 +63,13 @@
#include <vbahelper/vbashape.hxx>
#include "vbatextboxshape.hxx"
#include "vbaassistant.hxx"
-#include "vbafilesearch.hxx" // add the support of VBA Application.FileSearch
#include "sc.hrc"
#include "macromgr.hxx"
-#include "global.hxx"
-#include "scmod.hxx"
-#include "docoptio.hxx"
#include "defaultsoptions.hxx"
#include <osl/file.hxx>
#include <rtl/instance.hxx>
-#include <map>
-
#include <sfx2/request.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/viewfrm.hxx>
@@ -106,7 +90,6 @@
#include <basic/sbuno.hxx>
#include <basic/sbmeth.hxx>
-#include "transobj.hxx"
#include "convuno.hxx"
#include "cellsuno.hxx"
#include "miscuno.hxx"
@@ -118,7 +101,6 @@
#include <basic/sbmod.hxx>
#include <basic/sbxobj.hxx>
-#include "vbafiledialog.hxx"
#include "viewutil.hxx"
using namespace ::ooo::vba;
@@ -306,18 +288,6 @@ ScVbaApplication::getAssistant() throw (uno::RuntimeException)
return uno::Reference< XAssistant >( new ScVbaAssistant( this, mxContext ) );
}
-// add support of VBA Application.FileSearch
-uno::Reference< XFileSearch > SAL_CALL
-ScVbaApplication::getFileSearch() throw (uno::RuntimeException)
-{
- if (! m_xFileSearch.get() )
- {
- m_xFileSearch = uno::Reference< XFileSearch >( new ScVbaFileSearch( this, uno::Reference< XHelperInterface >( this ), mxContext ) );
- }
-
- return m_xFileSearch;
-}
-
uno::Any SAL_CALL
ScVbaApplication::getSelection() throw (uno::RuntimeException)
{
@@ -469,67 +439,16 @@ ScVbaApplication::getActiveWindow() throw (uno::RuntimeException)
uno::Any SAL_CALL
ScVbaApplication::getCutCopyMode() throw (uno::RuntimeException)
{
+ //# FIXME TODO, implementation
uno::Any result;
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( NULL );
- ScDocument* pDoc = pOwnClip ? pOwnClip->GetDocument() : NULL;
- if ( pDoc )
- {
- if ( pDoc->IsCutMode() )
- {
- result <<= excel::XlCutCopyMode::xlCut;
- }
- else
- {
- result <<= excel::XlCutCopyMode::xlCopy;
- }
- }
- else
- {
- result <<= false;
- }
+ result <<= sal_False;
return result;
}
void SAL_CALL
-ScVbaApplication::setCutCopyMode( const uno::Any& _cutcopymode ) throw (uno::RuntimeException)
+ScVbaApplication::setCutCopyMode( const uno::Any& /* _cutcopymode */ ) throw (uno::RuntimeException)
{
- // According to Excel's behavior, no matter what is the value of _cutcopymode, always releases the clip object.
- sal_Bool bCutCopyMode = false;
- if ( ( _cutcopymode >>= bCutCopyMode ) )
- {
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( NULL );
- if ( pOwnClip )
- {
- pOwnClip->ObjectReleased();
- ScTabViewShell* pTabViewShell = excel::getBestViewShell( getCurrentDocument() );
- if ( pTabViewShell )
- {
- ScViewData* pView = pTabViewShell->GetViewData();
- Window* pWindow = pView ? pView->GetActiveWin() : NULL;
- if ( pWindow )
- {
- Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard();
- Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
- if ( xClipboard.is() )
- {
- xClipboard->setContents( NULL, NULL );
- if ( xFlushableClipboard.is() )
- {
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
- try
- {
- xFlushableClipboard->flushClipboard();
- }
- catch (const uno::Exception&)
- {
- }
- Application::AcquireSolarMutex( nRef );
- }
- }
- }
- }
- }
- }
+ //# FIXME TODO, implementation
}
uno::Any SAL_CALL
@@ -956,90 +875,6 @@ ScVbaApplication::setShowWindowsInTaskbar( sal_Bool bSet ) throw (css::uno::Runt
mrAppSettings.mbShowWindowsInTaskbar = bSet;
}
-sal_Bool SAL_CALL
-ScVbaApplication::getVisible() throw (uno::RuntimeException)
-{
- sal_Bool bVisible = sal_True;
- return bVisible;
-}
-
-void SAL_CALL
-ScVbaApplication::setVisible(sal_Bool /*bVisible*/) throw (uno::RuntimeException)
-{
-}
-
-//add the support of Excel VBA Application.Iteration
-//The Excel Iteration option is global and unique, but in Symphony there is an Iteration property in ScModule and one in every ScDocument,
-//so the set method will set all the Iteration properties
-sal_Bool SAL_CALL
-ScVbaApplication::getIteration() throw (uno::RuntimeException)
-{
- ScModule* pScMod = SC_MOD();
- ScDocOptions aDocOpt = pScMod->GetDocOptions();
-
- return aDocOpt.IsIter();
-}
-
-void SAL_CALL
-ScVbaApplication::setIteration(sal_Bool bIteration) throw (uno::RuntimeException)
-{
- ScModule* pScMod = SC_MOD();
- ScDocOptions& aDocOpt = const_cast< ScDocOptions& > (pScMod->GetDocOptions());
- aDocOpt.SetIter( bIteration );
-
- uno::Any aIteration;
- aIteration <<= bIteration;
-
- OUString aPropName(RTL_CONSTASCII_USTRINGPARAM( "IsIterationEnabled" ));
-
- uno::Reference< XCollection > xWorkbooks( new ScVbaWorkbooks( this, mxContext ) );
- sal_Int32 nCount = xWorkbooks->getCount();
-
- for (sal_Int32 i = 1; i <= nCount; i++)
- {
- uno::Reference< ooo::vba::excel::XWorkbook > xWorkbook;
- uno::Any aWorkbook = xWorkbooks->Item(uno::makeAny(i), uno::Any());
- aWorkbook >>= xWorkbook;
- ScVbaWorkbook* pWorkbook = excel::getImplFromDocModuleWrapper<ScVbaWorkbook>( xWorkbook );
- uno::Reference< frame::XModel > xModel( pWorkbook->getDocModel(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
- xPropertySet->setPropertyValue( aPropName, aIteration );
- }
-}
-
-//add the support of Excel VBA Application.EnableCancelKey
-sal_Int32 SAL_CALL
-ScVbaApplication::getEnableCancelKey() throw (uno::RuntimeException)
-{
- return ooo::vba::excel::XlEnableCancelKey::xlDisabled;
-}
-
-void SAL_CALL
-ScVbaApplication::setEnableCancelKey(sal_Int32 /*lEnableCancelKey*/) throw (uno::RuntimeException)
-{
-}
-
-sal_Int32 SAL_CALL ScVbaApplication::getSheetsInNewWorkbook() throw (uno::RuntimeException)
-{
- const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
- return rOpt.GetInitTabCount();
-}
-
-void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- if ( SheetsInNewWorkbook < MININITTAB
- || SheetsInNewWorkbook > MAXINITTAB )
- {
- DebugHelper::exception( OUString(RTL_CONSTASCII_USTRINGPARAM("The number must be between 1 and 1024")),
- uno::Exception(), SbERR_METHOD_FAILED, OUString() );
- }
- else
- {
- ScDefaultsOptions& rOpt = const_cast< ScDefaultsOptions& >(SC_MOD()->GetDefaultsOptions());
- rOpt.SetInitTabCount( SheetsInNewWorkbook );
- }
-}
-
void SAL_CALL
ScVbaApplication::Calculate() throw( script::BasicErrorException , uno::RuntimeException )
{
@@ -1467,310 +1302,6 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep
return aRet;
}
-uno::Any SAL_CALL
-ScVbaApplication::GetOpenFilename(const uno::Any& FileFilter, const uno::Any& FilterIndex, const uno::Any& Title, const uno::Any& ButtonText, const uno::Any& MultiSelect) throw (uno::RuntimeException)
-{
- uno::Any aRet = uno::makeAny( false );
- try
- {
- const rtl::OUString sServiceName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ));
- uno::Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
- // Set the type of File Picker Dialog: TemplateDescription::FILEOPEN_SIMPLE.
- uno::Sequence< uno::Any > aDialogType( 1 );
- aDialogType[0] <<= ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
- uno::Reference< ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
- uno::Reference< ui::dialogs::XFilePicker2 > xFilePicker2( xFilePicker, UNO_QUERY );
- uno::Reference< ui::dialogs::XFilterManager > xFilterManager( xFilePicker, UNO_QUERY );
- uno::Reference< ui::dialogs::XExecutableDialog > xExecutableDialog( xFilePicker, UNO_QUERY );
- uno::Reference< ui::dialogs::XFilePickerControlAccess > xPickerControlAccess( xFilePicker, UNO_QUERY );
-
- if ( xFilterManager.is() && FileFilter.hasValue() )
- {
- sal_Int32 nFilterIndex = 1;
- if ( FilterIndex.hasValue() )
- {
- FilterIndex >>= nFilterIndex;
- }
- ::rtl::OUString strFilter;
- FileFilter >>= strFilter;
- sal_Int32 nCommaID = 0;
- sal_Int32 nIndex = 1;
- do
- {
- ::rtl::OUString aFilterTitleToken = strFilter.getToken( 0, ',' , nCommaID );
- ::rtl::OUString aFilterToken;
- if ( nCommaID >= 0 )
- {
- aFilterToken = strFilter.getToken( 0, ',' , nCommaID );
- }
- else if ( nCommaID < 0 && nIndex == 1 )
- {
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid FileFilter format!" )),
- uno::Reference< uno::XInterface >() );
- }
- xFilterManager->appendFilter( aFilterTitleToken, aFilterToken );
- if ( nFilterIndex == nIndex )
- {
- xFilterManager->setCurrentFilter( aFilterTitleToken );
- }
- nIndex++;
- } while ( nCommaID >= 0 );
- }
- if ( xExecutableDialog.is() && Title.hasValue() )
- {
- ::rtl::OUString sTitle;
- Title >>= sTitle;
- xExecutableDialog->setTitle( sTitle );
- }
- if ( xPickerControlAccess.is() && ButtonText.hasValue() )
- {
- ::rtl::OUString sButtonText;
- ButtonText >>= sButtonText;
- xPickerControlAccess->setLabel( ui::dialogs::CommonFilePickerElementIds::PUSHBUTTON_OK, sButtonText );
- }
- sal_Bool bMultiSelect = false;
- if ( xFilePicker.is() && MultiSelect.hasValue() )
- {
- MultiSelect >>= bMultiSelect;
- xFilePicker->setMultiSelectionMode( bMultiSelect );
- }
-
- if ( xFilePicker.is() && xFilePicker->execute() )
- {
- uno::Sequence< rtl::OUString > aSelectedFiles;
- if ( xFilePicker2.is() )
- {
- // On Linux, XFilePicker->getFiles() always return one selected file although we select more than one file, also on Vista
- // XFilePicker->getFiles() does not work well too, so we call XFilePicker2->getSelectedFiles() to get selected files.
- aSelectedFiles = xFilePicker2->getSelectedFiles();
- }
- else
- {
- // If only one file is selected, the first entry of the sequence contains the complete path/filename in URL format. If multiple files are selected,
- // the first entry of the sequence contains the path in URL format, and the other entries contains the names of the selected files without path information.
- uno::Sequence< rtl::OUString > aTmpFiles = xFilePicker->getFiles();
- aSelectedFiles = aTmpFiles;
- sal_Int32 iFileCount = aTmpFiles.getLength();
- if ( iFileCount > 1 )
- {
- aSelectedFiles.realloc( iFileCount - 1 );
- INetURLObject aPath( aTmpFiles[0] );
- aPath.setFinalSlash();
- for ( sal_Int32 i = 1; i < iFileCount; i++ )
- {
- if ( aTmpFiles[i].indexOf ('/') > 0 || aTmpFiles[i].indexOf ('\\') > 0 )
- {
- aSelectedFiles[i - 1] = aTmpFiles[i];
- }
- else
- {
- if ( i == 1 )
- aPath.Append( aTmpFiles[i] );
- else
- aPath.setName( aTmpFiles[i] );
- aSelectedFiles[i - 1] = aPath.GetMainURL( INetURLObject::NO_DECODE );
- }
- }
- }
- }
-
- sal_Int32 iFileCount = aSelectedFiles.getLength();
- for ( sal_Int32 i = 0; i < iFileCount; i++ )
- {
- INetURLObject aObj( aSelectedFiles[i] );
- if ( aObj.GetProtocol() == INET_PROT_FILE )
- {
- rtl::OUString aTemp = aObj.PathToFileName();
- aSelectedFiles[i] = aTemp.isEmpty() ? aSelectedFiles[i] : aTemp ;
- }
- }
- if ( bMultiSelect )
- {
- aRet = uno::makeAny( aSelectedFiles );
- }
- else if ( aSelectedFiles.getLength() > 0 && !bMultiSelect )
- {
- aRet = uno::makeAny( aSelectedFiles[0] );
- }
- }
- }
- catch (const uno::Exception&)
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
-
- return aRet;
-}
-
-::com::sun::star::uno::Reference< ::ooo::vba::XFileDialog > SAL_CALL
-ScVbaApplication::getFileDialog() throw (::com::sun::star::uno::RuntimeException)
-{
- uno::Reference< XFileDialog > xFileDialogs( new ScVbaFileDialog( uno::Reference< XHelperInterface >( this ), mxContext, getCurrentDocument() ) );
- return xFileDialogs;
-}
-
-typedef std::map< ::rtl::OUString, ::rtl::OUString > FileFilterMap;
-
-uno::Any SAL_CALL
-ScVbaApplication::GetSaveAsFilename( const ::com::sun::star::uno::Any& InitialFilename, const ::com::sun::star::uno::Any& FileFilter, const ::com::sun::star::uno::Any& FilterIndex, const ::com::sun::star::uno::Any& Title, const ::com::sun::star::uno::Any& ButtonText ) throw (::com::sun::star::uno::RuntimeException)
-{
- uno::Any strRet;
- try
- {
- const rtl::OUString sServiceName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ));
- uno::Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-
- uno::Sequence< uno::Any > aDialogType( 1 );
- aDialogType[0] <<= ui::dialogs::TemplateDescription::FILESAVE_SIMPLE;
- uno::Reference< ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
-
- if (InitialFilename.hasValue())
- {
- ::rtl::OUString strInitFileName;
- InitialFilename >>= strInitFileName;
- xFilePicker->setDefaultName(strInitFileName);
- }
-
- // Begin from 1.
- sal_Int32 nFilterIndex = 1;
- if (FilterIndex.hasValue())
- {
- FilterIndex >>= nFilterIndex;
- }
-
- uno::Reference< ui::dialogs::XFilterManager > xFilter( xFilePicker, UNO_QUERY );
- FileFilterMap mFilterNameMap;
- if (FileFilter.hasValue())
- {
- ::rtl::OUString strFilter;
- sal_Int32 nCommaID = 0;
- FileFilter >>= strFilter;
-
- sal_Int32 nIndex = 1;
- do
- {
- ::rtl::OUString aFilterTitleToken = strFilter.getToken( 0, ',' , nCommaID );
- ::rtl::OUString aFilterToken;
- if ( nCommaID >= 0 )
- {
- aFilterToken = strFilter.getToken( 0, ',' , nCommaID );
- }
- else if ( nCommaID < 0 && nIndex == 1 )
- {
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid FileFilter format!" )),
- uno::Reference< uno::XInterface >() );
- }
-
- FileFilterMap::const_iterator aIt = mFilterNameMap.find( aFilterTitleToken );
- if ( aIt == mFilterNameMap.end() )
- {
- xFilter->appendFilter( aFilterTitleToken, aFilterToken );
- if ( nFilterIndex == nIndex )
- {
- xFilter->setCurrentFilter( aFilterTitleToken );
- }
- nIndex++;
- mFilterNameMap[aFilterTitleToken] = aFilterToken;
- }
- } while ( nCommaID >= 0 );
- }
-
- if (Title.hasValue())
- {
- ::rtl::OUString strTitle;
- Title >>= strTitle;
- uno::Reference< ::com::sun::star::ui::dialogs::XExecutableDialog> xExcTblDlg(xFilePicker, UNO_QUERY );
- xExcTblDlg->setTitle(strTitle);
- }
-
- if (ButtonText.hasValue())
- {
- ::rtl::OUString strBttTxt;
- ButtonText >>= strBttTxt;
- }
-
-
- if ( xFilePicker.is() )
- {
- sal_Int16 nRet = xFilePicker->execute();
- if (nRet == 0)
- {
- strRet <<= false;
- }
- else
- {
- uno::Sequence < rtl::OUString > aPathSeq = xFilePicker->getFiles();
-
- if ( aPathSeq.getLength() )
- {
- ::rtl::OUString sSelectedFilters;
- if ( xFilter.is() )
- {
- ::rtl::OUString sSelectedFilterName = xFilter->getCurrentFilter();
- FileFilterMap::const_iterator aIt = mFilterNameMap.find( sSelectedFilterName );
- if ( aIt != mFilterNameMap.end() )
- {
- sSelectedFilters = aIt->second;
- }
- }
- INetURLObject aURLObj( aPathSeq[0] );
- ::rtl::OUString aPathStr = aURLObj.PathToFileName();
- if ( aURLObj.GetProtocol() == INET_PROT_FILE )
- {
- sal_Int32 nSemicolonID = 0;
- ::rtl::OUString sFirstFilter = sSelectedFilters.getToken( 0, ';' , nSemicolonID );
- ::rtl::OUString sFileExtension = aURLObj.GetExtension();
- if ( sFileExtension.isEmpty() )
- {
- sFileExtension = sFirstFilter == "*.*" ? sFileExtension : sFirstFilter.copy( sFirstFilter.indexOfAsciiL("*.", 2) + 2 );
- aPathStr = sFileExtension.isEmpty() ? aPathStr : aPathStr + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")) + sFileExtension;
- }
- else
- {
- sal_Bool bValidFilter = false;
- FileFilterMap::const_iterator aIt = mFilterNameMap.begin();
- while ( aIt != mFilterNameMap.end() )
- {
- sSelectedFilters = aIt->second;
- nSemicolonID = 0;
- do
- {
- ::rtl::OUString aFilterToken = sSelectedFilters.getToken( 0, ';' , nSemicolonID );
- if ( aFilterToken.trim().equalsIgnoreAsciiCase( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*.")) + sFileExtension) )
- {
- bValidFilter = sal_True;
- break;
- }
- } while ( nSemicolonID >= 0 );
- if ( bValidFilter )
- {
- break;
- }
- ++aIt;
- }
- if ( !bValidFilter )
- {
- sFileExtension = sFirstFilter == "*.*" ? rtl::OUString()
- : sFirstFilter.copy( sFirstFilter.indexOfAsciiL("*.", 2) + 2 );
- aPathStr = sFileExtension.isEmpty() ? aPathStr
- : aPathStr + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")) + sFileExtension;
- }
- }
- }
- strRet <<= aPathStr;
- }
- }
- }
- }
- catch (const uno::Exception&)
- {
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- }
- return strRet;
-}
-
-//end add
-
uno::Reference< frame::XModel >
ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
{
@@ -1790,86 +1321,6 @@ ScVbaApplication::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeExceptio
return uno::Any( xMenuBars );
}
-//add the support of Application.International
-sal_Int32 SAL_CALL
-ConvertCountryCode(const OUString& language)
-{
- sal_Int32 nCode = 0;
-
- if( language == "ar" ) nCode = 966; // Arabic
- else if ( language == "cs" ) nCode = 42; // Czech
- else if ( language == "da" ) nCode = 45; // Danish
- else if ( language == "de" ) nCode = 49; // German
- else if ( language == "en" ) nCode = 1; // English
- else if ( language == "es" ) nCode = 34; // Spanish
- else if ( language == "el" ) nCode = 30; // Greek
- else if ( language == "fa" ) nCode = 98; // Persian = Farsi
- else if ( language == "fi" ) nCode = 358; // Finnish
- else if ( language == "fr" ) nCode = 33; // French
- else if ( language == "he" ) nCode = 972; // Hebrew
- else if ( language == "hi" ) nCode = 91; // Indian = Hindi
- else if ( language == "hu" ) nCode = 36; // Hungarian
- else if ( language == "it" ) nCode = 39; // Italian
- else if ( language == "ja" ) nCode = 81; // Japanese
- else if ( language == "ko" ) nCode = 82; // Korean
- else if ( language == "nl" ) nCode = 31; // Dutch
- else if ( language == "no" ) nCode = 47; // Norwegian
- else if ( language == "pl" ) nCode = 48; // Polish
- else if ( language == "pt" ) nCode = 351; // Portuguese
- else if ( language == "ru" ) nCode = 7; // Russian
- else if ( language == "sv" ) nCode = 46; // Swedish
- else if ( language == "th" ) nCode = 66; // Thai
- else if ( language == "tk" ) nCode = 90; // Turkish
- else if ( language == "ur" ) nCode = 92; // Urdu
- else if ( language == "vi" ) nCode = 84; // Vietnamese
- else if ( language == "zh" ) nCode = 86; // Simplified Chinese
-
- return nCode;
-}
-
-uno::Any SAL_CALL
-ScVbaApplication::International( sal_Int32 Index ) throw (uno::RuntimeException)
-{
- uno::Any aRet;
- OUString str;
- const LocaleDataWrapper* pLocaleData = ScGlobal::GetpLocaleData();
- switch ( Index )
- {
- case excel::XlApplicationInternational::xlCountryCode:
- aRet <<= ConvertCountryCode( pLocaleData->getLanguageCountryInfo().Language );
- break;
- case excel::XlApplicationInternational::xlDecimalSeparator:
- str = pLocaleData->getNumDecimalSep();
- aRet <<= str;
- break;
- case excel::XlApplicationInternational::xlDateSeparator:
- str = pLocaleData->getDateSep();
- aRet <<= str;
- break;
- default:
- break;
- }
- return aRet;
-}
-
-void SAL_CALL ScVbaApplication::Undo( ) throw (::com::sun::star::uno::RuntimeException)
-{
- SfxAllItemSet reqList( SFX_APP()->GetPool() );
- SfxRequest rReq(SID_UNDO, 0, reqList);
- ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext );
-
- if (pViewShell != NULL)
- {
- pViewShell->ExecuteUndo(rReq);
- }
-}
-
-double SAL_CALL ScVbaApplication::InchesToPoints( double Inches ) throw (uno::RuntimeException)
-{
- // Convert a measurement from Inch to Point (1 inch = 72 points).
- return MetricField::ConvertDoubleValue( Inches, 0, 0, FUNIT_INCH, FUNIT_POINT );
-}
-
rtl::OUString
ScVbaApplication::getServiceImplName()
{
diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx
index 0f72d7bfaef5..751175c68220 100644
--- a/sc/source/ui/vba/vbaapplication.hxx
+++ b/sc/source/ui/vba/vbaapplication.hxx
@@ -48,7 +48,6 @@ private:
ScVbaAppSettings& mrAppSettings;
rtl::OUString getOfficePath( const rtl::OUString& sPath ) throw ( css::uno::RuntimeException );
- css::uno::Reference< ov::XFileSearch > m_xFileSearch;
protected:
virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
@@ -94,7 +93,6 @@ public:
virtual void SAL_CALL setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException );
virtual css::uno::Reference< ov::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ov::XFileSearch > SAL_CALL getFileSearch() throw (css::uno::RuntimeException); // add the support of Application.FileSearch
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);
@@ -108,17 +106,6 @@ public:
virtual ::sal_Int32 SAL_CALL getCursor() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCursor( ::sal_Int32 _cursor ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL getIteration() throw (css::uno::RuntimeException); // add the support of Iteration
- virtual void SAL_CALL setIteration( sal_Bool bIteration ) throw (css::uno::RuntimeException); // add the support of Iteration
- virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException); // add the support of EnableCancelKey
- virtual void SAL_CALL setEnableCancelKey( sal_Int32 lEnableCancelKey ) throw (css::uno::RuntimeException); // add the support of EnableCancelKey
-
- virtual sal_Int32 SAL_CALL getSheetsInNewWorkbook() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-
virtual sal_Bool SAL_CALL getEnableEvents() throw (css::uno::RuntimeException);
virtual void SAL_CALL setEnableEvents( sal_Bool bEnable ) throw (css::uno::RuntimeException);
@@ -144,12 +131,6 @@ public:
virtual void SAL_CALL Volatile( const css::uno::Any& Volatile ) throw (css::uno::RuntimeException );
virtual css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL GetOpenFilename( const css::uno::Any& FileFilter, const css::uno::Any& FilterIndex, const css::uno::Any& Title, const css::uno::Any& ButtonText, const css::uno::Any& MultiSelect ) throw (css::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::ooo::vba::XFileDialog > SAL_CALL getFileDialog() throw (::com::sun::star::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL International( sal_Int32 Index ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL GetSaveAsFilename( const ::com::sun::star::uno::Any& InitialFilename, const ::com::sun::star::uno::Any& FileFilter, const ::com::sun::star::uno::Any& FilterIndex, const ::com::sun::star::uno::Any& Title, const ::com::sun::star::uno::Any& ButtonText ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL Undo( ) throw (::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL InchesToPoints( double Inches ) throw (css::uno::RuntimeException);
// XHelperInterface
virtual rtl::OUString getServiceImplName();
diff --git a/sc/source/ui/vba/vbacomment.cxx b/sc/source/ui/vba/vbacomment.cxx
index bce3c19673f5..e30fd5e29a90 100644
--- a/sc/source/ui/vba/vbacomment.cxx
+++ b/sc/source/ui/vba/vbacomment.cxx
@@ -39,14 +39,6 @@
#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/text/XText.hpp>
-#include <cellsuno.hxx>
-#include <postit.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/svdocapt.hxx>
-#include <ooo/vba/msforms/XShape.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-
#include <vbahelper/vbashape.hxx>
#include "vbaglobals.hxx"
#include "vbacomments.hxx"
@@ -187,6 +179,7 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
aText >>= sText;
uno::Reference< text::XSimpleText > xAnnoText( getAnnotation(), uno::UNO_QUERY_THROW );
+ rtl::OUString sAnnoText = xAnnoText->getString();
if ( aStart.hasValue() )
{
@@ -225,7 +218,6 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
getAnnotations()->insertNew( aAddress, sText );
}
- rtl::OUString sAnnoText = xAnnoText->getString();
return sAnnoText;
}
diff --git a/sc/source/ui/vba/vbadialog.cxx b/sc/source/ui/vba/vbadialog.cxx
index d7cbb7446b1d..9bb4e4c91293 100644
--- a/sc/source/ui/vba/vbadialog.cxx
+++ b/sc/source/ui/vba/vbadialog.cxx
@@ -32,56 +32,42 @@
using namespace ::ooo::vba;
using namespace ::com::sun::star;
-//solve the problem that "Application.Dialogs.Item(***).Show" and "Application.Dialogs.Count" cannot get the correct result
-struct DialogMatch
+static const rtl::OUString aStringList[]=
{
- sal_Int32 nVbaDlgIndex;
- rtl::OUString aOODlgName;
+ rtl::OUString( ".uno:Open" ),
+ rtl::OUString( ".uno:FormatCellDialog" ),
+ rtl::OUString( ".uno:InsertCell" ),
+ rtl::OUString( ".uno:Print" ),
+ rtl::OUString( ".uno:PasteSpecial" ),
+ rtl::OUString( ".uno:ToolProtectionDocument" ),
+ rtl::OUString( ".uno:ColumnWidth" ),
+ rtl::OUString( ".uno:DefineName" ),
+ rtl::OUString( ".uno:ConfigureDialog" ),
+ rtl::OUString( ".uno:HyperlinkDialog" ),
+ rtl::OUString( ".uno:InsertGraphic" ),
+ rtl::OUString( ".uno:InsertObject" ),
+ rtl::OUString( ".uno:PageFormatDialog" ),
+ rtl::OUString( ".uno:DataSort" ),
+ rtl::OUString( ".uno:RowHeight" ),
+ rtl::OUString( ".uno:AutoCorrectDlg" ),
+ rtl::OUString( ".uno:ConditionalFormatDialog" ),
+ rtl::OUString( ".uno:DataConsolidate" ),
+ rtl::OUString( ".uno:CreateNames" ),
+ rtl::OUString( ".uno:FillSeries" ),
+ rtl::OUString( ".uno:Validation"),
+ rtl::OUString( ".uno:DefineLabelRange" ),
+ rtl::OUString( ".uno:DataFilterAutoFilter" ),
+ rtl::OUString( ".uno:DataFilterSpecialFilter" ),
+ rtl::OUString( ".uno:AutoFormat" )
};
-static const DialogMatch aDialogMatchList[] =
-{
- { 1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ) }, // xlDialogOpen -> .uno:Open
- { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ) }, // ??? -> .uno:FormatCellDialog
- { 55, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ) }, // xlDialogInsert -> .uno:InsertCell
- { 8, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ) }, // xlDialogPrint -> .uno:Print
- { 9, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrinterSetup" ) ) }, // xlDialogPrinterSetup -> .uno:PrinterSetup
- { 53, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ) }, // xlDialogPasteSpecial -> .uno:PasteSpecial
- { 28, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ) }, // xlDialogProtectDocument -> uno:ToolProtectionDocument
- { 47, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ) }, // xlDialogColumnWidth -> .uno:ColumnWidth
- { 61, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ) }, // xlDialogDefineName -> .uno:DefineName
- { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ) }, // ??? -> .uno:ConfigureDialog
- { 596, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ) }, // xlDialogInsertHyperlink -> .uno:HyperlinkDialog
- { 342, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ) }, // xlDialogInsertPicture -> .uno:InsertGraphic
- { 259, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ) }, // xlDialogInsertObject -> .uno:InsertObject
- { 7, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ) }, // xlDialogPageSetup -> .uno:PageFormatDialog
- { 39, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ) }, // xlDialogSort -> .uno:DataSort
- { 127, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ) }, // xlDialogRowHeight -> .uno:RowHeight
- { 485, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ) }, // xlDialogAutoCorrect -> .uno:AutoCorrectDlg
- { 583, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ) }, // xlDialogCondiationalFormatting -> .uno:ConditionalFormatDialog
- { 191, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ) }, // xlDialogConsolidate -> .uno:DataConsolidate
- { 62, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ) }, // xlDialogCreateNames -> .uno:CreateNames
- { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ) }, // ??? -> .uno:FillSeries
- { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation" ) ) }, // ??? -> .uno:Validation"
- { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ) }, // ??? -> .uno:DefineLabelRange
- { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ) }, // ??? -> .uno:DataFilterAutoFilter
- { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ) }, // ??? -> .uno:DataFilterSpecialFilter
- { 269, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) ) } // xlDialogFormatAuto -> .uno:AutoFormat
-};
-
-const sal_Int32 nDialogSize = sizeof (aDialogMatchList) / sizeof (aDialogMatchList[0]);
+const sal_Int32 nDialogSize = sizeof (aStringList) / sizeof (aStringList[0]);
rtl::OUString
ScVbaDialog::mapIndexToName( sal_Int32 nIndex )
{
- for (int i = 0; i < nDialogSize; i++)
- {
- if ( aDialogMatchList[i].nVbaDlgIndex == nIndex )
- {
- return aDialogMatchList[i].aOODlgName;
- }
- }
-
+ if( nIndex < nDialogSize )
+ return aStringList[ nIndex ];
return rtl::OUString();
}
@@ -102,9 +88,4 @@ ScVbaDialog::getServiceNames()
}
return aServiceNames;
}
-
-sal_Int32 ScVbaDialog::GetSupportedDialogCount()
-{
- return nDialogSize;
-}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbadialog.hxx b/sc/source/ui/vba/vbadialog.hxx
index 3bde7a7ff987..1ff2f651dfa9 100644
--- a/sc/source/ui/vba/vbadialog.hxx
+++ b/sc/source/ui/vba/vbadialog.hxx
@@ -47,7 +47,6 @@ public:
virtual rtl::OUString getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- static sal_Int32 GetSupportedDialogCount();
};
#endif /* SC_VBA_DIALOG_HXX */
diff --git a/sc/source/ui/vba/vbadialogs.cxx b/sc/source/ui/vba/vbadialogs.cxx
index f196ee2fa90c..15a06b5ff183 100644
--- a/sc/source/ui/vba/vbadialogs.cxx
+++ b/sc/source/ui/vba/vbadialogs.cxx
@@ -64,13 +64,4 @@ ScVbaDialogs::getServiceNames()
return aServiceNames;
}
-::sal_Int32
-ScVbaDialogs::getCount() throw (uno::RuntimeException)
-{
- return ScVbaDialog::GetSupportedDialogCount();
-}
-
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbadialogs.hxx b/sc/source/ui/vba/vbadialogs.hxx
index cda36dd18424..a0be27676405 100644
--- a/sc/source/ui/vba/vbadialogs.hxx
+++ b/sc/source/ui/vba/vbadialogs.hxx
@@ -45,7 +45,6 @@ public:
// XCollection
virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
// XDialogs
virtual void SAL_CALL Dummy() throw (css::uno::RuntimeException);
diff --git a/sc/source/ui/vba/vbafiledialog.cxx b/sc/source/ui/vba/vbafiledialog.cxx
deleted file mode 100644
index 7ae0a9eafb7a..000000000000
--- a/sc/source/ui/vba/vbafiledialog.cxx
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "vbafiledialog.hxx"
-#include "comphelper/processfactory.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include "tools/urlobj.hxx"
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-
-ScVbaFileDialog::ScVbaFileDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel )
-: ScVbaFileDialog_BASE( xParent, xContext, xModel )
-{
- m_pFileDialogSelectedItems = new VbaFileDialogSelectedItems(xParent, xContext, (com::sun::star::container::XIndexAccess *)&m_FileDialogSelectedObj);
-}
-
-ScVbaFileDialog::~ScVbaFileDialog()
-{
- if (m_pFileDialogSelectedItems != NULL)
- {
- delete m_pFileDialogSelectedItems;
- }
-}
-
-rtl::OUString
-ScVbaFileDialog::getServiceImplName()
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaFileDialog"));
-}
-
-css::uno::Sequence<rtl::OUString>
-ScVbaFileDialog::getServiceNames()
-{
- static Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.FileDialog" ) );
- }
- return aServiceNames;
-
-}
-
-css::uno::Reference< ov::XFileDialogSelectedItems > SAL_CALL
-ScVbaFileDialog::getSelectedItems() throw (css::uno::RuntimeException)
-{
- css::uno::Reference< ov::XFileDialogSelectedItems > xFileDlgSlc = (ov::XFileDialogSelectedItems *)m_pFileDialogSelectedItems;
- return xFileDlgSlc;
-}
-
-::sal_Int32 SAL_CALL
-ScVbaFileDialog::Show( ) throw (::com::sun::star::uno::RuntimeException)
-{
- // Returns an Integer indicating if user pressed "Open" button(-1) or "Cancel" button(0).
- sal_Int32 nResult = -1;
- try
- {
- m_sSelectedItems.realloc(0);
-
- const ::rtl::OUString sServiceName(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ));
-
- Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
- // Set the type of File Picker Dialog: TemplateDescription::FILEOPEN_SIMPLE.
- Sequence< uno::Any > aDialogType( 1 );
- aDialogType[0] <<= ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
- Reference < ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
- Reference < ui::dialogs::XFilePicker2 > xFilePicker2( xFilePicker, UNO_QUERY );
- if ( xFilePicker.is() )
- {
- xFilePicker->setMultiSelectionMode(sal_True);
- if ( xFilePicker->execute() )
- {
- if ( xFilePicker2.is() )
- {
- // On Linux, XFilePicker->getFiles() always return one selected file although we select
- // more than one file, also on Vista XFilePicker->getFiles() does not work well too,
- // so we call XFilePicker2->getSelectedFiles() to get selected files.
- m_sSelectedItems = xFilePicker2->getSelectedFiles();
- }
- else
- {
- // If only one file is selected, the first entry of the sequence contains the complete path/filename in
- // URL format. If multiple files are selected, the first entry of the sequence contains the path in URL
- // format, and the other entries contains the names of the selected files without path information.
- Sequence< rtl::OUString > aSelectedFiles = xFilePicker->getFiles();
- sal_Int32 iFileCount = aSelectedFiles.getLength();
- if ( iFileCount > 1 )
- {
- m_sSelectedItems.realloc( iFileCount - 1 );
- INetURLObject aPath( aSelectedFiles[0] );
- aPath.setFinalSlash();
- for ( sal_Int32 i = 1; i < iFileCount; i++ )
- {
- if ( aSelectedFiles[i].indexOf ('/') > 0 || aSelectedFiles[i].indexOf ('\\') > 0 )
- {
- m_sSelectedItems[i - 1] = aSelectedFiles[i];
- }
- else
- {
- if ( i == 1 )
- aPath.Append( aSelectedFiles[i] );
- else
- aPath.setName( aSelectedFiles[i] );
- m_sSelectedItems[i - 1] = aPath.GetMainURL(INetURLObject::NO_DECODE);
- }
- }
- }
- else if ( iFileCount == 1 )
- {
- m_sSelectedItems = aSelectedFiles;
- }
- }
-
- sal_Int32 iFileCount = m_sSelectedItems.getLength();
- rtl::OUString aTemp;
- for ( sal_Int32 i = 0; i < iFileCount; i++ )
- {
- INetURLObject aObj( m_sSelectedItems[i] );
- if ( aObj.GetProtocol() == INET_PROT_FILE )
- {
- aTemp = aObj.PathToFileName();
- m_sSelectedItems[i] = aTemp.isEmpty() ? m_sSelectedItems[i] : aTemp;
- }
- }
- }
- else
- {
- nResult = 0;
- }
- }
-
- m_FileDialogSelectedObj.SetSelectedFile(m_sSelectedItems);
- }
- catch( const uno::Exception& )
- {
- return 0;
- }
-
- return nResult;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbafiledialog.hxx b/sc/source/ui/vba/vbafiledialog.hxx
deleted file mode 100644
index 16ed4de39a01..000000000000
--- a/sc/source/ui/vba/vbafiledialog.hxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _vbafiledialog_hxx_
-#define _vbafiledialog_hxx_
-
-#include <cppuhelper/implbase1.hxx>
-#include <vbahelper/vbadialogsbase.hxx>
-#include <ooo/vba/XFileDialog.hpp>
-#include "vbafiledialogselecteditems.hxx"
-
-
-typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::XFileDialog > ScVbaFileDialog_BASE;
-
-class ScVbaFileDialog : public ScVbaFileDialog_BASE
-{
-public:
-
- ScVbaFileDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ) ;
- virtual ~ScVbaFileDialog() ;
-
- // XHelperInterface
- virtual rtl::OUString getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- //XFileDialog
- virtual css::uno::Reference< ov::XFileDialogSelectedItems > SAL_CALL getSelectedItems() throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL Show( ) throw (::com::sun::star::uno::RuntimeException) ;
-
-private:
- css::uno::Sequence < rtl::OUString > m_sSelectedItems;
- VbaFileDialogSelectedItems *m_pFileDialogSelectedItems;
- VbaFileDialogSelectedObj m_FileDialogSelectedObj;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbafiledialogselecteditems.cxx b/sc/source/ui/vba/vbafiledialogselecteditems.cxx
deleted file mode 100644
index 21fa2e75d88c..000000000000
--- a/sc/source/ui/vba/vbafiledialogselecteditems.cxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "vbafiledialogselecteditems.hxx"
-
-using namespace ::com::sun::star;
-
-VbaFileDialogSelectedItems::VbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess
- )
- : FileDialogSelectedItems_BASE( xParent, xContext, xIndexAccess )
-{
-}
-
-
-rtl::OUString VbaFileDialogSelectedItems::getServiceImplName()
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VbaFileDialogSelectedItems"));
-}
-
-css::uno::Sequence<rtl::OUString> VbaFileDialogSelectedItems::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FileDialogSelectedItems" ) );
- }
- return aServiceNames;
-
-}
-
-css::uno::Any VbaFileDialogSelectedItems::createCollectionObject( const css::uno::Any& aSource )
-{
- css::uno::Any aRet;
- aRet = aSource;
- return aRet;
-}
-
-
-css::uno::Type SAL_CALL
-VbaFileDialogSelectedItems::getElementType() throw (css::uno::RuntimeException)
-{
- return ooo::vba::XFileDialogSelectedItems::static_type(0);
-}
-
-css::uno::Reference< css::container::XEnumeration > SAL_CALL
-VbaFileDialogSelectedItems::createEnumeration() throw (css::uno::RuntimeException)
-{
- css::uno::Reference< css::container::XEnumeration > xEnumRet(m_xIndexAccess, css::uno::UNO_QUERY);
- return xEnumRet;
-}
-
-
-//VbaFileDialogSelectedObj
-//////////////////////////////////////////////////////////////////////////
-
-VbaFileDialogSelectedObj::VbaFileDialogSelectedObj()
-{
- m_nIndex = 0;
-}
-
-
-sal_Bool
-VbaFileDialogSelectedObj::SetSelectedFile(css::uno::Sequence<rtl::OUString> &sFList)
-{
- m_sFileList = sFList;
- return sal_True;
-}
-
-sal_Int32 SAL_CALL
-VbaFileDialogSelectedObj::getCount() throw(::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 nListCnt = m_sFileList.getLength();
- return nListCnt;
-}
-
-::com::sun::star::uno::Any SAL_CALL VbaFileDialogSelectedObj::getByIndex( sal_Int32 nIndex )
-throw(::com::sun::star::lang::IndexOutOfBoundsException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException)
-{
- css::uno::Any aRet;
-
- if ( nIndex >= getCount() )
- {
- throw css::lang::IndexOutOfBoundsException();
- }
-
- return uno::makeAny(m_sFileList[nIndex]);
-}
-
-::com::sun::star::uno::Type SAL_CALL
-VbaFileDialogSelectedObj::getElementType()
-throw(::com::sun::star::uno::RuntimeException)
-{
- return getCppuType((uno::Reference<com::sun::star::container::XIndexAccess>*)0);
-}
-
-sal_Bool SAL_CALL VbaFileDialogSelectedObj::hasElements()
-throw(::com::sun::star::uno::RuntimeException)
-{
- return ( getCount() != 0 );
-}
-
-::sal_Bool SAL_CALL
-VbaFileDialogSelectedObj::hasMoreElements( )
-throw (uno::RuntimeException)
-{
- if (getCount() > m_nIndex)
- {
- return sal_True;
- }
- return false;
-}
-
-uno::Any SAL_CALL
-VbaFileDialogSelectedObj::nextElement( )
-throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!hasMoreElements())
- {
- throw container::NoSuchElementException();
- }
-
- return uno::makeAny(m_sFileList[m_nIndex++]);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbafiledialogselecteditems.hxx b/sc/source/ui/vba/vbafiledialogselecteditems.hxx
deleted file mode 100644
index 030242a9e867..000000000000
--- a/sc/source/ui/vba/vbafiledialogselecteditems.hxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _vbafiledialogselecteditems_hxx_
-#define _vbafiledialogselecteditems_hxx_
-
-#include <ooo/vba/XFileDialogSelectedItems.hpp>
-#include <vbahelper/vbacollectionimpl.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/container/XIndexAccess.hpp>
-
-typedef CollTestImplHelper< ov::XFileDialogSelectedItems > FileDialogSelectedItems_BASE;
-
-
-class VbaFileDialogSelectedItems : public FileDialogSelectedItems_BASE
-{
-public:
- VbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-
- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
- 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);
-
-protected:
- virtual rtl::OUString getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-private:
-};
-
-
-class VbaFileDialogSelectedObj : public cppu::WeakImplHelper2<css::container::XIndexAccess, css::container::XEnumeration>
-{
-public:
- VbaFileDialogSelectedObj();
- sal_Bool SetSelectedFile(css::uno::Sequence<rtl::OUString> &sFList);
- //XIndexAccess
- virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex )
- throw(::com::sun::star::lang::IndexOutOfBoundsException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- // XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
-
- //XEnumeration
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
-
-protected:
-private:
- css::uno::Sequence<rtl::OUString> m_sFileList;
- sal_Int32 m_nIndex;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbafilesearch.cxx b/sc/source/ui/vba/vbafilesearch.cxx
deleted file mode 100644
index c0c6f9761541..000000000000
--- a/sc/source/ui/vba/vbafilesearch.cxx
+++ /dev/null
@@ -1,244 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "vbafilesearch.hxx"
-#include "vbaapplication.hxx"
-#include "vbafoundfiles.hxx"
-#include <comphelper/processfactory.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/wldcrd.hxx>
-#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <vector>
-#include "unotools/viewoptions.hxx"
-#include <osl/file.hxx>
-
-using namespace ::ooo::vba;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::lang;
-using namespace comphelper;
-
-static Reference< XSimpleFileAccess3 > getFileAccess( void )
-{
- static Reference< XSimpleFileAccess3 > xSFI;
- if( !xSFI.is() )
- {
- Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- if( xSMgr.is() )
- {
- xSFI = Reference< XSimpleFileAccess3 >( xSMgr->createInstance
- ( ::rtl::OUString( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
- }
- }
- return xSFI;
-}
-
-ScVbaFileSearch::ScVbaFileSearch( ScVbaApplication* pApp, const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext )
- : ScVbaFileSearchImpl_BASE( xParent, xContext ), m_pApplication( pApp )
-{
- NewSearch();
-}
-
-ScVbaFileSearch::~ScVbaFileSearch()
-{
-}
-
-::rtl::OUString SAL_CALL ScVbaFileSearch::getFileName() throw (css::uno::RuntimeException)
-{
- return m_sFileName;
-}
-
-void SAL_CALL ScVbaFileSearch::setFileName(const ::rtl::OUString& _fileName ) throw (css::uno::RuntimeException)
-{
- m_sFileName = _fileName;
-}
-
-::rtl::OUString SAL_CALL ScVbaFileSearch::getLookIn() throw (css::uno::RuntimeException)
-{
- return m_sLookIn;
-}
-
-void SAL_CALL ScVbaFileSearch::setLookIn( const ::rtl::OUString& _lookIn ) throw (css::uno::RuntimeException)
-{
- m_sLookIn = _lookIn;
-}
-
-sal_Bool SAL_CALL ScVbaFileSearch::getSearchSubFolders() throw (css::uno::RuntimeException)
-{
- return m_bSearchSubFolders;
-}
-
-void SAL_CALL ScVbaFileSearch::setSearchSubFolders( sal_Bool _searchSubFolders ) throw (css::uno::RuntimeException)
-{
- m_bSearchSubFolders = _searchSubFolders;
-}
-
-sal_Bool SAL_CALL ScVbaFileSearch::getMatchTextExactly() throw (css::uno::RuntimeException)
-{
- return m_bMatchTextExactly;
-}
-
-void SAL_CALL ScVbaFileSearch::setMatchTextExactly( sal_Bool _matchTextExactly ) throw (css::uno::RuntimeException)
-{
- m_bMatchTextExactly = _matchTextExactly;
-}
-
-static bool IsWildCard( const ::rtl::OUString& fileName )
-{
- static sal_Char cWild1 = '*';
- static sal_Char cWild2 = '?';
-
- return ( ( fileName.indexOf( cWild1 ) >= 0 )
- || ( fileName.indexOf( cWild2 ) >= 0 ) );
-}
-
-static void SearchWildCard(const WildCard& wildCard, const ::rtl::OUString& aDir, bool bSearchSubFolders, css::uno::Sequence< rtl::OUString >& aSearchedFiles)
-{
- Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
- Sequence< rtl::OUString > aDirSeq;
- try
- {
- if ( xSFI.is() )
- {
- aDirSeq = xSFI->getFolderContents( aDir, bSearchSubFolders );
- }
- }
- catch( css::uno::Exception& )
- {
- }
- sal_Int32 nLength = aDirSeq.getLength();
- for ( sal_Int32 i = 0; i < nLength; i++ )
- {
- rtl::OUString aURLStr = aDirSeq[i];
- if ( xSFI->isFolder( aURLStr ) )
- {
- if ( bSearchSubFolders )
- {
- SearchWildCard( wildCard, aURLStr, true, aSearchedFiles );
- }
- }
- else
- {
- INetURLObject aFileURL( aURLStr );
- rtl::OUString aFileName = aFileURL.GetLastName( INetURLObject::DECODE_UNAMBIGUOUS );
- if ( wildCard.Matches( aFileName.toAsciiLowerCase() ) )
- {
- sal_Int32 nFilesLength = aSearchedFiles.getLength();
- aSearchedFiles.realloc( nFilesLength + 1 );
- rtl::OUString sSystemPath;
- ::osl::File::getSystemPathFromFileURL( aURLStr, sSystemPath );
- aSearchedFiles[nFilesLength] = sSystemPath;
- }
- }
- }
-}
-
-sal_Int32 SAL_CALL ScVbaFileSearch::Execute( ) throw (css::uno::RuntimeException)
-{
- m_aSearchedFiles.realloc(0);
- Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
- if ( !xSFI.is() || !xSFI->isFolder( m_sLookIn ) )
- {
- return 0;
- }
-
- if ( m_sFileName.isEmpty() )
- {
- return 1;
- }
-
- ::rtl::OUString aTempFileName = m_sFileName.toAsciiLowerCase();
- if ( IsWildCard( aTempFileName ) )
- {
- bool bEndWithAsterisk = aTempFileName.endsWithAsciiL("*", 1);
- bool bStartWithAsterisk = (aTempFileName.indexOf('*') == 0);
- if ( !bEndWithAsterisk && !bStartWithAsterisk )
- {
- aTempFileName = ::rtl::OUString("*") + aTempFileName + ::rtl::OUString("*");
- }
- }
- else
- {
- aTempFileName = ::rtl::OUString("*") + aTempFileName + ::rtl::OUString("*");
- }
- WildCard wildCard( aTempFileName );
- SearchWildCard( wildCard, m_sLookIn, m_bSearchSubFolders, m_aSearchedFiles );
-
- return m_aSearchedFiles.getLength();
-}
-
-// set ScVbaApplication::getDefaultFilePath( ) as the InitPath for FileSearch
- ::rtl::OUString ScVbaFileSearch::getInitPath() throw (css::uno::RuntimeException)
-{
- String aPath;
-
- if (m_pApplication != NULL)
- {
- aPath = m_pApplication->getDefaultFilePath();
- }
-
- return aPath;
-}
-
-void SAL_CALL ScVbaFileSearch::NewSearch( ) throw (css::uno::RuntimeException)
-{
- m_sFileName = ::rtl::OUString();
- m_sLookIn = getInitPath();
- m_bSearchSubFolders = false;
- m_bMatchTextExactly = false;
- m_aSearchedFiles.realloc(0);
-}
-
-Reference< XFoundFiles > SAL_CALL ScVbaFileSearch::getFoundFiles() throw (css::uno::RuntimeException)
-{
- css::uno::Reference< ov::XFoundFiles > xFoundFiles = new VbaFoundFiles(
- mxParent, mxContext, (css::container::XIndexAccess *) new VbaFoundFilesEnum(m_aSearchedFiles) );
- return xFoundFiles;
-}
-
-rtl::OUString ScVbaFileSearch::getServiceImplName()
-{
- return rtl::OUString("VbaFileSearch");
-}
-
-css::uno::Sequence< rtl::OUString > ScVbaFileSearch::getServiceNames()
-{
- static css::uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( "ooo.vba.FileSearch" );
- }
- return aServiceNames;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbafilesearch.hxx b/sc/source/ui/vba/vbafilesearch.hxx
deleted file mode 100644
index f89fd11577e4..000000000000
--- a/sc/source/ui/vba/vbafilesearch.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_VBA_FILESEARCH_HXX
-#define SC_VBA_FILESEARCH_HXX
-
-#include <ooo/vba/XFileSearch.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <vbahelper/vbahelperinterface.hxx>
-
-namespace css = ::com::sun::star;
-
-typedef InheritedHelperInterfaceImpl1< ooo::vba::XFileSearch > ScVbaFileSearchImpl_BASE;
-
-class ScVbaApplication;
-
-class ScVbaFileSearch : public ScVbaFileSearchImpl_BASE
-{
-private:
- rtl::OUString m_sFileName;
- rtl::OUString m_sLookIn;
- sal_Bool m_bSearchSubFolders;
- sal_Bool m_bMatchTextExactly;
- ScVbaApplication* m_pApplication;
- css::uno::Sequence< rtl::OUString > m_aSearchedFiles;
-
- ::rtl::OUString getInitPath() throw (css::uno::RuntimeException);
-
-public:
- ScVbaFileSearch( ScVbaApplication* pApp, const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~ScVbaFileSearch();
-
- // Attributes
- virtual ::rtl::OUString SAL_CALL getFileName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFileName(const ::rtl::OUString& _fileName ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getLookIn() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setLookIn(const ::rtl::OUString& _lookIn ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getSearchSubFolders() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setSearchSubFolders( sal_Bool _searchSubFolders ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMatchTextExactly() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMatchTextExactly( sal_Bool _matchTextExactly ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ::ooo::vba::XFoundFiles > SAL_CALL getFoundFiles() throw (css::uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL Execute( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL NewSearch( ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString getServiceImplName();
- virtual css::uno::Sequence< rtl::OUString > getServiceNames();
-};
-
-#endif /* SC_VBA_FILESEARCH_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbaname.cxx b/sc/source/ui/vba/vbaname.cxx
index 6509f628edc0..4c5f5f5f5044 100644
--- a/sc/source/ui/vba/vbaname.cxx
+++ b/sc/source/ui/vba/vbaname.cxx
@@ -106,41 +106,78 @@ ScVbaName::setVisible( sal_Bool /*bVisible*/ ) throw (css::uno::RuntimeException
::rtl::OUString
ScVbaName::getValue() throw (css::uno::RuntimeException)
{
- return getValue( formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
-}
-
-::rtl::OUString
-ScVbaName::getValue(const formula::FormulaGrammar::Grammar eGrammar) throw (css::uno::RuntimeException)
-{
- rtl::OUString sValue = mxNamedRange->getContent();
- ScDocShell* pDocShell = excel::getDocShell( mxModel );
- ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
- String aContent;
- excel::CompileODFFormulaToExcel( pDoc, sValue, aContent, eGrammar );
- if ( aContent.Len() > 0 )
+ ::rtl::OUString sValue = mxNamedRange->getContent();
+ ::rtl::OUString sSheetName = getWorkSheet()->getName();
+ ::rtl::OUString sSegmentation = ::rtl::OUString::createFromAscii( ";" );
+ ::rtl::OUString sNewSegmentation = ::rtl::OUString::createFromAscii( "," );
+ ::rtl::OUString sResult;
+ sal_Int32 nFrom = 0;
+ sal_Int32 nTo = 0;
+ nTo = sValue.indexOf( sSegmentation, nFrom );
+ while ( nTo != -1 )
{
- sValue = aContent;
+ ::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 );
}
- if ( sValue.indexOf('=') != 0 )
+ ::rtl::OUString sTmpValue = sValue.copy( nFrom );
+ if ( sTmpValue.toChar() == '$' )
{
- sValue = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")) + sValue;
+ ::rtl::OUString sTmp = sTmpValue.copy(1);
+ sTmp = sTmp.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii(".")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("!"));
+ sResult += sTmp;
}
- return sValue;
+ if (sResult.indexOf('=') != 0)
+ {
+ sResult = ::rtl::OUString::createFromAscii("=") + sResult;
+ }
+ return sResult;
}
void
ScVbaName::setValue( const ::rtl::OUString & rValue ) throw (css::uno::RuntimeException)
{
+ ::rtl::OUString sSheetName = getWorkSheet()->getName();
::rtl::OUString sValue = rValue;
- ScDocShell* pDocShell = excel::getDocShell( mxModel );
- ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
- String aContent;
- excel::CompileExcelFormulaToODF( pDoc, sValue, aContent );
- if ( aContent.Len() > 0 )
+ ::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)
{
- sValue = aContent;
+ ::rtl::OUString sTmp = sValue.copy(1);
+ sValue = sTmp;
}
- mxNamedRange->setContent( sValue );
+ nTo = sValue.indexOf( sSegmentation, nFrom );
+ while ( nTo != -1 )
+ {
+ ::rtl::OUString sTmpValue = sValue.copy( nFrom, nTo - nFrom );
+ sTmpValue = sTmpValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii("!")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("."));
+ if (sTmpValue.copy(0, sSheetName.getLength()).equals(sSheetName))
+ {
+ sTmpValue = ::rtl::OUString::createFromAscii("$") + sTmpValue;
+ }
+ sTmpValue += sNewSegmentation;
+ sResult += sTmpValue;
+ nFrom = nTo + 1;
+ nTo = sValue.indexOf( sSegmentation, nFrom );
+ }
+ ::rtl::OUString sTmpValue = sValue.copy( nFrom );
+ sTmpValue = sTmpValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii("!")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("."));
+ if (sTmpValue.copy(0, sSheetName.getLength()).equals(sSheetName))
+ {
+ sTmpValue = ::rtl::OUString::createFromAscii("$") + sTmpValue;
+ }
+ sResult += sTmpValue;
+ mxNamedRange->setContent(sResult);
}
::rtl::OUString
@@ -170,7 +207,7 @@ ScVbaName::setRefersToLocal( const ::rtl::OUString & rRefersTo ) throw (css::uno
::rtl::OUString
ScVbaName::getRefersToR1C1() throw (css::uno::RuntimeException)
{
- return getValue( formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
+ return getRefersTo();
}
void
@@ -182,7 +219,7 @@ ScVbaName::setRefersToR1C1( const ::rtl::OUString & rRefersTo ) throw (css::uno:
::rtl::OUString
ScVbaName::getRefersToR1C1Local() throw (css::uno::RuntimeException)
{
- return getValue( formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
+ return getRefersTo();
}
void
diff --git a/sc/source/ui/vba/vbaname.hxx b/sc/source/ui/vba/vbaname.hxx
index 2159b9ad63d0..c75ea3fbcab9 100644
--- a/sc/source/ui/vba/vbaname.hxx
+++ b/sc/source/ui/vba/vbaname.hxx
@@ -34,7 +34,7 @@
#include <vbahelper/vbahelperinterface.hxx>
-#include <formula/grammar.hxx>
+class ScDocument;
typedef InheritedHelperInterfaceImpl1< ov::excel::XName > NameImpl_BASE;
@@ -47,8 +47,6 @@ class ScVbaName : public NameImpl_BASE
protected:
virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
virtual css::uno::Reference< ov::excel::XWorksheet > getWorkSheet() throw (css::uno::RuntimeException);
- // Get value by FormulaGrammar, such as FormulaGrammar::GRAM_NATIVE_XL_R1C1
- virtual ::rtl::OUString SAL_CALL getValue(const formula::FormulaGrammar::Grammar eGrammar) throw (css::uno::RuntimeException);
public:
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 );
diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx
index b6cd0a57e126..f704a8da0c4a 100644
--- a/sc/source/ui/vba/vbanames.cxx
+++ b/sc/source/ui/vba/vbanames.cxx
@@ -88,32 +88,6 @@ ScVbaNames::getScDocument()
return pViewData->GetDocument();
}
-void GetRangeOrRefersTo( const css::uno::Any& RefersTo, const uno::Reference< uno::XComponentContext >& xContext, css::uno::Reference< excel::XRange >& xRange, rtl::OUString& sRefersTo )
-{
- if ( RefersTo.getValueTypeClass() == uno::TypeClass_STRING )
- {
- RefersTo >>= sRefersTo;
- }
- else if ( RefersTo.getValueTypeClass() == uno::TypeClass_INTERFACE )
- {
- RefersTo >>= xRange;
- }
- else if ( RefersTo.hasValue() )
- {
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
- try
- {
- if ( xConverter.is() )
- {
- uno::Any aConverted = xConverter->convertTo( RefersTo, getCppuType((rtl::OUString*)0) );
- aConverted >>= sRefersTo;
- }
- }
- catch( uno::Exception& )
- {
- }
- }
-}
css::uno::Any
ScVbaNames::Add( const css::uno::Any& Name ,
@@ -128,9 +102,7 @@ ScVbaNames::Add( const css::uno::Any& Name ,
const css::uno::Any& RefersToR1C1,
const css::uno::Any& RefersToR1C1Local ) throw (css::uno::RuntimeException)
{
- rtl::OUString sSheetName;
rtl::OUString sName;
- rtl::OUString sRefersTo;
uno::Reference< excel::XRange > xRange;
if ( Name.hasValue() )
Name >>= sName;
@@ -138,12 +110,6 @@ ScVbaNames::Add( const css::uno::Any& Name ,
NameLocal >>= sName;
if ( !sName.isEmpty() )
{
- sal_Int32 nTokenIndex = sName.indexOf('!');
- if ( nTokenIndex >= 0 )
- {
- sSheetName = sName.copy( 0, nTokenIndex );
- sName = sName.copy( nTokenIndex + 1 );
- }
if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
{
::rtl::OUString sResult ;
@@ -156,22 +122,20 @@ ScVbaNames::Add( const css::uno::Any& Name ,
sResult = sName.copy( nIndex );
sName = sResult ;
if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
- throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This Name is a invalid .")), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( "This Name is not valid .",
+ uno::Reference< uno::XInterface >() );
}
}
if ( RefersTo.hasValue() || RefersToR1C1.hasValue() || RefersToR1C1Local.hasValue() )
{
if ( RefersTo.hasValue() )
- GetRangeOrRefersTo( RefersTo, mxContext, xRange, sRefersTo );
+ RefersTo >>= xRange;
if ( RefersToR1C1.hasValue() )
- GetRangeOrRefersTo( RefersToR1C1, mxContext, xRange, sRefersTo );
+ RefersToR1C1 >>= xRange;
if ( RefersToR1C1Local.hasValue() )
- GetRangeOrRefersTo( RefersToR1C1Local, mxContext, xRange, sRefersTo );
+ RefersToR1C1Local >>= xRange;
}
- String aContent;
- table::CellAddress aPosition;
- RangeType nType = RT_NAME;
if ( xRange.is() )
{
ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
@@ -184,37 +148,20 @@ ScVbaNames::Add( const css::uno::Any& Name ,
ScAddress aPos( static_cast< SCCOL >( aAddr.StartColumn ) , static_cast< SCROW >( aAddr.StartRow ) , static_cast< SCTAB >(aAddr.Sheet ) );
uno::Any xAny2 ;
String sRangeAdd = xRange->Address( xAny2, xAny2 , xAny2 , xAny2, xAny2 );
- aContent += rtl::OUString("$");
- aContent += UniString(xRange->getWorksheet()->getName());
- aContent += rtl::OUString(".");
- aContent += sRangeAdd;
- aPosition = table::CellAddress( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow );
- }
- else
- {
- ScDocShell* pDocShell = excel::getDocShell( mxModel );
- ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
- excel::CompileExcelFormulaToODF( pDoc, sRefersTo, aContent );
- if ( aContent.Len() == 0 )
+ String sTmp;
+ sTmp += "$";
+ sTmp += UniString(xRange->getWorksheet()->getName());
+ sTmp += ".";
+ sTmp += sRangeAdd;
+ if ( mxNames.is() )
{
- aContent = sRefersTo;
+ RangeType nType = RT_NAME;
+ table::CellAddress aCellAddr( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow );
+ if ( mxNames->hasByName( sName ) )
+ mxNames->removeByName(sName);
+ mxNames->addNewByName( sName , rtl::OUString(sTmp) , aCellAddr , (sal_Int32)nType);
}
}
-
- uno::Reference< sheet::XNamedRange > xNewNamedRange;
- if ( mxNames.is() )
- {
- if ( mxNames->hasByName( sName ) )
- {
- mxNames->removeByName( sName );
- }
- mxNames->addNewByName( sName, rtl::OUString( aContent ), aPosition, (sal_Int32) nType );
- xNewNamedRange = uno::Reference< sheet::XNamedRange >( mxNames->getByName( sName ), uno::UNO_QUERY );
- }
- if ( xNewNamedRange.is() )
- {
- return uno::makeAny( uno::Reference< excel::XName >( new ScVbaName( mxParent, mxContext, xNewNamedRange ,mxNames , mxModel ) ) );
- }
return css::uno::Any();
}
diff --git a/sc/source/ui/vba/vbaoleobject.cxx b/sc/source/ui/vba/vbaoleobject.cxx
index 1f26ccf986a3..1a6055103d1a 100644
--- a/sc/source/ui/vba/vbaoleobject.cxx
+++ b/sc/source/ui/vba/vbaoleobject.cxx
@@ -56,7 +56,7 @@ ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParen
uno::Reference< uno::XInterface > SAL_CALL
ScVbaOLEObject::getObject() throw (uno::RuntimeException)
{
- return uno::Reference< uno::XInterface >( m_xControl, uno::UNO_QUERY_THROW );
+ return uno::Reference< uno::XInterface >( m_xControlShape, uno::UNO_QUERY_THROW );
}
sal_Bool SAL_CALL
diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx
index b4f2d4eeac6e..6ac97b443f82 100644
--- a/sc/source/ui/vba/vbapagebreaks.cxx
+++ b/sc/source/ui/vba/vbapagebreaks.cxx
@@ -116,13 +116,10 @@ sal_Int32 SAL_CALL RangePageBreaks::getCount( ) throw (uno::RuntimeException)
for( sal_Int32 i=0; i<nLength; i++ )
{
sal_Int32 nPos = aTablePageBreakData[i].Position;
-
- // All page breaks before the used range should be counted.
- // And the page break at the end of the used range also should be counted.
- if( nPos <= nUsedEnd + 1 )
- nCount++;
- else
+ if( nPos > nUsedEnd )
return nCount;
+ if( nPos >= nUsedStart )
+ nCount++;
}
return nCount;
@@ -148,15 +145,26 @@ uno::Any SAL_CALL RangePageBreaks::getByIndex( sal_Int32 Index ) throw (lang::In
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();
- // No need to filter the page break. All page breaks before the used range are counted.
- if ( nAPIItemIndex < nLength && nAPIItemIndex>=0 )
- aTablePageBreakData = aTablePageBreakDataList[nAPIItemIndex];
+ 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;
}
diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx
index fe0403c056b9..b726d54aa035 100644
--- a/sc/source/ui/vba/vbapagesetup.cxx
+++ b/sc/source/ui/vba/vbapagesetup.cxx
@@ -39,8 +39,6 @@
#include <ooo/vba/excel/XlOrder.hpp>
#include <ooo/vba/excel/Constants.hpp>
#include <i18nutil/paper.hxx>
-#include <editeng/paperinf.hxx>
-#include <ooo/vba/excel/XlPaperSize.hpp>
#include <sal/macros.h>
using namespace ::com::sun::star;
@@ -629,103 +627,4 @@ ScVbaPageSetup::getServiceNames()
return aServiceNames;
}
-struct PaperSizeMap
-{
- Paper ePaper;
- sal_Int32 xlPaper;
-};
-
-static PaperSizeMap paperSizeMappings[] =
-{
- { PAPER_A3, ooo::vba::excel::XlPaperSize::xlPaperA3 },
- { PAPER_A4, ooo::vba::excel::XlPaperSize::xlPaperA4 },
- { PAPER_A5, ooo::vba::excel::XlPaperSize::xlPaperA5 },
- { PAPER_B4_ISO, ooo::vba::excel::XlPaperSize::xlPaperB4 },
- { PAPER_B5_ISO, ooo::vba::excel::XlPaperSize::xlPaperB5 },
- { PAPER_LETTER, ooo::vba::excel::XlPaperSize::xlPaperLetter },
- { PAPER_LEGAL, ooo::vba::excel::XlPaperSize::xlPaperLegal },
- { PAPER_TABLOID, ooo::vba::excel::XlPaperSize::xlPaperTabloid },
- { PAPER_USER, ooo::vba::excel::XlPaperSize::xlPaperUser },
- { PAPER_B6_ISO, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeB6 },
- { PAPER_ENV_C4, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC4 },
- { PAPER_ENV_C5, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC5 },
- { PAPER_ENV_C6, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC6 },
- { PAPER_ENV_C65, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC65 },
- { PAPER_ENV_DL, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeDL },
- { PAPER_C, ooo::vba::excel::XlPaperSize::xlPaperCsheet },
- { PAPER_D, ooo::vba::excel::XlPaperSize::xlPaperDsheet },
- { PAPER_E, ooo::vba::excel::XlPaperSize::xlPaperEsheet },
- { PAPER_ENV_MONARCH, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeMonarch },
- { PAPER_ENV_PERSONAL, ooo::vba::excel::XlPaperSize::xlPaperEnvelopePersonal },
- { PAPER_ENV_9, ooo::vba::excel::XlPaperSize::xlPaperEnvelope9 },
- { PAPER_ENV_10, ooo::vba::excel::XlPaperSize::xlPaperEnvelope10 },
- { PAPER_ENV_11, ooo::vba::excel::XlPaperSize::xlPaperEnvelope11 },
- { PAPER_ENV_12, ooo::vba::excel::XlPaperSize::xlPaperEnvelope12 }
-};
-
-static const int nMapSize = SAL_N_ELEMENTS(paperSizeMappings);
-
-sal_Int32 PaperSizeOOoToExcel(Paper ePaper)
-{
- sal_Int32 nPaperSize = ooo::vba::excel::XlPaperSize::xlPaperUser;
-
- for (int i = 0; i < nMapSize; i++)
- {
- if (ePaper == paperSizeMappings[i].ePaper)
- {
- nPaperSize = paperSizeMappings[i].xlPaper;
- break;
- }
- }
-
- return nPaperSize;
-}
-
-sal_Int32 SAL_CALL ScVbaPageSetup::getPaperSize() throw (css::uno::RuntimeException)
-{
- com::sun::star::awt::Size size;
- Paper ePaper = PAPER_USER;
-
- try
- {
- uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( "Size"));
- aValue >>= size;
- ePaper = SvxPaperInfo::GetSvxPaper( Size(size.Width, size.Height), MAP_100TH_MM, true);
- }
- catch( uno::Exception& )
- {
- }
-
- return PaperSizeOOoToExcel(ePaper);
-}
-
-Paper PaperSizeExcelToOOo( sal_Int32 xlPaper)
-{
- Paper ePaper = PAPER_USER;
-
- for (int i = 0; i < nMapSize; i++)
- {
- if (xlPaper == paperSizeMappings[i].xlPaper)
- {
- ePaper = paperSizeMappings[i].ePaper;
- break;
- }
- }
-
- return ePaper;
-}
-void SAL_CALL ScVbaPageSetup::setPaperSize( sal_Int32 paperSize) throw (css::uno::RuntimeException)
-{
- Paper ePaper = PaperSizeExcelToOOo( paperSize );
-
- try
- {
- Size size1 = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM );
- com::sun::star::awt::Size size(size1.Width(), size1.Height());
- mxPageProps->setPropertyValue( rtl::OUString( "Size"), uno::makeAny( size ));
- }
- catch( uno::Exception& )
- {
- }
-}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbapagesetup.hxx b/sc/source/ui/vba/vbapagesetup.hxx
index fb234200aec1..16542c1fe74c 100644
--- a/sc/source/ui/vba/vbapagesetup.hxx
+++ b/sc/source/ui/vba/vbapagesetup.hxx
@@ -83,8 +83,6 @@ public:
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);
- virtual sal_Int32 SAL_CALL getPaperSize() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setPaperSize( sal_Int32 paperSize ) throw (css::uno::RuntimeException);
// XHelperInterface
virtual rtl::OUString getServiceImplName();
diff --git a/sc/source/ui/vba/vbapivotcache.cxx b/sc/source/ui/vba/vbapivotcache.cxx
index ff50c7a8aeb1..fc83d6a3a2dd 100644
--- a/sc/source/ui/vba/vbapivotcache.cxx
+++ b/sc/source/ui/vba/vbapivotcache.cxx
@@ -35,17 +35,6 @@ ScVbaPivotCache::ScVbaPivotCache( const uno::Reference< XHelperInterface >& xPar
{
}
-sal_Int32
-ScVbaPivotCache::getMissingItemsLimit() throw (css::uno::RuntimeException)
-{
- return -1;
-}
-
-void
-ScVbaPivotCache::setMissingItemsLimit( sal_Int32 /*aValue*/ ) throw ( css::uno::RuntimeException)
-{
-}
-
void SAL_CALL
ScVbaPivotCache::Refresh() throw (css::uno::RuntimeException)
{
diff --git a/sc/source/ui/vba/vbapivotcache.hxx b/sc/source/ui/vba/vbapivotcache.hxx
index 44f10459a158..937d58ceb445 100644
--- a/sc/source/ui/vba/vbapivotcache.hxx
+++ b/sc/source/ui/vba/vbapivotcache.hxx
@@ -42,9 +42,6 @@ class ScVbaPivotCache : public PivotCacheImpl_BASE
public:
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 ::sal_Int32 SAL_CALL getMissingItemsLimit() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMissingItemsLimit( ::sal_Int32 aValue ) throw ( css::uno::RuntimeException);
-
virtual void SAL_CALL Refresh() throw (css::uno::RuntimeException);
// XHelperInterface
virtual rtl::OUString getServiceImplName();
diff --git a/sc/source/ui/vba/vbaquerytable.cxx b/sc/source/ui/vba/vbaquerytable.cxx
deleted file mode 100644
index aa4f8d01e62a..000000000000
--- a/sc/source/ui/vba/vbaquerytable.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "vbaquerytable.hxx"
-#include "document.hxx"
-#include "docsh.hxx"
-#include "sfx2/lnkbase.hxx"
-#include "sfx2/linkmgr.hxx"
-#include "arealink.hxx"
-#include "vbarange.hxx"
-
-using namespace com::sun::star;
-
-
-ScVbaQueryTable::ScVbaQueryTable(const css::uno::Reference< ov::XHelperInterface >& /*xParent*/,
- const css::uno::Reference< css::uno::XComponentContext > & /*xContext*/,
- ScDocument *pDocument ,
- ScVbaRange *pParent
- )
-//:QueryTable_Base(xParent, xContext)
-{
- m_pDocument = pDocument;
- m_pParent = pParent;
-}
-
-ScVbaQueryTable::~ScVbaQueryTable()
-{
-
-}
-
-::sal_Bool SAL_CALL
-ScVbaQueryTable::Refresh( const ::com::sun::star::uno::Any& /*aBackgroundQuery*/ ) throw (::com::sun::star::uno::RuntimeException)
-{
-
- //Get parent Info
- SCROW nRow = m_pParent->getRow();
- SCCOL nClm = m_pParent->getColumn();
- SCTAB nTab = m_pParent->getWorksheet()->getIndex() - 1; //The vba index begin from 1.
- ScAddress crrRngAddr(nClm, nRow, nTab);
-
- //Get link info
- sfx2::LinkManager *pLinkMng = m_pDocument->GetLinkManager();
- const ::sfx2::SvBaseLinks &rLinks = pLinkMng->GetLinks();
- sal_uInt16 nCount = rLinks.size();
-
- for (sal_uInt16 i=0; i<nCount; i++)
- {
- ::sfx2::SvBaseLink* pBase = *rLinks[i];
- if (pBase->ISA(ScAreaLink))
- {
-
- ScAreaLink *pAreaLink = (ScAreaLink *)pBase;
- const ScRange &destRange = pAreaLink->GetDestArea();
- if (destRange.In(crrRngAddr))
- {
- pBase->Update();
- }
- }
- }
-
- return sal_True;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbaquerytable.hxx b/sc/source/ui/vba/vbaquerytable.hxx
deleted file mode 100644
index f7deea7014cb..000000000000
--- a/sc/source/ui/vba/vbaquerytable.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_VBA_QUERYTABLE_HXX
-#define SC_VBA_QUERYTABLE_HXX
-
-
-#include <ooo/vba/excel/XQueryTable.hpp>
-#include "vbahelper/vbahelperinterface.hxx"
-
-using namespace ::ooo::vba;
-typedef ::cppu::WeakImplHelper1<excel::XQueryTable> QueryTable_Base;
-
-class ScDocument;
-class ScVbaRange;
-
-class ScVbaQueryTable : public QueryTable_Base
-{
-private:
- ScDocument *m_pDocument;
- ScVbaRange *m_pParent;
-public:
- ScVbaQueryTable(const css::uno::Reference< ov::XHelperInterface >& xParent,
- const css::uno::Reference< css::uno::XComponentContext > & xContext,
- ScDocument *pDocument = NULL,
- ScVbaRange *pParent = NULL
- );
- ~ScVbaQueryTable();
- virtual ::sal_Bool SAL_CALL Refresh( const ::com::sun::star::uno::Any& aBackgroundQuery )
- throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 34578e3c6f6f..62b450486b1b 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/sheet/XCellSeries.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
@@ -56,7 +57,6 @@
#include <com/sun/star/sheet/XSheetCellCursor.hpp>
#include <com/sun/star/sheet/XArrayFormulaRange.hpp>
#include <com/sun/star/sheet/XNamedRange.hpp>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
#include <com/sun/star/sheet/XPrintAreas.hpp>
#include <com/sun/star/sheet/XCellRangesQuery.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -99,12 +99,6 @@
#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
#include <com/sun/star/sheet/XSheetAnnotations.hpp>
-#include <com/sun/star/sheet/XDataPilotTable.hpp>
-#include <com/sun/star/sheet/XDataPilotTable2.hpp>
-#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
-#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
-#include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
-
#include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
#include <ooo/vba/excel/XlPasteType.hpp>
#include <ooo/vba/excel/Constants.hpp>
@@ -130,8 +124,6 @@
#include <ooo/vba/excel/XlSpecialCellsValue.hpp>
#include <ooo/vba/excel/XlConsolidationFunction.hpp>
#include <ooo/vba/excel/XlSearchDirection.hpp>
-#include <ooo/vba/excel/XlColumnDataType.hpp>
-#include <ooo/vba/excel/XlFilterAction.hpp>
#include <scitems.hxx>
#include <svl/srchitem.hxx>
@@ -149,7 +141,6 @@
#include <sc.hrc>
#include <globstr.hrc>
#include <unonames.hxx>
-#include <tools/stream.hxx>
#include "vbaapplication.hxx"
#include "vbafont.hxx"
@@ -161,13 +152,8 @@
#include "vbavalidation.hxx"
#include "vbahyperlinks.hxx"
-#include "vbapivottable.hxx"
-
-#include "asciiopt.hxx"
-#include "impex.hxx"
#include "tabvwsh.hxx"
#include "rangelst.hxx"
-#include "rangenam.hxx"
#include "convuno.hxx"
#include "compiler.hxx"
#include "attrib.hxx"
@@ -184,8 +170,6 @@
#include "vbaglobals.hxx"
#include "vbastyle.hxx"
-#include "vbaname.hxx"
-#include "vbanames.hxx"
#include <vector>
#include <vbahelper/vbacollectionimpl.hxx>
// begin test includes
@@ -408,6 +392,55 @@ ScVbaRangeAreas::createCollectionObject( const uno::Any& aSource )
return lcl_makeRange( mxParent, mxContext, aSource, mbIsRows, mbIsColumns );
}
+// assume that xIf is infact a ScCellRangesBase
+ScDocShell*
+getDocShellFromIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
+{
+ ScCellRangesBase* pUno = ScCellRangesBase::getImplementation( xIf );
+ if ( !pUno )
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying uno range object" ) ), uno::Reference< uno::XInterface >() );
+ return pUno->GetDocShell();
+}
+
+ScDocShell*
+getDocShellFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
+{
+ // need the ScCellRangesBase to get docshell
+ uno::Reference< uno::XInterface > xIf( xRange );
+ return getDocShellFromIf(xIf );
+}
+
+ScDocShell*
+getDocShellFromRanges( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException )
+{
+ // need the ScCellRangesBase to get docshell
+ uno::Reference< uno::XInterface > xIf( xRanges );
+ return getDocShellFromIf(xIf );
+}
+
+uno::Reference< frame::XModel > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
+{
+ ScDocShell* pDocShell = getDocShellFromIf(xIf );
+ return pDocShell->GetModel();
+}
+
+uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
+{
+ // the XInterface for getImplementation can be any derived interface, no need for queryInterface
+ uno::Reference< uno::XInterface > xIf( xRange );
+ return getModelFromXIf( xIf );
+}
+
+ScDocument*
+getDocumentFromRange( const uno::Reference< table::XCellRange >& xRange )
+{
+ ScDocShell* pDocShell = getDocShellFromRange( xRange );
+ if ( !pDocShell )
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying docshell from uno range object" ) ), uno::Reference< uno::XInterface >() );
+ ScDocument* pDoc = pDocShell->GetDocument();
+ return pDoc;
+}
+
ScDocument*
ScVbaRange::getScDocument() throw (uno::RuntimeException)
{
@@ -415,9 +448,9 @@ ScVbaRange::getScDocument() throw (uno::RuntimeException)
{
uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- return excel::GetDocumentFromRange( xRange );
+ return getDocumentFromRange( xRange );
}
- return excel::GetDocumentFromRange( mxRange );
+ return getDocumentFromRange( mxRange );
}
ScDocShell*
@@ -427,9 +460,9 @@ ScVbaRange::getScDocShell() throw (uno::RuntimeException)
{
uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- return excel::GetDocShellFromRange( xRange );
+ return getDocShellFromRange( xRange );
}
- return excel::GetDocShellFromRange( mxRange );
+ return getDocShellFromRange( mxRange );
}
ScVbaRange* ScVbaRange::getImplementation( const uno::Reference< excel::XRange >& rxRange )
@@ -475,7 +508,7 @@ class NumFormatHelper
public:
NumFormatHelper( const uno::Reference< table::XCellRange >& xRange )
{
- mxSupplier.set( excel::GetModelFromRange( xRange ), uno::UNO_QUERY_THROW );
+ mxSupplier.set( getModelFromRange( xRange ), uno::UNO_QUERY_THROW );
mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
mxFormats = mxSupplier->getNumberFormats();
}
@@ -758,15 +791,7 @@ CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< tab
{
double nDouble = 0.0;
if ( aValue >>= nDouble )
- {
xCell->setValue( nDouble );
- uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
- NumFormatHelper cellNumFormat( xRange );
- if ( cellNumFormat.isBooleanType() )
- {
- cellNumFormat.setNumberFormat( util::NumberFormat::NUMBER );
- }
- }
else
isExtracted = false;
break;
@@ -1300,7 +1325,7 @@ uno::Reference< sheet::XSheetCellRangeContainer > lclExpandToMerged( const uno::
ScUnoConversion::FillScRange( aScRange, aRangeAddr );
aScRanges.Append( aScRange );
}
- return new ScCellRangesObj( excel::GetDocShellFromRanges( rxCellRanges ), aScRanges );
+ return new ScCellRangesObj( getDocShellFromRanges( rxCellRanges ), aScRanges );
}
void lclExpandAndMerge( const uno::Reference< table::XCellRange >& rxCellRange, bool bMerge ) throw (uno::RuntimeException)
@@ -1346,7 +1371,7 @@ util::TriState lclGetMergedState( const uno::Reference< table::XCellRange >& rxC
of a merged range is part of this range are not covered. */
ScRange aScRange;
ScUnoConversion::FillScRange( aScRange, aRangeAddr );
- bool bHasMerged = excel::GetDocumentFromRange( rxCellRange )->HasAttrib( aScRange, HASATTR_MERGED | HASATTR_OVERLAPPED );
+ bool bHasMerged = getDocumentFromRange( rxCellRange )->HasAttrib( aScRange, HASATTR_MERGED | HASATTR_OVERLAPPED );
return bHasMerged ? util::TriState_INDETERMINATE : util::TriState_NO;
}
@@ -1363,29 +1388,6 @@ ScVbaRange::getRangeObjectForName(
return getRangeForName( xContext, sRangeName, pDocSh, refAddr, eConv );
}
-table::CellAddress ScVbaRange::getLeftUpperCellAddress()
-{
- table::CellAddress aCellAddress;
- uno::Reference< table::XCellRange > xCellRange = mxRange;
- if ( mxRanges.is() && m_Areas.is() && m_Areas->getCount() > 1 )
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY );
- if ( xIndex.is() && xIndex->getCount() > 0 )
- {
- xCellRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY );
- }
- }
- if ( xCellRange.is() )
- {
- uno::Reference< sheet::XCellAddressable > xCellAddr( xCellRange->getCellByPosition( 0, 0 ), uno::UNO_QUERY );
- if ( xCellAddr.is() )
- {
- aCellAddress = xCellAddr->getCellAddress();
- }
- }
- return aCellAddress;
-}
-
table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam, ScDocShell* pDocSh, formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1) throw ( uno::RuntimeException )
{
uno::Reference< table::XCellRange > xRangeParam;
@@ -1412,14 +1414,7 @@ table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam,
uno::Reference< excel::XRange > xRange;
aParam >>= xRange;
if ( xRange.is() )
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- if ( pRange && pDocSh && pRange->getScDocument() != pDocSh->GetDocument() )
- {
- throw uno::RuntimeException( rtl::OUString( "Invalid range" ), uno::Reference< uno::XInterface >() );
- }
xRange->getCellRange() >>= xRangeParam;
- }
break;
}
default:
@@ -1432,7 +1427,7 @@ 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< XHelperInterface > xParent( xParentRange, uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::GetDocumentFromRange(xRange);
+ ScDocument* pDoc = getDocumentFromRange(xRange);
if ( !pDoc )
throw uno::RuntimeException( rtl::OUString( "Failed to access document from shell" ), uno::Reference< uno::XInterface >() );
ScVbaPalette aPalette( pDoc->GetDocumentShell() );
@@ -1440,21 +1435,8 @@ lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno
return borders;
}
-void lcl_NotifyRangeChanges( const uno::Reference< frame::XModel >& xModel, ScCellRangesBase* pUnoRangesBase )
-{
- if ( xModel.is() && pUnoRangesBase )
- {
- ScModelObj* pModelObj = ScModelObj::getImplementation( xModel );
- const ScRangeList& aCellRanges = pUnoRangesBase->GetRangeList();
- if ( pModelObj && pModelObj->HasChangesListeners() )
- {
- pModelObj->NotifyChanges( ::rtl::OUString( "cell-change" ), aCellRanges );
- }
- }
-}
-
ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
- uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), excel::GetModelFromRange( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), true ), mbIsRows( false ), mbIsColumns( 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( false ), mbIsColumns( false )
{
mxRange.set( mxPropertySet, uno::UNO_QUERY );
mxRanges.set( mxPropertySet, uno::UNO_QUERY );
@@ -1471,7 +1453,7 @@ ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
}
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 ), excel::GetModelFromRange( xRange), true ), mxRange( xRange ),
+: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRange, uno::UNO_QUERY_THROW ), getModelFromRange( xRange), true ), mxRange( xRange ),
mbIsRows( bIsRows ),
mbIsColumns( bIsColumns )
{
@@ -1486,7 +1468,7 @@ ScVbaRange::ScVbaRange( const uno::Reference< XHelperInterface >& xParent, const
}
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 ), excel::GetModelFromRange( uno::Reference< uno::XInterface >( xRanges, uno::UNO_QUERY_THROW ) ), true ), mxRanges( xRanges ),mbIsRows( bIsRows ), mbIsColumns( bIsColumns )
+: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRanges, uno::UNO_QUERY_THROW ), getModelFromXIf( uno::Reference< uno::XInterface >( xRanges, uno::UNO_QUERY_THROW ) ), true ), mxRanges( xRanges ),mbIsRows( bIsRows ), mbIsColumns( bIsColumns )
{
uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
@@ -1525,77 +1507,6 @@ ScVbaRange::visitArray( ArrayVisitor& visitor )
}
}
-uno::Any SAL_CALL ScVbaRange::getName() throw (uno::RuntimeException)
-{
- uno::Reference< excel::XName > xName;
-
- ScDocShell* pDocShell = getScDocShell();
- uno::Reference< frame::XModel > xModel = pDocShell ? pDocShell->GetModel() : NULL;
- if ( !xModel.is() )
- {
- throw uno::RuntimeException( rtl::OUString( "Invalid document" ), uno::Reference< uno::XInterface >() );
- }
- uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XNamedRanges > xNamedRanges( xPropertySet->getPropertyValue( rtl::OUString("NamedRanges")) , uno::UNO_QUERY_THROW );
-
- uno::Reference< excel::XNames > xNames( new ScVbaNames( uno::Reference< XHelperInterface >(), mxContext , xNamedRanges , xModel ) );
- sal_Int32 nCount = xNames->getCount();
- ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
- if ( pUnoRangesBase && nCount > 0 )
- {
- ScRangeList aRangeList = pUnoRangesBase->GetRangeList();
- for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- uno::Reference< excel::XName > xTmpName( xNames->Item( uno::makeAny( nIndex + 1 ), uno::Any() ), uno::UNO_QUERY );
- if ( xTmpName.is() )
- {
- try
- {
- uno::Reference< excel::XRange > xRange = xTmpName->getRefersToRange();
- if ( xRange.is() )
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- ScCellRangesBase* pCurRangesBase = pRange ? pRange->getCellRangesBase() : NULL;
- if ( pCurRangesBase && aRangeList == pCurRangesBase->GetRangeList() )
- {
- xName = xTmpName;
- break;
- }
- }
- }
- catch (const uno::Exception&)
- {
- }
- }
- }
- }
-
- return uno::makeAny( xName );
-}
-
-void
-ScVbaRange::setName( const uno::Any& aName ) throw (uno::RuntimeException)
-{
- uno::Reference< excel::XName > xName;
-
- ScDocShell* pDocShell = getScDocShell();
- uno::Reference< frame::XModel > xModel = pDocShell ? pDocShell->GetModel() : NULL;
- if ( !xModel.is() )
- {
- throw uno::RuntimeException( rtl::OUString( "Invalid document" ), uno::Reference< uno::XInterface >() );
- }
- uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XNamedRanges > xNamedRanges( xPropertySet->getPropertyValue( rtl::OUString("NamedRanges")) , uno::UNO_QUERY_THROW );
-
- uno::Reference< excel::XNames > xNames( new ScVbaNames( uno::Reference< XHelperInterface >(), mxContext , xNamedRanges , xModel ) );
-
- uno::Any aDummy;
- //uno::Any aRefersTo;
- // aRefersTo <<= uno::Reference< excel::XRange >(this, uno::UNO_QUERY);
- xNames->Add(aName, getCellRange(), aDummy, aDummy, aDummy, aDummy,
- aDummy, aDummy, aDummy, aDummy, aDummy);
-}
-
uno::Any
ScVbaRange::getValue( ValueGetter& valueGetter) throw (uno::RuntimeException)
{
@@ -1685,11 +1596,6 @@ ScVbaRange::setValue( const uno::Any &aValue ) throw (uno::RuntimeException)
}
CellValueSetter valueSetter( aValue );
setValue( aValue, valueSetter, true );
-
-#if 0 // TODO: Noel, do we still need this?
- // Fires the range change event.
- lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
-#endif
}
void SAL_CALL
@@ -1698,11 +1604,6 @@ ScVbaRange::Clear() throw (uno::RuntimeException)
using namespace ::com::sun::star::sheet::CellFlags;
sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED;
ClearContents( nFlags, true );
-
-#if 0 // TODO: do we still need this?
- // Fires the range change event.
- lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
-#endif
}
//helper ClearContent
@@ -1747,11 +1648,6 @@ ScVbaRange::ClearContents() throw (uno::RuntimeException)
sheet::CellFlags::STRING | sheet::CellFlags::DATETIME |
sheet::CellFlags::FORMULA );
ClearContents( nClearFlags, true );
-
-#if 0 // TODO: do we still need this?
- // Fires the range change event.
- lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
-#endif
}
void SAL_CALL
@@ -1760,11 +1656,6 @@ ScVbaRange::ClearFormats() throw (uno::RuntimeException)
//FIXME: need to check if we need to combine sheet::CellFlags::FORMATTED
sal_Int32 nClearFlags = sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR;
ClearContents( nClearFlags, false );
-
-#if 0 // TODO: do we still need this?
- // Fires the range change event.
- lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
-#endif
}
void
@@ -1780,11 +1671,6 @@ ScVbaRange::setFormulaValue( const uno::Any& rFormula, formula::FormulaGrammar::
}
CellFormulaValueSetter formulaValueSetter( rFormula, getScDocument(), eGram );
setValue( rFormula, formulaValueSetter, bFireEvent );
-
-#if 0 // TODO: ditto
- // Fires the range change event.
- lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
-#endif
}
uno::Any
@@ -1945,9 +1831,6 @@ ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFi
uno::Reference< sheet::XCellSeries > xCellSeries(mxRange, uno::UNO_QUERY_THROW );
xCellSeries->fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue );
-
- // Fires the range change event.
- lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
}
void
@@ -2088,15 +1971,7 @@ ScVbaRange::getFormulaArray() throw (uno::RuntimeException)
uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula( mxRange, uno::UNO_QUERY_THROW );
uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
uno::Any aMatrix;
-
- uno::Sequence< uno::Sequence<rtl::OUString> > aFmArray = xCellRangeFormula->getFormulaArray();
- if( aFmArray.getLength() )
- {
- if( aFmArray.getLength() == 1 && aFmArray[0].getLength() == 1 )
- aMatrix <<= aFmArray[0][0];
- else
- aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
- }
+ aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
return aMatrix;
}
@@ -2280,15 +2155,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
// #FIXME - perhaps worth turning this into some sort of
// convertion routine e.g. bSuccess = getValueFromAny( nRow, nRowIndex, getCppuType((sal_Int32*)0) )
uno::Any aRowIndexAny = nRowIndex;
- if ( aRowIndexAny.getValueTypeClass() == uno::TypeClass_INTERFACE )
- {
- try
- {
- aRowIndexAny = getDefaultPropByIntrospection( aRowIndexAny );
- }
- catch( uno::Exception& ) {}
- }
- else if ( aRowIndexAny.hasValue() && !( aRowIndexAny >>= nRow ) )
+ if ( aRowIndexAny.hasValue() && !( aRowIndexAny >>= nRow ) )
{
uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
uno::Any aConverted;
@@ -2310,21 +2177,13 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- sal_uInt16 flags = tmpRange.ParseCols( sCol, excel::GetDocumentFromRange( xRange ), dDetails );
+ sal_uInt16 flags = tmpRange.ParseCols( sCol, getDocumentFromRange( xRange ), dDetails );
if ( ( flags & 0x200 ) != 0x200 )
throw uno::RuntimeException();
nColumn = tmpRange.aStart.Col() + 1;
}
else
{
- if ( aColumnAny.getValueTypeClass() == uno::TypeClass_INTERFACE )
- {
- try
- {
- aColumnAny = getDefaultPropByIntrospection( aColumnAny );
- }
- catch( uno::Exception& ) {}
- }
if ( !( aColumnAny >>= nColumn ) )
{
uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
@@ -2495,7 +2354,7 @@ ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- tmpRange.ParseRows( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
+ tmpRange.ParseRows( sAddress, getDocumentFromRange( mxRange ), dDetails );
SCROW nStartRow = tmpRange.aStart.Row();
SCROW nEndRow = tmpRange.aEnd.Row();
@@ -2539,7 +2398,7 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- tmpRange.ParseCols( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
+ tmpRange.ParseCols( sAddress, getDocumentFromRange( mxRange ), dDetails );
SCCOL nStartCol = tmpRange.aStart.Col();
SCCOL nEndCol = tmpRange.aEnd.Col();
@@ -2623,11 +2482,10 @@ ScVbaRange::getMergeCells() throw (script::BasicErrorException, uno::RuntimeExce
void
ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException)
{
+ if ( m_Areas->getCount() > 1 )
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("That command cannot be used on multiple selections" ) ), uno::Reference< uno::XInterface >() );
if ( Destination.hasValue() )
{
- // #TODO support ( if necessary ) multi-area range in this scenario
- if ( m_Areas->getCount() > 1 )
- throw uno::RuntimeException( rtl::OUString( "!!! That command cannot be used on multiple selections" ), uno::Reference< uno::XInterface >() );
uno::Reference< excel::XRange > xRange( Destination, uno::UNO_QUERY_THROW );
uno::Any aRange = xRange->getCellRange();
uno::Reference< table::XCellRange > xCellRange;
@@ -2643,24 +2501,9 @@ ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException)
}
else
{
- if ( m_Areas->getCount() > 1 )
- {
- uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRanges );
- ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
- ScRangeList aList = pUnoRangesBase->GetRangeList();
- if ( !excel::implnCopyRanges( xModel, aList ) )
- {
- throw uno::RuntimeException( rtl::OUString( "That command cannot be used on multiple selections" ), uno::Reference< uno::XInterface >() );
- }
- }
- else
- {
- ScRange aRange;
- RangeHelper thisRange( mxRange );
- uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRange );
- ScUnoConversion::FillScRange( aRange, thisRange.getCellRangeAddressable()->getRangeAddress() );
- excel::implnCopyRange( xModel, aRange );
- }
+ uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
+ Select();
+ excel::implnCopy( xModel );
}
}
@@ -2682,8 +2525,8 @@ ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException)
uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY);
xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
}
- else {
- uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRange );
+ {
+ uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
Select();
excel::implnCut( xModel );
}
@@ -3240,16 +3083,7 @@ ScVbaRange::Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replace
// OOo.org afaik
uno::Reference< util::XSearchDescriptor > xSearch( xDescriptor, uno::UNO_QUERY );
- // Find all cells that being replaced, used to fire the range changed event.
- uno::Reference< container::XIndexAccess > xIndexAccess = xReplace->findAll( xSearch );
xReplace->replaceAll( xSearch );
-
- if ( xIndexAccess.is() && xIndexAccess->getCount() > 0 )
- {
- // Fires the range change event.
- ScCellRangesBase* pScCellRangesBase = ScCellRangesBase::getImplementation( xIndexAccess );
- lcl_NotifyRangeChanges( getScDocShell()->GetModel(), pScCellRangesBase ); // the original convert method will fail in SUSE
- }
}
return sal_True; // always
}
@@ -3685,44 +3519,73 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException)
return xRange->End( Direction );
}
- table::CellAddress aAddress = getLeftUpperCellAddress();
- SCTAB nTab = aAddress.Sheet;
- SCCOL nCurX = aAddress.Column;
- SCROW nCurY = aAddress.Row;
- SCCOL nNewX = nCurX;
- SCROW nNewY = nCurY;
+ // #FIXME #TODO
+ // euch! found my orig implementation sucked, so
+ // trying this even suckier one ( really need to use/expose code in
+ // around ScTabView::MoveCursorArea(), thats the bit that calcutes
+ // where the cursor should go )
+ // Main problem with this method is the ultra hacky attempt to preserve
+ // the ActiveCell, there should be no need to go to these extreems
+
+ // Save ActiveCell pos ( to restore later )
+ uno::Any aDft;
+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
+ rtl::OUString sActiveCell = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
- ScDocShell* pDocShell = getScDocShell();
- ScDocument* pDoc = pDocShell->GetDocument();
+ // position current cell upper left of this range
+ Cells( uno::makeAny( (sal_Int32) 1 ), uno::makeAny( (sal_Int32) 1 ) )->Select();
- ScMoveDirection eDirection;
- switch ( Direction )
- {
- case excel::XlDirection::xlDown:
- eDirection = SC_MOVE_DOWN;
- break;
- case excel::XlDirection::xlUp:
- eDirection = SC_MOVE_UP;
- break;
- case excel::XlDirection::xlToLeft:
- eDirection = SC_MOVE_LEFT;
- break;
- case excel::XlDirection::xlToRight:
- eDirection = SC_MOVE_RIGHT;
- break;
- default:
- throw uno::RuntimeException( ::rtl::OUString( "Invalid Direction" ), uno::Reference< uno::XInterface >() );
- }
+ uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
- if ( pDoc )
+ SfxViewFrame* pViewFrame = excel::getViewFrame( xModel );
+ if ( pViewFrame )
{
- pDoc->FindAreaPos( nNewX, nNewY, nTab, eDirection );
+ SfxAllItemSet aArgs( SFX_APP()->GetPool() );
+ // Hoping this will make sure this slot is called
+ // synchronously
+ SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
+ aArgs.Put( sfxAsync, sfxAsync.Which() );
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+
+ sal_uInt16 nSID = 0;
+
+ switch( Direction )
+ {
+ case excel::XlDirection::xlDown:
+ nSID = SID_CURSORBLKDOWN;
+ break;
+ case excel::XlDirection::xlUp:
+ nSID = SID_CURSORBLKUP;
+ break;
+ case excel::XlDirection::xlToLeft:
+ nSID = SID_CURSORBLKLEFT;
+ break;
+ case excel::XlDirection::xlToRight:
+ nSID = SID_CURSORBLKRIGHT;
+ break;
+ default:
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Invalid ColumnIndex" ) ), uno::Reference< uno::XInterface >() );
+ }
+ if ( pDispatcher )
+ {
+ pDispatcher->Execute( nSID, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
+ }
}
- ScRange aNewRange( (SCCOL)nNewX, (SCROW)nNewY, nTab, (SCCOL)nNewX, (SCROW)nNewY, nTab );
- uno::Reference< table::XCellRange > xCellRange( new ScCellRangeObj( getScDocShell(), aNewRange ) );
- uno::Reference< excel::XRange > xResultRange = new ScVbaRange( mxParent, mxContext, xCellRange );
- return xResultRange;
+ // result is the ActiveCell
+ rtl::OUString sMoved = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
+
+ // restore old ActiveCell
+ uno::Any aVoid;
+
+ uno::Reference< excel::XRange > xOldActiveCell( xApplication->getActiveSheet()->Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW );
+ xOldActiveCell->Select();
+
+ uno::Reference< excel::XRange > resultCell;
+ resultCell.set( xApplication->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW );
+
+ // return result
+ return resultCell;
}
bool
@@ -3740,7 +3603,7 @@ ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (u
if ( !isSingleCellRange() )
throw uno::RuntimeException( rtl::OUString( "Can't create Characters property for multicell range " ), uno::Reference< uno::XInterface >() );
uno::Reference< text::XSimpleText > xSimple(mxRange->getCellByPosition(0,0) , uno::UNO_QUERY_THROW );
- ScDocument* pDoc = excel::GetDocumentFromRange(mxRange);
+ ScDocument* pDoc = getDocumentFromRange(mxRange);
if ( !pDoc )
throw uno::RuntimeException( rtl::OUString( "Failed to access document from shell" ), uno::Reference< uno::XInterface >() );
@@ -3857,7 +3720,7 @@ ScVbaRange::getCalcColWidth( const table::CellRangeAddress& rAddress) throw (uno
double
ScVbaRange::getCalcRowHeight( const table::CellRangeAddress& rAddress ) throw (uno::RuntimeException)
{
- ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
+ ScDocument* pDoc = getDocumentFromRange( mxRange );
sal_uInt16 nWidth = pDoc->GetOriginalHeight( rAddress.StartRow, rAddress.Sheet );
double nPoints = lcl_TwipsToPoints( nWidth );
nPoints = lcl_Round2DecPlaces( nPoints );
@@ -4127,7 +3990,7 @@ ScVbaRange::setRowHeight( const uno::Any& _rowheight) throw (uno::RuntimeExcepti
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
sal_uInt16 nTwips = lcl_pointsToTwips( nHeight );
- ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
+ ScDocShell* pDocShell = getDocShellFromRange( mxRange );
SCCOLROW nRowArr[2];
nRowArr[0] = thisAddress.StartRow;
nRowArr[1] = thisAddress.EndRow;
@@ -4139,7 +4002,7 @@ uno::Any SAL_CALL
ScVbaRange::getPageBreak() throw (uno::RuntimeException)
{
sal_Int32 nPageBreak = excel::XlPageBreak::xlPageBreakNone;
- ScDocShell* pShell = excel::GetDocShellFromRange( mxRange );
+ ScDocShell* pShell = getDocShellFromRange( mxRange );
if ( pShell )
{
RangeHelper thisRange( mxRange );
@@ -4152,7 +4015,7 @@ ScVbaRange::getPageBreak() throw (uno::RuntimeException)
uno::Reference< frame::XModel > xModel = pShell->GetModel();
if ( xModel.is() )
{
- ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
+ ScDocument* pDoc = getDocumentFromRange( mxRange );
ScBreakType nBreak = BREAK_NONE;
if ( !bColumn )
@@ -4177,7 +4040,7 @@ ScVbaRange::setPageBreak( const uno::Any& _pagebreak) throw (uno::RuntimeExcepti
sal_Int32 nPageBreak = 0;
_pagebreak >>= nPageBreak;
- ScDocShell* pShell = excel::GetDocShellFromRange( mxRange );
+ ScDocShell* pShell = getDocShellFromRange( mxRange );
if ( pShell )
{
RangeHelper thisRange( mxRange );
@@ -4271,7 +4134,7 @@ ScVbaRange::getWorksheet() throw (uno::RuntimeException)
uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
xRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
}
- ScDocShell* pDocShell = excel::GetDocShellFromRange(xRange);
+ ScDocShell* pDocShell = getDocShellFromRange(xRange);
RangeHelper rHelper(xRange);
// parent should be Thisworkbook
xSheet.set( new ScVbaWorksheet( uno::Reference< XHelperInterface >(), mxContext,rHelper.getSpreadSheet(),pDocShell->GetModel()) );
@@ -4327,34 +4190,9 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
}
}
- // Add these codes for supporting shortcut: Application.Range(Range1, Range2), Range1 or Range2 is not the range of current active sheet.
- // If Range1 and Range2 are not in current active sheet, we should not use the active sheet, but use the sheet of Range1 and Range2.
- // If Range1 and Range2 are not in the same sheet, we throw an exception.
- uno::Reference< sheet::XSpreadsheet > xSpreadsheet;
- uno::Reference< excel::XRange > xRange1( Cell1, uno::UNO_QUERY ), xRange2( Cell2, uno::UNO_QUERY );
- if ( xRange1.is() )
- {
- RangeHelper thisRange( xRange1->getCellRange() );
- xSpreadsheet = thisRange.getSpreadSheet();
- }
- else if ( xRange2.is() )
- {
- RangeHelper thisRange( xRange2->getCellRange() );
- xSpreadsheet = thisRange.getSpreadSheet();
- }
- if ( !xSpreadsheet.is() )
- {
- uno::Reference< frame::XModel > xModel = getCurrentExcelDoc( xContext );
- if ( xModel.is() )
- {
- uno::Reference< sheet::XSpreadsheetView > xView( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- xSpreadsheet = xView->getActiveSheet();
- }
- }
-
- uno::Reference< table::XCellRange > xSheetRange( xSpreadsheet, uno::UNO_QUERY_THROW );
+ uno::Reference< sheet::XSpreadsheetView > xView( getCurrentExcelDoc(xContext)->getCurrentController(), uno::UNO_QUERY );
+ uno::Reference< table::XCellRange > xSheetRange( xView->getActiveSheet(), uno::UNO_QUERY_THROW );
ScVbaRange* pRange = new ScVbaRange( excel::getUnoSheetModuleObj( xSheetRange ), xContext, xSheetRange );
-
uno::Reference< excel::XRange > xVbSheetRange( pRange );
return pRange->Range( Cell1, Cell2, true );
}
@@ -4592,20 +4430,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
// we can't use refresh as the uno interface doesn't have a concept of ALL
// in this case we just call the core calc functionality -
bool bAll = false;
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- bool bIsValidFieldValue = ( Field >>= nField );
- if ( !bIsValidFieldValue && xConverter.is() )
- {
- try
- {
- uno::Any aConverted = xConverter->convertTo( Field, getCppuType( (sal_Int32*)0 ) );
- bIsValidFieldValue = ( aConverted >>= nField );
- }
- catch( const uno::Exception& )
- {
- }
- }
- if ( bIsValidFieldValue )
+ if ( ( Field >>= nField ) )
{
uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
@@ -4636,19 +4461,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
bAll = true;
// not sure what the relationship between Criteria1 and Operator is,
// e.g. can you have a Operator without a Criteria ? in openoffice it
- bool bIsValidOpValue = ( Operator.hasValue() && ( Operator >>= nOperator ) );
- if ( Operator.hasValue() && !bIsValidOpValue && xConverter.is() )
- {
- try
- {
- uno::Any aConverted = xConverter->convertTo( Operator, getCppuType( (sal_Int32*)0 ) );
- bIsValidOpValue = ( aConverted >>= nOperator );
- }
- catch( const uno::Exception& )
- {
- }
- }
- if ( bIsValidOpValue )
+ if ( Operator.hasValue() && ( Operator >>= nOperator ) )
{
// if its a bottom/top Ten(Percent/Value) and there
// is no value specified for critera1 set it to 10
@@ -4796,7 +4609,7 @@ ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& /*CopyOrigin*/ ) thro
{
// After the insert ( this range ) actually has moved
ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) );
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( excel::GetDocShellFromRange( mxRange ) , aRange ) );
+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getDocShellFromRange( mxRange ) , aRange ) );
uno::Reference< excel::XRange > xVbaRange( new ScVbaRange( mxParent, mxContext, xRange, mbIsRows, mbIsColumns ) );
xVbaRange->PasteSpecial( uno::Any(), uno::Any(), uno::Any(), uno::Any() );
}
@@ -4820,7 +4633,7 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
if ( !( mbIsColumns || mbIsRows ) )
DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
- ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
+ ScDocShell* pDocShell = getDocShellFromRange( mxRange );
if ( pDocShell )
{
RangeHelper thisRange( mxRange );
@@ -4841,237 +4654,6 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
}
}
-/***************************************************************************************
- * interface for text:
- * com.sun.star.text.XText, com.sun.star.table.XCell, com.sun.star.container.XEnumerationAccess
- * com.sun.star.text.XTextRange,
- * the main problem is to recognize the numeric and date, which assosiate with DecimalSeparator, ThousandsSeparator,
- * TrailingMinusNumbers and FieldInfo.
-***************************************************************************************/
-void SAL_CALL
-ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
- const css::uno::Any& ConsecutiveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
- const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& FieldInfo,
- const css::uno::Any& DecimalSeparator, const css::uno::Any& ThousandsSeparator, const css::uno::Any& /*TrailingMinusNumbers*/ ) throw (css::uno::RuntimeException)
-{
- uno::Reference< excel::XRange > xRange;
- if( Destination.hasValue() )
- {
- if( !( Destination >>= xRange ) )
- throw uno::RuntimeException( rtl::OUString( "Destination parameter should be a range" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set range");
- }
- else
- {
- //set as current
- xRange = this;
- OSL_TRACE("set range as himself");
- }
-
- sal_Int16 xlTextParsingType = excel::XlTextParsingType::xlDelimited;
- if ( DataType.hasValue() )
- {
- if( !( DataType >>= xlTextParsingType ) )
- throw uno::RuntimeException( rtl::OUString( "DataType parameter should be a short" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Datatype" );
- }
- sal_Bool bDilimited = ( xlTextParsingType == excel::XlTextParsingType::xlDelimited );
-
- sal_Int16 xlTextQualifier = excel::XlTextQualifier::xlTextQualifierDoubleQuote;
- if( TextQualifier.hasValue() )
- {
- if( !( TextQualifier >>= xlTextQualifier ))
- throw uno::RuntimeException( rtl::OUString( "TextQualifier parameter should be a short" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set TextQualifier");
- }
-
- sal_Bool bConsecutiveDelimiter = false;
- if( ConsecutiveDelimiter.hasValue() )
- {
- if( !( ConsecutiveDelimiter >>= bConsecutiveDelimiter ) )
- throw uno::RuntimeException( rtl::OUString( "ConsecutiveDelimiter parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set ConsecutiveDelimiter");
- }
-
- sal_Bool bTab = false;
- if( Tab.hasValue() && bDilimited )
- {
- if( !( Tab >>= bTab ) )
- throw uno::RuntimeException( rtl::OUString( "Tab parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Tab");
- }
-
- sal_Bool bSemicolon = false;
- if( Semicolon.hasValue() && bDilimited )
- {
- if( !( Semicolon >>= bSemicolon ) )
- throw uno::RuntimeException( rtl::OUString( "Semicolon parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Semicolon");
- }
- sal_Bool bComma = false;
- if( Comma.hasValue() && bDilimited )
- {
- if( !( Comma >>= bComma ) )
- throw uno::RuntimeException( rtl::OUString( "Comma parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Comma");
- }
- sal_Bool bSpace = false;
- if( Space.hasValue() && bDilimited )
- {
- if( !( Space >>= bSpace ) )
- throw uno::RuntimeException( rtl::OUString( "Space parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set Space");
- }
- sal_Bool bOther = false;
- rtl::OUString sOtherChar;
- if( Other.hasValue() && bDilimited )
- {
- if( Other >>= bOther )
- {
- if( OtherChar.hasValue() )
- if( !( OtherChar >>= sOtherChar ) )
- throw uno::RuntimeException( rtl::OUString( "OtherChar parameter should be a String" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set OtherChar" );
- }
- else if( bOther )
- throw uno::RuntimeException( rtl::OUString( "Other parameter should be a True" ),
- uno::Reference< uno::XInterface >() );
- }
- // FieldInfo, Optional Variant. An array containing parse information for the individual columns of data.
- // The interpretation depends on the value of DataType. When the data is delimited, this argument is an array
- // of two-element arrays, with each two-element array specifying the conversion options for a particular column.
- // The first element is the column number (1-based), and the second element is one of the xlColumnDataType
- // constants specifying how the column is parsed.
- uno::Sequence< uno::Sequence< uno::Any > > sFieldInfo;
- FieldInfo >>= sFieldInfo;
-
- rtl::OUString sDecimalSeparator;
- if( DecimalSeparator.hasValue() )
- {
- if( !( DecimalSeparator >>= sDecimalSeparator ) )
- throw uno::RuntimeException( rtl::OUString( "DecimalSeparator parameter should be a String" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set DecimalSeparator" );
- }
- rtl::OUString sThousandsSeparator;
- if( ThousandsSeparator.hasValue() )
- {
- if( !( ThousandsSeparator >>= sThousandsSeparator ) )
- throw uno::RuntimeException( rtl::OUString( "ThousandsSeparator parameter should be a String" ),
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set ThousandsSpeparator" );
- }
- //TODO* TrailingMinusNumbers Optional Variant. Numbers that begin with a minus character.
-
- // Get the destination range's left-upper cell address.
- ScVbaRange* pDestVbaRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- ScAddress aScDestAddress;
- if ( pDestVbaRange )
- {
- ScUnoConversion::FillScAddress( aScDestAddress, pDestVbaRange->getLeftUpperCellAddress() );
- }
-
- // Parse the value of parameter FieldInfo.
- sal_uInt16 nRealCount = 0;
- sal_Int32* pColumns = NULL;
- sal_uInt8* pFormats = NULL;
- if ( sFieldInfo.getLength() > 0 )
- {
- sal_uInt16 nCount = sFieldInfo.getLength();
- pColumns = new sal_Int32[nCount];
- pFormats = new sal_uInt8[nCount];
- sal_uInt16 nFormat = 1;
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- if ( sFieldInfo[nIndex].getLength() >= 2 )
- {
- nFormat = 1;
- try
- {
- uno::Any aConverted = xConverter->convertTo( sFieldInfo[nIndex][0], getCppuType((sal_Int32*)0) );
- aConverted >>= pColumns[nRealCount];
- aConverted = xConverter->convertTo( sFieldInfo[nIndex][1], getCppuType((sal_uInt16*)0) );
- aConverted >>= nFormat;
- }
- catch( const uno::Exception& )
- {
- }
- pFormats[nRealCount++] = nFormat;
- }
- }
- }
-
- sal_Unicode cTextQualifier = '"';
- cTextQualifier = xlTextQualifier == excel::XlTextQualifier::xlTextQualifierNone ? '\0' : cTextQualifier;
- cTextQualifier = xlTextQualifier == excel::XlTextQualifier::xlTextQualifierSingleQuote ? '\'' : cTextQualifier;
-
- // Get field delimiters.
- String rFieldDelimiters;
- if ( bTab ) rFieldDelimiters += '\t';
- if ( bSemicolon ) rFieldDelimiters += ';';
- if ( bComma ) rFieldDelimiters += ',';
- if ( bSpace ) rFieldDelimiters += ' ';
- if ( bOther ) rFieldDelimiters += *sOtherChar.getStr();
-
- // Get the text in current range to SvMemoryStream.
- ScRange aSrcScRange;
- ScCellRangesBase* pSrcCellRangesBase = getCellRangesBase();
- if ( pSrcCellRangesBase )
- {
- ScRangeList aRangeList = pSrcCellRangesBase->GetRangeList();
- if ( !aRangeList.empty() )
- {
- aSrcScRange = *aRangeList.front();
- }
- }
- ScImportExport aExport( getScDocument(), aSrcScRange );
- aExport.SetDelimiter( static_cast< sal_Unicode >( 0 ) );
- SvMemoryStream aStream;
- aStream.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
- ScImportExport::SetNoEndianSwap( aStream );
- aExport.ExportStream( aStream, String(), FORMAT_STRING );
- aStream.Seek( 0 );
-
- // Set ScAsciiOptions according to the input parameters.
- ScAsciiOptions aOptions;
- aOptions.SetFixedLen( !bDilimited );
- aOptions.SetStartRow( 0 );
- aOptions.SetColInfo( nRealCount, pColumns, pFormats );
- if ( bDilimited )
- {
- aOptions.SetFieldSeps( rFieldDelimiters );
- aOptions.SetMergeSeps( bConsecutiveDelimiter );
- aOptions.SetTextSep( cTextQualifier );
- }
-
- // Split the String in to columns.
- if ( pDestVbaRange && pDestVbaRange->getScDocument() )
- {
- ScImportExport aImport( pDestVbaRange->getScDocument(), aScDestAddress );
- aImport.SetExtOptions( aOptions );
- aImport.SetApi( false );
- aImport.ImportStream( aStream, String(), FORMAT_STRING );
- }
- if ( pColumns )
- {
- DELETEZ( pColumns );
- }
- if ( pFormats )
- {
- DELETEZ( pFormats );
- }
-}
-
uno::Any SAL_CALL
ScVbaRange::Hyperlinks( const uno::Any& aIndex ) throw (uno::RuntimeException)
{
@@ -5214,7 +4796,7 @@ uno::Any ScVbaRange::getShowDetail() throw ( css::uno::RuntimeException)
(thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
{
sal_Bool bColumn =thisAddress.StartRow == thisAddress.EndRow ? false:sal_True;
- ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
+ 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 )
@@ -5270,17 +4852,6 @@ void ScVbaRange::setShowDetail(const uno::Any& aShowDetail) throw ( css::uno::Ru
}
}
-::com::sun::star::uno::Reference< ::ooo::vba::excel::XQueryTable > SAL_CALL
-ScVbaRange::getQueryTable() throw (::com::sun::star::uno::RuntimeException)
-{
- if (!m_xQueryTable.is())
- {
- m_xQueryTable = new ScVbaQueryTable(mxParent ,mxContext, getScDocument(), this);
- }
-
- return m_xQueryTable;
-}
-
uno::Reference< excel::XRange > SAL_CALL
ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeException)
{
@@ -5310,116 +4881,6 @@ ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeExceptio
return new ScVbaRange( mxParent, mxContext, mxRange );
}
-//The recordset's member: Recordset.Fields.Item will get a Field obj.
-//Field.value is the column value.
-::sal_Int32 SAL_CALL
-ScVbaRange::CopyFromRecordset( const ::com::sun::star::uno::Any& Data, const ::com::sun::star::uno::Any& MaxRows, const ::com::sun::star::uno::Any& MaxColumns )
-throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException)
-{
- uno::Sequence< uno::Any > aParams;
- uno::Sequence< uno::Any > aFieldsParams(1);
- uno::Sequence< sal_Int16 > aOutParamIndex;
- uno::Sequence< uno::Any > aOutParam;
- uno::Reference< uno::XInterface > xIntRes;
- uno::Reference< uno::XInterface > xIntFields;
- uno::Reference< uno::XInterface > xIntFld;
- uno::Any aRet;
- uno::Any aPar;
- uno::Any aCrrCol;
- uno::Any aCrrRow;
- sal_Int16 nCrrCol = 0;
- sal_Int32 nCrrRow = 0;
- sal_Int32 nCol;
- sal_Int32 nMaxRows = 0;
- sal_Int32 nMaxColumns = 0;
- sal_Bool bEof = false;
- long lColCnt = 0;
- if (MaxColumns.hasValue())
- {
- MaxColumns >>= nMaxColumns;
- }
-
- long lMaxCol = nMaxColumns;
-
- if (MaxRows.hasValue())
- {
- MaxRows >>= nMaxRows;
- }
-
-
- Data >>= xIntRes;
- uno::Reference< script::XInvocation > xInvRes(xIntRes, uno::UNO_QUERY_THROW);
- rtl::OUString oMoveNext("MoveNext") ;
- rtl::OUString oEof("EOF") ;
- rtl::OUString oFields("Fields") ;
-
- if( !xInvRes->hasMethod(oMoveNext))
- {
- return -1;
- }
-
- //Get columns count
- aRet = xInvRes->getValue(oFields);
- aRet >>= xIntFields;
- uno::Reference< script::XInvocation > xInvFields(xIntFields, uno::UNO_QUERY_THROW);
- aRet = xInvFields->getValue( rtl::OUString("Count")) ;
- aRet >>= lColCnt;
-
- //Set the assign column number
- if (lMaxCol != 0)
- {
- if (lColCnt > lMaxCol)
- {
- lColCnt = lMaxCol;
- }
- }
-
- aCrrRow <<= nCrrRow;
- aCrrCol <<= nCrrCol;
-
-
- //Get start position
- uno::Reference< excel::XRange > xRngStartRow = Rows(uno::Any(sal_Int32(1)) );
- uno::Reference< excel::XRange > xRngPos = xRngStartRow->Columns( uno::Any(sal_Int32(1)) );
-
- while(1)
- {//travel recordset
- //get every column
- for (long l = 0; l < lColCnt ; l++)
- {
- nCol = l;
- aPar <<= nCol;
- //get every field
- aRet = xInvFields->invoke( rtl::OUString("Item"), uno::Sequence< uno::Any >(&aPar,1) , aOutParamIndex,aOutParam);
- aRet >>= xIntFld;
- uno::Reference< script::XInvocation > xInvFld(xIntFld, uno::UNO_QUERY_THROW); //Get the Field obj
-
- //set the field value
- aRet = xInvFld->getValue( rtl::OUString("Value") );
- uno::Reference< excel::XRange > xRngToFill = xRngPos->Offset(aCrrRow,aCrrCol );
-
- xRngToFill->setValue(aRet);
- nCrrCol++;
- aCrrCol <<= nCrrCol;
- }
-
- aRet = xInvRes->invoke(oMoveNext, aParams,aOutParamIndex,aOutParam );
- aRet = xInvRes->getValue(oEof);
- aRet >>= bEof;
- if (bEof || ( nCrrRow >= nMaxRows && nMaxRows != 0) )
- {//Arrive the end of recordset
- break;
- }
-
- nCrrRow++;
- aCrrRow <<= nCrrRow;
- nCrrCol = 0;
- aCrrCol <<= nCrrCol;
- }
-
- return 0;
-}
-
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)
{
@@ -5438,7 +4899,7 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any&
{
ScVbaRange* pRange = getImplementation( xRange );
// initialise the doc shell and the printareas
- pShell = excel::GetDocShellFromRange( pRange->mxRange );
+ pShell = getDocShellFromRange( pRange->mxRange );
xPrintAreas.set( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
}
printAreas[ index - 1 ] = rangeAddress;
@@ -5565,7 +5026,7 @@ ScVbaRange::AutoFill( const uno::Reference< excel::XRange >& Destination, const
}
}
double fEndValue = MAXDOUBLE;
- ScDocShell* pDocSh = excel::GetDocShellFromRange( mxRange );
+ ScDocShell* pDocSh = getDocShellFromRange( mxRange );
pDocSh->GetDocFunc().FillAuto( aSourceRange, NULL, eDir, eCmd, eDateCmd,
nCount, fStep, fEndValue, sal_True, sal_True );
}
@@ -5637,8 +5098,13 @@ ScVbaRange::AutoOutline( ) throw (script::BasicErrorException, uno::RuntimeExce
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- xSheetOutline->autoOutline( thisAddress );
+ if ( isSingleCellRange() || mbIsRows )
+ {
+ uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
+ xSheetOutline->autoOutline( thisAddress );
+ }
+ else
+ DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
}
void SAL_CALL
@@ -5664,9 +5130,9 @@ ScVbaRange::groupUnGroup( bool bUnGroup ) throw ( script::BasicErrorException, u
{
if ( m_Areas->getCount() > 1 )
DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY);
- table::TableOrientation nOrient = table::TableOrientation_COLUMNS;
- if ( mbIsRows )
- nOrient = table::TableOrientation_ROWS;
+ table::TableOrientation nOrient = table::TableOrientation_ROWS;
+ if ( mbIsColumns )
+ nOrient = table::TableOrientation_COLUMNS;
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
@@ -6060,182 +5526,6 @@ ScVbaRange::Subtotal( ::sal_Int32 _nGroupBy, ::sal_Int32 _nFunction, const uno::
}
}
-uno::Any SAL_CALL ScVbaRange::AdvancedFilter( sal_Int32 Action, const uno::Any& CriteriaRange,
- const uno::Any& CopyToRange, const uno::Any& Unique ) throw (script::BasicErrorException, uno::RuntimeException)
-{
- uno::Any aRet;
- aRet <<= sal_True;
-
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- ScDocument* pDoc = getScDocument();
- if ( !pDoc )
- {
- throw uno::RuntimeException( rtl::OUString( "Failed to access document from range" ), uno::Reference< uno::XInterface >() );
- }
-
- // Action
- if ( Action != excel::XlFilterAction::xlFilterInPlace && Action != excel::XlFilterAction::xlFilterCopy )
- {
- throw uno::RuntimeException( rtl::OUString( "Invalid input parameter" ), uno::Reference< uno::XInterface >() );
- }
- if ( m_Areas->getCount() > 1 )
- {
- throw uno::RuntimeException( rtl::OUString( "Invalid range" ), uno::Reference< uno::XInterface >() );
- }
-
- sal_Bool bCopyOut = ( Action != excel::XlFilterAction::xlFilterInPlace );
- uno::Reference< sheet::XSheetFilterDescriptor > xFilterDesc;
- uno::Reference< sheet::XSheetFilterable > xSheetFilter( mxRange, uno::UNO_QUERY_THROW );
-
- // CriteriaRange
- String aBuiltInCriteria; // Excel Built-In Filter Criteria.
- table::CellRangeAddress refParentAddr;
- uno::Any aCriteriaRange = CriteriaRange;
- formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1;
- if ( aCriteriaRange.hasValue() && aCriteriaRange.getValueTypeClass() == uno::TypeClass_STRING )
- {
- rtl::OUString rRangeString;
- aCriteriaRange >>= rRangeString;
- aConv = excel::IsR1C1ReferFormat( pDoc, rRangeString ) ? formula::FormulaGrammar::CONV_XL_R1C1 : aConv;
- }
- else
- {
- // Get Excel BuiltIn Filter Criteria.
- ScRangeName* pRangeNames = pDoc->GetRangeName();
- if (pRangeNames)
- {
- ScRangeName::const_iterator itr = pRangeNames->begin(), itrEnd = pRangeNames->end();
- for (; itr != itrEnd; ++itr)
- {
- if (itr->second->HasType(RT_CRITERIA))
- {
- itr->second->GetSymbol( aBuiltInCriteria, formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
- break;
- }
- }
- }
- aCriteriaRange = aBuiltInCriteria.Len() > 0 ? uno::makeAny( rtl::OUString( aBuiltInCriteria ) ) : aCriteriaRange;
- }
- if ( aCriteriaRange.hasValue() )
- {
- table::CellRangeAddress criteriaRangeAddress = getCellRangeAddressForVBARange( aCriteriaRange, getScDocShell(), aConv );
- ScRange refRange;
- ScUnoConversion::FillScRange( refRange, criteriaRangeAddress );
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), refRange ) );
- uno::Reference< sheet::XSheetFilterableEx > xCriteria( xRange, uno::UNO_QUERY );
- if ( xCriteria.is() )
- {
- xFilterDesc = xCriteria->createFilterDescriptorByObject( xSheetFilter );
- }
- }
- else if ( mxRange.is() )
- {
- uno::Reference< sheet::XSheetFilterableEx > xCriteria( mxRange, uno::UNO_QUERY );
- if ( xCriteria.is() )
- {
- xFilterDesc = xCriteria->createFilterDescriptorByObject( xSheetFilter );
- }
- }
-
- uno::Reference< beans::XPropertySet > xPropertySet( xFilterDesc, uno::UNO_QUERY );
- if ( xPropertySet.is() )
- {
- xPropertySet->setPropertyValue( rtl::OUString( SC_UNONAME_COPYOUT ), uno::makeAny( bCopyOut ) );
- }
-
- // CopyToRange
- if ( bCopyOut && CopyToRange.hasValue() && xPropertySet.is() )
- {
- formula::FormulaGrammar::AddressConvention aTmpConv = formula::FormulaGrammar::CONV_XL_A1;
- if ( CopyToRange.getValueTypeClass() == uno::TypeClass_STRING )
- {
- rtl::OUString rRangeString;
- CopyToRange >>= rRangeString;
- aTmpConv = excel::IsR1C1ReferFormat( pDoc, rRangeString ) ? formula::FormulaGrammar::CONV_XL_R1C1 : aConv;
- }
- ScRange refRange;
- ScUnoConversion::FillScRange( refRange, getCellRangeAddressForVBARange( CopyToRange, getScDocShell(), aTmpConv ) );
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), refRange ) );
- uno::Reference< sheet::XCellAddressable > xCellAddr( xRange->getCellByPosition( 0, 0 ), uno::UNO_QUERY_THROW );
- xPropertySet->setPropertyValue( rtl::OUString( SC_UNONAME_OUTPOS ), uno::makeAny( xCellAddr->getCellAddress() ) );
- }
-
- // Unique
- if ( xPropertySet.is() )
- {
- sal_Bool bUnique = false;
- uno::Any aUnique;
- try
- {
- aUnique <<= bUnique;
- aUnique = ( xConverter.is() && Unique.hasValue() ) ? xConverter->convertTo( Unique, getCppuType( ( sal_Bool* ) 0 ) ) : aUnique;
- }
- catch( const uno::Exception& )
- {
- }
- xPropertySet->setPropertyValue( rtl::OUString( SC_UNONAME_SKIPDUP ), aUnique );
- }
-
- // Do filter.
- if ( xFilterDesc.is() )
- {
- xSheetFilter->filter( xFilterDesc );
- }
-
- return aRet;
-}
-
-//Range.PivotTable.
-//Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.
-uno::Reference< excel::XPivotTable >
-ScVbaRange::PivotTable() throw (uno::RuntimeException)
-{
- uno::Reference< excel::XPivotTable > xDestPVTable;
-
- uno::Reference< sheet::XSpreadsheet > xSheet;
- if ( mxRange.is() )
- {
- RangeHelper thisRange( mxRange );
- xSheet = thisRange.getSpreadSheet();
- }
- else if ( mxRanges.is() )
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- RangeHelper thisRange( xRange );
- xSheet = thisRange.getSpreadSheet();
- }
-
- uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ;
- uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW );
- if ( xIndexAccess.is() )
- {
- //get the upper-left cell address
- table::CellAddress aAddress = getLeftUpperCellAddress();
-
- sal_Int32 nCount = xIndexAccess->getCount();
- for (sal_Int32 i=0; i < nCount; i++)
- {
- uno::Reference< sheet::XDataPilotTable > xDPTable(xIndexAccess->getByIndex(i), uno::UNO_QUERY);
- uno::Reference< sheet::XDataPilotTable2 > xDPTable2(xDPTable, uno::UNO_QUERY);
-
- //check if the cell is in the pivot table
- sheet::DataPilotTablePositionData posData = xDPTable2->getPositionData(aAddress);
- table::CellRangeAddress aCellRangeAddress = xDPTable->getOutputRange();
- ScRange aScRange( aCellRangeAddress.StartColumn, aCellRangeAddress.StartRow, aCellRangeAddress.Sheet,
- aCellRangeAddress.EndColumn, aCellRangeAddress.EndRow, aCellRangeAddress.Sheet );
- ScAddress aPos( aAddress.Column, aAddress.Row, aAddress.Sheet );
- if( !(posData.PositionType == sheet::DataPilotTablePositionType::NOT_IN_TABLE) || aScRange.In( aPos ) )
- {
- xDestPVTable = new ScVbaPivotTable( mxContext, xDPTable );
- break;
- }
- }
- }
- return xDestPVTable;
-}
-
-
rtl::OUString
ScVbaRange::getServiceImplName()
{
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index b395445bf459..e39f8bb9ed5e 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -36,7 +36,6 @@
#include <ooo/vba/excel/XFont.hpp>
#include <ooo/vba/excel/XComment.hpp>
#include <ooo/vba/XCollection.hpp>
-#include <ooo/vba/excel/XPivotTable.hpp>
#include <ooo/vba/excel/XlPasteType.hpp>
#include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
@@ -51,8 +50,6 @@
#include <com/sun/star/sheet/FillDirection.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include "vbaquerytable.hxx"
#include "vbaformat.hxx"
#include <formula/grammar.hxx>
@@ -99,7 +96,6 @@ class ScVbaRange : public ScVbaRange_BASE
sal_Bool mbIsRows;
sal_Bool mbIsColumns;
css::uno::Reference< ov::excel::XValidation > m_xValidation;
- css::uno::Reference<excel::XQueryTable> m_xQueryTable;
double getCalcColWidth( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
double getCalcRowHeight( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
void visitArray( ArrayVisitor& vistor );
@@ -155,7 +151,6 @@ public:
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 );
- css::table::CellAddress getLeftUpperCellAddress();
static css::uno::Reference< ov::excel::XRange > CellsHelper(
const css::uno::Reference< ov::XHelperInterface >& xParent,
@@ -164,8 +159,6 @@ public:
const css::uno::Any &nRowIndex, const css::uno::Any &nColumnIndex ) throw(css::uno::RuntimeException);
// Attributes
- virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const css::uno::Any& aName ) throw (css::uno::RuntimeException);
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);
@@ -206,7 +199,6 @@ public:
virtual css::uno::Any SAL_CALL getPrefixCharacter() throw (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);
- virtual ::com::sun::star::uno::Reference< ::ooo::vba::excel::XQueryTable > SAL_CALL getQueryTable() throw (::com::sun::star::uno::RuntimeException);
// Methods
sal_Bool IsRows() const { return mbIsRows; }
sal_Bool IsColumns() const { return mbIsColumns; }
@@ -256,10 +248,6 @@ public:
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& ConsecutiveDelimiter, 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 css::uno::Any SAL_CALL Hyperlinks( const css::uno::Any& aIndex ) 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);
@@ -282,11 +270,7 @@ public:
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);
- virtual css::uno::Any SAL_CALL AdvancedFilter( ::sal_Int32 Action, const css::uno::Any& CriteriaRange, const css::uno::Any& CopyToRange, const css::uno::Any& Unique ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< ov::excel::XPivotTable > SAL_CALL PivotTable( ) throw (css::uno::RuntimeException);
-
- virtual ::sal_Int32 SAL_CALL CopyFromRecordset( const ::com::sun::star::uno::Any& Data, const ::com::sun::star::uno::Any& MaxRows, const ::com::sun::star::uno::Any& MaxColumns ) throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException);
// XEnumerationAccess
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
// XElementAccess
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 8e5b38f6049a..209facdef2b4 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -38,7 +38,6 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <ooo/vba/excel/XlFileFormat.hpp>
-#include <ooo/vba/excel/XApplication.hpp>
#include "scextopt.hxx"
#include "vbaworksheet.hxx"
@@ -163,24 +162,6 @@ ScVbaWorkbook::getFileFormat( ) throw (::uno::RuntimeException)
return aFileFormat;
}
-// Convert Excel fileformat to OO file filter
-::rtl::OUString ScVbaWorkbook::convertFileFormat(sal_Int32 aFileFormat)
-{
- rtl::OUString aFilterName;
-
- switch(aFileFormat)
- {
- case excel::XlFileFormat::xlCSV:
- aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text - txt - csv (StarCalc)" ) );
- break;
- case excel::XlFileFormat::xlExcel9795:
- aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MS Excel 97" ) );
- break;
- }
-
- return aFilterName;
-}
-
void
ScVbaWorkbook::init()
{
@@ -312,50 +293,6 @@ ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::Runtime
xStor->storeToURL( aURL, storeProps );
}
-// Add Workbook.SaveAs.
-void
-ScVbaWorkbook::SaveAs( const rtl::OUString& FileName, const uno::Any& FileFormat, const uno::Any& /*CreateBackup*/ ) throw ( uno::RuntimeException)
-{
- rtl::OUString aURL;
- osl::FileBase::getFileURLFromSystemPath( FileName, aURL );
- //if the input parameter "FileName" takes the form as "MyFile", we need to get the current directory and combine the current directory and the file name
- INetURLObject aFileNameURL( aURL );
- aURL = aFileNameURL.GetMainURL( INetURLObject::NO_DECODE );
- if ( aURL.isEmpty() )
- {
- uno::Reference< excel::XApplication > xApplication ( Application(),uno::UNO_QUERY_THROW );
- rtl::OUString aPathStr = xApplication->getDefaultFilePath();
- rtl::OUString aPathURLStr;
- osl::FileBase::getFileURLFromSystemPath( aPathStr, aPathURLStr );
- INetURLObject aPathURL( aPathURLStr );
- aPathURL.Append( FileName );
- aURL = aPathURL.GetMainURL( INetURLObject::NO_DECODE );
- }
-
- uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
-
- sal_Int32 aFileFormat = excel::XlFileFormat::xlExcel9795;
- FileFormat >>= aFileFormat;
-
- if ( FileName.indexOf('.') == -1 )
- {
- if ( aFileFormat == excel::XlFileFormat::xlExcel9795 )
- {
- aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".xls" ) );
- }
- else if ( aFileFormat == excel::XlFileFormat::xlCSV )
- {
- aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".csv" ) );
- }
- }
-
- uno::Sequence< beans::PropertyValue > storeProps(1);
- storeProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
- storeProps[0].Value <<= convertFileFormat(aFileFormat);
-
- xStor->storeAsURL( aURL, storeProps );
-}
-
css::uno::Any SAL_CALL
ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException)
{
diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx
index 0164eb75a900..063d7c3e139d 100644
--- a/sc/source/ui/vba/vbaworkbook.hxx
+++ b/sc/source/ui/vba/vbaworkbook.hxx
@@ -41,7 +41,6 @@ class ScVbaWorkbook : public ScVbaWorkbook_BASE
void initColorData( const css::uno::Sequence< sal_Int32 >& sColors );
void init();
- ::rtl::OUString convertFileFormat(sal_Int32 aFileFormat);
protected:
ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
@@ -72,7 +71,6 @@ public:
virtual css::uno::Any SAL_CALL Colors( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getFileFormat( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL SaveCopyAs( const rtl::OUString& Filename ) throw ( css::uno::RuntimeException);
- virtual void SAL_CALL SaveAs( const rtl::OUString& FileName, const css::uno::Any& FileFormat, const css::uno::Any& CreateBackup ) throw (css::uno::RuntimeException);
// code name
virtual ::rtl::OUString SAL_CALL getCodeName() throw ( css::uno::RuntimeException);
@@ -81,7 +79,6 @@ public:
virtual rtl::OUString getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- virtual css::uno::Reference< css::frame::XModel > getDocModel() { return mxModel; }
// XUnoTunnel
virtual ::sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8 >& rId ) throw(css::uno::RuntimeException);
};
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index a2e738475743..528941b090d7 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -106,7 +106,6 @@
#include "vbaworksheets.hxx"
#include "vbahyperlinks.hxx"
#include "vbasheetobjects.hxx"
-#include "viewuno.hxx"
#include "markdata.hxx"
#include "dbdata.hxx"
@@ -312,26 +311,18 @@ ScVbaWorksheet::setName(const ::rtl::OUString &rName ) throw (uno::RuntimeExcept
xNamed->setName( rName );
}
-::sal_Int32
+sal_Int32
ScVbaWorksheet::getVisible() throw (uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
- uno::Any aValue = xProps->getPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ) );
- sal_Bool bRet = false;
- aValue >>= bRet;
- if ( bRet )
- {
- return excel::XlSheetVisibility::xlSheetVisible;
- }
- else
- {
- return excel::XlSheetVisibility::xlSheetHidden;
- }
+ bool bVisible = false;
+ xProps->getPropertyValue( "IsVisible" ) >>= bVisible;
+ using namespace ::ooo::vba::excel::XlSheetVisibility;
+ return bVisible ? xlSheetVisible : (mbVeryHidden ? xlSheetVeryHidden : xlSheetHidden);
}
void
-ScVbaWorksheet::setVisible( ::sal_Int32 nVisible ) throw (uno::RuntimeException)
+ScVbaWorksheet::setVisible( sal_Int32 nVisible ) throw (uno::RuntimeException)
{
using namespace ::ooo::vba::excel::XlSheetVisibility;
bool bVisible = true;
@@ -353,9 +344,7 @@ ScVbaWorksheet::setVisible( ::sal_Int32 nVisible ) throw (uno::RuntimeException)
throw uno::RuntimeException();
}
uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
- xProps->setPropertyValue
- ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ),
- uno::Any( bVisible ) );
+ xProps->setPropertyValue( "IsVisible", uno::Any( bVisible ) );
}
sal_Int16
@@ -573,30 +562,10 @@ ScVbaWorksheet::Activate() throw (uno::RuntimeException)
xSpreadsheet->setActiveSheet(getSheet());
}
-// support expand (but not replace) the active sheet
void
-ScVbaWorksheet::Select(const css::uno::Any& aReplace) throw (uno::RuntimeException)
+ScVbaWorksheet::Select() throw (uno::RuntimeException)
{
- sal_Bool bReplace = true;
- if (aReplace.hasValue() && aReplace.getValueTypeClass() == uno::TypeClass_BOOLEAN)
- {
- aReplace >>= bReplace;
- }
-
- uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
- getModel()->getCurrentController(), uno::UNO_QUERY_THROW );
- ScTabViewObj* pTabView = static_cast< ScTabViewObj* >( xSpreadsheet.get() );
-
- if (bReplace)
- {
- pTabView->selectSheet(getSheet(), false);
- }
- else
- {
- uno::Reference< sheet::XSpreadsheet > xOldActiveSheet = pTabView->getActiveSheet();
- pTabView->selectSheet(getSheet(), true);
- pTabView->selectSheet(xOldActiveSheet, true);
- }
+ Activate();
}
void
@@ -699,25 +668,13 @@ ScVbaWorksheet::getSheetAtOffset(SCTAB offset) throw (uno::RuntimeException)
uno::Reference< excel::XWorksheet >
ScVbaWorksheet::getNext() throw (uno::RuntimeException)
{
- // catch the exception for index out of bound
- try{
- return getSheetAtOffset(static_cast<SCTAB>(1));
- }catch( lang::IndexOutOfBoundsException& /*e*/ )
- {
- return NULL;
- }
+ return getSheetAtOffset(static_cast<SCTAB>(1));
}
uno::Reference< excel::XWorksheet >
ScVbaWorksheet::getPrevious() throw (uno::RuntimeException)
{
- // catch the exception for index out of bound
- try{
- return getSheetAtOffset(-1);
- }catch( lang::IndexOutOfBoundsException& /*e*/ )
- {
- return NULL;
- }
+ return getSheetAtOffset(-1);
}
@@ -804,7 +761,7 @@ ScVbaWorksheet::ChartObjects( const uno::Any& Index ) throw (uno::RuntimeExcepti
uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW );
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
}
if ( Index.hasValue() )
@@ -1126,7 +1083,7 @@ ScVbaWorksheet::getCodeName() throw (css::uno::RuntimeException)
sal_Int16
ScVbaWorksheet::getSheetID() throw (uno::RuntimeException)
{
- uno::Reference< sheet::XCellRangeAddressable > xAddressable( getSheet(), uno::UNO_QUERY_THROW ); // if ActiveSheet, mxSheet is null.
+ uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW ); // if ActiveSheet, mxSheet is null.
return xAddressable->getRangeAddress().Sheet;
}
diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx
index a3771a24601a..f9b801152b3c 100644
--- a/sc/source/ui/vba/vbaworksheet.hxx
+++ b/sc/source/ui/vba/vbaworksheet.hxx
@@ -92,8 +92,8 @@ public:
// Attributes
virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( ::sal_Int32 _Visible ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( sal_Int32 nVisible ) throw (css::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getStandardWidth() throw (css::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getStandardHeight() throw (css::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL getProtectionMode() throw (css::uno::RuntimeException);
@@ -116,7 +116,7 @@ public:
// Methods
virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Select(const css::uno::Any& aReplace) throw (css::uno::RuntimeException); // add the input parameter to support expand selection
+ virtual void SAL_CALL Select() 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);
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 86371930c279..5def6996cc0c 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -237,8 +237,7 @@ sal_Bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, sal_Bool bCut, sal_Bool b
return bDone;
}
-// Copy the content of the Range into clipboard. Adding this method for VBA API: Range.Copy().
-// also combine the old content of CopyToClip method to share this implementation
+// Copy the content of the Range into clipboard.
sal_Bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, sal_Bool bCut, sal_Bool bApi, sal_Bool bIncludeObjects, sal_Bool bStopEdit, sal_Bool bUseRangeForVBA )
{
if ( rRanges.empty() )
@@ -256,7 +255,7 @@ sal_Bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRange
if ( !aClipParam.isMultiRange() )
{
- if ( pDoc && ( ( bUseRangeForVBA && !pDoc->HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ) ) || ( !bUseRangeForVBA && !pDoc->HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rMark ) ) ) )
+ if ( pDoc && ( !pDoc->HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rMark ) ) )
{
sal_Bool bSysClip = false;
if ( !pClipDoc ) // no clip doc specified
@@ -366,9 +365,8 @@ sal_Bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRange
for ( size_t i = 1; i < aClipParam.maRanges.size(); ++i )
{
p = aClipParam.maRanges[i];
- if ( ( bUseRangeForVBA && pDoc->HasSelectedBlockMatrixFragment(
- p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), p->aStart.Tab() ) ) || ( !bUseRangeForVBA && pDoc->HasSelectedBlockMatrixFragment(
- p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark) ) )
+ if ( pDoc->HasSelectedBlockMatrixFragment(
+ p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark) )
{
if (!bApi)
ErrorMessage(STR_MATRIXFRAGMENTERR);
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 4d93bbfffa3f..00981f075898 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -58,7 +58,7 @@
#include <com/sun/star/awt/XRadioButton.hpp>
#include <com/sun/star/awt/XListBox.hpp>
-#include "vbamsformreturntypes.hxx"
+#include <ooo/vba/msforms/ReturnInteger.hpp>
#include <sfx2/objsh.hxx>
#include <basic/sbstar.hxx>
@@ -68,9 +68,6 @@
#include <basic/sbx.hxx>
#include <filter/msfilter/msvbahelper.hxx>
-
-
-
// for debug
#include <comphelper/anytostring.hxx>
@@ -122,14 +119,6 @@ bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
return true;
}
-bool isFocusEventOk( awt::FocusEvent& evt, const Sequence< Any >& params )
-{
- if ( !( params.getLength() > 0 ) ||
- !( params[ 0 ] >>= evt ) )
- return false;
- return true;
-}
-
Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
{
Sequence< Any > translatedParams;
@@ -173,14 +162,9 @@ Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
translatedParams.realloc(1);
- //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
- //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
- //So the newly defined VbaReturnIntege class is used here to support default value.
- VbaReturnInteger* pKeyCode = new VbaReturnInteger();
- pKeyCode->Value = evt.KeyChar;
- ::uno::Reference< msforms::XReturnInteger > xInteger =
- static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
- translatedParams[0] <<= xInteger;
+ msforms::ReturnInteger keyCode;
+ keyCode.Value = evt.KeyCode;
+ translatedParams[0] <<= keyCode;
return translatedParams;
}
@@ -194,41 +178,18 @@ Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
translatedParams.realloc(2);
- //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
- //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
- //So the newly defined VbaReturnIntege class is used here to support default value.
- VbaReturnInteger* pKeyCode = new VbaReturnInteger();
- sal_Int8 shift = evt.Modifiers;
+ msforms::ReturnInteger keyCode;
+ sal_Int8 shift = sal::static_int_cast<sal_Int8>( evt.Modifiers );
- pKeyCode->Value = evt.KeyChar;
- ::uno::Reference< msforms::XReturnInteger > xInteger = static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
- translatedParams[0] <<= xInteger;
+ // #TODO check whether values from OOO conform to values generated from vba
+ keyCode.Value = evt.KeyCode;
+ translatedParams[0] <<= keyCode;
translatedParams[1] <<= shift;
return translatedParams;
}
-Sequence< Any > ooFocusLostToVBAExit( const Sequence< Any >& params )
-{
- Sequence< Any > translatedParams;
- awt::FocusEvent evt;
-
- if ( !isFocusEventOk( evt, params ) )
- return Sequence< Any >();
-
- translatedParams.realloc(1);
-
- VbaReturnBoolean* pCancel = new VbaReturnBoolean();
-
- ::uno::Reference< msforms::XReturnBoolean > xBoolean=
- static_cast< ::uno::Reference< msforms::XReturnBoolean > > (pCancel);
- translatedParams[0] <<= xBoolean;
- return translatedParams;
-}
-
-
typedef Sequence< Any > (*Translator)(const Sequence< Any >&);
-
//expand the "TranslateInfo" struct to support more kinds of events
struct TranslateInfo
{
@@ -255,7 +216,6 @@ bool ApproveAll(const ScriptEvent& evt, void* pPara); //allow all types of contr
bool ApproveType(const ScriptEvent& evt, void* pPara); //certain types of controls should execute the event, those types are given by pPara
bool DenyType(const ScriptEvent& evt, void* pPara); //certain types of controls should not execute the event, those types are given by pPara
bool DenyMouseDrag(const ScriptEvent& evt, void* pPara); //used for VBA MouseMove event when "Shift" key is pressed
-bool DenyKeys(const ScriptEvent& evt, void* pPara); //For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
struct TypeList
{
@@ -295,7 +255,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
// focusLost ooo event
{ MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_LostFocus"), NULL, ApproveAll, NULL } },
- { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), ooFocusLostToVBAExit, ApproveType, (void*)(&textCompList) } },
+ { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), NULL, ApproveType, (void*)(&textCompList) } }, // support VBA TextBox_Exit event
// adjustmentValueChanged ooo event
{ MAP_CHAR_LEN("adjustmentValueChanged"), { MAP_CHAR_LEN("_Scroll"), NULL, ApproveAll, NULL } },
@@ -321,7 +281,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
// keyPressed ooo event
{ MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } },
- { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyUpDown, DenyKeys, NULL } }
+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } }
};
EventInfoHash& getEventTransInfo()
@@ -885,23 +845,6 @@ bool DenyMouseDrag(const ScriptEvent& evt, void* )
}
}
-//For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
-bool DenyKeys(const ScriptEvent& evt, void* /*pPara*/)
-{
- awt::KeyEvent aEvent;
- evt.Arguments[ 0 ] >>= aEvent;
- if (aEvent.KeyChar == 0 || aEvent.KeyChar == 8)
- {
- return false;
- }
- else
- {
- return true;
- }
-}
-
-
-
// EventListener
diff --git a/scripting/source/vbaevents/vbamsformreturntypes.hxx b/scripting/source/vbaevents/vbamsformreturntypes.hxx
deleted file mode 100644
index e6cab6ade314..000000000000
--- a/scripting/source/vbaevents/vbamsformreturntypes.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright IBM Corporation 2009, 2010.
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef VBA_MSFORM_RETURNTYPES_HXX
-#define VBA_MSFORM_RETURNTYPES_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <ooo/vba/msforms/XReturnBoolean.hpp>
-#include <ooo/vba/msforms/XReturnInteger.hpp>
-
-
-typedef ::cppu::WeakImplHelper1<ooo::vba::msforms::XReturnBoolean> ReturnBoolean_BASE;
-
-class SAL_DLLPUBLIC_EXPORT VbaReturnBoolean : public ReturnBoolean_BASE
-{
-public:
- sal_Bool Value;
-
-public:
- VbaReturnBoolean() : Value(false) {} ;
-
- // XReturnBoolean
- virtual ::sal_Bool SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
- virtual void SAL_CALL setValue( ::sal_Bool _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
-
- // XDefaultProperty
- ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString("Value"); }
-};
-
-
-typedef ::cppu::WeakImplHelper1<ooo::vba::msforms::XReturnInteger> ReturnInteger_BASE;
-
-class SAL_DLLPUBLIC_EXPORT VbaReturnInteger : public ReturnInteger_BASE
-{
-public:
- sal_Int32 Value;
-
-public:
- VbaReturnInteger() : Value(0) {} ;
-
- // XReturnInteger
- virtual ::sal_Int32 SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
- virtual void SAL_CALL setValue( ::sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
-
- // XDefaultProperty
- ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString("Value"); }
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 0b53930c08be..549ac0ee4139 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -57,7 +57,6 @@
#define SID_VERSION_VISIBLE (SID_SFX_START + 313)
#define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
-#define SID_DIALOG_RETURN (SID_SFX_START + 318)
#define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320)
#define SID_PRINTER_NAME (SID_SFX_START + 322)
#define SID_PRINTER_CHANGESTODOC (SID_SFX_START + 324)
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 23ca46f4e014..1af5157d4868 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -634,7 +634,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
// Filter arguments which shouldn't be part of the sequence property value
sal_Bool bTemp = sal_Bool();
sal_uInt16 nModifier(0);
- sal_Bool bVBARequest = sal_False;
std::vector< ::com::sun::star::beans::PropertyValue > aAddArgs;
for( sal_Int32 n=0; n<nCount; n++ )
{
@@ -651,10 +650,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
}
else if( rProp.Name.equalsAsciiL("KeyModifier",11))
rProp.Value >>= nModifier;
- else if( rProp.Name.equalsAsciiL("VBADialogResultRequest",22) )
- {
- rProp.Value >>= bVBARequest;
- }
else
aAddArgs.push_back( aArgs[n] );
}
@@ -740,14 +735,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
pDispatcher->GetBindings()->Execute_Impl( aReq, pSlot, pShell );
pItem = aReq.GetReturnValue();
bSuccess = aReq.IsDone() || pItem != NULL;
- if ( bVBARequest )
- {
- SFX_REQUEST_ARG( aReq, pDlgRet, SfxBoolItem, SID_DIALOG_RETURN, sal_False );
- if ( pDlgRet )
- {
- bSuccess = pDlgRet->GetValue();
- }
- }
}
}
#ifdef DBG_UTIL
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 47547569f58b..999ab2076aa5 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -28,7 +28,6 @@
#include <com/sun/star/task/InteractionClassification.hpp>
#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
@@ -65,7 +64,6 @@ namespace sfx2
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::script::XLibraryContainer;
using ::com::sun::star::script::XLibraryQueryExecutable;
- using ::com::sun::star::script::vba::XVBACompatibility;
using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_QUERY;
@@ -331,8 +329,6 @@ namespace sfx2
if ( xScripts.is() )
xContainer.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW );
- Reference< XVBACompatibility > xDocVBAMode( xContainer, UNO_QUERY );
- sal_Bool bIsVBAMode = ( xDocVBAMode.is() && xDocVBAMode->getVBACompatibilityMode() );
if ( xContainer.is() )
{
// a library container exists; check if it's empty
@@ -345,47 +341,24 @@ namespace sfx2
{
::rtl::OUString aStdLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
- sal_Int32 nElementCount = aElements.getLength();
- if ( nElementCount )
+ if ( aElements.getLength() )
{
- // old check, if more than 1 library or the first library isn't the expected 'Standard'
- // trigger the security 'nag' dialog
- if ( !bIsVBAMode && ( nElementCount > 1 || !aElements[0].equals( aStdLibName ) ) )
+ if ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) )
bHasMacroLib = sal_True;
else
{
- // other wise just check all libraries for executeable code
- Reference< XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY );
+ // usually a "Standard" library is always present (design)
+ // for this reason we must check if it's empty
+ //
+ // Note: Since #i73229#, this is not true anymore. There's no default
+ // "Standard" lib anymore. Wouldn't it be time to get completely
+ // rid of the "Standard" thingie - this shouldn't be necessary
+ // anymore, should it?
+ Reference < XNameAccess > xLib;
+ Any aAny = xContainer->getByName( aStdLibName );
+ aAny >>= xLib;
if ( xLib.is() )
- {
- const ::rtl::OUString* pElementName = aElements.getConstArray();
- for ( sal_Int32 index = 0; index < nElementCount; ++index )
- {
- bHasMacroLib = xLib->HasExecutableCode( pElementName[index] );
- if ( bHasMacroLib )
- break;
- }
- }
- }
- }
- }
- }
- if ( bIsVBAMode && !bHasMacroLib && xScripts.is() )
- {
- Reference< XLibraryContainer > xDlgContainer( xScripts->getDialogLibraries(), UNO_QUERY );
- if ( xDlgContainer.is() && xDlgContainer->hasElements() )
- {
- Sequence< ::rtl::OUString > aElements = xDlgContainer->getElementNames();
- sal_Int32 nElementCount = aElements.getLength();
- const ::rtl::OUString* pElementName = aElements.getConstArray();
- for ( sal_Int32 index = 0; index < nElementCount; ++index )
- {
- Reference< XNameAccess > xNameAccess;
- xDlgContainer->getByName( pElementName[index] ) >>= xNameAccess;
- if ( xNameAccess.is() && xNameAccess->hasElements() )
- {
- bHasMacroLib = sal_True;
- break;
+ bHasMacroLib = xLib->hasElements();
}
}
}
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 5bc80c36073c..22f3780972e9 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -873,10 +873,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
aReq.AppendItem( SfxStringItem( SID_PRINTER_NAME, pDlgPrinter->GetName() ) );
aReq.Done();
}
- if ( nId == SID_SETUPPRINTER )
- {
- rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, sal_True ) );
- }
// take the changes made in the dialog
pPrinter = SetPrinter_Impl( pDlgPrinter );
@@ -893,8 +889,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
rReq.Ignore();
if ( SID_PRINTDOC == nId )
rReq.SetReturnValue(SfxBoolItem(0,sal_False));
- if ( nId == SID_SETUPPRINTER )
- rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, sal_False ) );
}
}
}
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index a1f078411d95..73db1b9c5e39 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -96,7 +96,6 @@
#include <vcl/image.hxx>
#include <vcl/tabctrl.hxx>
-#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-6-22, add the support of input/output parameters to VBA Dialog_QueryClose event
class Button;
class CheckBox;
class RadioButton;
@@ -414,7 +413,6 @@ public:
// class VCLXDialog
// ----------------------------------------------------
class TOOLKIT_DLLPUBLIC VCLXDialog : public ::com::sun::star::awt::XDialog2,
- public ::com::sun::star::document::XVbaMethodParameter, //liuchen 2009-6-22, add the support of input/output parameters to VBA UserForm_QueryClose event
public VCLXTopWindow
{
public:
@@ -452,10 +450,6 @@ public:
// ::com::sun::star::awt::XVclWindowPeer
void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
- //liuchen 2009-6-23, support Excel VBA UserForm_QueryClose event
- // ::com::sun::star::document::XVBAMethodParameter
- void SAL_CALL setVbaMethodParameter( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL getVbaMethodParameter( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
};
// ----------------------------------------------------
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 0fd3cf0c80dc..773d64ae4f83 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2290,7 +2290,6 @@ VCLXDialog::~VCLXDialog()
::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- (static_cast< ::com::sun::star::document::XVbaMethodParameter* >(this)),
(static_cast< ::com::sun::star::awt::XDialog2* >(this)),
(static_cast< ::com::sun::star::awt::XDialog* >(this)) );
return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
@@ -2298,7 +2297,6 @@ VCLXDialog::~VCLXDialog()
// ::com::sun::star::lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( VCLXDialog )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ),
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
VCLXTopWindow::getTypes()
@@ -2409,36 +2407,6 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
return aInfo;
}
-// ::com::sun::star::document::XVbaMethodParameter
-void SAL_CALL VCLXDialog::setVbaMethodParameter(
- const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Any& Value )
-throw(::com::sun::star::uno::RuntimeException)
-{
- if (rtl::OUString("Cancel") == PropertyName)
- {
- SolarMutexGuard aGuard;
- if ( GetWindow() )
- {
- sal_Int8 nCancel = 0;
- Value >>= nCancel;
-
- Dialog* pDlg = (Dialog*) GetWindow();
- pDlg->SetCloseFlag(nCancel);
- }
- }
-}
-
-::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter(
- const ::rtl::OUString& /*PropertyName*/ )
-throw(::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- ::com::sun::star::uno::Any aRet;
- return aRet;
-}
-
void SAL_CALL VCLXDialog::setProperty(
const ::rtl::OUString& PropertyName,
const ::com::sun::star::uno::Any& Value )
diff --git a/vbahelper/inc/vbahelper/vbadialogbase.hxx b/vbahelper/inc/vbahelper/vbadialogbase.hxx
index 01aa5f784e6d..b196c6bc3371 100644
--- a/vbahelper/inc/vbahelper/vbadialogbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadialogbase.hxx
@@ -36,7 +36,7 @@ public:
virtual ~VbaDialogBase() {}
// Methods
- virtual sal_Bool SAL_CALL Show() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Show() throw (css::uno::RuntimeException);
virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0;
};
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index d1d15f549b17..be84387d9f6a 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -108,7 +108,6 @@ namespace ooo
VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
- VBAHELPER_DLLPUBLIC css::uno::Any getDefaultPropByIntrospection( const css::uno::Any& aObj ) throw ( css::uno::RuntimeException );
VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx
index db08475030b4..423807229ef3 100644
--- a/vbahelper/inc/vbahelper/vbashape.hxx
+++ b/vbahelper/inc/vbahelper/vbashape.hxx
@@ -101,7 +101,6 @@ public:
// Replace??
virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
- virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException );
};
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index a0dc30b79ebe..b78dea3111f8 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -119,29 +119,8 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
- OUString sOldValue, sNewValue;
// booleans are converted to uppercase strings
- sOldValue = extractStringFromAny( getValue(), OUString(), true );
- // booleans are converted to uppercase strings
- sNewValue = extractStringFromAny( _value, OUString(), true );
-
- m_xProps->setPropertyValue( sSourceName, uno::Any( sNewValue ) );
-
- if ( sNewValue != sOldValue )
- {
- // If the new value is in current list, we should fire click event, otherwise fire the change event.
- sal_Int32 nListIndex = -1;
- getListIndex() >>= nListIndex;
- sal_Bool bIsInList = ( nListIndex >= 0 );
- if ( bIsInList )
- {
- fireClickEvent();
- }
- else
- {
- fireChangeEvent();
- }
- }
+ m_xProps->setPropertyValue( sSourceName, uno::Any( extractStringFromAny( _value, ::rtl::OUString(), true ) ) );
}
// see Value
diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx
index 27ef523bce54..c7998c3c781b 100644
--- a/vbahelper/source/msforms/vbaframe.cxx
+++ b/vbahelper/source/msforms/vbaframe.cxx
@@ -60,18 +60,6 @@ sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException)
return msforms::fmSpecialEffect::fmSpecialEffectEtched;
}
-::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-{
- // #STUB
- return 0;
-}
-
-void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException)
-{
- // #STUB
- return;
-}
-
void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException)
{
diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx
index 02a27b8afa6d..c5c226c3980d 100644
--- a/vbahelper/source/msforms/vbaframe.hxx
+++ b/vbahelper/source/msforms/vbaframe.hxx
@@ -41,8 +41,6 @@ public:
virtual OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const OUString& _caption ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getSpecialEffect() throw (css::uno::RuntimeException);
virtual void SAL_CALL setSpecialEffect( sal_Int32 nSpecialEffect ) throw (css::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getBorderStyle() throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx
index 4e704a94f5cc..483985ea26cd 100644
--- a/vbahelper/source/msforms/vbalistbox.cxx
+++ b/vbahelper/source/msforms/vbalistbox.cxx
@@ -103,7 +103,7 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
if ( nSelectedIndices != nOldSelectedIndices )
fireClickEvent();
- //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
+ m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
}
OUString SAL_CALL
@@ -120,19 +120,18 @@ ScVbaListBox::setText( const OUString& _text ) throw (uno::RuntimeException)
setValue( uno::makeAny( _text ) ); // seems the same
}
-sal_Int32 SAL_CALL
+sal_Bool SAL_CALL
ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
{
sal_Bool bMultiSelect = sal_False;
m_xProps->getPropertyValue( "MultiSelection" ) >>= bMultiSelect;
- return bMultiSelect ? 1 : 0 ;
+ return bMultiSelect;
}
void SAL_CALL
-ScVbaListBox::setMultiSelect( sal_Int32 _multiselect ) throw (css::uno::RuntimeException)
+ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
{
- sal_Bool bMultiSelect = _multiselect == 1 ? 1 : 0;
- m_xProps->setPropertyValue( "MultiSelection" , uno::makeAny( bMultiSelect ) );
+ m_xProps->setPropertyValue( "MultiSelection" , uno::makeAny( _multiselect ) );
}
diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx
index c337e929e377..3b0ee742e1a1 100644
--- a/vbahelper/source/msforms/vbalistbox.hxx
+++ b/vbahelper/source/msforms/vbalistbox.hxx
@@ -52,8 +52,8 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual OUString SAL_CALL getText() throw (css::uno::RuntimeException);
virtual void SAL_CALL setText( const OUString& _text ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// Methods
diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx
index d820e26ee99f..4e94a3380c8f 100644
--- a/vbahelper/source/msforms/vbatextbox.cxx
+++ b/vbahelper/source/msforms/vbatextbox.cxx
@@ -59,8 +59,6 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setText( const OUString& _text ) throw (css::uno::RuntimeException)
{
- OUString sOldText = getText();
-
if ( !mbDialog )
{
uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
@@ -68,11 +66,6 @@ ScVbaTextBox::setText( const OUString& _text ) throw (css::uno::RuntimeException
}
else
m_xProps->setPropertyValue( "Text" , uno::makeAny( _text ) );
-
- if ( _text != sOldText )
- {
- fireChangeEvent();
- }
}
sal_Int32 SAL_CALL
@@ -88,8 +81,7 @@ ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
{
- sal_Int16 _maxlength16 = static_cast<sal_Int16> (_maxlength);
- uno::Any aValue( _maxlength16 );
+ uno::Any aValue( _maxlength );
m_xProps->setPropertyValue( "MaxTextLen" , aValue);
}
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index f0d9eefd5966..6bf65c1e6d01 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -66,25 +66,10 @@ void SAL_CALL
ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int16 nState = 0;
- if (_value.getValueTypeClass() == uno::TypeClass_BOOLEAN)
- {
- sal_Bool bValue;
- _value >>= bValue;
- nState = static_cast< sal_Int16 >(bValue);
- }
- else if (_value.getValueTypeClass() == uno::TypeClass_BYTE)
- {
- sal_Int8 nValue;
- _value >>= nValue;
- nState = ( nValue == 1) ? 1 : 0;
- }
- else
- {
- _value >>= nState;
- OSL_TRACE( "nState - %d", nState );
- nState = ( nState == -1 ) ? 1 : 0;
- OSL_TRACE( "nState - %d", nState );
- }
+ _value >>= nState;
+ OSL_TRACE( "nState - %d", nState );
+ nState = ( nState == -1 ) ? 1 : 0;
+ OSL_TRACE( "nState - %d", nState );
m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
}
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index a55f55d79556..988e83748223 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -20,7 +20,6 @@
#include "vbauserform.hxx"
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
-#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/beans/PropertyConcept.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -141,20 +140,6 @@ ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
m_xDialog->endExecute();
}
-sal_Bool SAL_CALL ScVbaUserForm::getVisible() throw (uno::RuntimeException)
-{
- uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
- return xWindow2->isVisible();
-}
-
-void SAL_CALL ScVbaUserForm::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-{
- if ( bVisible )
- Show();
- else
- Hide();
-}
-
void SAL_CALL
ScVbaUserForm::RePaint( ) throw (uno::RuntimeException)
{
diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
index 7ed74ea7fd52..59321fc4d67b 100644
--- a/vbahelper/source/msforms/vbauserform.hxx
+++ b/vbahelper/source/msforms/vbauserform.hxx
@@ -42,8 +42,6 @@ public:
ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
virtual ~ScVbaUserForm();
static css::uno::Reference< css::awt::XControl > nestedSearch( const OUString& aPropertyName, css::uno::Reference< css::awt::XControlContainer >& xContainer );
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
// XUserForm
virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx
index ffee84eee758..6cfb3c8166fc 100644
--- a/vbahelper/source/vbahelper/vbadialogbase.cxx
+++ b/vbahelper/source/vbahelper/vbadialogbase.cxx
@@ -22,7 +22,7 @@
using namespace ::ooo::vba;
using namespace ::com::sun::star;
-sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
+void SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
{
OUString aURL;
if ( m_xModel.is() )
@@ -35,8 +35,6 @@ sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
uno::Sequence< beans::PropertyValue > dispatchProps(0);
dispatchRequests( m_xModel, aURL, dispatchProps );
-
}
- return sal_True;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index f3883f5fb683..7d1088314155 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -150,39 +150,38 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
if ( !bUIClose )
{
// if it is not possible to use UI dispatch, try to close the model directly
- uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY );
- if( xCloseable.is() )
+ bool bCloseable = false;
+ uno::Reference< frame::XModel > xModel = getModel();
+ try
{
- // use close(boolean DeliverOwnership)
+ uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY );
- // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may
- // assume ownership if they object the closure by throwing a CloseVetoException
- // Here we give up ownership. To be on the safe side, catch possible veto exception anyway.
- try
+ // use close(boolean DeliverOwnership)
+ // The boolean parameter DeliverOwnership tells objects vetoing the close
+ // process that they may assume ownership if they object the closure by
+ // throwing a CloseVetoException. Here we give up ownership. To be on the
+ // safe side, catch possible veto exception anyway.
+ if ( xCloseable.is() )
{
+ bCloseable = true;
xCloseable->close(sal_True);
}
- catch(const util::CloseVetoException&)
- {
- //close is cancelled, nothing to do
- }
}
- // If close is not supported by this model - try to dispose it.
- // But if the model disagree with a reset request for the modify state
- // we shouldn't do so. Otherwhise some strange things can happen.
- else
+ catch (const uno::Exception &)
+ {
+ // vetoed
+ }
+ if (!bCloseable)
{
- uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
- if ( xDisposable.is() )
+ try {
+ // If close is not supported by this model - try to dispose it.
+ // But if the model disagree with a reset request for the modify state
+ // we shouldn't do so. Otherwhise some strange things can happen.
+ uno::Reference< lang::XComponent > xDisposable ( xModel, uno::UNO_QUERY_THROW );
+ xDisposable->dispose();
+ }
+ catch(const uno::Exception&)
{
- // To be on the safe side, catch possible veto exception anyway.
- try
- {
- xDisposable->dispose();
- }
- catch(const uno::Exception&)
- {
- }
}
}
}
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index dee89256be3e..479074f72a15 100644
--- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
@@ -44,7 +44,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <sfx2/objsh.hxx>
#include <tools/urlobj.hxx>
-#include <vbahelper/vbadocumentbase.hxx>
#include <boost/unordered_map.hpp>
#include <osl/file.hxx>
@@ -142,13 +141,8 @@ public:
{
uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
m_documents.push_back( xModel );
- OUString sName;
- uno::Reference< ::ooo::vba::XDocumentBase > xVbaDocument = new VbaDocumentBase( uno::Reference< XHelperInterface >(), xContext, xModel );
- if ( xVbaDocument.is() )
- {
- sName = xVbaDocument->getName();
- }
- namesToIndices[ sName ] = nIndex++;
+ INetURLObject aURL( xModel->getURL() );
+ namesToIndices[ aURL.GetLastName() ] = nIndex++;
}
}
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 301cd76f02cd..9db368e72b68 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -782,23 +782,6 @@ void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue
throw uno::RuntimeException();
}
-uno::Any getDefaultPropByIntrospection( const uno::Any& aObj ) throw ( uno::RuntimeException )
-{
- uno::Any aValue;
- uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) );
- uno::Reference< script::XDefaultProperty > xDefaultProperty( aObj, uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xPropSet;
-
- if ( xUnoAccess.is() )
- xPropSet.set( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY );
-
- if ( xPropSet.is() )
- aValue = xPropSet->getPropertyValue( xDefaultProperty->getDefaultPropertyName() );
- else
- throw uno::RuntimeException();
- return aValue;
-}
-
uno::Any getPropertyValue( const uno::Sequence< beans::PropertyValue >& aProp, const OUString& aName )
{
uno::Any result;
diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx
index 9b2aa114f6e0..d8501a85a947 100644
--- a/vbahelper/source/vbahelper/vbapictureformat.cxx
+++ b/vbahelper/source/vbahelper/vbapictureformat.cxx
@@ -104,13 +104,13 @@ ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeExc
{
double nContrast = getContrast();
nContrast += increment;
- if( nContrast < 0 )
+ if( increment < 0 )
{
- nContrast = 0.0;
+ increment = 0.0;
}
- if( nContrast > 1 )
+ if( increment > 1 )
{
- nContrast = 1.0;
+ increment = 1.0;
}
setContrast( nContrast );
}
diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx
index 04462432a81c..bd7458e21309 100644
--- a/vbahelper/source/vbahelper/vbashape.cxx
+++ b/vbahelper/source/vbahelper/vbashape.cxx
@@ -492,17 +492,6 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
return uno::makeAny( xShapeRange );
}
-void SAL_CALL ScVbaShape::Copy() throw (uno::RuntimeException)
-{
- if ( m_xModel.is() )
- {
- Select( uno::Any() );
- // Copy this Shape.
- OUString sUrl( ".uno:Copy" );
- dispatchRequests( m_xModel, sUrl );
- }
-}
-
sal_Bool SAL_CALL
ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException)
{
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index c4dc0c6d1574..093ef1e0db69 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -54,7 +54,6 @@ private:
sal_Bool mbOldSaveBack;
sal_Bool mbInClose;
sal_Bool mbModalMode;
- sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
SAL_DLLPRIVATE void ImplInitDialogData();
SAL_DLLPRIVATE void ImplInitSettings();
@@ -89,9 +88,6 @@ public:
virtual short Execute();
sal_Bool IsInExecute() const { return mbInExecute; }
- sal_Int8 GetCloseFlag() const { return mnCancelClose; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
- void SetCloseFlag( sal_Int8 nCancel ) { mnCancelClose = nCancel; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-
////////////////////////////////////////
// Dialog::Execute replacement API
public:
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 0de832ae06b0..90f5576a598d 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -457,10 +457,7 @@ IMPL_LINK_NOARG(ComboBox, ImplSelectHdl)
mbSyntheticModify = sal_True;
Modify();
mbSyntheticModify = sal_False;
- if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed
- {
- Select();
- }
+ Select();
}
return 0;
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index bc7b73e30a97..3d6ad01f1c67 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -507,18 +507,7 @@ sal_Bool Dialog::Close()
{
ImplDelData aDelData;
ImplAddDel( &aDelData );
- //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
- mnCancelClose = 0;
ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
- // basic boolean ( and what the user might use in the event handler) can
- // be ambiguous ( e.g. basic true = -1 )
- // test agains 0 ( false ) and assume anything else is true
- // ( Note: ) this used to work ( something changes somewhere )
- if (mnCancelClose != 0)
- {
- return sal_False;
- }
- //liuchen 2009-7-22
if ( aDelData.IsDead() )
return sal_False;
ImplRemoveDel( &aDelData );