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



Author: noelpwer
Date: Thu Jun 19 16:56:52 2008
New Revision: 12928
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12928&view=rev

Log:
stitching to support data-aware form controls in openoffice dialogs,
import of the list source range and ref cell ( very incomplete )


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

Modified: trunk/patches/test/vba/ObjectModule.diff
==============================================================================
--- trunk/patches/test/vba/ObjectModule.diff	(original)
+++ trunk/patches/test/vba/ObjectModule.diff	Thu Jun 19 16:56:52 2008
@@ -359,6 +359,28 @@
      );
  };
  
+diff --git basic/source/uno/dlgcont.cxx basic/source/uno/dlgcont.cxx
+index 91efe9d..9920651 100644
+--- basic/source/uno/dlgcont.cxx
++++ basic/source/uno/dlgcont.cxx
+@@ -325,7 +325,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
+ 	
+ 	try {
+ 		// start parsing 
+-		xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
++		xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
+ 		xParser->parseStream( source );
+ 	}
+ 	catch( Exception& )
+@@ -339,7 +339,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
+ 
+ 	// Create InputStream, TODO: Implement own InputStreamProvider
+ 	// to avoid creating the DialogModel here!
+-	Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
++	Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
+ 	aRetAny <<= xISP;
+ 	return aRetAny;
+ }
 diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
 index e5f37c7..2b910a4 100644
 --- basic/source/uno/namecont.cxx
@@ -1526,6 +1548,110 @@
  };
  
  #endif
+diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
+index ed8f91e..970b945 100644
+--- scripting/source/dlgprov/dlgevtatt.cxx
++++ scripting/source/dlgprov/dlgevtatt.cxx
+@@ -415,7 +415,7 @@ namespace dlgprov
+ 
+     void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException )
+     {
+-        ::osl::MutexGuard aGuard( getMutex() );
++        //::osl::MutexGuard aGuard( getMutex() );
+ 
+         firing_impl( Event, NULL );
+     }
+@@ -425,7 +425,7 @@ namespace dlgprov
+     Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event ) 
+         throw ( reflection::InvocationTargetException, RuntimeException )
+     {
+-        ::osl::MutexGuard aGuard( getMutex() );
++        //::osl::MutexGuard aGuard( getMutex() );
+ 
+         Any aReturn;
+         firing_impl( Event, &aReturn );
+@@ -669,7 +669,7 @@ namespace dlgprov
+ 
+     void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
+     {
+-        ::osl::MutexGuard aGuard( getMutex() );
++        //::osl::MutexGuard aGuard( getMutex() );
+ 
+         firing_impl( aScriptEvent, NULL );
+     }
+@@ -679,7 +679,7 @@ namespace dlgprov
+     Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent ) 
+         throw ( reflection::InvocationTargetException, RuntimeException )
+     {
+-        ::osl::MutexGuard aGuard( getMutex() );
++        //::osl::MutexGuard aGuard( getMutex() );
+ 
+         Any aReturn;
+         firing_impl( aScriptEvent, &aReturn );
+diff --git scripting/source/dlgprov/dlgprov.cxx scripting/source/dlgprov/dlgprov.cxx
+index b6912c6..d48e6d7 100644
+--- scripting/source/dlgprov/dlgprov.cxx
++++ scripting/source/dlgprov/dlgprov.cxx
+@@ -188,7 +188,7 @@ static ::rtl::OUString aResourceResolver
+     Reference< container::XNameContainer > DialogProviderImpl::createDialogModel( const Reference< io::XInputStream >& xInput, const Reference< resource::XStringResourceManager >& xStringResourceManager ) throw ( Exception )
+     {
+         Reference< container::XNameContainer > xDialogModel(  createControlModel() );
+-        ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
++        ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
+         // Set resource property
+         if( xStringResourceManager.is() )
+         {
+diff --git svx/inc/svx/msocximex.hxx svx/inc/svx/msocximex.hxx
+index 05e3c75..62f8195 100644
+--- svx/inc/svx/msocximex.hxx
++++ svx/inc/svx/msocximex.hxx
+@@ -487,6 +487,8 @@ struct ContainerRecord
+ 
+     ::rtl::OUString cName;
+     ::rtl::OUString controlTip;
++    ::rtl::OUString sCtrlSource;
++    ::rtl::OUString sRowSource;
+ 
+     sal_uInt32 nTop;
+     sal_uInt32 nLeft;
+diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
+index 143c66b..6f730e0 100644
+--- svx/source/msfilter/msocximex.cxx
++++ svx/source/msfilter/msocximex.cxx
+@@ -707,14 +707,22 @@ class ContainerRecReader
+             if( nCtrlSrcBufSize > 0 )
+             {
+                 ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+-                pS->SeekRel( nCtrlSrcBufSize );
++                std::auto_ptr< sal_Char > pCtrlSrcName;
++                pCtrlSrcName.reset( new sal_Char[ nCtrlSrcBufSize ] );
++                pS->Read( pCtrlSrcName.get(), nCtrlSrcBufSize );
++                rec.sCtrlSource = lclCreateOUString( pCtrlSrcName.get(), nCtrlSrcLen );
++                OSL_TRACE("*** *** *** ControlSourceName -> %s ", rtl::OUStringToOString( rec.sCtrlSource, RTL_TEXTENCODING_UTF8 ).getStr() );
+             }
+             // row source name
+             sal_uInt32 nRowSrcBufSize = lclGetBufferSize( nRowSrcLen );
+             if( nRowSrcBufSize > 0 )
+             {
+                 ReadAlign( pS, pS->Tell() - nStartPos, 4 );
+-                pS->SeekRel( nRowSrcBufSize );
++                std::auto_ptr< sal_Char > pRowSrcName;
++                pRowSrcName.reset( new sal_Char[ nRowSrcBufSize ] );
++                pS->Read( pRowSrcName.get(), nRowSrcBufSize );
++                rec.sRowSource =  lclCreateOUString( pRowSrcName.get(), nRowSrcLen );
++                OSL_TRACE("*** *** *** RowSourceName -> %s ", rtl::OUStringToOString( rec.sRowSource, RTL_TEXTENCODING_UTF8 ).getStr() );
+             }
+ 
+             // seek to end of data
+@@ -4247,7 +4255,7 @@ sal_Bool OCX_UserForm::Import(
+     OCX_ContainerControl::Import( xPropSet );
+ 
+     uno::Reference<io::XInputStreamProvider> xSource =
+-        xmlscript::exportDialogModel(mxParent, mxCtx);
++        xmlscript::exportDialogModel(mxParent, mxCtx, pDocSh->GetModel() );
+     uno::Any aSourceAny(uno::makeAny(xSource));
+     if (rLib->hasByName(sName))
+         rLib->replaceByName(sName, aSourceAny);
 diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
 index e647cf8..83949e0 100644
 --- svx/source/msfilter/svxmsbas.cxx
@@ -1580,6 +1706,63 @@
                          aSourceAny <<= sModuleInfo;
                      }
                      else
+diff --git xmlscript/inc/xmlscript/xmldlg_imexp.hxx xmlscript/inc/xmlscript/xmldlg_imexp.hxx
+index ea5b591..4549fa9 100644
+--- xmlscript/inc/xmlscript/xmldlg_imexp.hxx
++++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx
+@@ -30,6 +30,8 @@
+ #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
+ #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
+ 
++#include <com/sun/star/frame/XModel.hpp>
++
+ #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HXX_
+ #include <com/sun/star/container/XNameContainer.hpp>
+ #endif
+@@ -54,7 +56,9 @@ void SAL_CALL exportDialogModel(
+ 	::com::sun::star::uno::Reference<
+     ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut,
+ 	::com::sun::star::uno::Reference<
+-    ::com::sun::star::container::XNameContainer > const & xDialogModel )
++    ::com::sun::star::container::XNameContainer > const & xDialogModel, 
++	::com::sun::star::uno::Reference<
++    ::com::sun::star::frame::XModel > const & xDocument )
+ 	SAL_THROW( (::com::sun::star::uno::Exception) );
+ 
+ //==============================================================================
+@@ -63,7 +67,9 @@ SAL_CALL importDialogModel(
+ 	::com::sun::star::uno::Reference<
+     ::com::sun::star::container::XNameContainer > const & xDialogModel,
+     ::com::sun::star::uno::Reference<
+-    ::com::sun::star::uno::XComponentContext > const & xContext )
++    ::com::sun::star::uno::XComponentContext > const & xContext,
++    ::com::sun::star::uno::Reference<
++    ::com::sun::star::frame::XModel > const & xDocument )
+ 	SAL_THROW( (::com::sun::star::uno::Exception) );
+ 
+ // additional functions for convenience
+@@ -74,7 +80,9 @@ SAL_CALL exportDialogModel(
+ 	::com::sun::star::uno::Reference<
+     ::com::sun::star::container::XNameContainer > const & xDialogModel,
+     ::com::sun::star::uno::Reference<
+-    ::com::sun::star::uno::XComponentContext > const & xContext )
++    ::com::sun::star::uno::XComponentContext > const & xContext,
++    ::com::sun::star::uno::Reference<
++    ::com::sun::star::frame::XModel > const & xDocument )
+ 	SAL_THROW( (::com::sun::star::uno::Exception) );
+ 
+ //==============================================================================
+@@ -84,7 +92,9 @@ void SAL_CALL importDialogModel(
+ 	::com::sun::star::uno::Reference<
+     ::com::sun::star::container::XNameContainer > const & xDialogModel,
+     ::com::sun::star::uno::Reference<
+-    ::com::sun::star::uno::XComponentContext > const & xContext )
++    ::com::sun::star::uno::XComponentContext > const & xContext,
++    ::com::sun::star::uno::Reference<
++    ::com::sun::star::frame::XModel > const & xDocument )
+ 	SAL_THROW( (::com::sun::star::uno::Exception) );
+ 
+ }
 diff --git xmlscript/inc/xmlscript/xmllib_imexp.hxx xmlscript/inc/xmlscript/xmllib_imexp.hxx
 index 9a3048f..f92b154 100644
 --- xmlscript/inc/xmlscript/xmllib_imexp.hxx
