ooo-build r13388 - in trunk: . patches/dev300 patches/vba



Author: noelpwer
Date: Fri Jul 25 13:47:07 2008
New Revision: 13388
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13388&view=rev

Log:
2008-07-25  Noel Power  <noel power novell com>

        * patches/dev300/apply: patch file to enable form models to be
        used for openoffice basic dialogs ( to allow data-aware ) properties
        to work ( also enables use of imagecontrol with document embedded
        images )
        * patches/vba/enhanced-form-userform-controls.diff:
        * patches/dev300/controls-with-images-in-document.diff:


Added:
   trunk/patches/vba/enhanced-form-userform-controls.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply
   trunk/patches/dev300/controls-with-images-in-document.diff

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Fri Jul 25 13:47:07 2008
@@ -1648,8 +1648,11 @@
 #make properties available for non class modules
 #also allow paramaters to be supported for Get properties
 vba-support-properties-inmodules.diff
-#FIXME: creates a circural build dependcy between toolkit and goodies 
 controls-with-images-in-document.diff, i#38215, noelpwer 
+#use of form control models in userforms/dialogs, additionally
+#enables use of document embedded images in image control for 
+#userforms/dialogs ( note: depends on controls-with-images-in-document.diff )
+enhanced-form-userform-controls.diff, noelpwer
 # object module support... getting there
 ObjectModule.diff
 # userform ( depends on ObjectModule.diff )
@@ -2725,3 +2728,4 @@
 
 # See what breaks if we build with more optimizations
 testing-more-optimizations-ark.diff
+

Modified: trunk/patches/dev300/controls-with-images-in-document.diff
==============================================================================
--- trunk/patches/dev300/controls-with-images-in-document.diff	(original)
+++ trunk/patches/dev300/controls-with-images-in-document.diff	Fri Jul 25 13:47:07 2008
@@ -193,7 +193,7 @@
 -        else
 +        else if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.GraphicObject:") ) == 0 ) )
 +        {
-+            // This is a bit of a hack, but I can't see a reason why using 
++            // #TODO This is a bit of a hack, but I can't see a reason why using 
 +            // SfxMedium [*] is necessary here ( for GraphicObject scheme 
 +            // objects )
 +            // We will get here if we have a vnd.sun.star.GraphicObject:xxxxx
@@ -202,12 +202,12 @@
 +            // Is the SfxMedium use just to handle say external links ( ftp etc. )
 +            // and notify when they are read?
 +            //
-+            // [*] we could always convert the "vnd.sun.star.GraphicObject:xxx
-+            // url to a "vnd.sun.star.Package:xxx" type url. Or we even could 
-+            // have another property at the controlmodel for that ( like Shapes
-+            // do ). Using a "vnd.sun.star.Package:" in theory would be possible
-+            // with the SfxMedium class ( assuming we can  access the document's
-+            // XStorage
++            // [*] there are 2 scenarios with "vnd.sun.star.GraphicObject:xxx"
++            // a) there is a real "vnd.sun.star.Package:xxx" type url. e.g. the image is stored to the document 
++            // b) the image is not yet stored to document ( in this case the
++            // real url to the target image could be used ) or a stream could
++            // I guess be contstructed from the XGraphic object, but is this
++            // necessary ?
 +            pImgProd->SetImage(sURL);
 +            pImgProd->startProduction();
 +            m_bProdStarted = sal_True;
@@ -351,7 +351,9 @@
 +namespace unographic {
 +
 +typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
-+
++ // Simple uno wrapper around the GraphicObject class to allow basic
++ // access. ( and solves a horrible cyclic link problem between
++ // goodies/toolkit/extensions )
 +class GObjectAccessImpl : public GObjectAccess_BASE
 +{
 +     std::auto_ptr< GraphicObject > mpGObject;
@@ -366,7 +368,6 @@
 +
 +GObjectAccessImpl::GObjectAccessImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException)
 +{
-+    OSL_TRACE("In GObjectAccessImpl::GObjectAccessImpl argslength = %d", args.getLength());
 +    if ( args.getLength() == 1 )
 +    {
 +        rtl::OUString sId;
@@ -377,7 +378,6 @@
 +    }
 +    else
 +       mpGObject.reset( new GraphicObject() ); 
-+    OSL_TRACE("In GObjectAccessImpl::GObjectAccessImpl complete");
 +}
 +
 +uno::Reference< graphic::XGraphic > SAL_CALL GObjectAccessImpl::getGraphic() throw (uno::RuntimeException)
@@ -449,7 +449,7 @@
  // -------------------
  // - GraphicProvider -
  // -------------------
-@@ -176,6 +179,18 @@ uno::Reference< ::graphic::XGraphic > Gr
+@@ -176,6 +179,19 @@ uno::Reference< ::graphic::XGraphic > Gr
  			xRet = pUnoGraphic;
  		}
  	}
