ooo-build r12271 - trunk/patches/test/vba



Author: noelpwer
Date: Tue Apr 22 08:22:54 2008
New Revision: 12271
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12271&view=rev

Log:
fix dynamic control by name without '.value' access problem
also fix the strange module scope variable problem.



Modified:
   trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff

Modified: trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff
==============================================================================
--- trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff	(original)
+++ trunk/patches/test/vba/UserFormObjectModuleEventsSuperBigPatch.diff	Tue Apr 22 08:22:54 2008
@@ -1924,6 +1924,14 @@
 diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/vba/vbahelper.cxx sc/source/ui/vba/vbahelper.cxx
 --- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/vba/vbahelper.cxx	2008-03-29 23:07:54.000000000 +0000
 +++ sc/source/ui/vba/vbahelper.cxx	2008-03-28 10:30:34.000000000 +0000
+@@ -42,6 +42,7 @@
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <com/sun/star/lang/XMultiComponentFactory.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/beans/XIntrospection.hpp>
+ 
+ #include <comphelper/processfactory.hxx>
+ 
 @@ -62,6 +62,7 @@
  #include "tabvwsh.hxx"
  #include "transobj.hxx"
@@ -1932,6 +1940,25 @@
  
  using namespace ::com::sun::star;
  using namespace ::org::openoffice;
+@@ -80,6 +81,18 @@ namespace openoffice
+ 
+ const double Millimeter::factor =  35.27778;
+ 
++uno::Reference< beans::XIntrospectionAccess >
++getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
++{
++	static uno::Reference< beans::XIntrospection > xIntrospection;
++	if( !xIntrospection.is() )
++	{
++		uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++		xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
++	}
++	return xIntrospection->inspect( aObject );
++}
++
+ uno::Reference< script::XTypeConverter >
+ getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
+ {
 @@ -770,5 +771,10 @@ double PixelsToPoints( css::uno::Referen
  	return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
  }
@@ -1946,6 +1973,14 @@
 diff -rup /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/vba/vbahelper.hxx sc/source/ui/vba/vbahelper.hxx
 --- /data4/OOOBuildM12/ooo-build/build/ooh680-m12/sc/source/ui/vba/vbahelper.hxx	2008-03-29 23:07:54.000000000 +0000
 +++ sc/source/ui/vba/vbahelper.hxx	2008-03-28 10:30:34.000000000 +0000
+@@ -36,6 +36,7 @@
+ #define SC_VBA_HELPER_HXX
+ 
+ #include <com/sun/star/drawing/XShape.hpp>
++#include <com/sun/star/beans/XIntrospectionAccess.hpp>
+ #include <com/sun/star/script/BasicErrorException.hpp>
+ #include <com/sun/star/script/XTypeConverter.hpp>
+ #include <com/sun/star/lang/IllegalArgumentException.hpp>
 @@ -45,6 +45,7 @@
  #include <com/sun/star/frame/XModel.hpp>
  #include <docsh.hxx>
@@ -1954,6 +1989,14 @@
  
  namespace css = ::com::sun::star;
  
+@@ -63,6 +64,7 @@ namespace org 
+ 				throw css::lang::IllegalArgumentException();
+ 			return aSomething;
+ 		}
++		css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
+ 		css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+ 
+ 		void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
 @@ -145,6 +146,62 @@ public:
  		return points;
  	}
@@ -3080,7 +3123,7 @@
 +#endif
 --- /dev/null	2007-05-04 11:54:36.000000000 +0100
 +++ sc/source/ui/vba/vbauserform.cxx	2008-04-11 16:20:05.000000000 +0100
-@@ -0,0 +1,266 @@
+@@ -0,0 +1,276 @@
 +/*************************************************************************
 + *
 + *  OpenOffice.org - a multi-platform office productivity suite
@@ -3119,6 +3162,7 @@
 +#include "vbauserform.hxx"
 +#include <com/sun/star/awt/XControl.hpp>
 +#include <com/sun/star/awt/XControlContainer.hpp>
++#include <com/sun/star/beans/PropertyConcept.hpp>
 +#include <basic/sbx.hxx>
 +#include <basic/sbstar.hxx>
 +#include <basic/sbmeth.hxx>
@@ -3297,9 +3341,18 @@
 +}
 +
 +void SAL_CALL 
-+ScVbaUserForm::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
++ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
 +{
-+	throw uno::RuntimeException();
++	uno::Any aObject = getValue( aPropertyName );
++	// The Object *must* support XDefaultProperty here because getValue will
++	// only return properties that are Objects ( e.g. controls )
++	// e.g. Userform1.aControl = something
++	// 'aControl' has to support XDefaultProperty to make sense here
++	uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW );
++	rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName();
++	uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) );
++	uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW );
++	xPropSet->setPropertyValue( aDfltPropName, aValue );
 +}
 +
 +uno::Any SAL_CALL 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]