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



Author: noelpwer
Date: Fri Jun 20 16:20:56 2008
New Revision: 12935
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12935&view=rev

Log:
more data-aware userform control stitching


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	Fri Jun 20 16:20:56 2008
@@ -8,10 +8,94 @@
  *.orig
 +*.swp
 +/sc.nodebug
+diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
+index 1865b94..12c8e0c 100644
+--- basctl/source/basicide/baside3.cxx
++++ basctl/source/basicide/baside3.cxx
+@@ -112,7 +112,7 @@ DialogWindow::DialogWindow( Window* pPar
+ {
+ 	InitSettings( TRUE, TRUE, TRUE );
+ 
+-	pEditor = new DlgEditor();
++	pEditor = new DlgEditor( rDocument.getDocument() );
+ 	pEditor->SetWindow( this );
+ 	pEditor->SetDialog( xDialogModel );
+ 
+@@ -724,7 +724,7 @@ BOOL DialogWindow::SaveDialog()
+ 		Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+ 		OSL_ASSERT( xProps.is() );
+ 		OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+-		Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
++		Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
+ 		Reference< XInputStream > xInput( xISP->createInputStream() );
+ 
+ 		Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
+@@ -942,7 +942,7 @@ void DialogWindow::StoreData()
+                     Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+                     OSL_ASSERT( xProps.is() );
+                     OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+-					Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
++					Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
+ 					xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
+ 				}
+ 			}
+diff --git basctl/source/basicide/basides3.cxx basctl/source/basicide/basides3.cxx
+index b211eb3..e562ecb 100644
+--- basctl/source/basicide/basides3.cxx
++++ basctl/source/basicide/basides3.cxx
+@@ -98,7 +98,7 @@ DialogWindow* BasicIDEShell::CreateDlgWi
+                 Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
+                 OSL_ASSERT( xProps.is() );
+                 OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+-				::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
++				::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.getDocument() );
+ 				LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
+ 
+ 				// new dialog window
+diff --git basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
+index a5b41e7..cd2c032 100644
+--- basctl/source/basicide/moduldlg.cxx
++++ basctl/source/basicide/moduldlg.cxx
+@@ -315,7 +315,7 @@ void BasicIDEShell::CopyDialogResources(
+     Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
+     OSL_ASSERT( xProps.is() );
+     OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+-	::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
++	::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.getDocument() );
+ 
+ 	if( xDialogModel.is() )
+ 	{
+@@ -332,7 +332,7 @@ void BasicIDEShell::CopyDialogResources(
+ 		{
+ 			LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
+ 		}
+-		io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
++		io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.getDocument() );
+ 	}
+ }
+ 
 diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index a12fb46..fc1e511 100644
+index a12fb46..e984052 100644
 --- basctl/source/basicide/scriptdocument.cxx
 +++ basctl/source/basicide/scriptdocument.cxx
+@@ -663,7 +663,7 @@ namespace basctl
+                 if ( !_rxExistingDialogModel.is() )
+                 {
+                     Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
+-    			    ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext() );
++    			    ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), getDocument() );
+                 }
+ 
+ 			    // set new name as property
+@@ -671,7 +671,7 @@ namespace basctl
+ 			    xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
+ 
+ 			    // export dialog model
+-			    xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
++			    xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
+ 			    aElement <<= xISP;
+             }
+ 
 @@ -749,8 +749,16 @@ namespace basctl
              Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
  	        if ( !xLib->hasByName( _rModName ) )
@@ -31,6 +115,88 @@
              return true;
          }
          catch( const Exception& )
