summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vbahelper/inc/vbahelper/helperdecl.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbaaccesshelper.hxx10
-rw-r--r--vbahelper/inc/vbahelper/vbaapplicationbase.hxx5
-rw-r--r--vbahelper/inc/vbahelper/vbacollectionimpl.hxx26
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentbase.hxx5
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentsbase.hxx3
-rwxr-xr-xvbahelper/inc/vbahelper/vbaeventshelperbase.hxx18
-rw-r--r--vbahelper/inc/vbahelper/vbafontbase.hxx2
-rw-r--r--vbahelper/inc/vbahelper/vbaglobalbase.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx33
-rw-r--r--vbahelper/inc/vbahelper/vbahelperinterface.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbapagesetupbase.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbashape.hxx4
-rw-r--r--vbahelper/inc/vbahelper/vbashaperange.hxx6
-rw-r--r--vbahelper/inc/vbahelper/vbashapes.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbatextframe.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbawindowbase.hxx3
-rw-r--r--vbahelper/source/msforms/service.cxx13
-rw-r--r--vbahelper/source/msforms/vbabutton.cxx3
-rw-r--r--vbahelper/source/msforms/vbabutton.hxx2
-rw-r--r--vbahelper/source/msforms/vbacheckbox.cxx6
-rw-r--r--vbahelper/source/msforms/vbacheckbox.hxx5
-rw-r--r--vbahelper/source/msforms/vbacombobox.cxx45
-rw-r--r--vbahelper/source/msforms/vbacombobox.hxx5
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx193
-rw-r--r--vbahelper/source/msforms/vbacontrol.hxx16
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx17
-rw-r--r--vbahelper/source/msforms/vbacontrols.hxx2
-rw-r--r--vbahelper/source/msforms/vbaframe.cxx43
-rw-r--r--vbahelper/source/msforms/vbaframe.hxx11
-rw-r--r--vbahelper/source/msforms/vbalabel.cxx31
-rw-r--r--vbahelper/source/msforms/vbalabel.hxx7
-rw-r--r--vbahelper/source/msforms/vbalistbox.cxx89
-rw-r--r--vbahelper/source/msforms/vbalistbox.hxx9
-rw-r--r--vbahelper/source/msforms/vbalistcontrolhelper.cxx111
-rw-r--r--vbahelper/source/msforms/vbalistcontrolhelper.hxx3
-rw-r--r--vbahelper/source/msforms/vbamultipage.cxx4
-rw-r--r--vbahelper/source/msforms/vbamultipage.hxx5
-rw-r--r--vbahelper/source/msforms/vbapages.cxx3
-rw-r--r--vbahelper/source/msforms/vbapages.hxx3
-rw-r--r--vbahelper/source/msforms/vbaprogressbar.cxx3
-rw-r--r--vbahelper/source/msforms/vbaprogressbar.hxx5
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.cxx15
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.hxx5
-rw-r--r--vbahelper/source/msforms/vbascrollbar.cxx3
-rw-r--r--vbahelper/source/msforms/vbascrollbar.hxx3
-rw-r--r--vbahelper/source/msforms/vbaspinbutton.cxx3
-rw-r--r--vbahelper/source/msforms/vbaspinbutton.hxx3
-rwxr-xr-xvbahelper/source/msforms/vbasystemaxcontrol.cxx2
-rwxr-xr-xvbahelper/source/msforms/vbasystemaxcontrol.hxx3
-rw-r--r--vbahelper/source/msforms/vbatextbox.cxx19
-rw-r--r--vbahelper/source/msforms/vbatextbox.hxx5
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.cxx23
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.hxx5
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx61
-rw-r--r--vbahelper/source/msforms/vbauserform.hxx8
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx17
-rw-r--r--vbahelper/source/vbahelper/vbacolorformat.cxx16
-rw-r--r--vbahelper/source/vbahelper/vbacolorformat.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbacommandbar.cxx13
-rw-r--r--vbahelper/source/vbahelper/vbacommandbar.hxx5
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.cxx34
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.cxx33
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarhelper.cxx19
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarhelper.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbacommandbars.cxx18
-rw-r--r--vbahelper/source/vbahelper/vbacommandbars.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbadialogsbase.cxx2
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx9
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx18
-rwxr-xr-xvbahelper/source/vbahelper/vbaeventshelperbase.cxx29
-rw-r--r--vbahelper/source/vbahelper/vbafillformat.cxx18
-rw-r--r--vbahelper/source/vbahelper/vbafillformat.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbafontbase.cxx2
-rw-r--r--vbahelper/source/vbahelper/vbaglobalbase.cxx7
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx281
-rw-r--r--vbahelper/source/vbahelper/vbalineformat.cxx102
-rw-r--r--vbahelper/source/vbahelper/vbalineformat.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbapagesetupbase.cxx2
-rw-r--r--vbahelper/source/vbahelper/vbapictureformat.cxx24
-rw-r--r--vbahelper/source/vbahelper/vbapictureformat.hxx3
-rw-r--r--vbahelper/source/vbahelper/vbapropvalue.cxx (renamed from vbahelper/inc/vbahelper/vbadllapi.h)29
-rw-r--r--vbahelper/source/vbahelper/vbashape.cxx279
-rw-r--r--vbahelper/source/vbahelper/vbashaperange.cxx36
-rw-r--r--vbahelper/source/vbahelper/vbashapes.cxx62
-rw-r--r--vbahelper/source/vbahelper/vbatextframe.cxx26
-rw-r--r--vbahelper/source/vbahelper/vbawindowbase.cxx3
-rw-r--r--vbahelper/util/makefile.mk26
90 files changed, 1364 insertions, 695 deletions
diff --git a/vbahelper/inc/vbahelper/helperdecl.hxx b/vbahelper/inc/vbahelper/helperdecl.hxx
index f6614add6b..8419be6a35 100644
--- a/vbahelper/inc/vbahelper/helperdecl.hxx
+++ b/vbahelper/inc/vbahelper/helperdecl.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,3 +54,5 @@ struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<Impl
} // namespace service_decl
} // namespace comphelper
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
index cfbe9e761e..ca3b3778db 100644
--- a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
+++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -6,9 +7,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: vbahelper.hxx,v $
- * $Revision: 1.5.32.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -71,9 +69,13 @@ namespace ooo
return bRes;
}
VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
- VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
+ //VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
+ // word seems to return an erroneous mime type :-/ "application/msword" not consistent with the excel one
+ VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/msword" ); }
} // openoffice
} // org
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
index 4ba494f83b..a7cd8af230 100644
--- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -62,7 +63,7 @@ public:
virtual css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getVBProjects() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
virtual void SAL_CALL OnTime( const css::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) throw (css::uno::RuntimeException);
virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Undo() throw (css::uno::RuntimeException);
@@ -73,3 +74,5 @@ public:
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
index 27ffa25eeb..2c114a4c76 100644
--- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -243,12 +244,25 @@ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
protected:
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
+ sal_Bool mbIgnoreCase;
virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
{
if ( !m_xNameAccess.is() )
throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
-
+
+ if( mbIgnoreCase )
+ {
+ css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames();
+ for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
+ {
+ rtl::OUString aName = sElementNames[i];
+ if( aName.equalsIgnoreAsciiCase( sIndex ) )
+ {
+ return createCollectionObject( m_xNameAccess->getByName( aName ) );
+ }
+ }
+ }
return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
}
@@ -275,7 +289,7 @@ protected:
}
public:
- ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
+ ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
//XCollection
virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
{
@@ -291,8 +305,8 @@ public:
if ( ( Index1 >>= nIndex ) != sal_True )
{
rtl::OUString message;
- message = rtl::OUString::createFromAscii(
- "Couldn't convert index to Int32");
+ message = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Couldn't convert index to Int32"));
throw css::lang::IndexOutOfBoundsException( message,
css::uno::Reference< css::uno::XInterface >() );
}
@@ -340,8 +354,10 @@ class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cp
typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1;
public:
- CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
+ CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess, bIgnoreCase ) {}
};
#endif //SC_VBA_COLLECTION_IMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
index b68eb06815..4a7dc837bf 100644
--- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,7 +59,7 @@ public:
virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
const css::uno::Any &aFileName,
const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Protect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Save() throw (css::uno::RuntimeException);
virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
@@ -69,3 +70,5 @@ public:
};
#endif /* VBA_DOCUMENTBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx
index 3a5c0f48f0..f617728237 100644
--- a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -64,3 +65,5 @@ protected:
};
#endif /* SC_VBA_WORKBOOKS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
index c328e316ff..f5ccb61de5 100755
--- a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -96,6 +97,15 @@ protected:
sal_Int32 nCancelIndex = -1,
const css::uno::Any& rUserData = css::uno::Any() );
+ /** Throws, if the passed sequence does not contain a value at the specified index. */
+ static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( rArgs.getLength() <= nIndex ) throw css::lang::IllegalArgumentException(); }
+
+ /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */
+ template< typename Type >
+ static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( (rArgs.getLength() <= nIndex) || !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); }
+
// ------------------------------------------------------------------------
struct EventQueueEntry
@@ -107,6 +117,10 @@ protected:
};
typedef ::std::deque< EventQueueEntry > EventQueue;
+ /** Derived classes return whether event processing is enabled. Throws if
+ the instance is in an invalid state. */
+ virtual bool implEventsEnabled() throw (css::uno::RuntimeException) = 0;
+
/** Derived classes do additional prpeparations and return whether the
event handler has to be called. */
virtual bool implPrepareEvent(
@@ -120,7 +134,7 @@ protected:
const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException) = 0;
/** Derived classes may do additional postprocessing. Called even if the
- event handler does not exist, or if an error occured during execution. */
+ event handler does not exist, or if an error occurred during execution. */
virtual void implPostProcessEvent(
EventQueue& rEventQueue,
const EventHandlerInfo& rInfo,
@@ -158,3 +172,5 @@ private:
// ============================================================================
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbafontbase.hxx b/vbahelper/inc/vbahelper/vbafontbase.hxx
index c49be459d5..e2fe222b12 100644
--- a/vbahelper/inc/vbahelper/vbafontbase.hxx
+++ b/vbahelper/inc/vbahelper/vbafontbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -101,3 +102,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
index 1394a7c749..491f8d5d24 100644
--- a/vbahelper/inc/vbahelper/vbaglobalbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -48,3 +49,5 @@ public:
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index 4a73ec2e03..8f6a990c12 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,6 +36,10 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/frame/DispatchResultEvent.hpp>
+#include <com/sun/star/frame/DispatchResultState.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
#include <com/sun/star/awt/XUnitConversion.hpp>
#include <basic/basmgr.hxx>
#include <basic/sberrors.hxx>
@@ -107,8 +112,10 @@ 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 );
class VBAHELPER_DLLPUBLIC Millimeter
{
@@ -196,6 +203,11 @@ class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttrib
{
css::uno::Reference< css::awt::XWindow > mxWindow;
sal_Bool mbDialog;
+ css::uno::Reference< css::awt::XUnitConversion > mxControlUnits;
+ css::uno::Reference< css::beans::XPropertySet > mxModel;
+
+ sal_Int32 ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit );
+ sal_Int32 ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit );
public:
UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
@@ -229,6 +241,25 @@ public:
static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException );
};
+
+class VBAHELPER_DLLPUBLIC VBADispatchListener : public cppu::WeakImplHelper1< css::frame::XDispatchResultListener >
+{
+private:
+ css::uno::Any m_Result;
+ sal_Bool m_State;
+
+public:
+ VBADispatchListener();
+ ~VBADispatchListener();
+
+ css::uno::Any getResult() { return m_Result; }
+ sal_Bool getState() { return m_State; }
+
+ // XDispatchResultListener
+ virtual void SAL_CALL dispatchFinished( const css::frame::DispatchResultEvent& aEvent ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw ( css::uno::RuntimeException );
+};
+
} // openoffice
} // org
@@ -243,3 +274,5 @@ namespace ov = ooo::vba;
#endif
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
index 315d28d093..37d11b874b 100644
--- a/vbahelper/inc/vbahelper/vbahelperinterface.hxx
+++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -191,3 +192,5 @@ VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename )
// ============================================================================
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx
index f602f51200..4454343049 100644
--- a/vbahelper/inc/vbahelper/vbapagesetupbase.hxx
+++ b/vbahelper/inc/vbahelper/vbapagesetupbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -65,3 +66,5 @@ public:
virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException);
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx
index 8fc259046d..9bc507190b 100644
--- a/vbahelper/inc/vbahelper/vbashape.hxx
+++ b/vbahelper/inc/vbahelper/vbashape.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -109,7 +110,10 @@ 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 );
};
#endif//SC_VBA_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbashaperange.hxx b/vbahelper/inc/vbahelper/vbashaperange.hxx
index d1bc1e576e..1aad3bd9f7 100644
--- a/vbahelper/inc/vbahelper/vbashaperange.hxx
+++ b/vbahelper/inc/vbahelper/vbashaperange.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -56,6 +57,8 @@ public:
virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ;
virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
@@ -76,6 +79,7 @@ public:
virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException);
//XEnumerationAccess
virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
@@ -84,3 +88,5 @@ public:
};
#endif//SC_VBA_SHAPERANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbashapes.hxx b/vbahelper/inc/vbahelper/vbashapes.hxx
index 80c99592f8..212810b907 100644
--- a/vbahelper/inc/vbahelper/vbashapes.hxx
+++ b/vbahelper/inc/vbahelper/vbashapes.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -79,3 +80,5 @@ public:
};
#endif//SC_VBA_SHAPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbatextframe.hxx b/vbahelper/inc/vbahelper/vbatextframe.hxx
index 75b3c97186..d08902096f 100644
--- a/vbahelper/inc/vbahelper/vbatextframe.hxx
+++ b/vbahelper/inc/vbahelper/vbatextframe.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -65,3 +66,5 @@ public:
};
#endif//SC_VBA_TEXTFRAME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbawindowbase.hxx b/vbahelper/inc/vbahelper/vbawindowbase.hxx
index fa7943d2c6..963ae4d510 100644
--- a/vbahelper/inc/vbahelper/vbawindowbase.hxx
+++ b/vbahelper/inc/vbahelper/vbawindowbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,5 @@ public:
};
#endif //VBA_WINDOWBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/service.cxx b/vbahelper/source/msforms/service.cxx
index 01e6014a37..432552254b 100644
--- a/vbahelper/source/msforms/service.cxx
+++ b/vbahelper/source/msforms/service.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -57,6 +58,16 @@ extern "C"
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
+ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
+ {
+ OSL_TRACE("In component_writeInfo");
+
+ // Component registration
+ return component_writeInfoHelper( pServiceManager, pRegistryKey,
+ controlprovider::serviceDecl, userform::serviceDecl );
+ }
+
SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
registry::XRegistryKey * pRegistryKey )
@@ -68,3 +79,5 @@ extern "C"
return pRet;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbabutton.cxx b/vbahelper/source/msforms/vbabutton.cxx
index ed93d0b6e7..69e4733c5d 100644
--- a/vbahelper/source/msforms/vbabutton.cxx
+++ b/vbahelper/source/msforms/vbabutton.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -69,3 +70,5 @@ ScVbaButton::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbabutton.hxx b/vbahelper/source/msforms/vbabutton.hxx
index 0596c0bd28..1a01d69165 100644
--- a/vbahelper/source/msforms/vbabutton.hxx
+++ b/vbahelper/source/msforms/vbabutton.hxx
@@ -47,3 +47,5 @@ public:
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif //SC_VBA_BUTTON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx
index 15175f0e0f..fea0853b68 100644
--- a/vbahelper/source/msforms/vbacheckbox.cxx
+++ b/vbahelper/source/msforms/vbacheckbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -70,6 +71,8 @@ void SAL_CALL
ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
{
sal_Int16 nValue = 0;
+ sal_Int16 nOldValue = 0;
+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
sal_Bool bValue = false;
if( _value >>= nValue )
{
@@ -82,6 +85,8 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
nValue = 1;
}
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
+ if ( nValue != nOldValue )
+ fireClickEvent();
}
rtl::OUString&
ScVbaCheckbox::getServiceImplName()
@@ -102,3 +107,4 @@ ScVbaCheckbox::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx
index d3922d84a9..2c306486b0 100644
--- a/vbahelper/source/msforms/vbacheckbox.hxx
+++ b/vbahelper/source/msforms/vbacheckbox.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -44,10 +45,12 @@ public:
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif //SC_VBA_CHECKBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index 4dfbf2908a..d0446bca77 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,6 +27,9 @@
************************************************************************/
#include "vbacombobox.hxx"
#include <vector>
+#include <filter/msfilter/msvbahelper.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/sbmod.hxx>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -63,12 +67,18 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti
sal_Int16 nIndex = 0;
if( _value >>= nIndex )
{
+ sal_Int32 nOldIndex = -1;
+ getListIndex() >>= nOldIndex;
uno::Sequence< rtl::OUString > sItems;
m_xProps->getPropertyValue( ITEMS ) >>= sItems;
if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) )
{
rtl::OUString sText = sItems[ nIndex ];
m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) );
+
+ // fire the _Change event
+ if( nOldIndex != nIndex )
+ fireClickEvent();
}
}
}
@@ -103,7 +113,38 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
- m_xProps->setPropertyValue( sSourceName, _value );
+ rtl::OUString sOldValue, sNewValue;
+ getValue() >>= sOldValue;
+
+ uno::Any aConverted = _value;
+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
+ try
+ {
+ aConverted = xConverter.is() ? xConverter->convertTo( _value, getCppuType( static_cast< const rtl::OUString* >(0) ) ) : aConverted;
+ }
+ catch( const uno::Exception& /*ex*/ )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid value" ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ m_xProps->setPropertyValue( sSourceName, aConverted );
+
+ aConverted >>= 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();
+ }
+ }
}
// see Value
@@ -178,3 +219,5 @@ ScVbaComboBox::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx
index e7e86a00fd..77a546e678 100644
--- a/vbahelper/source/msforms/vbacombobox.hxx
+++ b/vbahelper/source/msforms/vbacombobox.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -68,10 +69,12 @@ public:
virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
// XDefaultProperty
- ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif //
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 28f6d7f61c..6b14bed48e 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -1,7 +1,8 @@
+/* -*- 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 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,6 +29,7 @@
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XActionListener.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
@@ -39,6 +41,9 @@
#include <com/sun/star/form/binding/XListEntrySink.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/script/XScriptListener.hpp>
+#include <com/sun/star/document/XCodeNameQuery.hpp>
+#include <com/sun/star/form/XChangeListener.hpp>
#include <ooo/vba/XControlProvider.hpp>
#ifdef VBA_OOBUILD_HACK
#include <svtools/bindablecontrolhelper.hxx>
@@ -65,15 +70,15 @@
using namespace com::sun::star;
using namespace ooo::vba;
-uno::Reference< css::awt::XWindowPeer >
+uno::Reference< css::awt::XWindowPeer >
ScVbaControl::getWindowPeer() throw (uno::RuntimeException)
{
uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
uno::Reference< awt::XControlModel > xControlModel;
uno::Reference< css::awt::XWindowPeer > xWinPeer;
- if ( !xControlShape.is() )
- {
+ if ( !xControlShape.is() )
+ {
// would seem to be a Userform control
uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW );
xWinPeer = xControl->getPeer();
@@ -90,7 +95,7 @@ ScVbaControl::getWindowPeer() throw (uno::RuntimeException)
}
catch( uno::Exception )
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ),
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The Control does not exsit")),
uno::Reference< uno::XInterface >() );
}
return xWinPeer;
@@ -127,21 +132,30 @@ ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeE
//ScVbaControl
-ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel )
+ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), bIsDialog(false), m_xControl( xControl ), m_xModel( xModel )
{
//add listener
m_xEventListener.set( new ScVbaControlListener( this ) );
setGeometryHelper( pGeomHelper );
uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
xComponent->addEventListener( m_xEventListener );
-
+
//init m_xProps
uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ;
if ( xControlShape.is() ) // form control
+ {
m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
+ rtl::OUString sDefaultControl;
+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultControl") ) ) >>= sDefaultControl;
+ uno::Reference< lang::XMultiComponentFactory > xMFac( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ m_xEmptyFormControl.set( xMFac->createInstanceWithContext( sDefaultControl, mxContext ), uno::UNO_QUERY_THROW );
+ }
else if ( xUserFormControl.is() ) // userform control
+ {
m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
+ bIsDialog = true;
+ }
}
ScVbaControl::~ScVbaControl()
@@ -153,7 +167,7 @@ ScVbaControl::~ScVbaControl()
}
}
-void
+void
ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper )
{
mpGeometryHelper.reset( pHelper );
@@ -227,6 +241,7 @@ void SAL_CALL
ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException)
{
mpGeometryHelper->setLeft( _left );
+
}
double SAL_CALL
@@ -248,7 +263,7 @@ ScVbaControl::getObject() throw (uno::RuntimeException)
return xRet;
}
-void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException)
+void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException)
{
uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW );
xWin->setFocus();
@@ -270,7 +285,7 @@ void SAL_CALL ScVbaControl::Move( double Left, double Top, const uno::Any& Width
setHeight( nHeight );
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getControlSource() throw (uno::RuntimeException)
{
// #FIXME I *hate* having these upstream differences
@@ -293,7 +308,7 @@ ScVbaControl::getControlSource() throw (uno::RuntimeException)
}
catch( uno::Exception& )
{
- }
+ }
}
return sControlSource;
#else
@@ -301,7 +316,7 @@ ScVbaControl::getControlSource() throw (uno::RuntimeException)
#endif
}
-void SAL_CALL
+void SAL_CALL
ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException)
{
#ifdef VBA_OOBUILD_HACK
@@ -312,7 +327,7 @@ ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno
#endif
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getRowSource() throw (uno::RuntimeException)
{
#ifdef VBA_OOBUILD_HACK
@@ -333,7 +348,7 @@ ScVbaControl::getRowSource() throw (uno::RuntimeException)
}
catch( uno::Exception& )
{
- }
+ }
}
return sRowSource;
#else
@@ -341,7 +356,7 @@ ScVbaControl::getRowSource() throw (uno::RuntimeException)
#endif
}
-void SAL_CALL
+void SAL_CALL
ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
{
#ifdef VBA_OOBUILD_HACK
@@ -352,7 +367,7 @@ ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::Runtim
#endif
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getName() throw (uno::RuntimeException)
{
rtl::OUString sName;
@@ -369,7 +384,7 @@ ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) );
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getControlTipText() throw (css::uno::RuntimeException)
{
rtl::OUString sName;
@@ -378,7 +393,7 @@ ScVbaControl::getControlTipText() throw (css::uno::RuntimeException)
return sName;
}
-void SAL_CALL
+void SAL_CALL
ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::uno::RuntimeException)
{
m_xProps->setPropertyValue
@@ -397,6 +412,85 @@ void SAL_CALL ScVbaControl::setTag( const ::rtl::OUString& aTag )
m_aControlTag = aTag;
}
+::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nForeColor = -1;
+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor;
+ return OORGBToXLRGB( nForeColor );
+}
+
+void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
+}
+
+void ScVbaControl::fireEvent( script::ScriptEvent& evt )
+{
+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ uno::Reference< script::XScriptListener > xScriptListener( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), mxContext ), uno::UNO_QUERY_THROW );
+
+ uno::Reference< beans::XPropertySet > xProps( xScriptListener, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ), uno::makeAny( m_xModel ) );
+
+ // handling for sheet control
+ uno::Reference< msforms::XControl > xThisControl( this );
+ try
+ {
+ evt.Arguments.realloc( 1 );
+ lang::EventObject aEvt;
+
+ uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
+ uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ) ;
+
+ if ( xControlShape.is() )
+ {
+ evt.Source = xControlShape;
+ aEvt.Source = m_xEmptyFormControl;
+ // Set up proper scriptcode
+ uno::Reference< lang::XMultiServiceFactory > xDocFac( m_xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VBACodeNameProvider")) ), uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
+ evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
+ xScriptListener->firing( evt );
+ }
+ else
+ {
+ if ( xControl.is() ) // normal control ( from dialog/userform )
+ {
+ // #FIXME We should probably store a reference to the
+ // parent dialog/userform here ( other wise the name of
+ // dialog could be changed and we won't be aware of it.
+ // ( OTOH this is probably an unlikely scenario )
+ evt.Source = xThisControl;
+ aEvt.Source = xControl;
+ evt.ScriptCode = m_sLibraryAndCodeName;
+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
+ xScriptListener->firing( evt );
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ }
+}
+void ScVbaControl::fireChangeEvent()
+{
+ script::ScriptEvent evt;
+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
+ evt.ListenerType = form::XChangeListener::static_type(0);
+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("changed") );
+ fireEvent( evt );
+}
+
+void ScVbaControl::fireClickEvent()
+{
+ script::ScriptEvent evt;
+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
+ evt.ListenerType = awt::XActionListener::static_type(0);
+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("actionPerformed") );
+ fireEvent( evt );
+}
//ScVbaControlFactory
@@ -422,16 +516,25 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
xProps->getPropertyValue( sClassId ) >>= nClassId;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
+ sal_Bool bToggle = sal_False;
switch( nClassId )
{
case form::FormComponentType::COMBOBOX:
return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::COMMANDBUTTON:
- return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
+ if ( bToggle )
+ return new ScVbaToggleButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ else
+ return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+
case form::FormComponentType::FIXEDTEXT:
return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::TEXTFIELD:
return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ case form::FormComponentType::CHECKBOX:
+ return new ScVbaCheckbox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::RADIOBUTTON:
return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::LISTBOX:
@@ -441,8 +544,8 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
case form::FormComponentType::IMAGECONTROL:
return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Donot support this Control Type." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Donot support this Control Type." )), uno::Reference< uno::XInterface >() );
}
}
@@ -453,9 +556,9 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XCo
ScVbaControl* pControl = NULL;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
- pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
- pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
@@ -470,36 +573,41 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XCo
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
- pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
- pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
- pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
- pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
+ pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
+ // #FIXME implement a page control
+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) )
+ pControl = new ScVbaControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) )
+ pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
- pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) )
- pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unsupported control ")), uno::Reference< uno::XInterface >() );
return pControl;
}
-rtl::OUString&
+rtl::OUString&
ScVbaControl::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaControl::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
@@ -523,25 +631,25 @@ public:
virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
};
-uno::Reference< msforms::XControl > SAL_CALL
+uno::Reference< msforms::XControl > SAL_CALL
ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
{
uno::Reference< msforms::XControl > xControlToReturn;
- if ( xControlShape.is() )
+ if ( xControlShape.is() )
{
ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner );
xControlToReturn.set( controlFactory.createControl( xDocOwner ) );
}
return xControlToReturn;
-
+
}
-uno::Reference< msforms::XControl > SAL_CALL
+uno::Reference< msforms::XControl > SAL_CALL
ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
{
uno::Reference< msforms::XControl > xControlToReturn;
- if ( xControl.is() && xDialog.is() )
- {
-
+ if ( xControl.is() && xDialog.is() )
+ {
+
ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner );
xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) );
ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() );
@@ -561,3 +669,4 @@ extern sdecl::ServiceDecl const serviceDecl(
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
index d2631c761e..ed7004a1e4 100644
--- a/vbahelper/source/msforms/vbacontrol.hxx
+++ b/vbahelper/source/msforms/vbacontrol.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,6 +35,7 @@
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/script/ScriptEvent.hpp>
#include <ooo/vba/msforms/XControl.hpp>
#include <vbahelper/vbahelper.hxx>
@@ -47,17 +49,23 @@ class ScVbaControl : public ControlImpl_BASE
{
private:
com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > m_xEmptyFormControl;
protected:
// awt control has nothing similar to Tag property of Mso controls,
// whether it is necessary is another question
::rtl::OUString m_aControlTag;
+ bool bIsDialog;
+ rtl::OUString m_sLibraryAndCodeName;
std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
css::uno::Reference< css::beans::XPropertySet > m_xProps;
css::uno::Reference< css::uno::XInterface > m_xControl;
css::uno::Reference< css::frame::XModel > m_xModel;
virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
+ void fireChangeEvent();
+ void fireClickEvent();
+ void fireEvent( css::script::ScriptEvent& evt );
public:
ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper );
@@ -65,6 +73,10 @@ public:
// This class will own the helper, so make sure it is allocated from
// the heap
void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
+ // sets the name of the associated library ( used for UserForm controls )
+ void setLibraryAndCodeName( const rtl::OUString& sLibCodeName ) { m_sLibraryAndCodeName = sLibCodeName; }
+ rtl::OUString getLibraryAndCodeName() { return m_sLibraryAndCodeName; }
+
// XControl
virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
@@ -94,6 +106,8 @@ public:
virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) throw (css::uno::RuntimeException);
//remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
virtual void removeResouce() throw( css::uno::RuntimeException );
+ 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);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
@@ -115,3 +129,5 @@ private:
};
#endif//SC_VBA_CONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 78c8b25885..55bc5b8c36 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -70,7 +71,19 @@ private:
mIndices[ msNames[ nIndex ] ] = nIndex;
}
}
-
+ void getNestedControls( ControlVec& vControls, uno::Reference< awt::XControlContainer >& xContainer )
+ {
+ uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls();
+ const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray();
+ const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength();
+ for ( ; pCtrl < pCtrlsEnd; ++pCtrl )
+ {
+ uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY );
+ vControls.push_back( *pCtrl );
+ if ( xC.is() )
+ getNestedControls( vControls, xC );
+ }
+ }
public:
ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
{
@@ -394,3 +407,5 @@ ScVbaControls::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbacontrols.hxx b/vbahelper/source/msforms/vbacontrols.hxx
index a050415c9b..cbbb4fcafe 100644
--- a/vbahelper/source/msforms/vbacontrols.hxx
+++ b/vbahelper/source/msforms/vbacontrols.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -62,3 +63,4 @@ public:
};
#endif //SC_VBA_OLEOBJECTS_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx
index 3c202f1e58..09d3b3c7fb 100644
--- a/vbahelper/source/msforms/vbaframe.cxx
+++ b/vbahelper/source/msforms/vbaframe.cxx
@@ -1,7 +1,8 @@
+/* -*- 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 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,7 +38,7 @@ ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const
}
// Attributes
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
{
rtl::OUString Label;
@@ -45,34 +46,58 @@ ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
return Label;
}
-void SAL_CALL
+void SAL_CALL
ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
{
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaFrame::getValue() throw (css::uno::RuntimeException)
{
return uno::makeAny( getCaption() );
}
-void SAL_CALL
+void SAL_CALL
ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString sCaption;
_value >>= sCaption;
- setCaption( sCaption );
+ setCaption( sCaption );
+}
+
+::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
}
-rtl::OUString&
+void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return;
+}
+
+
+rtl::OUString SAL_CALL
+ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+ return rtl::OUString();
+}
+
+void SAL_CALL
+ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+}
+
+rtl::OUString&
ScVbaFrame::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaFrame::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
@@ -83,3 +108,5 @@ ScVbaFrame::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx
index c55a41bf08..9b2c77252f 100644
--- a/vbahelper/source/msforms/vbaframe.hxx
+++ b/vbahelper/source/msforms/vbaframe.hxx
@@ -1,7 +1,8 @@
+/* -*- 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 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -43,8 +44,16 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+
+ 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 rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif //SC_VBA_LABEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx
index 5fb6ebeabb..29c8dfa834 100644
--- a/vbahelper/source/msforms/vbalabel.cxx
+++ b/vbahelper/source/msforms/vbalabel.cxx
@@ -1,7 +1,8 @@
+/* -*- 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 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,7 +38,7 @@ ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent,
}
// Attributes
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
{
rtl::OUString Label;
@@ -45,34 +46,46 @@ ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
return Label;
}
-void SAL_CALL
+void SAL_CALL
ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
{
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaLabel::getValue() throw (css::uno::RuntimeException)
{
return uno::makeAny( getCaption() );
}
-void SAL_CALL
+void SAL_CALL
ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString sCaption;
_value >>= sCaption;
- setCaption( sCaption );
+ setCaption( sCaption );
}
+rtl::OUString SAL_CALL
+ScVbaLabel::getAccelerator() throw (css::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+ return rtl::OUString();
+}
-rtl::OUString&
+void SAL_CALL
+ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+}
+
+rtl::OUString&
ScVbaLabel::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaLabel::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
@@ -83,3 +96,5 @@ ScVbaLabel::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx
index fd6b1c199f..3619c06e15 100644
--- a/vbahelper/source/msforms/vbalabel.hxx
+++ b/vbahelper/source/msforms/vbalabel.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -44,10 +45,14 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
};
#endif //SC_VBA_LABEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx
index 8538fc29bc..a29c1312ee 100644
--- a/vbahelper/source/msforms/vbalistbox.cxx
+++ b/vbahelper/source/msforms/vbalistbox.cxx
@@ -1,7 +1,8 @@
+/* -*- 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 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -45,16 +46,16 @@ ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, c
}
// Attributes
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int32 nIndex = 0;
_value >>= nIndex;
uno::Reference< XPropValue > xPropVal( Selected( nIndex ), uno::UNO_QUERY_THROW );
- xPropVal->setValue( uno::makeAny( sal_True ) );
+ xPropVal->setValue( uno::makeAny( sal_True ) );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaListBox::getListIndex() throw (uno::RuntimeException)
{
uno::Sequence< sal_Int16 > sSelection;
@@ -64,7 +65,7 @@ ScVbaListBox::getListIndex() throw (uno::RuntimeException)
return uno::Any( sSelection[ 0 ] );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaListBox::getValue() throw (uno::RuntimeException)
{
uno::Sequence< sal_Int16 > sSelection;
@@ -72,21 +73,21 @@ ScVbaListBox::getValue() throw (uno::RuntimeException)
m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
m_xProps->getPropertyValue( ITEMS ) >>= sItems;
if( getMultiSelect() )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Attribute use invalid." )), uno::Reference< uno::XInterface >() );
uno::Any aRet;
if ( sSelection.getLength() )
- aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] );
+ aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] );
return aRet;
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
if( getMultiSelect() )
- {
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
+ {
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Attribute use invalid." )), uno::Reference< uno::XInterface >() );
}
rtl::OUString sValue = getAnyAsString( _value );
uno::Sequence< rtl::OUString > sList;
@@ -99,21 +100,25 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
if( sList[i].equals( sValue ) )
{
- nValue = i;
+ nValue = i;
break;
}
}
if( nValue == -1 )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Attribute use invalid." )), uno::Reference< uno::XInterface >() );
uno::Sequence< sal_Int16 > nSelectedIndices(1);
+ uno::Sequence< sal_Int16 > nOldSelectedIndices;
+ m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nOldSelectedIndices;
nSelectedIndices[ 0 ] = nValue;
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
- m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
+ m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
+ if ( nSelectedIndices != nOldSelectedIndices )
+ fireClickEvent();
+ //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
}
-::rtl::OUString SAL_CALL
+::rtl::OUString SAL_CALL
ScVbaListBox::getText() throw (uno::RuntimeException)
{
rtl::OUString result;
@@ -121,56 +126,58 @@ ScVbaListBox::getText() throw (uno::RuntimeException)
return result;
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
{
setValue( uno::makeAny( _text ) ); // seems the same
}
-sal_Bool SAL_CALL
+sal_Int32 SAL_CALL
ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
{
sal_Bool bMultiSelect = sal_False;
m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect;
- return bMultiSelect;
+ return bMultiSelect ? 1 : 0 ;
}
-void SAL_CALL
-ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
+void SAL_CALL
+ScVbaListBox::setMultiSelect( sal_Int32 _multiselect ) throw (css::uno::RuntimeException)
{
- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
+ sal_Bool bMultiSelect = _multiselect == 1 ? 1 : 0;
+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( bMultiSelect ) );
}
-css::uno::Any SAL_CALL
+
+css::uno::Any SAL_CALL
ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
{
uno::Sequence< rtl::OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList;
sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
// no choice but to do a horror cast as internally
- // the indices are but sal_Int16
+ // the indices are but sal_Int16
sal_Int16 nIndex = static_cast< sal_Int16 >( index );
if( nIndex < 0 || nIndex >= nLength )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Error Number." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Error Number." )), uno::Reference< uno::XInterface >() );
m_nIndex = nIndex;
return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
}
// Methods
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
{
mpListHelper->AddItem( pvargItem, pvargIndex );
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
{
mpListHelper->removeItem( index );
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::Clear( ) throw (uno::RuntimeException)
{
mpListHelper->Clear();
@@ -180,13 +187,13 @@ ScVbaListBox::Clear( ) throw (uno::RuntimeException)
// to set the selected state of particular entries in the Listbox
// ListBox1.Selected( 3 ) = false
//PropListener
-void
+void
ScVbaListBox::setValueEvent( const uno::Any& value )
{
sal_Bool bValue = sal_False;
if( !(value >>= bValue) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Invalid type\n. need boolean." )), uno::Reference< uno::XInterface >() );
uno::Sequence< sal_Int16 > nList;
m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList;
sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
@@ -205,6 +212,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
}
nList.realloc( nLength - 1 );
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
+ fireClickEvent();
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
return;
}
@@ -223,6 +231,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
nList[0] = nIndex;
}
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
+ fireClickEvent();
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
}
}
@@ -231,14 +240,14 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
// to determine the selected state of particular entries in the Listbox
// msgbox ListBox1.Selected( 3 )
-css::uno::Any
+css::uno::Any
ScVbaListBox::getValueEvent()
{
uno::Sequence< sal_Int16 > nList;
m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
sal_Int32 nLength = nList.getLength();
sal_Int32 nIndex = m_nIndex;
-
+
for( sal_Int32 i = 0; i < nLength; i++ )
{
if( nList[i] == nIndex )
@@ -261,20 +270,20 @@ ScVbaListBox::getListCount() throw (uno::RuntimeException)
return mpListHelper->getListCount();
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
{
return mpListHelper->List( pvargIndex, pvarColumn );
}
-rtl::OUString&
+rtl::OUString&
ScVbaListBox::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaListBox::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
@@ -285,3 +294,5 @@ ScVbaListBox::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx
index 01c53d1b0f..a35f100f4b 100644
--- a/vbahelper/source/msforms/vbalistbox.hxx
+++ b/vbahelper/source/msforms/vbalistbox.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,8 +59,8 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
// Methods
@@ -71,7 +72,7 @@ public:
virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
@@ -85,3 +86,5 @@ public:
};
#endif //
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx
index 36683ae6f7..696b52bfb4 100644
--- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx
+++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx
@@ -1,12 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <vbalistcontrolhelper.hxx>
#include <vector>
+#include <vbahelper/vbapropvalue.hxx>
using namespace com::sun::star;
using namespace ooo::vba;
const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-void SAL_CALL
+class ListPropListener : public PropListener
+{
+private:
+ uno::Reference< beans::XPropertySet > m_xProps;
+ uno::Any m_pvargIndex;
+ uno::Any m_pvarColumn;
+
+public:
+ ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn );
+ virtual void setValueEvent( const css::uno::Any& value );
+ virtual css::uno::Any getValueEvent();
+};
+
+ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn )
+{
+}
+
+void ListPropListener::setValueEvent( const uno::Any& value )
+{
+ if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Bad argument" )), uno::Reference< uno::XInterface >() );
+
+ m_xProps->setPropertyValue( ITEMS, value );
+}
+
+uno::Any ListPropListener::getValueEvent()
+{
+ uno::Sequence< rtl::OUString > sList;
+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
+ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
+ uno::Any aRet;
+ if ( m_pvargIndex.hasValue() )
+ {
+ sal_Int16 nIndex = -1;
+ m_pvargIndex >>= nIndex;
+ if( nIndex < 0 || nIndex >= nLength )
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Bad row Index" )), uno::Reference< uno::XInterface >() );
+ aRet <<= sList[ nIndex ];
+ }
+ else if ( m_pvarColumn.hasValue() ) // pvarColumn on its own would be bad
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Bad column Index" )), uno::Reference< uno::XInterface >() );
+ else // List() ( e.g. no args )
+ {
+ uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
+ for ( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ sReturnArray[ i ].realloc( 10 );
+ sReturnArray[ i ][ 0 ] = sList[ i ];
+ }
+ aRet = uno::makeAny( sReturnArray );
+ }
+ return aRet;
+}
+
+void SAL_CALL
ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
{
if ( pvargItem.hasValue() )
@@ -21,13 +80,13 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
rtl::OUString sString = getAnyAsString( pvargItem );
- // if no index specified or item is to be appended to end of
+ // if no index specified or item is to be appended to end of
// list just realloc the array and set the last item
if ( nIndex == sList.getLength() )
{
sal_Int32 nOldSize = sList.getLength();
sList.realloc( nOldSize + 1 );
- sList[ nOldSize ] = sString;
+ sList[ nOldSize ] = sString;
}
else
{
@@ -41,10 +100,10 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
// insert the new element
sVec.push_back( sString );
- // copy elements
+ // copy elements
for ( ; pString != pEndString; ++pString )
sVec.push_back( *pString );
-
+
sList.realloc( sList.getLength() + 1 );
// point at first element to be overwritten
@@ -52,16 +111,16 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
pEndString = sList.getArray() + sList.getLength();
std::vector< rtl::OUString >::iterator it = sVec.begin();
for ( ; pString != pEndString; ++pString, ++it)
- *pString = *it;
+ *pString = *it;
//
}
m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
-
+
}
}
-void SAL_CALL
+void SAL_CALL
ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
{
sal_Int32 nIndex = 0;
@@ -71,7 +130,7 @@ ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeExcept
uno::Sequence< rtl::OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList;
if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid index")), uno::Reference< uno::XInterface > () );
if( sList.hasElements() )
{
if( sList.getLength() == 1 )
@@ -90,7 +149,7 @@ ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeExcept
}
}
-void SAL_CALL
+void SAL_CALL
ListControlHelper::Clear( ) throw (uno::RuntimeException)
{
// urk, setValue doesn't seem to work !!
@@ -113,34 +172,10 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
return sList.getLength();
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
{
- uno::Sequence< rtl::OUString > sList;
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
- sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
- uno::Any aRet;
- if ( pvargIndex.hasValue() )
- {
- sal_Int16 nIndex = -1;
- pvargIndex >>= nIndex;
- if( nIndex < 0 || nIndex >= nLength )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Bad row Index" ), uno::Reference< uno::XInterface >() );
- aRet <<= sList[ nIndex ];
- }
- else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Bad column Index" ), uno::Reference< uno::XInterface >() );
- else // List() ( e.g. no args )
- {
- uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
- for ( sal_Int32 i = 0; i < nLength; ++i )
- {
- sReturnArray[ i ].realloc( 10 );
- sReturnArray[ i ][ 0 ] = sList[ i ];
- }
- aRet = uno::makeAny( sReturnArray );
- }
- return aRet;
+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.hxx b/vbahelper/source/msforms/vbalistcontrolhelper.hxx
index 6b332ab9d8..82ac338765 100644
--- a/vbahelper/source/msforms/vbalistcontrolhelper.hxx
+++ b/vbahelper/source/msforms/vbalistcontrolhelper.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef SC_VBA_LISTCONTROLHELPER
#define SC_VBA_LISTCONTROLHELPER
@@ -18,3 +19,5 @@ public:
virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx
index 4cdf220aa6..c3ca653dc9 100644
--- a/vbahelper/source/msforms/vbamultipage.cxx
+++ b/vbahelper/source/msforms/vbamultipage.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +29,7 @@
#include <ooo/vba/XCollection.hpp>
#include "vbapages.hxx"
#include <vector>
+#include <com/sun/star/container/XNameContainer.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -122,3 +124,5 @@ ScVbaMultiPage::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbamultipage.hxx b/vbahelper/source/msforms/vbamultipage.hxx
index 75c0da0bb1..0113b8ea91 100644
--- a/vbahelper/source/msforms/vbamultipage.hxx
+++ b/vbahelper/source/msforms/vbamultipage.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,6 +53,8 @@ public:
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
};
#endif //SC_VBA_LABEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbapages.cxx b/vbahelper/source/msforms/vbapages.cxx
index 95e2e715b4..7f6b2d5be8 100644
--- a/vbahelper/source/msforms/vbapages.cxx
+++ b/vbahelper/source/msforms/vbapages.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -70,3 +71,5 @@ ScVbaPages::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbapages.hxx b/vbahelper/source/msforms/vbapages.hxx
index 7914f5bd6f..f19c6120f4 100644
--- a/vbahelper/source/msforms/vbapages.hxx
+++ b/vbahelper/source/msforms/vbapages.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -54,3 +55,5 @@ public:
};
#endif//SC_VBA_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaprogressbar.cxx b/vbahelper/source/msforms/vbaprogressbar.cxx
index 3ffe96d5c6..80b05467ce 100644
--- a/vbahelper/source/msforms/vbaprogressbar.cxx
+++ b/vbahelper/source/msforms/vbaprogressbar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -68,3 +69,5 @@ ScVbaProgressBar::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaprogressbar.hxx b/vbahelper/source/msforms/vbaprogressbar.hxx
index a4d4270f96..e022bd9f52 100644
--- a/vbahelper/source/msforms/vbaprogressbar.hxx
+++ b/vbahelper/source/msforms/vbaprogressbar.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,6 +47,8 @@ public:
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
};
#endif //SC_VBA_LABEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx
index 3853f380d9..aa08851902 100644
--- a/vbahelper/source/msforms/vbaradiobutton.cxx
+++ b/vbahelper/source/msforms/vbaradiobutton.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -70,6 +71,9 @@ void SAL_CALL
ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int16 nValue = 0;
+ sal_Int16 nOldValue = 0;
+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
+
sal_Bool bValue = sal_False;
if( _value >>= nValue )
{
@@ -82,6 +86,15 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
nValue = 1;
}
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
+ if ( nValue != nOldValue )
+ {
+ fireChangeEvent();
+ // In Excel, only when the radio button is checked, the click event is fired.
+ if ( nValue != 0 )
+ {
+ fireClickEvent();
+ }
+ }
}
rtl::OUString&
@@ -102,3 +115,5 @@ ScVbaRadioButton::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaradiobutton.hxx b/vbahelper/source/msforms/vbaradiobutton.hxx
index 576cde6709..0bcbb33f15 100644
--- a/vbahelper/source/msforms/vbaradiobutton.hxx
+++ b/vbahelper/source/msforms/vbaradiobutton.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,7 +47,9 @@ public:
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
};
#endif //SC_VBA_RADIOBUTTON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbascrollbar.cxx b/vbahelper/source/msforms/vbascrollbar.cxx
index 1c37e61bb9..0cf4e6c963 100644
--- a/vbahelper/source/msforms/vbascrollbar.cxx
+++ b/vbahelper/source/msforms/vbascrollbar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -129,3 +130,5 @@ ScVbaScrollBar::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbascrollbar.hxx b/vbahelper/source/msforms/vbascrollbar.hxx
index 8543fe081b..de36b51398 100644
--- a/vbahelper/source/msforms/vbascrollbar.hxx
+++ b/vbahelper/source/msforms/vbascrollbar.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -56,3 +57,5 @@ public:
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif //SC_VBA_LABEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaspinbutton.cxx b/vbahelper/source/msforms/vbaspinbutton.cxx
index fbb7961aaf..42f025a45f 100644
--- a/vbahelper/source/msforms/vbaspinbutton.cxx
+++ b/vbahelper/source/msforms/vbaspinbutton.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -99,3 +100,5 @@ ScVbaSpinButton::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbaspinbutton.hxx b/vbahelper/source/msforms/vbaspinbutton.hxx
index cd6aaf7ce2..66d2b906ef 100644
--- a/vbahelper/source/msforms/vbaspinbutton.hxx
+++ b/vbahelper/source/msforms/vbaspinbutton.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,3 +52,5 @@ public:
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif //SC_VBA_SPINBUTTON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.cxx b/vbahelper/source/msforms/vbasystemaxcontrol.cxx
index 227338d7f6..171986ac6c 100755
--- a/vbahelper/source/msforms/vbasystemaxcontrol.cxx
+++ b/vbahelper/source/msforms/vbasystemaxcontrol.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -99,3 +100,4 @@ VbaSystemAXControl::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.hxx b/vbahelper/source/msforms/vbasystemaxcontrol.hxx
index 5bc23f44b2..45bcb3a630 100755
--- a/vbahelper/source/msforms/vbasystemaxcontrol.hxx
+++ b/vbahelper/source/msforms/vbasystemaxcontrol.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -56,3 +57,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx
index 730f24c961..3fc94c7a17 100644
--- a/vbahelper/source/msforms/vbatextbox.cxx
+++ b/vbahelper/source/msforms/vbatextbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -67,13 +68,20 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
{
+ rtl::OUString sOldText = getText();
+
if ( !mbDialog )
{
- uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
- xTextRange->setString( _text );
-}
+ uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
+ xTextRange->setString( _text );
+ }
else
m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) );
+
+ if ( _text != sOldText )
+ {
+ fireChangeEvent();
+ }
}
sal_Int32 SAL_CALL
@@ -90,7 +98,8 @@ ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
{
- uno::Any aValue( _maxlength );
+ sal_Int16 _maxlength16 = static_cast<sal_Int16> (_maxlength);
+ uno::Any aValue( _maxlength16 );
m_xProps->setPropertyValue
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
}
@@ -132,3 +141,5 @@ ScVbaTextBox::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbatextbox.hxx b/vbahelper/source/msforms/vbatextbox.hxx
index 58d22f45e9..548ae2ab47 100644
--- a/vbahelper/source/msforms/vbatextbox.hxx
+++ b/vbahelper/source/msforms/vbatextbox.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -48,9 +49,11 @@ public:
virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException);
virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException);
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif //SC_VBA_TEXTBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index d16fab90e4..297e30c103 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -68,17 +69,34 @@ ScVbaToggleButton::getValue() throw (uno::RuntimeException)
return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
}
+
void SAL_CALL
ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int16 nState = 0;
- _value >>= nState;
+ 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;
+ nState = ( nState == -1 ) ? 1 : 0;
OSL_TRACE( "nState - %d", nState );
+ }
m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
}
+
rtl::OUString&
ScVbaToggleButton::getServiceImplName()
{
@@ -98,3 +116,4 @@ ScVbaToggleButton::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbatogglebutton.hxx b/vbahelper/source/msforms/vbatogglebutton.hxx
index 8950a1ff09..540069de3d 100644
--- a/vbahelper/source/msforms/vbatogglebutton.hxx
+++ b/vbahelper/source/msforms/vbatogglebutton.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,6 +51,8 @@ public:
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
// XDefaultProperty
- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); }
};
#endif //SC_VBA_TOGGLEBUTTON_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 3db05ee747..2e7dc0984d 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -55,6 +56,8 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Refer
uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
+ if ( aArgs.getLength() >= 4 )
+ aArgs[ 3 ] >>= m_sLibName;
}
ScVbaUserForm::~ScVbaUserForm()
@@ -66,8 +69,7 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
{
OSL_TRACE("ScVbaUserForm::Show( )");
short aRet = 0;
- mbDispose = true;
-
+ mbDispose = true;
if ( m_xDialog.is() )
{
// try to center dialog on model window
@@ -125,6 +127,24 @@ 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)
{
@@ -190,6 +210,30 @@ ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& a
}
}
+uno::Reference< awt::XControl >
+ScVbaUserForm::nestedSearch( const rtl::OUString& aPropertyName, uno::Reference< awt::XControlContainer >& xContainer )
+{
+ uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
+ if ( !xControl.is() )
+ {
+ uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls();
+ const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray();
+ const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength();
+
+ for ( ; pCtrl < pCtrlsEnd; ++pCtrl )
+ {
+ uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY );
+ if ( xC.is() )
+ {
+ xControl.set( nestedSearch( aPropertyName, xC ) );
+ if ( xControl.is() )
+ break;
+ }
+ }
+ }
+ return xControl;
+}
+
uno::Any SAL_CALL
ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
{
@@ -238,10 +282,14 @@ ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeEx
OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() );
if ( xControl.is() )
{
- uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW );
- sal_Bool bRes = xNameAccess->hasByName( aName );
- OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes );
- return bRes;
+ uno::Reference< beans::XPropertySet > xDlgProps( xControl->getModel(), uno::UNO_QUERY );
+ if ( xDlgProps.is() )
+ {
+ uno::Reference< container::XNameContainer > xAllChildren( xDlgProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllDialogChildren")) ), uno::UNO_QUERY_THROW );
+ sal_Bool bRes = xAllChildren->hasByName( aName );
+ OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xAllChildren.is(), bRes );
+ return bRes;
+ }
}
return sal_False;
}
@@ -256,3 +304,4 @@ extern sdecl::ServiceDecl const serviceDecl(
"ooo.vba.msforms.UserForm" );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
index 463a3cba3b..625d1fae02 100644
--- a/vbahelper/source/msforms/vbauserform.hxx
+++ b/vbahelper/source/msforms/vbauserform.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,6 +31,7 @@
#include <cppuhelper/implbase1.hxx>
#include <ooo/vba/msforms/XUserForm.hpp>
#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <vbahelper/vbahelperinterface.hxx>
@@ -43,10 +45,14 @@ class ScVbaUserForm : public ScVbaUserForm_BASE
private:
css::uno::Reference< css::awt::XDialog > m_xDialog;
bool mbDispose;
+ rtl::OUString m_sLibName;
protected:
public:
ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
virtual ~ScVbaUserForm();
+ static css::uno::Reference< css::awt::XControl > nestedSearch( const rtl::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);
@@ -67,3 +73,5 @@ public:
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index f4825f09e2..fef92e3f88 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,6 +27,7 @@
************************************************************************/
#include "vbahelper/vbaapplicationbase.hxx"
+#include <sal/macros.h>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -200,6 +202,8 @@ void SAL_CALL
VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
{
uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+ if( bUpdate != xModel->hasControllersLocked() )
+ return;
if (bUpdate)
xModel->unlockControllers();
else
@@ -293,7 +297,7 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION));
}
-void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
+uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
{
::rtl::OUString aMacroName = MacroName.trim();
if (0 == aMacroName.indexOf('!'))
@@ -302,11 +306,11 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
uno::Reference< frame::XModel > xModel;
SbMethod* pMeth = StarBASIC::GetActiveMethod();
if ( pMeth )
- {
+ {
SbModule* pMod = dynamic_cast< SbModule* >( pMeth->GetParent() );
if ( pMod )
xModel = StarBASIC::GetModelFromBasic( pMod );
- }
+ }
if ( !xModel.is() )
xModel = getCurrentDocument();
@@ -317,7 +321,7 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
// handle the arguments
const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 };
- int nArg = sizeof( aArgsPtrArray ) / sizeof( aArgsPtrArray[0] );
+ int nArg = SAL_N_ELEMENTS( aArgsPtrArray );
uno::Sequence< uno::Any > aArgs( nArg );
const uno::Any** pArg = aArgsPtrArray;
@@ -338,7 +342,9 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
uno::Any aRet;
uno::Any aDummyCaller;
- executeMacro( aMacroInfo.mpDocContext, aMacroInfo.msResolvedMacro, aArgs, aRet, aDummyCaller );
+ executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
+
+ return aRet;
}
else
{
@@ -465,3 +471,4 @@ void VbaApplicationBase::Quit() throw (uno::RuntimeException)
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacolorformat.cxx b/vbahelper/source/vbahelper/vbacolorformat.cxx
index 99c25b1365..f51b29757e 100644
--- a/vbahelper/source/vbahelper/vbacolorformat.cxx
+++ b/vbahelper/source/vbahelper/vbacolorformat.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -76,20 +77,20 @@ ScVbaColorFormat::getRGB() throw (uno::RuntimeException)
switch( m_nColorFormatType )
{
case ColorFormatType::LINEFORMAT_FORECOLOR:
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LineColor") ) >>= nRGB;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineColor")) ) >>= nRGB;
break;
case ColorFormatType::LINEFORMAT_BACKCOLOR:
//TODO BackColor not supported
- // m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("Color"), uno::makeAny( nRGB ) );
+ // m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color")), uno::makeAny( nRGB ) );
break;
case ColorFormatType::FILLFORMAT_FORECOLOR:
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillColor") ) >>= nRGB;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")) ) >>= nRGB;
break;
case ColorFormatType::FILLFORMAT_BACKCOLOR:
nRGB = m_nFillFormatBackColor;
break;
default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second parameter of ColorFormat is wrong.")), uno::Reference< uno::XInterface >() );
}
nRGB = OORGBToXLRGB( nRGB );
return nRGB;
@@ -102,13 +103,13 @@ ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException)
switch( m_nColorFormatType )
{
case ColorFormatType::LINEFORMAT_FORECOLOR:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineColor" ), uno::makeAny( nRGB ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineColor")), uno::makeAny( nRGB ) );
break;
case ColorFormatType::LINEFORMAT_BACKCOLOR:
// TODO BackColor not supported
break;
case ColorFormatType::FILLFORMAT_FORECOLOR:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor" ), uno::makeAny( nRGB ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), uno::makeAny( nRGB ) );
if( m_pFillFormat )
{
m_pFillFormat->setForeColorAndInternalStyle(nRGB);
@@ -122,7 +123,7 @@ ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException)
}
break;
default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second parameter of ColorFormat is wrong.")), uno::Reference< uno::XInterface >() );
}
}
@@ -185,3 +186,4 @@ ScVbaColorFormat::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacolorformat.hxx b/vbahelper/source/vbahelper/vbacolorformat.hxx
index d7771dd73a..e29ea90cb9 100644
--- a/vbahelper/source/vbahelper/vbacolorformat.hxx
+++ b/vbahelper/source/vbahelper/vbacolorformat.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -123,3 +124,5 @@ public:
};
#endif//SC_VBA_XCOLORFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx
index dfda6756a3..04c6d6674d 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,7 +47,7 @@ ScVbaCommandBar::getName() throw ( uno::RuntimeException )
{
// This will get a "NULL length string" when Name is not set.
uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
- uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") );
+ uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")) );
rtl::OUString sName;
aName >>= sName;
if( sName.getLength() < 1 )
@@ -55,9 +56,9 @@ ScVbaCommandBar::getName() throw ( uno::RuntimeException )
{
if( m_sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) )
{
- if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.sheet.SpreadsheetDocument") )
+ if( pCBarHelper->getModuleId().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sheet.SpreadsheetDocument")) )
sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Worksheet Menu Bar") );
- else if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") )
+ else if( pCBarHelper->getModuleId().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")) )
sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Menu Bar") );
return sName;
}
@@ -77,7 +78,7 @@ void SAL_CALL
ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) );
+ xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), uno::makeAny( _name ) );
pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings );
}
@@ -159,7 +160,7 @@ ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorExc
{
uno::Reference< frame::XLayoutManager > xLayoutManager = pCBarHelper->getLayoutManager();
uno::Reference< beans::XPropertySet > xPropertySet( xLayoutManager->getElement( m_sResourceUrl ), uno::UNO_QUERY_THROW );
- xMenu.set( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("XMenuBar") ), uno::UNO_QUERY );
+ xMenu.set( xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XMenuBar")) ), uno::UNO_QUERY );
}
uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) );
if( aIndex.hasValue() )
@@ -284,3 +285,5 @@ uno::Sequence< rtl::OUString > VbaDummyCommandBar::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbar.hxx b/vbahelper/source/vbahelper/vbacommandbar.hxx
index 30599517b7..a8fd71a164 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,7 +53,7 @@ private:
public:
ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary = sal_True ) throw( css::uno::RuntimeException );
- sal_Bool IsMenu() { return m_bIsMenu; }
+ sal_Bool IsMenu() const { return m_bIsMenu; }
// Attributes
virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
@@ -107,3 +108,5 @@ private:
};
#endif//SC_VBA_COMMANDBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
index 3176602dab..e09c434d30 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,7 +54,7 @@ ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException )
{
// "Label" always empty
rtl::OUString sCaption;
- getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption;
+ getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) >>= sCaption;
return sCaption;
}
@@ -61,7 +62,7 @@ void SAL_CALL
ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
{
rtl::OUString sCaption = _caption.replace('&','~');
- setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( sCaption ) );
+ setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), uno::makeAny( sCaption ) );
ApplyChange();
}
@@ -69,7 +70,7 @@ ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno
ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException)
{
rtl::OUString sCommandURL;
- getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ) >>= sCommandURL;
+ getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandURL")) ) >>= sCommandURL;
return sCommandURL;
}
@@ -78,12 +79,12 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u
{
// get the current model
uno::Reference< frame::XModel > xModel( pCBarHelper->getModel() );
- MacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true );
- if ( aResolvedMacro.mbFound )
+ VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true );
+ if ( aResolvedMacro.IsResolved() )
{
- rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.msResolvedMacro );
+ rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() );
OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
- setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
+ setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandURL")), uno::makeAny( aCommandURL ) );
ApplyChange();
}
}
@@ -91,24 +92,21 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u
::sal_Bool SAL_CALL
ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException)
{
- /*sal_Bool bVisible = sal_True;
- uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") );
+ sal_Bool bVisible = sal_True;
+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")) );
if( aValue.hasValue() )
aValue >>= bVisible;
- return bVisible;*/
- return getEnabled();
-
+ return bVisible;
}
void SAL_CALL
ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
{
- /*uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") );
+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")) );
if( aValue.hasValue() )
{
- setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible"), uno::makeAny( _visible ) );
+ setPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")), uno::makeAny( _visible ) );
ApplyChange();
- }*/
- setEnabled( _visible);
+ }
}
::sal_Bool SAL_CALL
@@ -202,7 +200,7 @@ ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicE
{
// only Popup Menu has controls
uno::Reference< container::XIndexAccess > xSubMenu;
- getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu;
+ getPropertyValue( m_aPropertyValues, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )) ) >>= xSubMenu;
if( !xSubMenu.is() )
throw uno::RuntimeException();
@@ -293,3 +291,5 @@ ScVbaCommandBarButton::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
index d07366f02a..c599472682 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -114,3 +115,5 @@ public:
};
#endif//SC_VBA_COMMANDBARCONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
index c479d451ea..3c8c531628 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -64,15 +65,15 @@ uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemDat
{
uno::Sequence< beans::PropertyValue > aProps(5);
- aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL );
+ aProps[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ));
aProps[0].Value <<= sCommandURL;
- aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL );
+ aProps[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ));
aProps[1].Value <<= sHelpURL;
- aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL );
+ aProps[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ));
aProps[2].Value <<= sLabel;
- aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE );
+ aProps[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ));
aProps[3].Value <<= nType;
- aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER );
+ aProps[4].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ));
aProps[4].Value = aSubMenu;
return aProps;
@@ -82,19 +83,19 @@ uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateToolbarItem
{
uno::Sequence< beans::PropertyValue > aProps(7);
- aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL );
+ aProps[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ));
aProps[0].Value <<= sCommandURL;
- aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL );
+ aProps[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ));
aProps[1].Value <<= sHelpURL;
- aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL );
+ aProps[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ));
aProps[2].Value <<= sLabel;
- aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE );
+ aProps[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ));
aProps[3].Value <<= nType;
- aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER );
+ aProps[4].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ));
aProps[4].Value = aSubMenu;
- aProps[5].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE );
+ aProps[5].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_ISVISIBLE ));
aProps[5].Value <<= isVisible;
- aProps[6].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_STYLE );
+ aProps[6].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_STYLE ));
aProps[6].Value <<= nStyle;
return aProps;
@@ -121,7 +122,7 @@ ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource )
uno::Sequence< beans::PropertyValue > aProps;
m_xIndexAccess->getByIndex( nPosition ) >>= aProps;
uno::Reference< container::XIndexAccess > xSubMenu;
- getPropertyValue( aProps, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu;
+ getPropertyValue( aProps, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )) ) >>= xSubMenu;
ScVbaCommandBarControl* pNewCommandBarControl = NULL;
if( xSubMenu.is() )
pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu );
@@ -160,8 +161,8 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un
{
// Parameter is not supported
// the following name needs to be individually created;
- rtl::OUString sLabel( rtl::OUString::createFromAscii("Custom") );
- rtl::OUString sCommandUrl = rtl::OUString::createFromAscii( CUSTOM_MENU_STR ) + sLabel;
+ rtl::OUString sLabel(RTL_CONSTASCII_USTRINGPARAM("Custom"));
+ rtl::OUString sCommandUrl(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CUSTOM_MENU_STR)) + sLabel);
sal_Int32 nType = office::MsoControlType::msoControlButton;
sal_Int32 nPosition = 0;
sal_Bool bTemporary = sal_True;
@@ -318,3 +319,5 @@ uno::Sequence<rtl::OUString> VbaDummyCommandBarControls::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
index 08c5f57b7f..b62b18e44b 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -85,3 +86,5 @@ public:
};
#endif//SC_VBA_COMMANDBARCONTROLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
index 9b73bb6f59..a78ed0cc37 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,7 +41,7 @@
using namespace com::sun::star;
using namespace ooo::vba;
-#define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
+#define CREATEOUSTRING(asciistr) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(asciistr))
typedef std::map< rtl::OUString, rtl::OUString > MSO2OOCommandbarMap;
@@ -80,7 +81,7 @@ public:
rtl::OUString findBuildinToolbar( const rtl::OUString& sToolbarName )
{
MSO2OOCommandbarMap::iterator it = maBuildinToolbarMap.begin();
- for(; it != maBuildinToolbarMap.end(); it++ )
+ for(; it != maBuildinToolbarMap.end(); ++it )
{
rtl::OUString sName = it->first;
if( sName.equalsIgnoreAsciiCase( sToolbarName ) )
@@ -184,7 +185,7 @@ uno::Reference< frame::XLayoutManager > VbaCommandBarHelper::getLayoutManager()
{
uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW );
- uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW );
return xLayoutManager;
}
@@ -194,7 +195,7 @@ sal_Bool VbaCommandBarHelper::hasToolbar( const rtl::OUString& sResourceUrl, con
{
rtl::OUString sUIName;
uno::Reference< beans::XPropertySet > xPropertySet( m_xDocCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW );
- xPropertySet->getPropertyValue( rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_UINAME) ) >>= sUIName;
+ xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ITEM_DESCRIPTOR_UINAME)) ) >>= sUIName;
if( sName.equalsIgnoreAsciiCase( sUIName ) )
return sal_True;
}
@@ -215,7 +216,7 @@ rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference<
for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
{
sResourceUrl = allNames[i];
- if(sResourceUrl.indexOf( rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ) ) == 0 )
+ if(sResourceUrl.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_TOOLBAR_URL )) ) == 0 )
{
if( hasToolbar( sResourceUrl, sName ) )
return sResourceUrl;
@@ -240,7 +241,7 @@ sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css
{
rtl::OUString sLabel;
xIndexAccess->getByIndex( i ) >>= aProps;
- getPropertyValue( aProps, rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_LABEL) ) >>= sLabel;
+ getPropertyValue( aProps, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ITEM_DESCRIPTOR_LABEL)) ) >>= sLabel;
// handle the hotkey marker '~' (remove in toolbars (?), replace by '&' in menus)
::rtl::OUStringBuffer aBuffer;
sal_Int32 index = sLabel.indexOf( sal_Unicode('~') );
@@ -267,11 +268,13 @@ sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css
rtl::OUString VbaCommandBarHelper::generateCustomURL()
{
- rtl::OUString url = rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL );
- url += rtl::OUString::createFromAscii( CUSTOM_TOOLBAR_STR );
+ rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( ITEM_TOOLBAR_URL ));
+ url += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CUSTOM_TOOLBAR_STR ));
// use a random number to minimize possible clash with existing custom toolbars
srand( unsigned( time( NULL ) ));
url += rtl::OUString::valueOf( sal_Int64( rand() ), 16 );
return url;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
index 2643656f7b..e494c8787b 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -100,3 +101,5 @@ public:
};
#endif //VBA_COMMANDBARHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx
index db077be164..cc1cbb2284 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -67,7 +68,7 @@ public:
if( hasMoreElements() )
{
rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] );
- if( sResourceUrl.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
+ if( sResourceUrl.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/")) ) != -1 )
{
uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl );
uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, m_pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) );
@@ -122,7 +123,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Worksheet Menu Bar") ) )
{
// spreadsheet menu bar
- sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL );
+ sResourceUrl = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ));
bMenu = sal_True;
}
else if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Cell") ) )
@@ -136,7 +137,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Menu Bar") ) )
{
// text processor menu bar
- sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL );
+ sResourceUrl = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ));
bMenu = sal_True;
}
}
@@ -202,7 +203,7 @@ ScVbaCommandBars::getCount() throw(css::uno::RuntimeException)
uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
{
- if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
+ if(allNames[i].indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/")) ) != -1 )
{
nCount++;
}
@@ -225,10 +226,10 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th
if( nIndex == 1 )
{
uno::Any aSource;
- if( m_pCBarHelper->getModuleId().equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ) )
- aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
- else if( m_pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") )
- aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
+ if( m_pCBarHelper->getModuleId().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) )
+ aSource <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Worksheet Menu Bar"));
+ else if( m_pCBarHelper->getModuleId().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")) )
+ aSource <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Menu Bar"));
if( aSource.hasValue() )
return createCollectionObject( aSource );
}
@@ -254,3 +255,4 @@ ScVbaCommandBars::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbacommandbars.hxx b/vbahelper/source/vbahelper/vbacommandbars.hxx
index 5709fd354e..27af1dbd10 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,5 @@ public:
};
#endif//SC_VBA_COMMANDBARS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbadialogsbase.cxx b/vbahelper/source/vbahelper/vbadialogsbase.cxx
index f595d9e991..e60d3f5be5 100644
--- a/vbahelper/source/vbahelper/vbadialogsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadialogsbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,3 +43,4 @@ VbaDialogsBase::Item( const uno::Any& /* &aItem */) throw (uno::RuntimeException
return uno::Any();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index caa2a37db2..7499643b4d 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,6 +37,7 @@
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -197,7 +199,7 @@ VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeExcepti
xProt->protect( rtl::OUString() );
}
-void
+void
VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException)
{
rtl::OUString rPassword;
@@ -214,8 +216,8 @@ VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeExcep
xProt->unprotect( rtl::OUString() );
}
}
-
-void
+
+void
VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
{
uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
@@ -297,3 +299,4 @@ VbaDocumentBase::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index 911cfdef40..4e3133b351 100644
--- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,6 +36,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/frame/XStorable.hpp>
@@ -50,14 +52,15 @@
#include <sfx2/objsh.hxx>
#include <tools/urlobj.hxx>
#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbadocumentbase.hxx>
#include <hash_map>
#include <osl/file.hxx>
using namespace ::ooo::vba;
using namespace ::com::sun::star;
-static const rtl::OUString sSpreadsheetDocument( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) );
-static const rtl::OUString sTextDocument( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) );
+static const rtl::OUString sSpreadsheetDocument( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") );
+static const rtl::OUString sTextDocument( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument") );
typedef std::hash_map< rtl::OUString,
sal_Int32, ::rtl::OUStringHash,
@@ -87,7 +90,7 @@ public:
m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
uno::Reference< frame::XDesktop > xDesktop
- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW );
+ (xSMgr->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), m_xContext), uno::UNO_QUERY_THROW );
uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration();
while( mxComponents->hasMoreElements() )
{
@@ -220,7 +223,7 @@ uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException)
uno::Reference< frame::XComponentLoader > xLoader(
xSMgr->createInstanceWithContext(
- ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")),
mxContext), uno::UNO_QUERY_THROW );
rtl::OUString sURL;
if( meDocType == WORD_DOCUMENT )
@@ -238,7 +241,7 @@ uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException)
// craete the new document
uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL(
sURL ,
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0,
aMediaDesc.getAsConstPropertyValueList() );
return uno::makeAny( xComponent );
}
@@ -271,11 +274,11 @@ uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const u
uno::Reference< lang::XMultiComponentFactory > xSMgr(
mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
uno::Reference< frame::XDesktop > xDesktop
- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , mxContext),
+ (xSMgr->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) , mxContext),
uno::UNO_QUERY_THROW );
uno::Reference< frame::XComponentLoader > xLoader(
xSMgr->createInstanceWithContext(
- ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")),
mxContext),
uno::UNO_QUERY_THROW );
@@ -305,3 +308,4 @@ uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const u
return uno::makeAny( xComponent );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
index 86ae20a735..3844e603d9 100755
--- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -74,6 +75,10 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
EventQueue aEventQueue;
aEventQueue.push_back( EventQueueEntry( nEventId, rArgs ) );
+ /* bEnabled will track if event processing is enabled. Every event handler
+ may disable handling of other events. */
+ bool bEnabled = true;
+
/* bCancel will contain the current Cancel value. It is possible that
multiple events will try to modify the Cancel value. Every event
handler receives the Cancel value of the previous event handler. */
@@ -83,10 +88,10 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
executed successfully. */
bool bSuccess = false;
- /* Loop as long as there are more events to be processed. Derived classes
- may add new events to be processed in the virtual implPrepareEvent()
- function. */
- while( !aEventQueue.empty() )
+ /* Loop as long as there are more events to be processed, and as event
+ handling is still enabled. Derived classes may add new events to be
+ processed in the virtual implPrepareEvent() function. */
+ while( bEnabled && !aEventQueue.empty() )
{
/* Check that all class members are available, and that we are not
disposed (this may have happened at any time during execution of
@@ -99,14 +104,14 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs;
aEventQueue.pop_front();
- /* Let derived classes prepare the event, they may add new events for
- next iteration. If false is returned, the event handler must not be
- called. */
- bool bEventSuccess = false;
- if( implPrepareEvent( aEventQueue, rInfo, aEventArgs ) )
+ // let derived classes decide whether event processing is still enabled
+ bEnabled = implEventsEnabled();
+ // let derived classes prepare the event, they may add new events for next iteration
+ if( bEnabled && implPrepareEvent( aEventQueue, rInfo, aEventArgs ) )
{
// search the event handler macro in the document
::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
+ bool bEventSuccess = false;
if( aMacroPath.getLength() > 0 )
{
// build the argument list
@@ -135,11 +140,11 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
bCancel = nNewCancel != 0;
}
}
+ // post processing (also, if event handler does not exist, or on error
+ implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel );
// global success, if at least one event handler succeeded
bSuccess |= bEventSuccess;
}
- // post processing (also, if event handler does not exist, or disabled, or on error
- implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel );
}
// if event handlers want to cancel the event, do so regardless of any errors
@@ -213,3 +218,5 @@ void VbaEventsHelperBase::stopListening()
}
// ============================================================================
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbafillformat.cxx b/vbahelper/source/vbahelper/vbafillformat.cxx
index db2ceba788..23a6e469dd 100644
--- a/vbahelper/source/vbahelper/vbafillformat.cxx
+++ b/vbahelper/source/vbahelper/vbafillformat.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -49,7 +50,7 @@ ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::Runti
m_nFillStyle = nFillStyle;
if( m_nFillStyle == drawing::FillStyle_GRADIENT )
{
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny( drawing::FillStyle_GRADIENT ) );
awt::Gradient aGradient;
// AXIAL
// RADIAL
@@ -66,11 +67,11 @@ ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::Runti
aGradient.StartIntensity = 100;
aGradient.EndIntensity = 100;
aGradient.StepCount = 1;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), uno::makeAny( aGradient ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillGradient")), uno::makeAny( aGradient ) );
}
else if( m_nFillStyle == drawing::FillStyle_SOLID )
{
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny(drawing::FillStyle_SOLID) );
}
}
@@ -86,7 +87,7 @@ sal_Bool SAL_CALL
ScVbaFillFormat::getVisible() throw (uno::RuntimeException)
{
drawing::FillStyle nFillStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= nFillStyle;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")) ) >>= nFillStyle;
if( nFillStyle == drawing::FillStyle_NONE )
return sal_False;
return sal_True;
@@ -96,10 +97,10 @@ void SAL_CALL
ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
{
drawing::FillStyle aFillStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= aFillStyle;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")) ) >>= aFillStyle;
if( !_visible )
{
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny( drawing::FillStyle_NONE ) );
}
else
{
@@ -115,7 +116,7 @@ ScVbaFillFormat::getTransparency() throw (uno::RuntimeException)
{
sal_Int16 nTransparence = 0;
double dTransparence = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ) ) >>= nTransparence;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillTransparence")) ) >>= nTransparence;
dTransparence = static_cast<double>( nTransparence );
dTransparence /= 100;
return dTransparence;
@@ -125,7 +126,7 @@ void SAL_CALL
ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException)
{
sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ), uno::makeAny( nTransparence ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillTransparence")), uno::makeAny( nTransparence ) );
}
@@ -197,3 +198,4 @@ ScVbaFillFormat::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbafillformat.hxx b/vbahelper/source/vbahelper/vbafillformat.hxx
index cff28053b6..c2db69f525 100644
--- a/vbahelper/source/vbahelper/vbafillformat.hxx
+++ b/vbahelper/source/vbahelper/vbafillformat.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -69,3 +70,5 @@ public:
};
#endif//SC_VBA_XFILLFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx
index 9b931a5462..e807a1842c 100644
--- a/vbahelper/source/vbahelper/vbafontbase.cxx
+++ b/vbahelper/source/vbahelper/vbafontbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -337,3 +338,4 @@ VbaFontBase::getUnderline() throw ( uno::RuntimeException )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx
index 0388d145f2..fd85d99a95 100644
--- a/vbahelper/source/vbahelper/vbaglobalbase.cxx
+++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -25,6 +26,7 @@
*
************************************************************************/
#include "vbahelper/vbaglobalbase.hxx"
+#include <sal/macros.h>
#include <cppuhelper/component_context.hxx>
#include <comphelper/processfactory.hxx>
@@ -59,7 +61,7 @@ const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& s
};
// don't pass a delegate, this seems to introduce yet another cyclic dependency ( and
// some strange behavior
- mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), NULL );
+ mxContext = ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), NULL );
}
VbaGlobalsBase::~VbaGlobalsBase()
@@ -136,7 +138,7 @@ VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException)
// common
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ),
};
- static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) );
+ static uno::Sequence< rtl::OUString > serviceNames( names, SAL_N_ELEMENTS( names ) );
return serviceNames;
}
@@ -154,3 +156,4 @@ VbaGlobalsBase::hasServiceName( const rtl::OUString& serviceName )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 542667b37e..05e35b300b 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -1,7 +1,8 @@
+/* -*- 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 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -32,6 +33,7 @@
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel2.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -76,7 +78,7 @@
#ifndef OOVBA_DLLIMPLEMENTATION
#define OOVBA_DLLIMPLEMENTATION
-#endif
+#endif
#include <vbahelper/vbahelper.hxx>
#include <sfx2/app.hxx>
@@ -120,158 +122,6 @@ nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
}
return false;
}
-#if 0
-namespace excel // all in this namespace probably can be moved to sc
-{
-
-
-const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
-class PasteCellsWarningReseter
-{
-private:
- bool bInitialWarningState;
- static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
- {
- static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
- static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
- xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
- return xProps;
- }
-
- bool getReplaceCellsWarning() throw ( uno::RuntimeException )
- {
- sal_Bool res = sal_False;
- getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
- return ( res == sal_True );
- }
-
- void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
- {
- getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
- }
-public:
- PasteCellsWarningReseter() throw ( uno::RuntimeException )
- {
- bInitialWarningState = getReplaceCellsWarning();
- if ( bInitialWarningState )
- setReplaceCellsWarning( false );
- }
- ~PasteCellsWarningReseter()
- {
- if ( bInitialWarningState )
- {
- // don't allow dtor to throw
- try
- {
- setReplaceCellsWarning( true );
- }
- catch ( uno::Exception& /*e*/ ){}
- }
- }
-};
-
-void
-implnPaste()
-{
- PasteCellsWarningReseter resetWarningBox;
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- {
- pViewShell->PasteFromSystem();
- pViewShell->CellContentChanged();
- }
-}
-
-
-void
-implnCopy()
-{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- pViewShell->CopyToClip(NULL,false,false,true);
-}
-
-void
-implnCut()
-{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- pViewShell->CutToClip( NULL, TRUE );
-}
-void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
-{
- PasteCellsWarningReseter resetWarningBox;
- sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
- InsCellCmd eMoveMode = INS_NONE;
-
- if ( !pTabViewShell )
- // none active, try next best
- pTabViewShell = getCurrentBestViewShell();
- if ( pTabViewShell )
- {
- ScViewData* pView = pTabViewShell->GetViewData();
- Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
- if ( pView && pWin )
- {
- if ( bAsLink && bOtherDoc )
- pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
- else
- {
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
- ScDocument* pDoc = NULL;
- if ( pOwnClip )
- pDoc = pOwnClip->GetDocument();
- pTabViewShell->PasteFromClip( nFlags, pDoc,
- nFunction, bSkipEmpty, bTranspose, bAsLink,
- eMoveMode, IDF_NONE, TRUE );
- pTabViewShell->CellContentChanged();
- }
- }
- }
-
-}
-
-ScDocShell*
-getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
-{
- uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
- ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
- ScDocShell* pDocShell = NULL;
- if ( pModel )
- pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
- return pDocShell;
-
-}
-
-ScTabViewShell*
-getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
-{
- ScDocShell* pDocShell = getDocShell( xModel );
- if ( pDocShell )
- return pDocShell->GetBestViewShell();
- return NULL;
-}
-
-ScTabViewShell*
-getCurrentBestViewShell()
-{
- uno::Reference< frame::XModel > xModel = getCurrentDocument();
- return getBestViewShell( xModel );
-}
-
-SfxViewFrame*
-getCurrentViewFrame()
-{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
- if ( pViewShell )
- return pViewShell->GetViewFrame();
- return NULL;
-}
-};
-
-#endif
uno::Reference< beans::XIntrospectionAccess >
getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
@@ -280,7 +130,7 @@ getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
if( !xIntrospection.is() )
{
uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
+ xIntrospection.set( xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")) ), uno::UNO_QUERY_THROW );
}
return xIntrospection->inspect( aObject );
}
@@ -310,11 +160,11 @@ void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
{
pDispatcher->Execute( nSlot , nCall );
}
- }
+ }
}
-
+
void
-dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUString& aUrl, const uno::Sequence< beans::PropertyValue >& sProps )
+dispatchRequests (const uno::Reference< frame::XModel>& xModel, const rtl::OUString & aUrl, const uno::Sequence< beans::PropertyValue >& sProps, const uno::Reference< frame::XDispatchResultListener >& rListener, const sal_Bool bSilent )
{
util::URL url;
url.Complete = aUrl;
@@ -346,6 +196,7 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr
}
uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
+ uno::Reference< frame::XNotifyingDispatch > xNotifyingDispatcher( xDispatcher, uno::UNO_QUERY );
uno::Sequence<beans::PropertyValue> dispatchProps(1);
@@ -361,11 +212,20 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr
*pDest = *pSrc;
}
+ if ( bSilent )
+ {
(*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
(*pDest).Value <<= (sal_Bool)sal_True;
+ }
- if (xDispatcher.is())
+ if ( !rListener.is() && xDispatcher.is() )
+ {
xDispatcher->dispatch( url, dispatchProps );
+ }
+ else if ( rListener.is() && xNotifyingDispatcher.is() )
+ {
+ xNotifyingDispatcher->dispatchWithNotification( url, dispatchProps, rListener );
+ }
}
void
@@ -701,7 +561,7 @@ rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeEx
break;
}
default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid type, can't convert")), uno::Reference< uno::XInterface >() );
}
return sString;
}
@@ -962,6 +822,23 @@ 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 rtl::OUString& aName )
{
uno::Any result;
@@ -989,6 +866,18 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r
return sal_False;
}
+void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
+{
+ if( setPropertyValue( aProp, aName, aValue ) )
+ return;
+
+ // append the property
+ sal_Int32 nLength = aProp.getLength();
+ aProp.realloc( nLength + 1 );
+ aProp[ nLength ].Name = aName;
+ aProp[ nLength ].Value = aValue;
+}
+
// ====UserFormGeomentryHelper====
//---------------------------------------------
UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
@@ -1103,9 +992,9 @@ void UserFormGeometryHelper::setHeight( double nHeight )
if ( nHeight < nDecor - nUnDecor )
nUnDecor = nDecor - nHeight; // avoid negative size
nNewHeight = nHeight + nUnDecor - nDecor;
- }
}
}
+ }
mxWindow->setPosSize( 0, 0, 0, nNewHeight, awt::PosSize::HEIGHT );
}
@@ -1148,11 +1037,11 @@ void UserFormGeometryHelper::setHeight( double nHeight )
ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
- {
- if( !xShape.is() )
- throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() );
+ {
+ if( !xShape.is() )
+ throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No valid shape for helper")), css::uno::Reference< css::uno::XInterface >() );
}
-
+
double ShapeHelper::getHeight()
{
return Millimeter::getInPoints(xShape->getSize().Height);
@@ -1172,10 +1061,10 @@ void UserFormGeometryHelper::setHeight( double nHeight )
throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
}
}
-
-
+
+
double ShapeHelper::getWidth()
- {
+ {
return Millimeter::getInPoints(xShape->getSize().Width);
}
@@ -1192,39 +1081,39 @@ void UserFormGeometryHelper::setHeight( double nHeight )
throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
}
}
-
-
+
+
double ShapeHelper::getLeft()
{
return Millimeter::getInPoints(xShape->getPosition().X);
}
-
+
void ShapeHelper::setLeft(double _fLeft)
{
css::awt::Point aPoint = xShape->getPosition();
aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
xShape->setPosition(aPoint);
}
-
+
double ShapeHelper::getTop()
{
return Millimeter::getInPoints(xShape->getPosition().Y);
}
-
+
void ShapeHelper::setTop(double _fTop)
{
css::awt::Point aPoint = xShape->getPosition();
aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
xShape->setPosition(aPoint);
}
-
+
void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
{
// #TODO #FIXME ( do we want to support additionalArg here )
- throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
+ throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
}
void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
@@ -1237,20 +1126,20 @@ void UserFormGeometryHelper::setHeight( double nHeight )
}
Millimeter::Millimeter():m_nMillimeter(0) {}
-
+
Millimeter::Millimeter(double mm):m_nMillimeter(mm) {}
-
+
void Millimeter::set(double mm) { m_nMillimeter = mm; }
- void Millimeter::setInPoints(double points)
- {
+ void Millimeter::setInPoints(double points)
+ {
m_nMillimeter = points * factor / 100.0;
}
-
+
void Millimeter::setInHundredthsOfOneMillimeter(double hmm)
{
m_nMillimeter = hmm / 100;
}
-
+
double Millimeter::get()
{
return m_nMillimeter;
@@ -1262,14 +1151,14 @@ void UserFormGeometryHelper::setHeight( double nHeight )
double Millimeter::getInPoints()
{
return m_nMillimeter / factor * 100.0;
- }
+ }
sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points)
{
sal_Int32 mm = static_cast<sal_Int32>(points * factor);
return mm;
}
-
+
double Millimeter::getInPoints(int _hmm)
{
double points = double( static_cast<double>(_hmm) / factor);
@@ -1292,10 +1181,32 @@ void UserFormGeometryHelper::setHeight( double nHeight )
if ( pMod )
xIf = pMod->GetUnoModule();
}
- }
+ }
return xIf;
}
+ // Listener for XNotifyingDispatch
+ VBADispatchListener::VBADispatchListener() : m_State( sal_False )
+ {
+ }
+
+ // Listener for XNotifyingDispatch
+ VBADispatchListener::~VBADispatchListener()
+ {
+ }
+
+ // Listener for XNotifyingDispatch
+ void SAL_CALL VBADispatchListener::dispatchFinished( const frame::DispatchResultEvent& aEvent ) throw ( uno::RuntimeException )
+ {
+ m_Result = aEvent.Result;
+ m_State = ( aEvent.State == frame::DispatchResultState::SUCCESS ) ? sal_True : sal_False;
+ }
+
+ // Listener for XNotifyingDispatch
+ void SAL_CALL VBADispatchListener::disposing( const lang::EventObject& /*aEvent*/ ) throw( uno::RuntimeException )
+ {
+ }
+
SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
{
SfxObjectShell* pFoundShell = NULL;
@@ -1311,3 +1222,5 @@ void UserFormGeometryHelper::setHeight( double nHeight )
} // openoffice
} //org
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx b/vbahelper/source/vbahelper/vbalineformat.cxx
index 6ca952fd59..06787b0a9c 100644
--- a/vbahelper/source/vbahelper/vbalineformat.cxx
+++ b/vbahelper/source/vbahelper/vbalineformat.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,39 +54,39 @@ sal_Int32
ScVbaLineFormat::convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName )
{
sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone;
- if (sLineName.equals(rtl::OUString::createFromAscii("Small Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowEnd")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Double Arrow")))
+ if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Small Arrow"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowEnd"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Double Arrow"))))
{
// msoArrowheadTriangle
nLineType = office::MsoArrowheadStyle::msoArrowheadTriangle;
}
- else if (sLineName.equals(rtl::OUString::createFromAscii("Square 45")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Square")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowDiamondEnd")))
+ else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Square 45"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Square"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowDiamondEnd"))))
{
// msoArrowheadDiamond
nLineType = office::MsoArrowheadStyle::msoArrowheadDiamond;
}
- else if (sLineName.equals(rtl::OUString::createFromAscii("Circle")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowOvalEnd")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Dimension Lines")) )
+ else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Circle"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowOvalEnd"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dimension Lines"))) )
{
// msoArrowheadOval
nLineType = office::MsoArrowheadStyle::msoArrowheadOval;
}
- else if (sLineName.equals(rtl::OUString::createFromAscii("Arrow concave")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowStealthEnd")))
+ else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow concave"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowStealthEnd"))))
{
// msoArrowheadStealth
nLineType = office::MsoArrowheadStyle::msoArrowheadStealth;
}
- else if (sLineName.equals(rtl::OUString::createFromAscii("Rounded short Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Rounded large Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Symmetric Arrow")) ||
- sLineName.equals(rtl::OUString::createFromAscii("msArrowOpenEnd")) ||
- sLineName.equals(rtl::OUString::createFromAscii("Line Arrow")))
+ else if (sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rounded short Arrow"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rounded large Arrow"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Symmetric Arrow"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArrowOpenEnd"))) ||
+ sLineName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line Arrow"))))
{
// msoArrowheadOpen
nLineType = office::MsoArrowheadStyle::msoArrowheadOpen;
@@ -104,19 +105,19 @@ ScVbaLineFormat::convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadSt
switch( nArrowheadStyle )
{
case office::MsoArrowheadStyle::msoArrowheadNone:
- return rtl::OUString(rtl::OUString::createFromAscii( "" ) );
+ return rtl::OUString();
case office::MsoArrowheadStyle::msoArrowheadStealth:
- return rtl::OUString::createFromAscii( "Arrow concave" );
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow concave"));
case office::MsoArrowheadStyle::msoArrowheadOpen:
- return rtl::OUString::createFromAscii("Line Arrow" );
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line Arrow"));
case office::MsoArrowheadStyle::msoArrowheadOval:
- return rtl::OUString::createFromAscii("Circle" );
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Circle"));
case office::MsoArrowheadStyle::msoArrowheadDiamond:
- return rtl::OUString::createFromAscii( "Square 45" );
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Square 45"));
case office::MsoArrowheadStyle::msoArrowheadTriangle:
- return rtl::OUString::createFromAscii( "Arrow" );
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Arrow"));
default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Invalid Arrow Style!"), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid Arrow Style!")), uno::Reference< uno::XInterface >() );
}
}
@@ -126,10 +127,10 @@ ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException)
{
sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone;
rtl::OUString sLineName;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ) ) >>= sLineName;
- if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString::createFromAscii( "msArray" ) ) ) != -1 )
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStartName")) ) >>= sLineName;
+ if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("msArray")) ) ) != -1 )
{
- sal_Int32 nIndex = sLineName.indexOf( rtl::OUString::createFromAscii(" ") );
+ sal_Int32 nIndex = sLineName.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) );
rtl::OUString sName = sLineName.copy( 0, nIndex );
//sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32();
nLineType = convertLineStartEndNameToArrowheadStyle( sName );
@@ -145,31 +146,31 @@ void SAL_CALL
ScVbaLineFormat::setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (uno::RuntimeException)
{
rtl::OUString sArrayName = convertArrowheadStyleToLineStartEndName( _beginarrowheadstyle );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ), uno::makeAny( sArrayName ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStartName")), uno::makeAny( sArrayName ) );
}
sal_Int32 SAL_CALL
ScVbaLineFormat::getBeginArrowheadLength() throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
void SAL_CALL
ScVbaLineFormat::setBeginArrowheadLength( sal_Int32 /*_beginarrowheadlength*/ ) throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
sal_Int32 SAL_CALL
ScVbaLineFormat::getBeginArrowheadWidth() throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
void SAL_CALL
ScVbaLineFormat::setBeginArrowheadWidth( sal_Int32 /*_beginarrowheadwidth*/ ) throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
sal_Int32 SAL_CALL
@@ -186,32 +187,32 @@ ScVbaLineFormat::setEndArrowheadStylel( sal_Int32 /*_endarrowheadstylel*/ ) thro
sal_Int32 SAL_CALL
ScVbaLineFormat::getEndArrowheadLength() throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
void SAL_CALL
ScVbaLineFormat::setEndArrowheadLength( sal_Int32 /*_endarrowheadlength*/ ) throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
sal_Int32 SAL_CALL
ScVbaLineFormat::getEndArrowheadWidth() throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
void SAL_CALL
ScVbaLineFormat::setEndArrowheadWidth( sal_Int32 /*_endarrowheadwidth*/ ) throw (uno::RuntimeException)
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property 'EndArrowheadWidth' is not supported.")), uno::Reference< uno::XInterface >() );
}
double SAL_CALL
ScVbaLineFormat::getWeight() throw (uno::RuntimeException)
{
sal_Int32 nLineWidth=0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineWidth") ) >>= nLineWidth;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineWidth")) ) >>= nLineWidth;
double dLineWidth = Millimeter::getInPoints( nLineWidth );
return dLineWidth;
}
@@ -220,7 +221,7 @@ void SAL_CALL
ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException)
{
if( _weight < 0 )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter: Must be positv."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parameter: Must be positive.")), uno::Reference< uno::XInterface >() );
if( _weight == 0 )
_weight = 0.5;
m_nLineWeight = _weight;
@@ -228,7 +229,7 @@ ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException)
aMillimeter.setInPoints( _weight );
sal_Int32 nLineWidth = static_cast<sal_Int32>( aMillimeter.getInHundredthsOfOneMillimeter() );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineWidth" ), uno::makeAny( nLineWidth ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineWidth")), uno::makeAny( nLineWidth ) );
setDashStyle( m_nLineDashStyle );
}
@@ -236,7 +237,7 @@ sal_Bool SAL_CALL
ScVbaLineFormat::getVisible() throw (uno::RuntimeException)
{
drawing::LineStyle aLineStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")) ) >>= aLineStyle;
if( aLineStyle == drawing::LineStyle_NONE )
{
return sal_False;
@@ -248,11 +249,11 @@ void SAL_CALL
ScVbaLineFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException)
{
drawing::LineStyle aLineStyle;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")) ) >>= aLineStyle;
if( !_visible )
{
aLineStyle = drawing::LineStyle_NONE;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( aLineStyle ) );
}
else
{
@@ -267,7 +268,7 @@ double SAL_CALL
ScVbaLineFormat::getTransparency() throw (uno::RuntimeException)
{
sal_Int16 nTransparency = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ) ) >>= nTransparency;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineTransparence")) ) >>= nTransparency;
double fTransparency = static_cast<double>( nTransparency );
return fTransparency / 100;
}
@@ -276,7 +277,7 @@ void SAL_CALL
ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException)
{
sal_Int16 nTransparency = static_cast<sal_Int16>( _transparency * 100 );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ), uno::makeAny( nTransparency ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineTransparence")), uno::makeAny( nTransparency ) );
}
sal_Int16 SAL_CALL
@@ -301,13 +302,13 @@ ScVbaLineFormat::getDashStyle() throw (uno::RuntimeException)
{
drawing::LineStyle eLineStyle;
//LineStyle integer in Xray
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= eLineStyle;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")) ) >>= eLineStyle;
if( eLineStyle == drawing::LineStyle_SOLID )
m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid;
else
{
drawing::LineDash aLineDash;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineDash" ) ) >>= aLineDash;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineDash")) ) >>= aLineDash;
if( aLineDash.Dots == 0 )
{
//LineDash
@@ -353,11 +354,11 @@ ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeExcepti
m_nLineDashStyle = _dashstyle;
if( _dashstyle == office::MsoLineDashStyle::msoLineSolid )
{
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ));
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( drawing::LineStyle_SOLID ));
}
else
{
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_DASH ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( drawing::LineStyle_DASH ) );
drawing::LineDash pLineDash;
Millimeter aMillimeter( m_nLineWeight );
sal_Int32 nPixel = static_cast< sal_Int32 >( aMillimeter.getInHundredthsOfOneMillimeter() );
@@ -413,9 +414,9 @@ ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeExcepti
pLineDash.Distance = nPixel;
break;
default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii("this MsoLineDashStyle is not supported."), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this MsoLineDashStyle is not supported.")), uno::Reference< uno::XInterface >() );
}
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineDash" ), uno::makeAny( pLineDash ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineDash")), uno::makeAny( pLineDash ) );
}
}
@@ -453,3 +454,4 @@ ScVbaLineFormat::getServiceNames()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbalineformat.hxx b/vbahelper/source/vbahelper/vbalineformat.hxx
index 948a7d368f..9a96ceaa85 100644
--- a/vbahelper/source/vbahelper/vbalineformat.hxx
+++ b/vbahelper/source/vbahelper/vbalineformat.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -80,3 +81,5 @@ public:
};
#endif//SC_VBA_XLINEFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbapagesetupbase.cxx b/vbahelper/source/vbahelper/vbapagesetupbase.cxx
index ff48f47464..7b509f9288 100644
--- a/vbahelper/source/vbahelper/vbapagesetupbase.cxx
+++ b/vbahelper/source/vbahelper/vbapagesetupbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -320,3 +321,4 @@ void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (c
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx
index bcdf83a88c..34d3cf736d 100644
--- a/vbahelper/source/vbahelper/vbapictureformat.cxx
+++ b/vbahelper/source/vbahelper/vbapictureformat.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,11 +43,11 @@ ScVbaPictureFormat::checkParameterRangeInDouble( double nRange, double nMin, dou
{
if( nRange < nMin )
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too small.") , uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parameter out of range, value is too small.")) , uno::Reference< uno::XInterface >() );
}
if( nRange > nMax )
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too high.") , uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parameter out of range, value is too high.")) , uno::Reference< uno::XInterface >() );
}
}
@@ -55,7 +56,7 @@ double SAL_CALL
ScVbaPictureFormat::getBrightness() throw (uno::RuntimeException)
{
sal_Int16 nLuminance = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance") ) >>= nLuminance;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustLuminance")) ) >>= nLuminance;
double fBrightness = static_cast< double >( nLuminance );
fBrightness = ( fBrightness +100 ) / 200;
return fBrightness;
@@ -67,14 +68,14 @@ ScVbaPictureFormat::setBrightness( double _brightness ) throw (uno::RuntimeExcep
checkParameterRangeInDouble( _brightness, 0.0, 1.0 );
double fLuminance = _brightness * 200 - 100;
sal_Int16 nLuminance = static_cast< sal_Int16 >( fLuminance );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance"), uno::makeAny( nLuminance ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustLuminance")), uno::makeAny( nLuminance ) );
}
double SAL_CALL
ScVbaPictureFormat::getContrast() throw (uno::RuntimeException)
{
sal_Int16 nContrast = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustContrast") ) >>= nContrast;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustContrast")) ) >>= nContrast;
double fContrast = static_cast< double >( nContrast );
fContrast = ( fContrast + 100 ) / 200;
return fContrast;
@@ -86,7 +87,7 @@ ScVbaPictureFormat::setContrast( double _contrast ) throw (uno::RuntimeException
checkParameterRangeInDouble( _contrast, 0.0, 1.0 );
double fContrast = _contrast * 200 - 100;
sal_Int16 nContrast = static_cast< sal_Int16 >( fContrast );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustContrast"), uno::makeAny( nContrast ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustContrast")), uno::makeAny( nContrast ) );
}
@@ -112,13 +113,14 @@ ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeExc
{
double nContrast = getContrast();
nContrast += increment;
- if( increment < 0 )
+ //VBA, minz@cn.ibm.com.
+ if( nContrast < 0 )
{
- increment = 0.0;
+ nContrast = 0.0;
}
- if( increment > 1 )
+ if( nContrast > 1 )
{
- increment = 1.0;
+ nContrast = 1.0;
}
setContrast( nContrast );
}
@@ -142,3 +144,5 @@ ScVbaPictureFormat::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbapictureformat.hxx b/vbahelper/source/vbahelper/vbapictureformat.hxx
index 49245869ad..d11d8aecee 100644
--- a/vbahelper/source/vbahelper/vbapictureformat.hxx
+++ b/vbahelper/source/vbahelper/vbapictureformat.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -59,3 +60,5 @@ public:
};
#endif//SC_VBA_PICTUREFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/inc/vbahelper/vbadllapi.h b/vbahelper/source/vbahelper/vbapropvalue.cxx
index dfdf6ae6fd..e75a7a45dd 100644
--- a/vbahelper/inc/vbahelper/vbadllapi.h
+++ b/vbahelper/source/vbahelper/vbapropvalue.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,18 +25,24 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+#include "vbahelper/vbapropvalue.hxx"
-#ifndef INCLUDED_VBADLLAPI_H
-#define INCLUDED_VBADLLAPI_H
+using namespace com::sun::star;
+
+ScVbaPropValue::ScVbaPropValue( PropListener* pListener ) : m_pListener( pListener )
+{
+}
-#include "sal/types.h"
+css::uno::Any SAL_CALL
+ScVbaPropValue::getValue() throw (css::uno::RuntimeException)
+{
+ return m_pListener->getValueEvent();
+}
-#if defined(VBAHELPER_DLLIMPLEMENTATION)
-#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
-#else
-#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
-#endif
-#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE
-
-#endif /* INCLUDED_SVLDLLAPI_H */
+void SAL_CALL
+ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException)
+{
+ m_pListener->setValueEvent( _value );
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx
index e0ec739f23..ca368e4471 100644
--- a/vbahelper/source/vbahelper/vbashape.cxx
+++ b/vbahelper/source/vbahelper/vbashape.cxx
@@ -1,7 +1,8 @@
+/* -*- 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 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -35,11 +36,12 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
#include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
#include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
#include <comphelper/processfactory.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svx/unopage.hxx>
#include <svx/unoshape.hxx>
@@ -53,7 +55,6 @@
using namespace ::ooo::vba;
using namespace ::com::sun::star;
-using namespace ::vos;
ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType ), m_xModel( xModel )
{
@@ -69,7 +70,7 @@ ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext
}
ScVbaShape::~ScVbaShape()
-{
+{
// dtor must never ever throw
/*try
{
@@ -78,10 +79,10 @@ ScVbaShape::~ScVbaShape()
}
catch( uno::Exception& )
{
- }*/
+ }*/
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException )
{
try
@@ -92,7 +93,7 @@ ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::Runti
removeShapesListener();
if ( xShape.is() )
removeShapeListener();
- }
+ }
catch( uno::Exception& )
{
}
@@ -133,7 +134,7 @@ ScVbaShape::removeShapesListener() throw( uno::RuntimeException )
m_xShapes = NULL;
}
-sal_Int32
+sal_Int32
ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException)
{
rtl::OUString sShapeType;
@@ -141,42 +142,42 @@ ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw
sShapeType = xShapeDescriptor->getShapeType();
OSL_TRACE("ScVbaShape::getType: %s", rtl::OUStringToOString( sShapeType, RTL_TEXTENCODING_UTF8 ).getStr() );
// office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape"
- if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) )
+ if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GroupShape")) ) )
return office::MsoShapeType::msoGroup;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) )
+ else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape")) ) )
return office::MsoShapeType::msoPicture;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) ||
- sShapeType.equals( rtl::OUString::createFromAscii( "FrameShape" ) ) )
+ else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape")) ) ||
+ sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameShape")) ) )
return office::MsoShapeType::msoOLEControlObject;
// OOo don't support office::MsoShapeType::msoComment as a Shape.
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) )
+ else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ) )
return office::MsoShapeType::msoChart;
// Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape"
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) )
+ else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ConnectorShape")) ) )
{
enum drawing::ConnectorType connectorType;
uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
- xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType;
+ xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind"))) >>= connectorType;
if( connectorType == drawing::ConnectorType_CURVE )
return office::MsoShapeType::msoFreeform;
else if( connectorType == drawing::ConnectorType_LINE )
return office::MsoShapeType::msoLine;
- else
+ else
return office::MsoShapeType::msoAutoShape;
}
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) )
+ else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape")) ) )
return office::MsoShapeType::msoLine;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) ||
- sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) )
+ else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")) ) ||
+ sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape")) ) )
return office::MsoShapeType::msoAutoShape;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ) )
+ else if( sShapeType.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TextShape")) ) )
return office::MsoShapeType::msoTextBox;
else
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be supported: " ) + sShapeType, uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("the shape type do not be supported: ")) + sShapeType, uno::Reference< uno::XInterface >() );
}
// Attributes
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaShape::getName() throw (uno::RuntimeException)
{
rtl::OUString sName;
@@ -185,107 +186,148 @@ ScVbaShape::getName() throw (uno::RuntimeException)
return sName;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
{
uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW );
xNamed->setName( _name );
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getHeight() throw (uno::RuntimeException)
{
return m_pShapeHelper->getHeight();
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException)
{
m_pShapeHelper->setHeight( _height );
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getWidth() throw (uno::RuntimeException)
{
return m_pShapeHelper->getWidth();
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
{
m_pShapeHelper->setWidth( _width );
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getLeft() throw (uno::RuntimeException)
{
- return m_pShapeHelper->getLeft();
+ double left = 0;
+ try
+ {
+ left = m_pShapeHelper->getLeft();
+ }
+ catch( uno::Exception& )
+ {
+ // fail to get position by using XShape::getPosition()
+ sal_Int32 nLeft = 0;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") ) ) >>= nLeft;
+ left = Millimeter::getInPoints( nLeft );
+ }
+ return left;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
{
- m_pShapeHelper->setLeft( _left );
+ try
+ {
+ m_pShapeHelper->setLeft( _left );
+ }
+ catch( uno::Exception& )
+ {
+ sal_Int32 nLeft = 0;
+ nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")), uno::makeAny( nLeft ) );
+ }
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getTop() throw (uno::RuntimeException)
{
- return m_pShapeHelper->getTop();
+ double top = 0;
+ try
+ {
+ top = m_pShapeHelper->getTop();
+ }
+ catch( uno::Exception& )
+ {
+ sal_Int32 nTop = 0;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop;
+ top = Millimeter::getInPoints( nTop );
+ }
+ return top;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
{
- return m_pShapeHelper->setTop( _top );
+ try
+ {
+ m_pShapeHelper->setTop( _top );
+ }
+ catch( uno::Exception& )
+ {
+ sal_Int32 nTop = 0;
+ nTop = Millimeter::getInHundredthsOfOneMillimeter( _top );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")), uno::makeAny( nTop ) );
+ }
}
-sal_Bool SAL_CALL
+sal_Bool SAL_CALL
ScVbaShape::getVisible() throw (uno::RuntimeException)
{
//UNO Shapes are always visible
return sal_True;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
{
//UNO Shapes are always visible
}
-sal_Int32 SAL_CALL
+sal_Int32 SAL_CALL
ScVbaShape::getZOrderPosition() throw (uno::RuntimeException)
{
sal_Int32 nZOrderPosition = 0;
- uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) );
+ uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")) );
aZOrderPosition >>= nZOrderPosition;
return nZOrderPosition + 1;
}
-sal_Int32 SAL_CALL
+sal_Int32 SAL_CALL
ScVbaShape::getType() throw (uno::RuntimeException)
{
return m_nType;
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getRotation() throw (uno::RuntimeException)
{
double dRotation = 0;
sal_Int32 nRotation = 0;
- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation;
+ m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RotateAngle")) ) >>= nRotation;
dRotation = static_cast< double >( nRotation /100 );
return dRotation;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException)
{
sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RotateAngle")), uno::makeAny( nRotation ) );
}
-uno::Reference< msforms::XLineFormat > SAL_CALL
+uno::Reference< msforms::XLineFormat > SAL_CALL
ScVbaShape::getLine() throw (uno::RuntimeException)
{
// TODO should ongly return line
@@ -305,7 +347,7 @@ ScVbaShape::getPictureFormat() throw (uno::RuntimeException)
}
// Methods
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaShape::TextFrame() throw (uno::RuntimeException)
{
uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
@@ -322,48 +364,48 @@ ScVbaShape::TextFrame() throw (uno::RuntimeException)
return uno::makeAny( uno::Reference< msforms::XTextFrame >( new VbaTextFrame( this, mxContext, m_xShape ) ) );
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::Delete() throw (uno::RuntimeException)
{
- OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
m_xShapes->remove( m_xShape );
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
{
sal_Int32 nOrderPositon;
- uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) );
+ uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")) );
aOrderPostion >>= nOrderPositon;
switch( ZOrderCmd )
{
case office::MsoZOrderCmd::msoBringToFront:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( SAL_MAX_INT32 ) );
break;
case office::MsoZOrderCmd::msoSendToBack:
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( (sal_Int32)0 ) );
break;
case office::MsoZOrderCmd::msoBringForward:
nOrderPositon += 1;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( nOrderPositon ) );
break;
case office::MsoZOrderCmd::msoSendBackward:
if( nOrderPositon > 0 )
{
nOrderPositon -= 1;
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), uno::makeAny( nOrderPositon ) );
}
break;
// below two commands use with Writer for text and image object.
case office::MsoZOrderCmd::msoBringInFrontOfText:
case office::MsoZOrderCmd::msoSendBehindText:
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("This ZOrderCmd is not implemented, it is use with writer.")), uno::Reference< uno::XInterface >() );
default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid Parameter.")), uno::Reference< uno::XInterface >() );
}
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException)
{
double nCurrentRotation = getRotation();
@@ -371,7 +413,7 @@ ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException)
setRotation(nCurrentRotation);
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException)
{
double nCurrentLeft = getLeft();
@@ -379,7 +421,7 @@ ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException)
setLeft(nCurrentLeft);
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException)
{
double nCurrentTop = getTop();
@@ -387,7 +429,7 @@ ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException)
setTop(nCurrentTop);
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
{
double nHeight = getHeight();
@@ -412,11 +454,11 @@ ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal
}
else
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScaleHeight.Scale wrong value is given.")) , uno::Reference< uno::XInterface >() );
}
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
{
double nWidth = getWidth();
@@ -441,7 +483,7 @@ ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_
}
else
{
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScaleHeight.Scale wrong value is given.")) , uno::Reference< uno::XInterface >() );
}
}
@@ -453,20 +495,20 @@ ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException
}
// This method should not be part of Shape, what we reall need to do is...
-// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc.
+// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc.
// ( e.g. the ones that really do have ShapeRange as an attribute )
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
{
- // perhaps we should store a reference to the Shapes Collection
+ // perhaps we should store a reference to the Shapes Collection
// in this class
// but anyway this method should not even be in this class
// #TODO not sure what the parent of the Shapes collection should be
-
+
XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec;
aVec.push_back( m_xShape );
uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) );
- uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW );
// #FIXME for want of a better parent, setting this
uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ), m_xModel ) );
if ( index.hasValue() )
@@ -474,90 +516,104 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
return uno::makeAny( xShapeRange );
}
-sal_Bool SAL_CALL
+void SAL_CALL ScVbaShape::Copy() throw (uno::RuntimeException)
+{
+ if ( m_xModel.is() )
+ {
+ Select( uno::Any() );
+ // Copy this Shape.
+ rtl::OUString sUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Copy") );
+ dispatchRequests( m_xModel, sUrl );
+ }
+}
+
+sal_Bool SAL_CALL
ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException)
{
// FIXME:
return sal_False;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setLockAspectRatio( sal_Bool /*_lockaspectratio*/ ) throw (uno::RuntimeException)
{
// FIXME:
}
-sal_Bool SAL_CALL
+sal_Bool SAL_CALL
ScVbaShape::getLockAnchor() throw (uno::RuntimeException)
{
// FIXME:
return sal_True;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setLockAnchor( sal_Bool /*_lockanchor*/ ) throw (uno::RuntimeException)
{
// FIXME:
}
-sal_Int32 SAL_CALL
+sal_Int32 SAL_CALL
ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
{
sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-
- switch( eType )
+ sal_Int16 nType = text::RelOrientation::PAGE_LEFT;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType;
+
+ switch( nType )
{
- case text::TextContentAnchorType_AT_PARAGRAPH:
+ case text::RelOrientation::FRAME:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
break;
}
- case text::TextContentAnchorType_AT_PAGE:
+ case text::RelOrientation::PAGE_FRAME:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
break;
}
- case text::TextContentAnchorType_AT_CHARACTER:
+ case text::RelOrientation::CHAR:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
break;
}
- case text::TextContentAnchorType_AT_FRAME:
- case text::TextContentAnchorType_AS_CHARACTER:
+ case text::RelOrientation::PAGE_PRINT_AREA:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
break;
}
default:
{
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
}
}
return nRelativeHorizontalPosition;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
{
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
switch( _relativehorizontalposition )
{
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
{
- eType = text::TextContentAnchorType_AT_CHARACTER;
+ nType = text::RelOrientation::CHAR;
break;
}
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
+ {
+ nType = text::RelOrientation::PAGE_FRAME;
+ break;
+ }
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
{
- eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ nType = text::RelOrientation::PAGE_PRINT_AREA;
break;
}
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
{
- eType = text::TextContentAnchorType_AT_PAGE;
+ nType = text::RelOrientation::PAGE_FRAME;
break;
}
default:
@@ -565,67 +621,70 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi
DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
}
}
- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ), uno::makeAny( nType ) );
}
-sal_Int32 SAL_CALL
+sal_Int32 SAL_CALL
ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
{
sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-
- switch( eType )
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType;
+
+ switch( nType )
{
- case text::TextContentAnchorType_AT_PARAGRAPH:
+ case text::RelOrientation::FRAME:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
break;
}
- case text::TextContentAnchorType_AT_PAGE:
+ case text::RelOrientation::PAGE_FRAME:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
break;
}
- case text::TextContentAnchorType_AT_CHARACTER:
+ case text::RelOrientation::TEXT_LINE:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
break;
}
- case text::TextContentAnchorType_AT_FRAME:
- case text::TextContentAnchorType_AS_CHARACTER:
+ case text::RelOrientation::PAGE_PRINT_AREA:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
break;
}
default:
{
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
}
}
return nRelativeVerticalPosition;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
{
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
switch( _relativeverticalposition )
{
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
{
- eType = text::TextContentAnchorType_AT_CHARACTER;
+ nType = text::RelOrientation::TEXT_LINE;
break;
}
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
+ {
+ nType = text::RelOrientation::FRAME;
+ break;
+ }
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
{
- eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ nType = text::RelOrientation::PAGE_PRINT_AREA;
break;
}
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
{
- eType = text::TextContentAnchorType_AT_PAGE;
+ nType = text::RelOrientation::PAGE_FRAME;
break;
}
default:
@@ -633,10 +692,10 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
}
}
- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ), uno::makeAny( nType ) );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaShape::WrapFormat() throw (uno::RuntimeException)
{
uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
@@ -653,14 +712,14 @@ ScVbaShape::WrapFormat() throw (uno::RuntimeException)
}
-rtl::OUString&
+rtl::OUString&
ScVbaShape::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaShape::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
@@ -671,3 +730,5 @@ ScVbaShape::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx
index f6dc8ad72c..ec15b5fe5e 100644
--- a/vbahelper/source/vbahelper/vbashaperange.cxx
+++ b/vbahelper/source/vbahelper/vbashaperange.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -82,7 +83,7 @@ ScVbaShapeRange::getShapes() throw (uno::RuntimeException)
if ( !m_xShapes.is() )
{
uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
- m_xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW );
+ m_xShapes.set( xMSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection")) ), uno::UNO_QUERY_THROW );
sal_Int32 nLen = m_xIndexAccess->getCount();
for ( sal_Int32 index = 0; index < nLen; ++index )
m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) );
@@ -125,6 +126,27 @@ ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException)
}
}
+rtl::OUString SAL_CALL ScVbaShapeRange::getName() throw (uno::RuntimeException)
+{
+ sal_Int32 nLen = getCount();
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
+ {
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
+ return xShape->getName( );
+ }
+ throw uno::RuntimeException();
+}
+
+void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
+{
+ sal_Int32 nLen = getCount();
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
+ {
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
+ xShape->setName( _name );
+ }
+}
+
double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException)
{
sal_Int32 nLen = getCount();
@@ -337,6 +359,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeExcept
throw uno::RuntimeException();
}
+void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
+{
+ sal_Int32 nLen = getCount();
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
+ {
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
+ xShape->ZOrder( ZOrderCmd );
+ }
+}
+
uno::Type SAL_CALL
ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
{
@@ -377,3 +409,5 @@ ScVbaShapeRange::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx
index f64b4aafd0..570e4030b3 100644
--- a/vbahelper/source/vbahelper/vbashapes.cxx
+++ b/vbahelper/source/vbahelper/vbashapes.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -86,7 +87,7 @@ void ScVbaShapes::initBaseCollection()
m_xNameAccess.set( xShapes, uno::UNO_QUERY );
}
-ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel )
+ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel )
{
m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
@@ -235,7 +236,7 @@ ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeExcept
uno::Any
ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException)
{
- rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) );
+ rtl::OUString sCreateShapeName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape")) );
sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
@@ -244,7 +245,7 @@ ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWi
uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
m_xShapes->add( xShape );
- rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Rectangle" ) );
+ rtl::OUString sName(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rectangle")) ));
setDefaultShapeProperties( xShape );
setShape_NameProperty( xShape, sName );
@@ -267,7 +268,7 @@ ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWi
uno::Any
ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException)
{
- rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.EllipseShape" ) );
+ rtl::OUString sCreateShapeName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.EllipseShape") );
sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
@@ -289,7 +290,7 @@ ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidt
setShape_AnchorTypeAndRangeProperty(xShape, _aRange);
*/
- rtl::OUString name = createName( rtl::OUString::createFromAscii( "Oval" ));
+ rtl::OUString name(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Oval"))));
setDefaultShapeProperties(xShape);
setShape_NameProperty(xShape, name);
@@ -320,12 +321,12 @@ ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_In
sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX );
sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY );
- uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape") ), uno::UNO_QUERY_THROW );
+ uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape")) ), uno::UNO_QUERY_THROW );
m_xShapes->add( xShape );
awt::Point aMovePositionIfRange( 0, 0 );
- rtl::OUString name = createName( rtl::OUString::createFromAscii( "Line" ) );
+ rtl::OUString name(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line")) ));
setDefaultShapeProperties(xShape);
setShape_NameProperty(xShape, name);
@@ -372,7 +373,7 @@ ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _n
uno::Any
ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
{
- rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) );
+ rtl::OUString sCreateShapeName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TextShape") );
sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft );
sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop );
sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth );
@@ -383,7 +384,7 @@ ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft,
setDefaultShapeProperties(xShape);
- rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Text Box") );
+ rtl::OUString sName(createName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text Box")) ));
setShape_NameProperty( xShape, sName );
awt::Size size;
@@ -392,23 +393,23 @@ ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft,
xShape->setSize(size);
uno::Reference< beans::XPropertySet > xShapeProps( xShape, uno::UNO_QUERY_THROW );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "AnchorType" ), uno::makeAny( text::TextContentAnchorType_AT_PAGE ) );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_LEFT ) );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrient" ), uno::makeAny( text::HoriOrientation::NONE ) );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nXPos ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorType")), uno::makeAny( text::TextContentAnchorType_AT_PAGE ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation")), uno::makeAny( text::RelOrientation::PAGE_LEFT ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")), uno::makeAny( text::HoriOrientation::NONE ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")), uno::makeAny( nXPos ) );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_FRAME ) );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrient" ), uno::makeAny( text::VertOrientation::NONE ) );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nYPos ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation")), uno::makeAny( text::RelOrientation::PAGE_FRAME ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrient")), uno::makeAny( text::VertOrientation::NONE ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")), uno::makeAny( nYPos ) );
// set to visible
drawing::LineStyle aLineStyle = drawing::LineStyle_SOLID;
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny( aLineStyle ) );
// set to font
sal_Int16 nLayerId = 1;
- rtl::OUString sLayerName = rtl::OUString::createFromAscii("Heaven");
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerID" ), uno::makeAny( nLayerId ) );
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerName" ), uno::makeAny( sLayerName ) );
+ rtl::OUString sLayerName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Heaven"));
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayerID")), uno::makeAny( nLayerId ) );
+ xShapeProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayerName")), uno::makeAny( sLayerName ) );
ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
@@ -447,11 +448,11 @@ void
ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillStyle" ), uno::makeAny( rtl::OUString::createFromAscii( "SOLID" ) ) );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor"), uno::makeAny( sal_Int32(0xFFFFFF) ) );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap"), uno::makeAny( text::WrapTextMode_THROUGHT ) );
+ xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SOLID")) ) );
+ xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), uno::makeAny( sal_Int32(0xFFFFFF) ) );
+ xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextWordWrap")), uno::makeAny( text::WrapTextMode_THROUGHT ) );
//not find in OOo2.3
- //xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Opaque"), uno::makeAny( sal_True ) );
+ //xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Opaque")), uno::makeAny( sal_True ) );
}
void
@@ -460,7 +461,7 @@ ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShap
uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
try
{
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Name" ), uno::makeAny( sName ) );
+ xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), uno::makeAny( sName ) );
}
catch( script::BasicErrorException e )
{
@@ -476,13 +477,4 @@ ScVbaShapes::createName( rtl::OUString sName )
return sName;
}
-#if 0
-//TODO helperapi using a writer document
-awt::Point
-calculateTopLeftMargin( uno::Reference< XHelperInterface > xDocument )
-{
- awt::Point aPoint( 0, 0 );
- uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW );
- return awt::Point();
-}
-#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbatextframe.cxx b/vbahelper/source/vbahelper/vbatextframe.cxx
index 18aef99e00..e215416a59 100644
--- a/vbahelper/source/vbahelper/vbatextframe.cxx
+++ b/vbahelper/source/vbahelper/vbatextframe.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,8 +44,8 @@ VbaTextFrame::setAsMSObehavior()
//set property TextWordWrap default as False.
// TextFitToSize control the text content. it seems we should set the default as False.
// com.sun.star.drawing.TextFitToSizeType.NONE
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) );
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextWordWrap")), uno::makeAny( sal_False ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextFitToSize")), uno::makeAny( drawing::TextFitToSizeType_NONE ) );
}
sal_Int32 VbaTextFrame::getMargin( rtl::OUString sMarginType )
@@ -69,7 +70,7 @@ VbaTextFrame::getAutoSize() throw (uno::RuntimeException)
// TextFitToSize control the text content.
// and in mso, there isnot option TextWordWrap which means auto wrap. the default is False.
sal_Bool bAutosize = sal_False;
- uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ) );
+ uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowHeight")) );
aTextAutoGrowHeight >>= bAutosize;
return bAutosize;
}
@@ -78,13 +79,13 @@ void SAL_CALL
VbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException)
{
setAsMSObehavior();
- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowHeight")), uno::makeAny( _autosize ) );
}
float SAL_CALL
VbaTextFrame::getMarginBottom() throw (uno::RuntimeException)
{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) );
+ sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLowerDistance")) );
float fMargin = (float)Millimeter::getInPoints( nMargin );
return fMargin;
}
@@ -92,13 +93,13 @@ VbaTextFrame::getMarginBottom() throw (uno::RuntimeException)
void SAL_CALL
VbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException)
{
- setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom );
+ setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLowerDistance")), _marginbottom );
}
float SAL_CALL
VbaTextFrame::getMarginTop() throw (uno::RuntimeException)
{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) );
+ sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextUpperDistance")) );
float fMargin = (float)Millimeter::getInPoints( nMargin );
return fMargin;
}
@@ -106,13 +107,13 @@ VbaTextFrame::getMarginTop() throw (uno::RuntimeException)
void SAL_CALL
VbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException)
{
- setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop );
+ setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextUpperDistance")), _margintop );
}
float SAL_CALL
VbaTextFrame::getMarginLeft() throw (uno::RuntimeException)
{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) );
+ sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLeftDistance")) );
float fMargin = (float)Millimeter::getInPoints( nMargin );
return fMargin;
}
@@ -120,13 +121,13 @@ VbaTextFrame::getMarginLeft() throw (uno::RuntimeException)
void SAL_CALL
VbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException)
{
- setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft );
+ setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextLeftDistance")), _marginleft );
}
float SAL_CALL
VbaTextFrame::getMarginRight() throw (uno::RuntimeException)
{
- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) );
+ sal_Int32 nMargin = getMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextRightDistance")) );
float fMargin = (float)Millimeter::getInPoints( nMargin );
return fMargin;
}
@@ -134,7 +135,7 @@ VbaTextFrame::getMarginRight() throw (uno::RuntimeException)
void SAL_CALL
VbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException)
{
- setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright );
+ setMargin( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextRightDistance")), _marginright );
}
@@ -164,3 +165,4 @@ VbaTextFrame::getServiceNames()
return aServiceNames;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/source/vbahelper/vbawindowbase.cxx b/vbahelper/source/vbahelper/vbawindowbase.cxx
index 6410231930..2a6d92421b 100644
--- a/vbahelper/source/vbahelper/vbawindowbase.cxx
+++ b/vbahelper/source/vbahelper/vbawindowbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -175,3 +176,5 @@ VbaWindowBase::getServiceNames()
}
return aServiceNames;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk
index 59f9776bf5..9469df4736 100644
--- a/vbahelper/util/makefile.mk
+++ b/vbahelper/util/makefile.mk
@@ -36,7 +36,7 @@ TARGET=vbahelper
.IF "$(ENABLE_VBA)" == "NO"
dummy:
- @echo "Nothing to build"
+ @echo "Nothing to build"
.ENDIF
TARGET_HELPER=vbahelper
@@ -49,18 +49,18 @@ SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX)
# dynamic libraries
SHL1STDLIBS= \
- $(CPPULIB) \
- $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(BASICLIB) \
- $(TOOLSLIB) \
- $(SALLIB)\
- $(SFXLIB) \
- $(SVTOOLLIB) \
- $(SVLLIB) \
+ $(CPPULIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(BASICLIB) \
+ $(TOOLSLIB) \
+ $(SALLIB)\
+ $(SFXLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
$(VCLLIB) \
- $(SVTOOLLIB) \
- $(MSFILTERLIB) \
+ $(SVTOOLLIB) \
+ $(MSFILTERLIB) \
$(TKLIB)
SHL1DEPN=
@@ -87,7 +87,7 @@ SHL2STDLIBS= \
$(SVLIB) \
$(TOOLSLIB) \
$(SALLIB)\
- $(VBAHELPERLIB) \
+ $(VBAHELPERLIB) \
$(SFXLIB) \
$(SVXLIB) \
$(SVTOOLLIB) \