@@ -459,7 +459,8 @@
 +		String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) );
 +		ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 );
 +		GraphicObject aGrafObj( aUniqueID );	
-+		// Don't call aGrafObj.GetXGraphic because it will call us back 		// here again ( albeit in the "private:memorygraphic" test 
++		// I don't call aGrafObj.GetXGraphic because it will call us back 		
++		// here again ( albeit in the "private:memorygraphic" test 
 +		// above )
 +		::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
 +		pUnoGraphic->init( aGrafObj.GetGraphic() );
@@ -619,20 +620,6 @@
  protected:
      ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
      ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index 3fd5723..fcf99e4 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -2118,7 +2118,8 @@ throw (RuntimeException)
- 	rbase  >>= baseLocation;
- 	rUrl  >>= url;
- 
--	if ( url.getLength() > 0 )
-+	// Don't adjust GraphicObject url(s)
-+	if ( url.getLength() > 0 && url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
- 	{
- 		INetURLObject urlObj(baseLocation);
- 		urlObj.removeSegment();
 diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
 index 821c1b9..8412a98 100644
 --- toolkit/source/controls/unocontrols.cxx

Added: trunk/patches/vba/enhanced-form-userform-controls.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/enhanced-form-userform-controls.diff	Fri Jul 25 13:47:07 2008
@@ -0,0 +1,1460 @@
+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 408f88d..645c396 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;
+             }
+ 
+@@ -783,7 +783,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/source/classes/eventatt.cxx basic/source/classes/eventatt.cxx
+index a3d4293..6bdd42a 100644
+--- basic/source/classes/eventatt.cxx
++++ basic/source/classes/eventatt.cxx
+@@ -556,11 +556,23 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
+ 	}
+ 
+ 	Any aDlgLibAny;
++	bool bDocDialog = false;
+ 	if( pSearchBasic1 )
+ 	{
++		StarBASIC* pSearch = (StarBASIC*)pSearchBasic1;
+ 		aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
+ 		if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
++		{
++			pSearch = (StarBASIC*)pSearchBasic2;
+ 			aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
++		}
++		// If we found the dialog then it belongs to the Search basic
++		if ( aDlgLibAny.hasValue() )
++			bDocDialog = pSearch->IsDocBasic();
++		// otherwise it belongs to the opposite, 
++		// and yes, this algorithm doesn't scale does it
++		else
++			bDocDialog = !( pSearch->IsDocBasic() );
+ 	}
+ 
+ 
+@@ -569,7 +581,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
+ 	Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pBasic, xModel );
+ 
+ 	Sequence< Any > aArgs( 4 );
+-	aArgs[ 0 ] <<= xModel;
++	aArgs[ 0 ] <<= bDocDialog ? xModel : uno::Reference< uno::XInterface >();
+ 	aArgs[ 1 ] <<= xInput;
+ 	aArgs[ 2 ] = aDlgLibAny;
+ 	aArgs[ 3 ] <<= xScriptListener;
+diff --git basic/source/uno/dlgcont.cxx basic/source/uno/dlgcont.cxx
+index e010d24..31f6757 100644
+--- basic/source/uno/dlgcont.cxx
++++ basic/source/uno/dlgcont.cxx
+@@ -322,7 +322,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& )
+@@ -336,7 +336,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 extensions/source/propctrlr/defaultforminspection.cxx extensions/source/propctrlr/defaultforminspection.cxx
+index 9dcd644..3073295 100644
+--- extensions/source/propctrlr/defaultforminspection.cxx
++++ extensions/source/propctrlr/defaultforminspection.cxx
+@@ -154,7 +154,7 @@ namespace pcr
+             { "com.sun.star.form.inspection.EventHandler", false },
+ 
+             // a handler which introduces virtual properties for binding controls to spreadsheet cells
+-            { "com.sun.star.form.inspection.CellBindingPropertyHandler", true },
++            { "com.sun.star.form.inspection.CellBindingPropertyHandler", false },
+ 
+             // properties related to binding to an XForms DOM node
+             { "com.sun.star.form.inspection.XMLFormsPropertyHandler", true },
+diff --git sc/inc/addruno.hxx sc/inc/addruno.hxx
+index bc9391a..fad1f03 100644
+--- sc/inc/addruno.hxx
++++ sc/inc/addruno.hxx
+@@ -50,7 +50,7 @@ private:
+     sal_Int32               nRefSheet;
+     sal_Bool                bIsRange;
+ 
+-    sal_Bool                ParseUIString( const String& rUIString );
++    sal_Bool                ParseUIString( const String& rUIString, ScAddress::Convention eConv = ScAddress::CONV_OOO );
+ 
+ public:
+ 
+diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
+index fcfd0fb..73b3744 100644
+--- sc/inc/unonames.hxx
++++ sc/inc/unonames.hxx
+@@ -590,6 +590,7 @@
+ #define SC_UNONAME_ADDRESS          "Address"
+ #define SC_UNONAME_UIREPR           "UserInterfaceRepresentation"
+ #define SC_UNONAME_PERSREPR         "PersistentRepresentation"
++#define SC_UNONAME_XL_A1_REPR       "XL_A1_Representation"
+ #define SC_UNONAME_REFSHEET         "ReferenceSheet"
+ 
+ // --> PB 2004-08-23 #i33095# Security Options
+diff --git sc/source/ui/unoobj/addruno.cxx sc/source/ui/unoobj/addruno.cxx
+index b417b7e..4f313f2 100644
+--- sc/source/ui/unoobj/addruno.cxx
++++ sc/source/ui/unoobj/addruno.cxx
+@@ -72,7 +72,7 @@ void ScAddressConversionObj::Notify( Sfx
+     }
+ }
+ 
+-sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
++sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ScAddress::Convention eConv )
+ {
+     if (!pDocShell)
+         return sal_False;
+@@ -81,7 +81,7 @@ sal_Bool ScAddressConversionObj::ParseUI
+     sal_Bool bSuccess = sal_False;
+     if ( bIsRange )
+     {
+-        USHORT nResult = aRange.ParseAny( rUIString, pDoc );
++        USHORT nResult = aRange.ParseAny( rUIString, pDoc, eConv );
+         if ( nResult & SCA_VALID )
+         {
+             if ( ( nResult & SCA_TAB_3D ) == 0 )
+@@ -95,7 +95,7 @@ sal_Bool ScAddressConversionObj::ParseUI
+     }
+     else
+     {
+-        USHORT nResult = aRange.aStart.Parse( rUIString, pDoc );
++        USHORT nResult = aRange.aStart.Parse( rUIString, pDoc, eConv );
+         if ( nResult & SCA_VALID )
+         {
+             if ( ( nResult & SCA_TAB_3D ) == 0 )
+@@ -119,6 +119,7 @@ uno::Reference<beans::XPropertySetInfo> 
+         {
+             {MAP_CHAR_LEN(SC_UNONAME_ADDRESS),  0,  &getCppuType((table::CellRangeAddress*)0), 0, 0 },
+             {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0,  &getCppuType((rtl::OUString*)0),    0, 0 },
++            {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0,  &getCppuType((rtl::OUString*)0),    0, 0 },
+             {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0,  &getCppuType((sal_Int32*)0),        0, 0 },
+             {MAP_CHAR_LEN(SC_UNONAME_UIREPR),   0,  &getCppuType((rtl::OUString*)0),    0, 0 },
+             {0,0,0,0,0,0}
+@@ -132,6 +133,7 @@ uno::Reference<beans::XPropertySetInfo> 
+         {
+             {MAP_CHAR_LEN(SC_UNONAME_ADDRESS),  0,  &getCppuType((table::CellAddress*)0), 0, 0 },
+             {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0,  &getCppuType((rtl::OUString*)0),    0, 0 },
++            {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0,  &getCppuType((rtl::OUString*)0),    0, 0 },
+             {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0,  &getCppuType((sal_Int32*)0),        0, 0 },
+             {MAP_CHAR_LEN(SC_UNONAME_UIREPR),   0,  &getCppuType((rtl::OUString*)0),    0, 0 },
+             {0,0,0,0,0,0}
+@@ -193,8 +195,11 @@ void SAL_CALL ScAddressConversionObj::se
+             bSuccess = ParseUIString( aUIString );
+         }
+     }
+-    else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
++    else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
+     {
++        ScAddress::Convention aConv = ScAddress::CONV_OOO; 
++        if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
++            aConv = ScAddress::CONV_XL_A1; 
+         //  parse the file format string
+         rtl::OUString sRepresentation;
+         if (aValue >>= sRepresentation)
+@@ -215,7 +220,7 @@ void SAL_CALL ScAddressConversionObj::se
+             }
+ 
+             //  parse the rest like a UI string
+-            bSuccess = ParseUIString( aUIString );
++            bSuccess = ParseUIString( aUIString, aConv );
+         }
+     }
+     else
+@@ -268,17 +273,21 @@ uno::Any SAL_CALL ScAddressConversionObj
+             aRange.aStart.Format( aFormatStr, nFlags, pDoc );
+         aRet <<= rtl::OUString( aFormatStr );
+     }
+-    else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
++    else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
+     {
++        ScAddress::Convention aConv = ScAddress::CONV_OOO; 
++        if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
++            aConv = ScAddress::CONV_XL_A1; 
++
+         //  generate file format string - always include sheet
+         String aFormatStr;
+-        aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc );
++        aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
+         if ( bIsRange )
+         {
+             //  manually concatenate range so both parts always have the sheet name
+             aFormatStr.Append( (sal_Unicode) ':' );
+             String aSecond;
+-            aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc );
++            aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
+             aFormatStr.Append( aSecond );
+         }
+         aRet <<= rtl::OUString( aFormatStr );
+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 58533b2..0d7ded2 100644
+--- scripting/source/dlgprov/dlgprov.cxx
++++ scripting/source/dlgprov/dlgprov.cxx
+@@ -196,7 +196,15 @@ static ::rtl::OUString aResourceResolver
+ 		Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
+ 		xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
+ 
+-        ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
++        // #TODO we really need to detect the source of the Dialog, is it
++        // located in the document or not. m_xModel need not be the location of
++        // the dialog. E.g. if the dialog was created from basic ( then we just
++        // can't tell  where its from ) 
++        // If we are happy to always substitute the form model for the awt
++        // one then maybe the presence of a document model is enough to trigger
++        // swapping out the models ( or perhaps we only want to do this 
++        // for vba mode ) there are a number of feasible and valid possibilities
++        ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
+         // Set resource property
+         if( xStringResourceManager.is() )
+         {
+@@ -658,7 +666,10 @@ static ::rtl::OUString aResourceResolver
+             aArguments[0] >>= m_xModel;
+             m_BasicInfo.reset( new BasicRTLParams() );
+             m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
+-            m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
++            // allow null mxDlgLib, a document dialog instantiated from 
++            // from application basic is unable to provide ( or find ) it's
++            // Library
++            aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib;
+             // leave the possibility to optionally allow the old dialog creation
+             // to use the new XScriptListener ( which converts the old style macro
+             // to a SF url )
+diff --git svx/inc/svx/msocximex.hxx svx/inc/svx/msocximex.hxx
+index 7447e10..3d52e4d 100644
+--- svx/inc/svx/msocximex.hxx
++++ svx/inc/svx/msocximex.hxx
+@@ -405,6 +405,8 @@ public:
+ 	sal_uInt32 nGroupNameLen;
+ 	sal_uInt32 nUnknown10;
+ 
++        rtl::OUString msCtrlSource;
++        rtl::OUString msRowSource;
+ 	char *pValue;
+ 	char *pCaption;
+ 	char *pGroupName;
+@@ -488,6 +490,8 @@ struct ContainerRecord
+ 
+     ::rtl::OUString cName;
+     ::rtl::OUString controlTip;
++    ::rtl::OUString sCtrlSource;
++    ::rtl::OUString sRowSource;
+ 
+     sal_uInt32 nTop;
+     sal_uInt32 nLeft;
+@@ -914,7 +918,8 @@ public:
+ 	OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton"))
+ 	{
+ 		msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
+-		msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
++		//msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
++		msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
+         mnBackColor = 0x80000005L;
+         mnForeColor = 0x80000008L;
+         aFontData.SetHasAlign(TRUE);
+@@ -1015,7 +1020,7 @@ class OCX_ComboBox : public OCX_ModernCo
+ public:
+ 	OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){
+ 		msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
+-	        msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel");
++	        msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
+ 		mnBackColor = 0x80000005;
+ 		mnForeColor = 0x80000008;
+ 		nBorderColor = 0x80000006;
+@@ -1040,7 +1045,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 c2bd3b2..85cabda 100644
+--- svx/source/msfilter/msocximex.cxx
++++ svx/source/msfilter/msocximex.cxx
+@@ -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 );
+-                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
+@@ -1489,7 +1508,69 @@ sal_Bool OCX_ImageButton::Export(SvStora
+ 	SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents")));
+ 	return WriteContents(xContents,rPropSet,rSize);
+ }
++void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
++{
++// XBindable etc.
++    uno::Reference< lang::XMultiServiceFactory > xFac;
++    if ( xModel.is() )
++        xFac.set( xModel, uno::UNO_QUERY );
++    uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
++    if (  xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
++    {
++         
++         // OOo address structures
++         // RefCell - convert from XL
++         // pretend we converted the imported string address into the
++         // appropriate address structure
++         uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
++         table::CellAddress aAddress;
++         if ( xConvertor.is() )
++         {
++             // we need this service to properly convert XL notation also
++             // Should be easy to extend
++             xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
++             xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;    
++         }
++        
++         beans::NamedValue aArg1;
++         aArg1.Name = C2U("BoundCell");
++         aArg1.Value <<= aAddress;
++
++         uno::Sequence< uno::Any > aArgs(1);
++         aArgs[ 0 ]  <<= aArg1;
++
++         uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
++         xBindable->setValueBinding( xBinding );
++    }
++    uno::Reference< form::binding::XListEntrySink > xListEntrySink( rPropSet, uno::UNO_QUERY );
++    if (  xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
++    {
++         
++         // OOo address structures
++         // RefCell - convert from XL
++         // pretend we converted the imported string address into the
++         // appropriate address structure
++         uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
++         table::CellRangeAddress aAddress;
++         if ( xConvertor.is() )
++         {
++             // we need this service to properly convert XL notation also
++             // Should be easy to extend
++             xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
++             xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;    
++         }
++        
++         beans::NamedValue aArg1;
++         aArg1.Name = C2U("CellRange");
++         aArg1.Value <<= aAddress;
+ 
++         uno::Sequence< uno::Any > aArgs(1);
++         aArgs[ 0 ]  <<= aArg1;
++
++         uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
++         xListEntrySink->setListEntrySource( xSource );
++    }
++}
+ 
+ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
+         com::sun::star::beans::XPropertySet> &rPropSet)
+@@ -1561,7 +1642,8 @@ sal_Bool OCX_OptionButton::Import(com::s
+         aTmp <<= sGroupName;
+         rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
+     }
+-
++	uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
++	lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
+ 	aFontData.Import(rPropSet);
+ 	return sal_True;
+ }
+@@ -2452,6 +2534,9 @@ sal_Bool OCX_ComboBox::Import(com::sun::
+ 	aTmp <<= nTmp;
+ 	rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
+ 
++	uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
++	lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
++
+ 	aFontData.Import(rPropSet);
+ 	return sal_True;
+ }
+@@ -2672,7 +2757,8 @@ sal_Bool OCX_ListBox::Import(com::sun::s
+ 
+     aTmp <<= ImportColor( nBorderColor );
+     rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
+-
++	uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
++	lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
+ 	aFontData.Import(rPropSet);
+ 	return sal_True;
+ }
+@@ -3447,15 +3533,29 @@ 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:
++            case OPTIONBUTTON:
++            case COMBOBOX:
++                {
++                    OCX_ModernControl* pList = static_cast< OCX_ModernControl* >( pControl );
++                    if ( pList )
++                    {
++                        pList->msCtrlSource = rec.sCtrlSource;
++                        pList->msRowSource = rec.sRowSource;
++                    }
++                }
+         }
+-
+         pControl->sName = rec.cName;
+         pControl->msToolTip = rec.controlTip;
+         // Position of controls is relative to the container
+@@ -4084,7 +4184,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 toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
+index 3fd5723..7e717ae 100644
+--- toolkit/source/controls/dialogcontrol.cxx
++++ toolkit/source/controls/dialogcontrol.cxx
+@@ -2120,10 +2120,17 @@ throw (RuntimeException)
+ 
+ 	if ( url.getLength() > 0 )
+ 	{
+-		INetURLObject urlObj(baseLocation);
+-		urlObj.removeSegment();
+-		baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
+-		::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
++		// Don't adjust GraphicObject url(s)
++		if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
++		{
++			INetURLObject urlObj(baseLocation);
++			urlObj.removeSegment();
++			baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
++			::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
++		}
++		else
++			ret = url;
++
+ 	}
+ 
+ 	return ret;
+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/source/xmldlg_imexp/exp_share.hxx xmlscript/source/xmldlg_imexp/exp_share.hxx
+index c87538f..db2aa1c 100644
+--- xmlscript/source/xmldlg_imexp/exp_share.hxx
++++ xmlscript/source/xmldlg_imexp/exp_share.hxx
+@@ -180,9 +180,9 @@ public:
+         SAL_THROW( (css::uno::Exception) );
+     void readCheckBoxModel( StyleBag * all_styles )
+         SAL_THROW( (css::uno::Exception) );
+-    void readRadioButtonModel( StyleBag * all_styles )
++    void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+         SAL_THROW( (css::uno::Exception) );
+-    void readComboBoxModel( StyleBag * all_styles )
++    void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+         SAL_THROW( (css::uno::Exception) );
+     void readCurrencyFieldModel( StyleBag * all_styles )
+         SAL_THROW( (css::uno::Exception) );
+@@ -196,9 +196,9 @@ public:
+         SAL_THROW( (css::uno::Exception) );
+     void readGroupBoxModel( StyleBag * all_styles )
+         SAL_THROW( (css::uno::Exception) );
+-    void readImageControlModel( StyleBag * all_styles )
++    void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument  )
+         SAL_THROW( (css::uno::Exception) );
+-    void readListBoxModel( StyleBag * all_styles )
++    void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+         SAL_THROW( (css::uno::Exception) );
+     void readNumericFieldModel( StyleBag * all_styles )
+         SAL_THROW( (css::uno::Exception) );
+diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
+index c53e325..e5263ad 100644
+--- xmlscript/source/xmldlg_imexp/imp_share.hxx
++++ xmlscript/source/xmldlg_imexp/imp_share.hxx
+@@ -131,6 +131,7 @@ struct DialogImport
+     
+     css::uno::Reference< css::container::XNameContainer > _xDialogModel;
+     css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
++    css::uno::Reference< css::frame::XModel > _xDoc;
+ 
+     sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
+     
+@@ -164,16 +165,18 @@ public:
+     inline DialogImport(
+         css::uno::Reference<css::uno::XComponentContext> const & xContext,
+         css::uno::Reference<css::container::XNameContainer>
+-        const & xDialogModel )
++        const & xDialogModel,
++        css::uno::Reference<css::frame::XModel> const & xDoc )
+         SAL_THROW( () )
+         : _xContext( xContext )
+         , _xDialogModel( xDialogModel )
+-        , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
++        , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
+         { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
+                       _xContext.is() ); }
+     virtual ~DialogImport()
+         SAL_THROW( () );
+     
++    inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
+     // XRoot
+     virtual void SAL_CALL startDocument(
+         css::uno::Reference< css::xml::input::XNamespaceMapping >
+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 3d744be..7488f94 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+@@ -32,7 +32,16 @@
+ #include "precompiled_xmlscript.hxx"
+ #include "exp_share.hxx"
+ 
++#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>
++#include <com/sun/star/table/CellRangeAddress.hpp>
+ #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
++#include <com/sun/star/document/XStorageBasedDocument.hpp>
++#include <com/sun/star/document/XGraphicObjectResolver.hpp>
++#include <comphelper/componentcontext.hxx>
++#include <comphelper/processfactory.hxx>
+ 
+ 
+ using namespace ::com::sun::star;
+@@ -42,6 +51,60 @@ using ::rtl::OUString;
+ namespace xmlscript
+ {
+ 
++void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
++{
++    Reference< lang::XMultiServiceFactory > xFac;
++    if ( xDocument.is() )
++        xFac.set( xDocument, uno::UNO_QUERY );
++
++    Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
++
++    if ( xFac.is() && xBinding.is() )
++    {
++         Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );  
++        Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
++        if ( xBindable.is() )
++        {
++            table::CellAddress aAddress; 
++	    try
++            {
++                xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress; 
++                xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
++                rtl::OUString sAddress;
++                xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
++                if ( sAddress.getLength() > 0 )
++                    rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
++                
++                OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() ); 
++               
++            }
++            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() )
++        {
++            Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );  
++
++            table::CellRangeAddress aAddress; 
++            xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
++
++            rtl::OUString sAddress;
++            xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
++            xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
++            OSL_TRACE("**** cell range source list %s",
++                rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() ); 
++            if ( sAddress.getLength() > 0 );
++                rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
++        }
++    }
++
++}
+ static inline bool readBorderProps(
+     ElementDescriptor * element, Style & style )
+ {
+@@ -209,7 +272,7 @@ void ElementDescriptor::readCheckBoxMode
+     readEvents();
+ }
+ //__________________________________________________________________________________________________
+-void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
++void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+     SAL_THROW( (Exception) )
+ {
+     // collect styles
+@@ -250,7 +313,8 @@ void ElementDescriptor::readComboBoxMode
+                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
+                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
+-
++    // Cell Range, Ref Cell etc.
++    lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+     // string item list
+     Sequence< OUString > itemValues;
+     if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
+@@ -276,7 +340,7 @@ void ElementDescriptor::readComboBoxMode
+     readEvents();
+ }
+ //__________________________________________________________________________________________________
+-void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
++void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument  )
+     SAL_THROW( (Exception) )
+ {
+     // collect styles
+@@ -311,7 +375,7 @@ 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") ) );
+-
++    lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+     // string item list
+     Sequence< OUString > itemValues;
+     if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
+@@ -351,7 +415,7 @@ void ElementDescriptor::readListBoxModel
+     readEvents();
+ }
+ //__________________________________________________________________________________________________
+-void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
++void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument  )
+     SAL_THROW( (Exception) )
+ {
+     // collect styles
+@@ -409,6 +473,7 @@ void ElementDescriptor::readRadioButtonM
+             break;
+         }
+     }
++    lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+     readEvents();
+ }
+ //__________________________________________________________________________________________________
+@@ -581,7 +646,7 @@ void ElementDescriptor::readEditModel( S
+     readEvents();
+ }
+ //__________________________________________________________________________________________________
+-void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
++void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+     SAL_THROW( (Exception) )
+ {
+     // collect styles
+@@ -600,8 +665,31 @@ void ElementDescriptor::readImageControl
+     readDefaults();
+     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
+                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
+-    readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+-                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
++    rtl::OUString sURL;
++    _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
++    
++    if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:"  ) ) ) == 0 )
++    {
++        Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
++
++        if ( xDocStorage.is() )
++        {
++            uno::Sequence< Any > aArgs( 1 );
++            aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
++
++            ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
++            uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
++            aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
++            if ( xGraphicResolver.is() )
++            {
++                sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
++            }
++        }     
++    }
++    if ( sURL.getLength() > 0 )
++    {
++        addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
++    }
+     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+     readEvents();
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+index 999f899..2e4729e 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;
+@@ -1357,7 +1358,7 @@ void SAL_CALL exportDialogModel(
+                 xProps, xPropState,
+                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
+             xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+-            pElem->readRadioButtonModel( &all_styles );
++            pElem->readRadioButtonModel( &all_styles, xDocument  );
+             pRadioGroup->addSubElement( xElem );
+         }
+         else // no radio
+@@ -1386,7 +1387,7 @@ void SAL_CALL exportDialogModel(
+                     xProps, xPropState,
+                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
+                 xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+-                pElem->readComboBoxModel( &all_styles );
++                pElem->readComboBoxModel( &all_styles, xDocument );
+             }
+             else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
+             {
+@@ -1394,7 +1395,7 @@ void SAL_CALL exportDialogModel(
+                     xProps, xPropState,
+                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
+                 xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+-                pElem->readListBoxModel( &all_styles );
++                pElem->readListBoxModel( &all_styles, xDocument );
+             }
+             else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
+             {
+@@ -1435,7 +1436,7 @@ void SAL_CALL exportDialogModel(
+                     xProps, xPropState,
+                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
+                 xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+-                pElem->readImageControlModel( &all_styles );
++                pElem->readImageControlModel( &all_styles, xDocument );
+             }
+             else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
+             {
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+index ee1d824..310b3a6 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+@@ -31,11 +31,19 @@
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_xmlscript.hxx"
+ #include "imp_share.hxx"
+-
++#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/beans/NamedValue.hpp>
++#include <com/sun/star/table/CellAddress.hpp>
++#include <com/sun/star/table/CellRangeAddress.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <com/sun/star/beans/XPropertyState.hpp>
++#include <com/sun/star/document/XStorageBasedDocument.hpp>
++#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+ 
+-
++#include <comphelper/componentcontext.hxx>
++#include <comphelper/processfactory.hxx>
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using ::rtl::OUString;
+@@ -43,6 +51,100 @@ using ::rtl::OUString;
+ namespace xmlscript
+ {
+ 
++// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251 
++// of course we need to find a common home for this helper
++
++bool IsPackageURL( const ::rtl::OUString& rURL )
++{
++    // Some quick tests: Some may rely on the package structure!
++    sal_Int32 nLen = rURL.getLength();
++    if( (nLen > 0 && '/' == rURL[0]) )
++        // RFC2396 net_path or abs_path
++        return false;
++    else if( nLen > 1 && '.' == rURL[0] )
++    {
++        if( '.' == rURL[1] )
++            // ../: We are never going up one level, so we know
++            // it's not an external URI
++            return false;
++        else if( '/' == rURL[1] )
++            // we are remaining on a level, so it's an package URI
++            return true;
++    }
++
++    // Now check for a RFC2396 schema
++    sal_Int32 nPos = 1;
++    while( nPos < nLen )
++    {
++        switch( rURL[nPos] )
++        {
++            case '/':
++                // a relative path segement
++                return true;
++            case ':':
++                // a schema
++                return false;
++            default:
++                break;
++                // we don't care about any other characters
++        }
++        ++nPos;
++    }
++
++    return true;
++}
++
++void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
++{
++    Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
++    if ( xFac.is() && ( sLinkedCell.getLength() ||  sCellRange.getLength() ) )
++    {
++        // Set up Celllink
++        if ( sLinkedCell.getLength() )
++        {
++            Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
++            Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
++            if ( xBindable.is() && xConvertor.is() )
++            {
++                table::CellAddress aAddress;
++                xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
++                xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;     
++                beans::NamedValue aArg1;
++                aArg1.Name = OUSTR("BoundCell");
++                aArg1.Value <<= aAddress;
++           
++                uno::Sequence< uno::Any > aArgs(1);
++                aArgs[ 0 ]  <<= aArg1;
++           
++                uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
++                xBindable->setValueBinding( xBinding );
++ 
++            }
++        }
++        // Set up CelllRange
++        if ( sCellRange.getLength() )
++        {
++           Reference< form::binding::XListEntrySink  > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
++           Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
++           if ( xListEntrySink.is() && xConvertor.is() )
++           {
++               table::CellRangeAddress aAddress;
++               xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
++               xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;     
++               beans::NamedValue aArg1;
++               aArg1.Name = OUSTR("CellRange");
++               aArg1.Value <<= aAddress;
++           
++               uno::Sequence< uno::Any > aArgs(1);
++               aArgs[ 0 ]  <<= aArg1;
++           
++               uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
++               xListEntrySink->setListEntrySource( xSource );
++ 
++           }
++       }
++   }
++}
+ // progessmeter
+ //__________________________________________________________________________________________________
+ Reference< xml::input::XElement > ProgressBarElement::startChildElement(
+@@ -1003,9 +1105,37 @@ void ImageControlElement::endElement()
+ 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
+ 							   OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
+ 							   _xAttributes );
+-	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+-							  OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
+-							  _xAttributes );
++    rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
++    Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
++
++    if ( xDocStorage.is() && IsPackageURL( sURL ) )
++    {
++        uno::Sequence< Any > aArgs( 1 );
++        aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
++
++        ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
++        uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
++        aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
++
++        if ( xGraphicResolver.is() )
++        {
++            rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
++            aTmp += sURL;
++            sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
++            Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
++            // we must set the url while the graphic object ( held by the resolver is in scope )
++            if ( xProps.is() )
++                xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
++        }
++    }
++    
++    else if ( sURL.getLength() > 0 )
++    {
++        Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
++        if ( xProps.is() )
++            xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
++    }
++
+     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+                                _xAttributes );
+@@ -1338,10 +1468,24 @@ void TitledBoxElement::endElement()
+ 		Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
+ 		Reference< xml::input::XAttributes > xAttributes(
+             xRadio->getAttributes() );
++		OUString sLinkedCell;
++		OUString sCellRange;
++		OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
++		try
++		{
++			sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
++			// we should probably limit this to vba mode also ( leave for now )
++			if ( _pImport->getDocOwner().is() )
++				sService = OUSTR("com.sun.star.form.component.RadioButton");
++		}
++		catch( Exception& /*e*/ )
++		{
++		}
++
+ 		
+ 		ControlImportContext ctx(
+ 			_pImport, getControlId( xAttributes ),
+-			OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
++			sService );
+ 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+ 		
+ 		Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
+@@ -1393,7 +1537,7 @@ void TitledBoxElement::endElement()
+ 		}
+ 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
+ 										 makeAny( nVal ) );
+-        
++	importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
+         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
+             static_cast< RadioElement * >( xRadio.get() )->getEvents();
+ 		ctx.importEvents( *radioEvents );
+@@ -1469,10 +1613,23 @@ void RadioGroupElement::endElement()
+ 		Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
+ 		Reference< xml::input::XAttributes > xAttributes(
+             xRadio->getAttributes() );
++		OUString sLinkedCell;
++		OUString sCellRange;
++		OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
++		try
++		{
++			sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
++			// we should probably limit this to vba mode also ( leave for now )
++			if ( _pImport->getDocOwner().is() )
++				sService = OUSTR("com.sun.star.form.component.RadioButton");
++		}
++		catch( Exception& /*e*/ )
++		{
++		}
+ 		
+ 		ControlImportContext ctx(
+ 			_pImport, getControlId( xAttributes ),
+-			OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
++			sService );
+ 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+ 		
+ 		Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
+@@ -1524,6 +1681,7 @@ void RadioGroupElement::endElement()
+ 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
+ 										 makeAny( nVal ) );
+ 		
++	importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
+         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
+             static_cast< RadioElement * >( xRadio.get() )->getEvents();
+ 		ctx.importEvents( *radioEvents );
+@@ -1644,9 +1802,26 @@ Reference< xml::input::XElement > MenuLi
+ void MenuListElement::endElement()
+ 	throw (xml::sax::SAXException, RuntimeException)
+ {
++        OUString sLinkedCell;
++        OUString sCellRange;
++        OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
++
++        // we should probably limit this to vba mode also ( leave for now )
++        if ( _pImport->getDocOwner().is() )
++            sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
++
++        try
++        {
++            sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
++            sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
++        }
++        catch( Exception& /*e*/ )
++        {
++        }
+ 	ControlImportContext ctx(
+ 		_pImport, getControlId( _xAttributes ),
+-		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
++		//OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
++		sListBoxService );
+ 	Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+ 	
+ 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+@@ -1679,13 +1854,16 @@ void MenuListElement::endElement()
+ 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+                              _xAttributes );
+-	
++        // import cell-link and cell source range
++	importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
+ 	if (_popup.is())
+ 	{
+ 		MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
+-		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
++        if (  !sCellRange.getLength() )
++		    xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
+ 										 makeAny( p->getItemValues() ) );
+-		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
++        if (  !sLinkedCell.getLength() )
++		    xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
+ 										 makeAny( p->getSelectedItems() ) );
+ 	}
+ 	ctx.importEvents( _events );
+@@ -1731,9 +1909,26 @@ Reference< xml::input::XElement > ComboB
+ void ComboBoxElement::endElement()
+ 	throw (xml::sax::SAXException, RuntimeException)
+ {
++        OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
++
++        // we should probably limit this to vba mode also ( leave for now )
++        if ( _pImport->getDocOwner().is() )
++            sService = OUSTR("com.sun.star.form.component.ComboBox");
++
++        OUString sLinkedCell;
++        OUString sCellRange;
++        try
++        {
++            sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
++            sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
++        }
++        catch( Exception& /*e*/ )
++        {
++        }
++
+ 	ControlImportContext ctx(
+ 		_pImport, getControlId( _xAttributes ),
+-		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
++		sService );
+ 	Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+ 	
+ 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+@@ -1775,8 +1970,10 @@ void ComboBoxElement::endElement()
+ 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+                              _xAttributes );
++	// import cell-link and cell source range
++	importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
+ 	
+-	if (_popup.is())
++	if (_popup.is() && !sCellRange.getLength() )
+ 	{
+ 		MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
+ 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+index f4869b1..99064cc 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,12 +1880,13 @@ 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(
+         static_cast< xml::input::XRoot * >(
+-            new DialogImport( xContext, xDialogModel ) ) );
++            new DialogImport( xContext, xDialogModel, xDocument ) ) );
+ }
+ 
+ }



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