+@@ -783,7 +791,7 @@ namespace basctl
+ 		    xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
+ 
+ 		    // export dialog model
+-            _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
++            _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
+ 
+ 		    // insert dialog into library
+ 		    xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
+diff --git basctl/source/dlged/dlged.cxx basctl/source/dlged/dlged.cxx
+index b7588ee..09ebe9c 100644
+--- basctl/source/dlged/dlged.cxx
++++ basctl/source/dlged/dlged.cxx
+@@ -208,7 +208,7 @@ BOOL DlgEditor::RemarkDialog()
+ 
+ //----------------------------------------------------------------------------
+ 
+-DlgEditor::DlgEditor()
++DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
+ 	:pHScroll(NULL)
+ 	,pVScroll(NULL)
+ 	,pDlgEdModel(NULL)
+@@ -230,6 +230,7 @@ DlgEditor::DlgEditor()
+ 	,bCreateOK(TRUE)
+ 	,bDialogModelChanged(FALSE)
+ 	,mnPaintGuard(0)
++	,m_xDocument( xModel )
+ {
+ 	pDlgEdModel = new DlgEdModel();
+ 	pDlgEdModel->GetItemPool().FreezeIdRanges();
+@@ -838,7 +839,7 @@ void DlgEditor::Copy()
+     Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+     OSL_ASSERT( xProps.is() );
+     OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+-	Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
++	Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
+ 	Reference< XInputStream > xStream( xISP->createInputStream() );
+ 	Sequence< sal_Int8 > DialogModelBytes;
+ 	implCopyStreamToByteSequence( xStream, DialogModelBytes );
+@@ -871,7 +872,7 @@ void DlgEditor::Copy()
+ 			uno::Reference< resource::XStringResourceManager >
+ 				xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
+ 			LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
+-			Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
++			Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
+ 			Reference< XInputStream > xStream2( xISP2->createInputStream() );
+ 			Sequence< sal_Int8 > NoResourceDialogModelBytes;
+ 			implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
+@@ -1017,7 +1018,7 @@ void DlgEditor::Paste()
+                     Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
+                     OSL_ASSERT( xProps.is() );
+                     OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+-					::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
++					::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext, m_xDocument );
+ 				}
+ 
+ 				// get control models from clipboard dialog model
+diff --git basctl/source/inc/dlged.hxx basctl/source/inc/dlged.hxx
+index 02a1b08..3db132a 100644
+--- basctl/source/inc/dlged.hxx
++++ basctl/source/inc/dlged.hxx
+@@ -35,6 +35,7 @@
+ #include <com/sun/star/awt/XControlContainer.hpp>
+ #include <com/sun/star/datatransfer/DataFlavor.hpp>
+ #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
++#include <com/sun/star/frame/XModel.hpp>
+ #include <tools/link.hxx>
+ #include <tools/gen.hxx> 
+ #include <vcl/timer.hxx>
+@@ -129,9 +130,11 @@ protected:
+ 	BOOL				bDialogModelChanged;
+     Timer               aMarkTimer;
+ 	long				mnPaintGuard;
++	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
+ 
++	DlgEditor(); // not implemented
+ public:
+-	DlgEditor();
++	DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+ 	~DlgEditor();
+ 
+ 	void			SetWindow( Window* pWindow );
 diff --git basic/inc/basic/basmgr.hxx basic/inc/basic/basmgr.hxx
 index 2674c59..3c4f364 100644
 --- basic/inc/basic/basmgr.hxx