@@ -1640,6 +1823,144 @@
  
  void
  SAL_CALL exportLibrary(
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
+index be29402..1d7e398 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
+@@ -44,6 +44,7 @@
+ using namespace ::rtl;
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
++using namespace ::com::sun::star::frame;
+ 
+ namespace xmlscript
+ {
+@@ -73,7 +74,8 @@ Reference< io::XInputStream > InputStrea
+ //==================================================================================================
+ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
+     Reference< container::XNameContainer > const & xDialogModel,
+-    Reference< XComponentContext > const & xContext )
++    Reference< XComponentContext > const & xContext,
++    Reference< XModel > const & xDocument )
+ 	SAL_THROW( (Exception) )
+ {
+ 	Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
+@@ -98,7 +100,7 @@ Reference< io::XInputStreamProvider > SA
+ 	
+ 	Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
+ 	xSource->setOutputStream( createOutputStream( &aBytes ) );
+-	exportDialogModel( xHandler, xDialogModel );
++	exportDialogModel( xHandler, xDialogModel, xDocument );
+ 	
+ 	return new InputStreamProvider( aBytes );
+ }
+@@ -107,7 +109,8 @@ Reference< io::XInputStreamProvider > SA
+ void SAL_CALL importDialogModel(
+ 	Reference< io::XInputStream > xInput,
+ 	Reference< container::XNameContainer > const & xDialogModel,
+-    Reference< XComponentContext > const & xContext )
++    Reference< XComponentContext > const & xContext,
++    Reference< XModel > const & xDocument )
+ 	SAL_THROW( (Exception) )
+ {
+ 	Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
+@@ -129,7 +132,7 @@ void SAL_CALL importDialogModel(
+ 	}
+ 	
+ 	// error handler, entity resolver omitted for this helper function
+-	xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
++	xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) );
+ 	
+ 	xml::sax::InputSource source;
+ 	source.aInputStream = xInput;
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+index 4a2c142..21ebe87 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+@@ -33,7 +33,10 @@
+ #include "exp_share.hxx"
+ 
+ #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+-
++#include <com/sun/star/form/binding/XListEntrySink.hpp>
++#include <com/sun/star/form/binding/XBindableValue.hpp>
++#include <com/sun/star/form/binding/XValueBinding.hpp>
++#include <com/sun/star/table/CellAddress.hpp>
+ 
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+@@ -311,7 +314,34 @@ void ElementDescriptor::readListBoxModel
+                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
+     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+-
++    Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
++    if ( xBinding.is() )
++    {
++        Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
++        if ( xBindable.is() )
++        {
++            table::CellAddress sAddress; 
++	    try
++            {
++                xBindable->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= sAddress; 
++                osl_trace( "*** Bindable value %d %d %d", sAddress.Row, sAddress.Column, sAddress.Sheet );
++            }
++            catch( Exception& e )
++            {
++            }
++        }
++    }
++    Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
++    if ( xEntrySink.is() )
++    {
++        Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
++        if ( xListSource.is() )
++        {
++            table::CellRangeAddress aAddress; 
++            xListSource->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellRange" ) ) ) >>= aAddress;
++            osl_trace("**** cell range source list start ( %d, %d, %d ) end ( %d, %d, %d ", aAddress.StartColumn, aAddress.StartRow, aAddress.StartSheet, aAddress.EndColumn, aAddress.EndRow, aAddress.EndSheet );
++        }
++    }
+     // string item list
+     Sequence< OUString > itemValues;
+     if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+index 999f899..c99fcbe 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+@@ -1309,7 +1309,8 @@ void StyleBag::dump( Reference< xml::sax
+ //==================================================================================================
+ void SAL_CALL exportDialogModel(
+     Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
+-    Reference< container::XNameContainer > const & xDialogModel )
++    Reference< container::XNameContainer > const & xDialogModel,
++    Reference< frame::XModel > const & xDocument )
+     SAL_THROW( (Exception) )
+ {
+     StyleBag all_styles;
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+index 74c09e6..be6db0c 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+@@ -62,6 +62,7 @@
+ 
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
++using namespace ::com::sun::star::frame;
+ using ::rtl::OUString;
+ 
+ namespace xmlscript
+@@ -1879,7 +1880,8 @@ Reference< xml::input::XElement > Dialog
+ //==================================================================================================
+ Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
+     Reference< container::XNameContainer > const & xDialogModel,
+-    Reference< XComponentContext > const & xContext )
++    Reference< XComponentContext > const & xContext,
++    Reference< XModel > const & xDocument )
+     SAL_THROW( (Exception) )
+ {
+     return ::xmlscript::createDocumentHandler(
 diff --git xmlscript/source/xmllib_imexp/imp_share.hxx xmlscript/source/xmllib_imexp/imp_share.hxx
 index d602103..fdc0536 100644
 --- xmlscript/source/xmllib_imexp/imp_share.hxx



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