[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - 19 commits - basic/source forms/source oovbaapi/ooo oox/inc oox/source sc/inc scripting/source sc/source vbahelper/inc vbahelper/source
Noel Power
noel.power at suse.com
Fri Apr 26 07:52:41 PDT 2013
basic/source/runtime/methods.cxx | 22 +++++
forms/source/misc/InterfaceContainer.cxx | 2
oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl | 2
oovbaapi/ooo/vba/excel/XApplication.idl | 6 +
oovbaapi/ooo/vba/excel/XWorkbook.idl | 6 +
oovbaapi/ooo/vba/msforms/XShape.idl | 1
oox/inc/oox/ole/vbacontrol.hxx | 3
oox/source/ole/vbacontrol.cxx | 1
sc/inc/scmod.hxx | 4 -
sc/source/ui/vba/vbaapplication.cxx | 74 +++++++++++++++++++
sc/source/ui/vba/vbaapplication.hxx | 8 ++
sc/source/ui/vba/vbaoleobject.cxx | 2
sc/source/ui/vba/vbapagebreaks.cxx | 10 +-
sc/source/ui/vba/vbarange.cxx | 43 +++++++++--
sc/source/ui/vba/vbaworkbook.cxx | 92 ++++++++++++++++++++++++
sc/source/ui/vba/vbaworkbook.hxx | 2
scripting/source/vbaevents/eventhelper.cxx | 38 ++++++++-
vbahelper/inc/vbahelper/vbadocumentbase.hxx | 2
vbahelper/inc/vbahelper/vbashape.hxx | 2
vbahelper/source/msforms/vbacombobox.cxx | 13 +++
vbahelper/source/msforms/vbatextbox.cxx | 3
vbahelper/source/msforms/vbauserform.cxx | 18 ++++
vbahelper/source/msforms/vbauserform.hxx | 2
vbahelper/source/vbahelper/vbadocumentbase.cxx | 11 ++
vbahelper/source/vbahelper/vbadocumentsbase.cxx | 5 -
vbahelper/source/vbahelper/vbapictureformat.cxx | 8 +-
vbahelper/source/vbahelper/vbashape.cxx | 16 ++++
27 files changed, 362 insertions(+), 34 deletions(-)
New commits:
commit edde7acd46f796c4f719ea33a7809e1df13b057f
Author: Noel Power <noel.power at suse.com>
Date: Fri Apr 26 14:27:43 2013 +0100
stub implementation(s) for Application EnableCancelKey & International
Change-Id: I19d7f46eef6adbc8a3e8d32a69aaa1ab498dd8f1
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index 183db97..4e8c185 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -56,6 +56,7 @@ interface XApplication
[attribute] any StatusBar;
[attribute] long Cursor;
[attribute] boolean EnableEvents;
+ [attribute] boolean EnableCancelKey;
[attribute] boolean DisplayFullScreen;
[attribute] boolean DisplayScrollBars;
[attribute] boolean DisplayExcel4Menus;
@@ -70,7 +71,7 @@ interface XApplication
string getDefaultFilePath() raises(com::sun::star::script::BasicErrorException);
- //any CommandBars( [in] any Index );
+ any International( [in] long Index );
any Workbooks( [in] any Index );
any Worksheets( [in] any Index );
any Windows( [in] any Index );
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index f59ad5e..67b02ab 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -119,6 +119,7 @@ struct ScVbaAppSettings
sal_Bool mbExcel4Menus;
sal_Bool mbDisplayNoteIndicator;
sal_Bool mbShowWindowsInTaskbar;
+ sal_Bool mbEnableCancelKey;
explicit ScVbaAppSettings();
};
@@ -128,7 +129,8 @@ ScVbaAppSettings::ScVbaAppSettings() :
mbEnableEvents( sal_True ),
mbExcel4Menus( sal_False ),
mbDisplayNoteIndicator( sal_True ),
- mbShowWindowsInTaskbar( sal_True )
+ mbShowWindowsInTaskbar( sal_True ),
+ mbEnableCancelKey( sal_False )
{
}
@@ -327,6 +329,15 @@ ScVbaApplication::getActiveCell() throw (uno::RuntimeException )
}
uno::Any SAL_CALL
+ScVbaApplication::International( sal_Int32 Index ) throw (uno::RuntimeException)
+{
+ // complete stub for now
+ // #TODO flesh out some of the Indices we could handle
+ uno::Any aRet;
+ return aRet;
+}
+
+uno::Any SAL_CALL
ScVbaApplication::Workbooks( const uno::Any& aIndex ) throw (uno::RuntimeException)
{
uno::Reference< XCollection > xWorkBooks( new ScVbaWorkbooks( this, mxContext ) );
@@ -745,6 +756,19 @@ ScVbaApplication::getEnableEvents() throw (uno::RuntimeException)
return mrAppSettings.mbEnableEvents;
}
+void SAL_CALL
+ScVbaApplication::setEnableCancelKey(sal_Bool bEnable) throw (uno::RuntimeException)
+{
+ // Stub, does nothing
+ mrAppSettings.mbEnableCancelKey = bEnable;
+}
+
+sal_Bool SAL_CALL
+ScVbaApplication::getEnableCancelKey() throw (uno::RuntimeException)
+{
+ return mrAppSettings.mbEnableCancelKey;
+}
+
sal_Bool SAL_CALL
ScVbaApplication::getDisplayFullScreen() throw (uno::RuntimeException)
{
diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx
index 20481ab..c3faae0 100644
--- a/sc/source/ui/vba/vbaapplication.hxx
+++ b/sc/source/ui/vba/vbaapplication.hxx
@@ -85,6 +85,7 @@ public:
virtual css::uno::Reference< ov::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException);
virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL International( sal_Int32 Index ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Workbooks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL WorksheetFunction( ) throw (css::uno::RuntimeException);
@@ -99,6 +100,8 @@ public:
virtual void SAL_CALL OnKey( const ::rtl::OUString& Key, const css::uno::Any& Procedure ) throw (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);
+ virtual sal_Bool SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEnableCancelKey( sal_Bool bEnable ) throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL getDisplayFullScreen() throw (css::uno::RuntimeException);
virtual void SAL_CALL setDisplayFullScreen( sal_Bool bSet ) throw (css::uno::RuntimeException);
commit 2e02d88804f3fe17a52122f893ae192f65ebd2b8
Author: Noel Power <noel.power at suse.com>
Date: Fri Apr 26 12:32:37 2013 +0100
implement Application.Iteration & Application.InchesToPoints
Change-Id: I58b8e14d01220ae46020ed8104f2d94a21364072
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index d0c346b..183db97 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -61,6 +61,7 @@ interface XApplication
[attribute] boolean DisplayExcel4Menus;
[attribute] boolean DisplayNoteIndicator;
[attribute] boolean ShowWindowsInTaskbar;
+ [attribute] boolean Iteration;
[attribute, readonly] string LibraryPath;
[attribute, readonly] string TemplatesPath;
[attribute, readonly] string PathSeparator;
@@ -86,6 +87,7 @@ interface XApplication
raises(com::sun::star::script::BasicErrorException);
XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
raises(com::sun::star::script::BasicErrorException);
+ double InchesToPoints( [in] double Inches );
void Volatile([in] any Volatile);
any Caller( [in] any Index );
any MenuBars( [in] any aIndex );
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index acc0e17..d3dde66 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -170,14 +170,14 @@ public:
// Options:
const ScViewOptions& GetViewOptions ();
- const ScDocOptions& GetDocOptions ();
+SC_DLLPUBLIC const ScDocOptions& GetDocOptions ();
SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
SC_DLLPUBLIC const ScDefaultsOptions& GetDefaultsOptions ();
SC_DLLPUBLIC const ScFormulaOptions& GetFormulaOptions ();
const ScInputOptions& GetInputOptions ();
SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
void SetViewOptions ( const ScViewOptions& rOpt );
- void SetDocOptions ( const ScDocOptions& rOpt );
+SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt );
SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
void SetDefaultsOptions ( const ScDefaultsOptions& rOpt );
SC_DLLPUBLIC void SetFormulaOptions ( const ScFormulaOptions& rOpt );
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index a5b60dc..f59ad5e 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
#include <com/sun/star/sheet/XCalculatable.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <ooo/vba/excel/XlMousePointer.hpp>
@@ -91,6 +92,7 @@
#include <basic/sbxobj.hxx>
#include "viewutil.hxx"
+#include "docoptio.hxx"
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -818,6 +820,36 @@ ScVbaApplication::setShowWindowsInTaskbar( sal_Bool bSet ) throw (css::uno::Runt
mrAppSettings.mbShowWindowsInTaskbar = bSet;
}
+sal_Bool SAL_CALL
+ScVbaApplication::getIteration() throw (css::uno::RuntimeException)
+{
+ return SC_MOD()->GetDocOptions().IsIter();
+}
+
+void SAL_CALL
+ScVbaApplication::setIteration( sal_Bool bSet ) throw (css::uno::RuntimeException)
+{
+ uno::Reference< lang::XMultiComponentFactory > xSMgr(
+ mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< frame::XDesktop > xDesktop
+ (xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XEnumeration > xComponents = xDesktop->getComponents()->createEnumeration();
+ while ( xComponents->hasMoreElements() )
+ {
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xComponents->nextElement(), uno::UNO_QUERY );
+ if ( xServiceInfo.is() && xServiceInfo->supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
+ {
+ uno::Reference< beans::XPropertySet > xProps( xServiceInfo, uno::UNO_QUERY );
+ if ( xProps.is() )
+ xProps->setPropertyValue( SC_UNO_ITERENABLED, uno::Any( bSet ) );
+ }
+ }
+ ScDocOptions aOpts( SC_MOD()->GetDocOptions() );
+ aOpts.SetIter( bSet );
+ SC_MOD()->SetDocOptions( aOpts );
+}
+
void SAL_CALL
ScVbaApplication::Calculate() throw( script::BasicErrorException , uno::RuntimeException )
{
@@ -1177,6 +1209,13 @@ uno::Reference< excel::XRange > SAL_CALL ScVbaApplication::Union(
return lclCreateVbaRange( mxContext, getCurrentDocument(), aList );
}
+double
+ScVbaApplication::InchesToPoints( double Inches ) throw (uno::RuntimeException )
+{
+ double result = ( Inches * 72.0 );
+ return result;
+}
+
void
ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeException )
{
diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx
index 8d59082..20481ab 100644
--- a/sc/source/ui/vba/vbaapplication.hxx
+++ b/sc/source/ui/vba/vbaapplication.hxx
@@ -111,6 +111,9 @@ public:
virtual void SAL_CALL setDisplayNoteIndicator( sal_Bool bSet ) throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL getShowWindowsInTaskbar() throw (css::uno::RuntimeException);
virtual void SAL_CALL setShowWindowsInTaskbar( sal_Bool bSet ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getIteration() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setIteration( sal_Bool bSet ) throw (css::uno::RuntimeException);
+
virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual void SAL_CALL wait( double time ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException);
@@ -119,12 +122,13 @@ public:
virtual void SAL_CALL Calculate() throw (css::script::BasicErrorException, css::uno::RuntimeException);
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicError
Exception, css::uno::RuntimeException);
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorExce
ption, css::uno::RuntimeException);
+ virtual double SAL_CALL InchesToPoints( double InchesToPoints ) throw (css::uno::RuntimeException );
virtual void SAL_CALL Volatile( const css::uno::Any& Volatile ) 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 Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL GetOpenFilename( const css::uno::Any& rFileFilter, const css::uno::Any& rFilterIndex, const css::uno::Any& rTitle, const css::uno::Any& rButtonText, const css::uno::Any& rMultiSelect ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL GetSaveAsFilename( const css::uno::Any& rInitialFileName, const css::uno::Any& rFileFilter, const css::uno::Any& rFilterIndex, const css::uno::Any& rTitle, const css::uno::Any& rButtonText ) throw (css::uno::RuntimeException);
- virtual void Undo() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Undo() throw (css::uno::RuntimeException);
// XHelperInterface
virtual rtl::OUString getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
commit bda63da4b1027bdeabb8428e2602e3010d755313
Author: Noel Power <noel.power at suse.com>
Date: Fri Apr 26 10:26:25 2013 +0100
implement Application.Undo
Change-Id: I0579efa9dc26be93cd0fa01c23220d9c723a9a26
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index d5c48a7..d0c346b 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -89,6 +89,7 @@ interface XApplication
void Volatile([in] any Volatile);
any Caller( [in] any Index );
any MenuBars( [in] any aIndex );
+ void Undo();
};
}; }; };
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index db8bcaf..a5b60dc 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -1312,6 +1312,15 @@ void SAL_CALL ScVbaApplication::OnKey( const ::rtl::OUString& Key, const uno::An
}
}
+void SAL_CALL ScVbaApplication::Undo() throw (uno::RuntimeException)
+{
+ uno::Reference< frame::XModel > xModel( getThisExcelDoc( mxContext ), uno::UNO_SET_THROW );
+
+ ScTabViewShell* pViewShell = excel::getBestViewShell( xModel );
+ if ( pViewShell )
+ dispatchExecute( pViewShell, SID_UNDO );
+}
+
rtl::OUString
ScVbaApplication::getServiceImplName()
{
diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx
index 7541178..8d59082 100644
--- a/sc/source/ui/vba/vbaapplication.hxx
+++ b/sc/source/ui/vba/vbaapplication.hxx
@@ -124,6 +124,7 @@ public:
virtual css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL GetOpenFilename( const css::uno::Any& rFileFilter, const css::uno::Any& rFilterIndex, const css::uno::Any& rTitle, const css::uno::Any& rButtonText, const css::uno::Any& rMultiSelect ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL GetSaveAsFilename( const css::uno::Any& rInitialFileName, const css::uno::Any& rFileFilter, const css::uno::Any& rFilterIndex, const css::uno::Any& rTitle, const css::uno::Any& rButtonText ) throw (css::uno::RuntimeException);
+ virtual void Undo() throw (css::uno::RuntimeException);
// XHelperInterface
virtual rtl::OUString getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
commit 0e32584f5e732adfef200c36132a4c2cddd2e5ff
Author: Noel Power <noel.power at suse.com>
Date: Thu Apr 25 17:10:46 2013 +0100
fix VBA mode MkDir when passed folder is not a full path
Change-Id: I7fd804999f1b96e6aab112445edcd9dcf7753c24
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index e09f447..d0b2c9a 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -639,6 +639,28 @@ RTLFUNC(MkDir)
if (rPar.Count() == 2)
{
OUString aPath = rPar.Get(1)->GetOUString();
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ // In vba if the full path is not specified then
+ // folder is created relative to the curdir
+ INetURLObject aURLObj( getFullPath( aPath ) );
+ if ( aURLObj.GetProtocol() != INET_PROT_FILE )
+ {
+ SbxArrayRef pPar = new SbxArray();
+ SbxVariableRef pResult = new SbxVariable();
+ SbxVariableRef pParam = new SbxVariable();
+ pPar->Insert( pResult, pPar->Count() );
+ pPar->Insert( pParam, pPar->Count() );
+ SbRtl_CurDir( pBasic, *pPar, bWrite );
+
+ rtl::OUString sCurPathURL;
+ File::getFileURLFromSystemPath( pPar->Get(0)->GetOUString(), sCurPathURL );
+
+ aURLObj.SetURL( sCurPathURL );
+ aURLObj.Append( aPath );
+ File::getSystemPathFromFileURL(aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI ),aPath ) ;
+ }
+ }
if( hasUno() )
{
commit cdb7217a0fa82edd13f8c532f2d66215f382f673
Author: Noel Power <noel.power at suse.com>
Date: Thu Apr 25 15:37:22 2013 +0100
fix userform data aware control import
Change-Id: I5b958f8760c38793344c2c573e1cef97a0b6e3e9
diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx
index b9f3975..2542100 100644
--- a/oox/inc/oox/ole/vbacontrol.hxx
+++ b/oox/inc/oox/ole/vbacontrol.hxx
@@ -73,7 +73,8 @@ public:
const ControlConverter& rConv,
ApiControlType eCtrlType,
sal_Int32 nCtrlIndex ) const;
-
+ inline ::rtl::OUString getControlSource() { return maControlSource; }
+ inline ::rtl::OUString getRowSource() { return maRowSource; }
protected:
::rtl::OUString maName; ///< Name of the control.
::rtl::OUString maTag; ///< User defined tag.
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 91b0ac6..7146327 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -493,6 +493,7 @@ bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrl
// convert all properties
PropertyMap aPropMap;
mxSiteModel->convertProperties( aPropMap, rConv, mxCtrlModel->getControlType(), nCtrlIndex );
+ rConv.bindToSources( rxCtrlModel, mxSiteModel->getControlSource(), mxSiteModel->getRowSource() );
mxCtrlModel->convertProperties( aPropMap, rConv );
mxCtrlModel->convertSize( aPropMap, rConv );
PropertySet aPropSet( rxCtrlModel );
commit 0de977ff6067cf8c7cc8fe7e279eaaf849f10446
Author: Noel Power <noel.power at suse.com>
Date: Thu Apr 25 12:36:17 2013 +0100
reset Logical format when setting a number value via Range vba api
Change-Id: I0f9a68228c9cb6425b1d139744a92c4a3d4c6012
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 7116088..63d0ad6 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -782,7 +782,16 @@ CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< tab
{
double nDouble = 0.0;
if ( aValue >>= nDouble )
+ {
+ uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
+ NumFormatHelper cellFormat( xRange );
+ // If we are setting a number and the cell types was logical
+ // then we need to reset the logical format. ( see case uno::TypeClass_BOOLEAN:
+ // handling above )
+ if ( cellFormat.isBooleanType() )
+ cellFormat.setNumberFormat("General");
xCell->setValue( nDouble );
+ }
else
isExtracted = false;
break;
commit 96a6bddcbe52db803ce6faed7e2bc3030bee5c45
Author: Noel Power <noel.power at suse.com>
Date: Thu Apr 25 11:10:24 2013 +0100
fix memory leak with orphaned controls created on the fly
Change-Id: Iabdd7d906bd7f72592c8e4b2d2b1774807e9dbdb
diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index 4e09785..1e3d77a 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -149,7 +149,7 @@ 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 );
- Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( m_xServiceFactory->createInstance( sServiceName ), sCodeName );
+ Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( sServiceName , sCodeName );
// register the vba script events
m_xEventAttacher->registerScriptEvents( i_nIndex, vbaEvents );
}
diff --git a/oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl b/oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl
index 5dd6dbb..dd92553 100644
--- a/oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl
+++ b/oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl
@@ -24,7 +24,7 @@
module ooo { module vba {
interface XVBAToOOEventDescGen : com::sun::star::uno::XInterface
{
- sequence< com::sun::star::script::ScriptEventDescriptor > getEventDescriptions( [in] com::sun::star::uno::XInterface xControl, [in] string sCodeName );
+ sequence< com::sun::star::script::ScriptEventDescriptor > getEventDescriptions( [in] string controlServiceName, [in] string sCodeName );
com::sun::star::script::XScriptEventsSupplier getEventSupplier( [in] com::sun::star::uno::XInterface xControl, [in] string sCodeName );
};
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index e7f90e2..a28a139 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -316,11 +316,14 @@ class ScriptEventHelper
{
public:
ScriptEventHelper( const Reference< XInterface >& xControl );
+ ScriptEventHelper( const rtl::OUString& sCntrlServiceName );
+ ~ScriptEventHelper();
Sequence< ScriptEventDescriptor > createEvents( const rtl::OUString& sCodeName );
Sequence< rtl::OUString > getEventListeners();
private:
Reference< XComponentContext > m_xCtx;
Reference< XInterface > m_xControl;
+ bool m_bDispose;
};
bool
@@ -365,11 +368,36 @@ eventMethodToDescriptor( const ::rtl::OUString& rEventMethod, ScriptEventDescrip
}
-ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ):
+ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ) :
m_xCtx( comphelper::getProcessComponentContext() ),
- m_xControl( xControl )
+ m_xControl( xControl ),
+ m_bDispose( false )
{}
+ScriptEventHelper::ScriptEventHelper( const rtl::OUString& sCntrlServiceName ) :
+ m_xCtx( comphelper::getProcessComponentContext() ),
+ m_bDispose( true )
+{
+ m_xControl.set( m_xCtx->getServiceManager()->createInstanceWithContext( sCntrlServiceName, m_xCtx ), uno::UNO_QUERY );
+}
+
+ScriptEventHelper::~ScriptEventHelper()
+{
+ // dispose control ( and remove any associated event registrations )
+ if ( m_bDispose )
+ {
+ try
+ {
+ uno::Reference< lang::XComponent > xComp( m_xControl, uno::UNO_QUERY_THROW );
+ xComp->dispose();
+ }
+ // destructor can't throw
+ catch( uno::Exception& )
+ {
+ }
+ }
+}
+
Sequence< rtl::OUString >
ScriptEventHelper::getEventListeners()
{
@@ -1004,7 +1032,7 @@ public:
VBAToOOEventDescGen( const Reference< XComponentContext >& rxContext );
// XVBAToOOEventDescGen
- virtual Sequence< ScriptEventDescriptor > SAL_CALL getEventDescriptions( const Reference< XInterface >& control, const rtl::OUString& sCodeName ) throw (RuntimeException);
+ virtual Sequence< ScriptEventDescriptor > SAL_CALL getEventDescriptions( const rtl::OUString& sCtrlServiceName, const rtl::OUString& sCodeName ) throw (RuntimeException);
virtual Reference< XScriptEventsSupplier > SAL_CALL getEventSupplier( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (::com::sun::star::uno::RuntimeException);
private:
Reference< XComponentContext > m_xContext;
@@ -1014,9 +1042,9 @@ private:
VBAToOOEventDescGen::VBAToOOEventDescGen( const Reference< XComponentContext >& rxContext ):m_xContext( rxContext ) {}
Sequence< ScriptEventDescriptor > SAL_CALL
-VBAToOOEventDescGen::getEventDescriptions( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (RuntimeException)
+VBAToOOEventDescGen::getEventDescriptions( const rtl::OUString& sCntrlServiceName, const rtl::OUString& sCodeName ) throw (RuntimeException)
{
- ScriptEventHelper evntHelper( xControl );
+ ScriptEventHelper evntHelper( sCntrlServiceName );
return evntHelper.createEvents( sCodeName );
}
commit 4aadebb03603a82afb1659c6b16f89ed2375d139
Author: Noel Power <noel.power at suse.com>
Date: Wed Apr 24 17:59:49 2013 +0100
add Workbook.Save method
has limited support for paramaters ( only FileName and Format are processed )
Change-Id: I669f264679101ab3697dfaa3a3fb3b2d75f5a14b
diff --git a/oovbaapi/ooo/vba/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl
index 76eaf2a..852ac69 100644
--- a/oovbaapi/ooo/vba/excel/XWorkbook.idl
+++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl
@@ -52,6 +52,12 @@ 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] any FileName, [in] any FileFormat, [in] any Password,
+ [in] any WriteResPassword, [in] any ReadOnlyRecommended,
+ [in] any CreateBackup, [in] any AccessMode,
+ [in] any ConflictResolution, [in] any AddToMru,
+ [in] any TextCodepage, [in] any TextVisualLayout,
+ [in] any Local );
};
}; }; };
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 71b98c5..f25ae23 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -30,6 +30,7 @@
#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"
@@ -93,6 +94,48 @@ ScVbaWorkbook::Colors( const ::uno::Any& Index ) throw (::script::BasicErrorExce
return aRet;
}
+bool ScVbaWorkbook::setFilterPropsFromFormat( sal_Int32 nFormat, uno::Sequence< beans::PropertyValue >& rProps )
+{
+ bool bRes = false;
+ for ( sal_Int32 index = 0; index < rProps.getLength(); ++index )
+ {
+ if ( rProps[ index ].Name == "FilterName" )
+ {
+ switch( nFormat )
+ {
+ case excel::XlFileFormat::xlCSV:
+ rProps[ index ].Value = uno::Any( OUString("Text - txt - csv (StarCalc)") );
+ break;
+ case excel::XlFileFormat::xlDBF4:
+ rProps[ index ].Value = uno::Any( OUString("DBF") );
+ break;
+ case excel::XlFileFormat::xlDIF:
+ rProps[ index ].Value = uno::Any( OUString("DIF") );
+ break;
+ case excel::XlFileFormat::xlWK3:
+ rProps[ index ].Value = uno::Any( OUString("Lotus") );
+ break;
+ case excel::XlFileFormat::xlExcel4Workbook:
+ rProps[ index ].Value = uno::Any( OUString("MS Excel 4.0") );
+ break;
+ case excel::XlFileFormat::xlExcel5:
+ rProps[ index ].Value = uno::Any( OUString("MS Excel 5.0/95") );
+ break;
+ case excel::XlFileFormat::xlHtml:
+ rProps[ index ].Value = uno::Any( OUString("HTML (StarCalc)") );
+ break;
+ case excel::XlFileFormat::xlExcel9795:
+ default:
+ rProps[ index ].Value = uno::Any( OUString("MS Excel 97") );
+ break;
+ }
+ bRes = true;
+ break;
+ }
+ }
+ return bRes;
+}
+
::sal_Int32 SAL_CALL
ScVbaWorkbook::getFileFormat( ) throw (::uno::RuntimeException)
{
@@ -272,6 +315,55 @@ ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::Runtime
xStor->storeToURL( aURL, storeProps );
}
+void SAL_CALL
+ScVbaWorkbook::SaveAs( const uno::Any& FileName, const uno::Any& FileFormat, const uno::Any& /*Password*/, const uno::Any& /*WriteResPassword*/, const uno::Any& /*ReadOnlyRecommended*/, const uno::Any& /*CreateBackup*/, const uno::Any& /*AccessMode*/, const uno::Any& /*ConflictResolution*/, const uno::Any& /*AddToMru*/, const uno::Any& /*TextCodepage*/, const uno::Any& /*TextVisualLayout*/, const uno::Any& /*Local*/ )
+{
+ OUString sFileName;
+ FileName >>= sFileName;
+ OUString sURL;
+ osl::FileBase::getFileURLFromSystemPath( sFileName, sURL );
+ // detect if there is no path if there is no path then we need
+ // to use the current current folder
+ INetURLObject aURL( sURL );
+ sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
+ if( sURL.isEmpty() )
+ {
+ // need to add cur dir ( of this workbook ) or else the 'Work' dir
+ sURL = getModel()->getURL();
+
+ if ( sURL.isEmpty() )
+ {
+ // not path available from 'this' document
+ // need to add the 'document'/work directory then
+ uno::Reference< excel::XApplication > xApplication ( Application(),uno::UNO_QUERY_THROW );
+ OUString sWorkPath = xApplication->getDefaultFilePath();
+ OUString sWorkURL;
+ osl::FileBase::getFileURLFromSystemPath( sWorkPath, sWorkURL );
+ aURL.SetURL( sWorkURL );
+ }
+ else
+ {
+ aURL.SetURL( sURL );
+ aURL.Append( sFileName );
+ }
+ sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
+
+ }
+
+ sal_Int32 nFileFormat = excel::XlFileFormat::xlExcel9795;
+ FileFormat >>= nFileFormat;
+
+ uno::Sequence< beans::PropertyValue > storeProps(1);
+ storeProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
+
+ setFilterPropsFromFormat( nFileFormat, storeProps );
+
+ uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
+ OUString sFilterName;
+ storeProps[0].Value >>= sFilterName;
+ xStor->storeAsURL( sURL, 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 f17ef3c..3c58010 100644
--- a/sc/source/ui/vba/vbaworkbook.hxx
+++ b/sc/source/ui/vba/vbaworkbook.hxx
@@ -29,6 +29,7 @@ typedef cppu::ImplInheritanceHelper1< VbaDocumentBase, ov::excel::XWorkbook > Sc
class ScVbaWorkbook : public ScVbaWorkbook_BASE
{
static css::uno::Sequence< sal_Int32 > ColorData;
+ bool setFilterPropsFromFormat( sal_Int32 nFormat, css::uno::Sequence< css::beans::PropertyValue >& rProps );
void initColorData( const css::uno::Sequence< sal_Int32 >& sColors );
void init();
@@ -53,6 +54,7 @@ public:
virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL SaveAs( const css::uno::Any& FileName, const css::uno::Any& FileFormat, const css::uno::Any& Password, const css::uno::Any& WriteResPassword, const css::uno::Any& ReadOnlyRecommended, const css::uno::Any& CreateBackup, const css::uno::Any& AccessMode, const css::uno::Any& ConflictResolution, const css::uno::Any& AddToMru, const css::uno::Any& TextCodepage, const css::uno::Any& TextVisualLayout, const css::uno::Any& Local );
virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& Item ) throw (css::uno::RuntimeException);
commit 4253c69b851bda470115d2b1a5f9a73d7f8e4da4
Author: Noel Power <noel.power at suse.com>
Date: Wed Apr 24 17:58:34 2013 +0100
Parse workbook name correctly, don't fall over spaces etc.
Change-Id: I6b22cee7e417aeeff7fc9f41494c349398683a54
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
index 999cf55..aacbf4e 100644
--- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -59,6 +59,8 @@ public:
// XHelperInterface
virtual rtl::OUString getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+ static OUString getNameFromModel( const css::uno::Reference< css::frame::XModel >& xModel );
};
#endif /* VBA_DOCUMENTBASE_HXX */
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 7d10883..f6ace07 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -58,16 +58,21 @@ VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args,
OUString
VbaDocumentBase::getName() throw (uno::RuntimeException)
{
- OUString sName = getModel()->getURL();
+ return VbaDocumentBase::getNameFromModel( getModel() );
+}
+
+OUString VbaDocumentBase::getNameFromModel( const uno::Reference< frame::XModel >& xModel )
+{
+ OUString sName = xModel.is() ? xModel->getURL() : OUString();
if ( !sName.isEmpty() )
{
- INetURLObject aURL( getModel()->getURL() );
+ INetURLObject aURL( xModel->getURL() );
::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
}
else
{
- uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
sName = xTitle->getTitle();
sName = sName.trim();
}
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index 479074f..cb3be9b 100644
--- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
@@ -49,6 +49,7 @@
#include "vbahelper/vbahelper.hxx"
#include "vbahelper/vbaapplicationbase.hxx"
+#include "vbahelper/vbadocumentbase.hxx"
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -141,8 +142,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 );
- INetURLObject aURL( xModel->getURL() );
- namesToIndices[ aURL.GetLastName() ] = nIndex++;
+ OUString sName = VbaDocumentBase::getNameFromModel( xModel );
+ namesToIndices[ sName ] = nIndex++;
}
}
commit 0f9a9b5842ac747ddae6667e6c1e5b2ec0807f2d
Author: Noel Power <noel.power at suse.com>
Date: Wed Apr 24 11:44:59 2013 +0100
support UserForm.Visible attribute
Change-Id: I6e5a9d3e7908349a76a73a79b3b1319b44e1e3aa
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 988e837..5a67b79 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -20,6 +20,7 @@
#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>
@@ -112,6 +113,23 @@ ScVbaUserForm::setCaption( const OUString& _caption ) throw (uno::RuntimeExcepti
m_xProps->setPropertyValue( "Title", uno::makeAny( _caption ) );
}
+sal_Bool SAL_CALL
+ScVbaUserForm::getVisible() throw (uno::RuntimeException)
+{
+ uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XWindow2 > xControlWindow( xControl->getPeer(), uno::UNO_QUERY_THROW );
+ return xControlWindow->isVisible();
+}
+
+void SAL_CALL
+ScVbaUserForm::setVisible( sal_Bool bVis ) throw (uno::RuntimeException)
+{
+ if ( bVis )
+ Show();
+ else
+ Hide();
+}
+
double SAL_CALL ScVbaUserForm::getInnerWidth() throw (uno::RuntimeException)
{
return mpGeometryHelper->getInnerWidth();
diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
index 59321fc..77826c3 100644
--- a/vbahelper/source/msforms/vbauserform.hxx
+++ b/vbahelper/source/msforms/vbauserform.hxx
@@ -56,6 +56,8 @@ public:
virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getVisible() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( sal_Bool bVis ) throw (::com::sun::star::uno::RuntimeException);
// XIntrospection
virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL invoke( const OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
commit 1bbf62198c9118961024aba482e8f600cde22007
Author: Noel Power <noel.power at suse.com>
Date: Wed Apr 24 11:36:34 2013 +0100
support Shape.Alternative
Change-Id: I0679ee479ee8b75726a4d2fee7350803b852fbc8
diff --git a/oovbaapi/ooo/vba/msforms/XShape.idl b/oovbaapi/ooo/vba/msforms/XShape.idl
index 8b59f20..bdeba83 100644
--- a/oovbaapi/ooo/vba/msforms/XShape.idl
+++ b/oovbaapi/ooo/vba/msforms/XShape.idl
@@ -28,6 +28,7 @@ interface XShapeRange;
interface XShape : ooo::vba::XHelperInterface
{
[attribute] string Name;
+ [attribute] string AlternativeText;
[attribute] double Height;
[attribute] double Width;
[attribute] double Left;
diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx
index 4238072..0f5b815 100644
--- a/vbahelper/inc/vbahelper/vbashape.hxx
+++ b/vbahelper/inc/vbahelper/vbashape.hxx
@@ -62,6 +62,8 @@ public:
// Attributes
virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getAlternativeText() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAlternativeText( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx
index bd7458e..55795bc 100644
--- a/vbahelper/source/vbahelper/vbashape.cxx
+++ b/vbahelper/source/vbahelper/vbashape.cxx
@@ -167,6 +167,22 @@ ScVbaShape::setName( const OUString& _name ) throw (uno::RuntimeException)
xNamed->setName( _name );
}
+OUString SAL_CALL
+ScVbaShape::getAlternativeText() throw (uno::RuntimeException)
+{
+ OUString sAltText;
+ uno::Reference< beans::XPropertySet > xProps( m_xShape, uno::UNO_QUERY_THROW );
+ xProps->getPropertyValue( OUString( "Title" ) ) >>= sAltText;
+ return sAltText;
+}
+
+void SAL_CALL
+ScVbaShape::setAlternativeText( const OUString& sAltText ) throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xProps( m_xShape, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( OUString( "Title" ), uno::Any( sAltText ) );
+}
+
double SAL_CALL
ScVbaShape::getHeight() throw (uno::RuntimeException)
{
commit 018752d1f6c90ac2fc6fd89b105d2dfe7ca3c666
Author: Noel Power <noel.power at suse.com>
Date: Tue Apr 23 20:19:45 2013 +0100
return correct object ( was returning an uno object in the vba api )
Fix typo ( or brain fart ) where the VBA api was returning the libreoffice
uno object instead of the vba wrapper object
Change-Id: I0e615368d636ad08b40842ef9b91f3818829d3ea
diff --git a/sc/source/ui/vba/vbaoleobject.cxx b/sc/source/ui/vba/vbaoleobject.cxx
index 8824921..04d50c8 100644
--- a/sc/source/ui/vba/vbaoleobject.cxx
+++ b/sc/source/ui/vba/vbaoleobject.cxx
@@ -50,7 +50,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_xControlShape, uno::UNO_QUERY_THROW );
+ return uno::Reference< uno::XInterface >( m_xControl, uno::UNO_QUERY_THROW );
}
sal_Bool SAL_CALL
commit 3ea0652f6b3d8ee73a4ad57e48f3352e4329cfe8
Author: Noel Power <noel.power at suse.com>
Date: Tue Apr 23 19:50:13 2013 +0100
tweak combox to selectively fire change or click event
we need to fire a click event if just the item in the dropdown changed and
a change event if the item we changed is really part of the list
Change-Id: I19f950fca0857761d8f59a07513803f1f3ef135b
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index f632e1b..7d4a651 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -122,9 +122,18 @@ ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
// booleans are converted to uppercase strings
OUString oldValue = extractStringFromAny( getValue(), ::rtl::OUString(), true );
m_xProps->setPropertyValue( sSourceName, uno::Any( extractStringFromAny( _value, ::rtl::OUString(), true ) ) );
- OUString newValue = extractStringFromAny( getValue(), ::rtl::OUString(), true );
+ OUString newValue = extractStringFromAny( _value, ::rtl::OUString(), true );
+
if ( oldValue != newValue )
- fireChangeEvent();
+ {
+ sal_Int32 index = 0;
+ uno::Any aIndex = getListIndex();
+ aIndex >>= index;
+ if ( index < 0 )
+ fireChangeEvent();
+ else
+ fireClickEvent();
+ }
}
// see Value
commit 0156c82761d45631c96d6469c3a6627e86b3ca09
Author: Noel Power <noel.power at suse.com>
Date: Tue Apr 23 18:13:37 2013 +0100
support api initiated change_event for combox & textbox
Change-Id: Iff51a184792e9d12accb902df1772fc07589443b
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index dbdabc2..f632e1b 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -120,7 +120,11 @@ void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
// booleans are converted to uppercase strings
+ OUString oldValue = extractStringFromAny( getValue(), ::rtl::OUString(), true );
m_xProps->setPropertyValue( sSourceName, uno::Any( extractStringFromAny( _value, ::rtl::OUString(), true ) ) );
+ OUString newValue = extractStringFromAny( getValue(), ::rtl::OUString(), true );
+ if ( oldValue != newValue )
+ fireChangeEvent();
}
// see Value
diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx
index d4d10c1..f61087e 100644
--- a/vbahelper/source/msforms/vbatextbox.cxx
+++ b/vbahelper/source/msforms/vbatextbox.cxx
@@ -59,6 +59,7 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setText( const OUString& _text ) throw (css::uno::RuntimeException)
{
+ OUString oldText( getText() );
if ( !mbDialog )
{
uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
@@ -66,6 +67,8 @@ ScVbaTextBox::setText( const OUString& _text ) throw (css::uno::RuntimeException
}
else
m_xProps->setPropertyValue( "Text" , uno::makeAny( _text ) );
+ if ( oldText != _text )
+ fireChangeEvent();
}
sal_Int32 SAL_CALL
commit f67fdd37729f4bba164a461b20cb28d4c82b469c
Author: Noel Power <noel.power at suse.com>
Date: Tue Apr 23 17:07:02 2013 +0100
handle non int32 values for Field in Range.AutoFilter
Change-Id: I7288371ab32abd02b858c538f50a68eff66ecced
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 3f7223e..7116088 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4296,7 +4296,7 @@ static void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Refe
}
void SAL_CALL
-ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const uno::Any& Operator, const uno::Any& Criteria2, const uno::Any& VisibleDropDown ) throw (uno::RuntimeException)
+ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const uno::Any& Operator, const uno::Any& Criteria2, const uno::Any& VisibleDropDown ) throw (uno::RuntimeException)
{
// Is there an existing autofilter
RangeHelper thisRange( mxRange );
@@ -4392,12 +4392,24 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
if ( bHasCritValue )
bCritHasNumericValue = ( Criteria1 >>= nCriteria1 );
- if ( !Field.hasValue() && ( Criteria1.hasValue() || Operator.hasValue() || Criteria2.hasValue() ) )
+ if ( !aField.hasValue() && ( Criteria1.hasValue() || Operator.hasValue() || Criteria2.hasValue() ) )
throw uno::RuntimeException();
+ bool bAll = false;
+ uno::Any Field( aField );
+ if ( !( Field >>= nField ) )
+ {
+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
+ try
+ {
+ Field = xConverter->convertTo( aField, getCppuType( (sal_Int32*)0 ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
// Use the normal uno api, sometimes e.g. when you want to use ALL as the filter
// we can't use refresh as the uno interface doesn't have a concept of ALL
// in this case we just call the core calc functionality -
- bool bAll = false;
if ( ( Field >>= nField ) )
{
uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
commit fab7dbe058e4ae4d6752dfc428b9d490473e071c
Author: Noel Power <noel.power at suse.com>
Date: Mon Apr 22 20:44:29 2013 +0100
test contrast not increment to limit value between 0.0 & 1.0
Change-Id: Ibfdca27927df3ac4f89c9db7d8487c1c4b544024
diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx
index d8501a8..9b2aa11 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( increment < 0 )
+ if( nContrast < 0 )
{
- increment = 0.0;
+ nContrast = 0.0;
}
- if( increment > 1 )
+ if( nContrast > 1 )
{
- increment = 1.0;
+ nContrast = 1.0;
}
setContrast( nContrast );
}
commit 6d88e0b29981c9df87923b804b91a845eafc2624
Author: Noel Power <noel.power at suse.com>
Date: Mon Apr 22 19:29:22 2013 +0100
fix another instance where the index is broken for pagebreaks
Change-Id: I5c3215373c0a63c2831d7be5005f1b04a0645e99
diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx
index 80db6e39..af580da 100644
--- a/sc/source/ui/vba/vbapagebreaks.cxx
+++ b/sc/source/ui/vba/vbapagebreaks.cxx
@@ -148,10 +148,9 @@ sheet::TablePageBreakData RangePageBreaks::getTablePageBreakData( sal_Int32 nAPI
{
aTablePageBreakData = aTablePageBreakDataList[i];
sal_Int32 nPos = aTablePageBreakData.Position;
- if( nPos >= nUsedStart )
- index++;
- if( nPos > nUsedEnd )
+ if( nPos > nUsedEnd + 1 )
DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
+ index++;
if( index == nAPIItemIndex )
return aTablePageBreakData;
}
commit f75a5bd648ba4caab1692583c2bdcf1b6111b7da
Author: Noel Power <noel.power at suse.com>
Date: Mon Apr 22 16:46:40 2013 +0100
fix limits check on breaks ( ignore breaks outside used area )
Change-Id: I36154ba6999c9a74ecf2c55c0559b6c25d137283
diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx
index 5c02d5d..80db6e39 100644
--- a/sc/source/ui/vba/vbapagebreaks.cxx
+++ b/sc/source/ui/vba/vbapagebreaks.cxx
@@ -107,10 +107,9 @@ sal_Int32 SAL_CALL RangePageBreaks::getCount( ) throw (uno::RuntimeException)
for( sal_Int32 i=0; i<nLength; i++ )
{
sal_Int32 nPos = aTablePageBreakData[i].Position;
- if( nPos > nUsedEnd )
+ if( nPos > nUsedEnd + 1 )
return nCount;
- if( nPos >= nUsedStart )
- nCount++;
+ nCount++;
}
return nCount;
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 754d308..3f7223e 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1961,9 +1961,18 @@ 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;
- aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
- return aMatrix;
+ uno::Any aSingleValueOrMatrix;
+ // When dealing with a single element ( embedded in the sequence of sequence ) unwrap and return
+ // that value
+ uno::Sequence< uno::Sequence<rtl::OUString> > aTmpSeq = xCellRangeFormula->getFormulaArray();
+ if ( aTmpSeq.getLength() == 1 )
+ {
+ if ( aTmpSeq[ 0 ].getLength() == 1 )
+ aSingleValueOrMatrix <<= aTmpSeq[ 0 ][ 0 ];
+ }
+ else
+ aSingleValueOrMatrix = xConverter->convertTo( uno::makeAny( aTmpSeq ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
+ return aSingleValueOrMatrix;
}
void
commit b08a23ce87404e9df886888491afe9aba92b08a7
Author: Noel Power <noel.power at suse.com>
Date: Mon Apr 22 14:02:07 2013 +0100
fix range cut with destination paramater( missing else )
Change-Id: I67829b3b15177977bc0e31ec6384c124cc61f1b5
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index abbe31e..754d308 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2516,6 +2516,7 @@ 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 = getModelFromRange( mxRange );
Select();
More information about the Libreoffice-commits
mailing list