@@ -1602,10 +1768,19 @@
          if( xStringResourceManager.is() )
          {
 diff --git svx/inc/svx/msocximex.hxx svx/inc/svx/msocximex.hxx
-index 05e3c75..62f8195 100644
+index 05e3c75..7a98fbe 100644
 --- svx/inc/svx/msocximex.hxx
 +++ svx/inc/svx/msocximex.hxx
-@@ -487,6 +487,8 @@ struct ContainerRecord
+@@ -404,6 +404,8 @@ public:
+ 	sal_uInt32 nGroupNameLen;
+ 	sal_uInt32 nUnknown10;
+ 
++        rtl::OUString msCtrlSource;
++        rtl::OUString msRowSource;
+ 	char *pValue;
+ 	char *pCaption;
+ 	char *pGroupName;
+@@ -487,6 +489,8 @@ struct ContainerRecord
  
      ::rtl::OUString cName;
      ::rtl::OUString controlTip;
@@ -1614,11 +1789,46 @@
  
      sal_uInt32 nTop;
      sal_uInt32 nLeft;
+@@ -1086,7 +1090,8 @@ class OCX_ListBox : public OCX_ModernCon
+ public:
+ 	OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){
+ 		msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
+-		msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
++		//msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
++		msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
+ 		mnBackColor = 0x80000005;
+ 		mnForeColor = 0x80000008;
+ 		nBorderColor = 0x80000006;
 diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index 143c66b..6f730e0 100644
+index 143c66b..aa434b4 100644
 --- svx/source/msfilter/msocximex.cxx
 +++ svx/source/msfilter/msocximex.cxx
-@@ -707,14 +707,22 @@ class ContainerRecReader
+@@ -49,6 +49,10 @@
+ #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+ #include <com/sun/star/form/XFormsSupplier.hpp>
+ #include <com/sun/star/form/XForm.hpp>
++#include <com/sun/star/form/binding/XBindableValue.hpp>
++#include <com/sun/star/form/binding/XValueBinding.hpp>
++#include <com/sun/star/form/binding/XListEntrySink.hpp>
++#include <com/sun/star/form/binding/XListEntrySource.hpp>
+ #include <com/sun/star/form/FormComponentType.hpp>
+ #include <com/sun/star/awt/FontWeight.hpp>
+ #include <com/sun/star/awt/FontSlant.hpp>
+@@ -80,6 +84,13 @@
+ #include <algorithm>
+ #include <memory>
+ 
++#include <com/sun/star/beans/NamedValue.hpp>
++#include <com/sun/star/table/XCellRange.hpp>
++#include <com/sun/star/table/CellRangeAddress.hpp>
++#include <com/sun/star/table/CellAddress.hpp>
++#include <com/sun/star/sheet/XSpreadsheetView.hpp>
++#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
++ 
+ #ifndef C2S
+ #define C2S(cChar)	String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
+ #endif
+@@ -707,14 +718,22 @@ class ContainerRecReader
              if( nCtrlSrcBufSize > 0 )
              {
                  ReadAlign( pS, pS->Tell() - nStartPos, 4 );
@@ -1643,7 +1853,76 @@
              }
  
              // seek to end of data
-@@ -4247,7 +4255,7 @@ sal_Bool OCX_UserForm::Import(
+@@ -2825,7 +2844,34 @@ sal_Bool OCX_ListBox::Import(com::sun::s
+ 
+     aTmp <<= ImportColor( nBorderColor );
+     rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
+-
++// XBindable etc.
++    uno::Reference< lang::XMultiServiceFactory > xFac;
++    if ( pDocSh )
++        xFac.set( pDocSh->GetModel(), uno::UNO_QUERY );
++    uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
++    if (  xFac.is() && msCtrlSource.getLength() && xBindable.is() )
++    {
++         // we need a service to properly convert XL notation into
++         // OOo address structures
++         // RefCell - convert from XL
++         // pretend we converted the imported string address into the
++         // appropriate address structure
++         table::CellAddress aAddress;
++         aAddress.Row = 0;
++         aAddress.Column = 6;
++         aAddress.Sheet = 0;
++        
++         beans::NamedValue aArg1;
++         aArg1.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") );
++         aArg1.Value <<= aAddress;
++
++         uno::Sequence< uno::Any > aArgs(1);
++         aArgs[ 0 ]  <<= aArg1;
++
++         uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.table.CellValueBinding" ) ), aArgs ), uno::UNO_QUERY );
++         if ( xBindable.is() )
++             xBindable->setValueBinding( xBinding );
++    }
+ 	aFontData.Import(rPropSet);
+ 	return sal_True;
+ }
+@@ -3600,13 +3646,26 @@ void OCX_ContainerControl::ProcessContro
+     {
+         // A container control needs to read the f stream in
+         // the folder ( substorage ) associated with this control
+-        if (  rec.nTypeIdent ==  FRAME ||
+-            rec.nTypeIdent ==  MULTIPAGE||
+-            rec.nTypeIdent ==  PAGE )
++        switch ( rec.nTypeIdent )
+         {
+-            OCX_ContainerControl* pContainer =
+-               static_cast< OCX_ContainerControl* >( pControl );
+-            oStream = pContainer->getContainerStream();
++            case FRAME:
++            case MULTIPAGE:
++            case PAGE:
++                {
++                    OCX_ContainerControl* pContainer =
++                        static_cast< OCX_ContainerControl* >( pControl );
++                    oStream = pContainer->getContainerStream();
++                    break;
++                }
++            case LISTBOX:
++                {
++                    OCX_ModernControl* pList = static_cast< OCX_ModernControl* >( pControl );
++                    if ( pList )
++                    {
++                        pList->msCtrlSource = rec.sCtrlSource;
++                        pList->msRowSource = rec.sRowSource;
++                    }
++                }
+         }
+ 
+         pControl->sName = rec.cName;
+@@ -4247,7 +4306,7 @@ sal_Bool OCX_UserForm::Import(
      OCX_ContainerControl::Import( xPropSet );
  
      uno::Reference<io::XInputStreamProvider> xSource =
@@ -1874,10 +2153,10 @@
  	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
+index 4a2c142..cdaa6cd 100644
 --- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
 +++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-@@ -33,7 +33,10 @@
+@@ -33,7 +33,11 @@
  #include "exp_share.hxx"
  
  #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -1886,10 +2165,11 @@
 +#include <com/sun/star/form/binding/XBindableValue.hpp>
 +#include <com/sun/star/form/binding/XValueBinding.hpp>
 +#include <com/sun/star/table/CellAddress.hpp>
++#include <com/sun/star/table/CellRangeAddress.hpp>
  
  using namespace ::com::sun::star;
  using namespace ::com::sun::star::uno;
-@@ -311,7 +314,34 @@ void ElementDescriptor::readListBoxModel
+@@ -311,7 +315,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") ) );
@@ -1919,7 +2199,7 @@
 +        {
 +            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 );
++            osl_trace("**** cell range source list start ( %d, %d, %d ) end ( %d, %d, %d ", aAddress.StartColumn, aAddress.StartRow, aAddress.Sheet, aAddress.EndColumn, aAddress.EndRow, aAddress.Sheet );
 +        }
 +    }
      // string item list



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