diff options
Diffstat (limited to 'patches/vba/enhanced-form-userform-controls.diff')
-rw-r--r-- | patches/vba/enhanced-form-userform-controls.diff | 2031 |
1 files changed, 0 insertions, 2031 deletions
diff --git a/patches/vba/enhanced-form-userform-controls.diff b/patches/vba/enhanced-form-userform-controls.diff deleted file mode 100644 index 997afe9ce..000000000 --- a/patches/vba/enhanced-form-userform-controls.diff +++ /dev/null @@ -1,2031 +0,0 @@ ---- basctl/source/basicide/baside3.cxx.old 2009-04-02 10:56:36.000000000 +0000 -+++ basctl/source/basicide/baside3.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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 ) ); - } - } ---- basctl/source/basicide/basides3.cxx.old 2009-04-02 10:56:36.000000000 +0000 -+++ basctl/source/basicide/basides3.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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 ---- basctl/source/basicide/moduldlg.cxx.old 2009-04-02 10:56:36.000000000 +0000 -+++ basctl/source/basicide/moduldlg.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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() ); - } - } - ---- basctl/source/basicide/scriptdocument.cxx.old 2009-04-02 10:56:36.000000000 +0000 -+++ basctl/source/basicide/scriptdocument.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -661,7 +661,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 -@@ -669,7 +669,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; - } - -@@ -772,7 +772,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 ) ); ---- basctl/source/dlged/dlged.cxx.old 2009-04-02 10:56:34.000000000 +0000 -+++ basctl/source/dlged/dlged.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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 ---- basctl/source/inc/dlged.hxx.old 2009-04-02 10:56:36.000000000 +0000 -+++ basctl/source/inc/dlged.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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 ); ---- basic/source/classes/eventatt.cxx.old 2009-04-02 10:49:17.000000000 +0000 -+++ basic/source/classes/eventatt.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -58,7 +58,10 @@ - #include <com/sun/star/awt/XDialogProvider.hpp> - - #include <com/sun/star/frame/XModel.hpp> -- -+#include <com/sun/star/frame/XDesktop.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <basic/basicmanagerrepository.hxx> -+#include <basic/basmgr.hxx> - //================================================================================================== - - #include <xmlscript/xmldlg_imexp.hxx> -@@ -458,6 +461,43 @@ Any implFindDialogLibForDialog( const An - return aRetDlgLibAny; - } - -+Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, StarBASIC*& pFoundBasic ) -+{ -+ Any aDlgLibAny; -+ // Find dialog library for dialog, direct access is not possible here -+ StarBASIC* pStartedBasic = (StarBASIC*)pBasic; -+ SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL; -+ SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL; -+ -+ SbxObject* pSearchBasic1 = NULL; -+ SbxObject* pSearchBasic2 = NULL; -+ if( pParentParentBasic ) -+ { -+ pSearchBasic1 = pParentBasic; -+ pSearchBasic2 = pParentParentBasic; -+ } -+ else -+ { -+ pSearchBasic1 = pStartedBasic; -+ pSearchBasic2 = pParentBasic; -+ } -+ if( pSearchBasic1 ) -+ { -+ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 ); -+ -+ if ( aDlgLibAny.hasValue() ) -+ pFoundBasic = (StarBASIC*)pSearchBasic1; -+ -+ else if( pSearchBasic2 ) -+ { -+ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 ); -+ if ( aDlgLibAny.hasValue() ) -+ pFoundBasic = (StarBASIC*)pSearchBasic2; -+ } -+ } -+ return aDlgLibAny; -+} -+ - static ::rtl::OUString aDecorationPropName = - ::rtl::OUString::createFromAscii( "Decoration" ); - static ::rtl::OUString aTitlePropName = -@@ -537,39 +577,51 @@ void RTL_Impl_CreateUnoDialog( StarBASIC - {} - } - -- // Find dialog library for dialog, direct access is not possible here -- StarBASIC* pStartedBasic = pINST->GetBasic(); -- SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL; -- SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL; -- -- SbxObject* pSearchBasic1 = NULL; -- SbxObject* pSearchBasic2 = NULL; -- if( pParentParentBasic ) -- { -- pSearchBasic1 = pParentBasic; -- pSearchBasic2 = pParentParentBasic; -- } -- else -- { -- pSearchBasic1 = pStartedBasic; -- pSearchBasic2 = pParentBasic; -- } -- - Any aDlgLibAny; -- if( pSearchBasic1 ) -- { -- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 ); -- if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID ) -- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 ); -- } -- -- -+ bool bDocDialog = false; -+ StarBASIC* pFoundBasic = NULL; - OSL_TRACE("About to try get a hold of ThisComponent"); -- Reference< frame::XModel > xModel = getModelFromBasic( pStartedBasic ) ; -- Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pStartedBasic, xModel ); -+ Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ; -+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic ); -+ // If we found the dialog then it belongs to the Search basic -+ if ( !pFoundBasic ) -+ { -+ Reference< frame::XDesktop > xDesktop( xMSF->createInstance -+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), -+ UNO_QUERY ); -+ Reference< container::XEnumeration > xModels; -+ if ( xDesktop.is() ) -+ { -+ Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); -+ if ( xComponents.is() ) -+ xModels.set( xComponents->createEnumeration(), UNO_QUERY ); -+ if ( xModels.is() ) -+ { -+ while ( xModels->hasMoreElements() ) -+ { -+ Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); -+ if ( xNextModel.is() ) -+ { -+ BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); -+ if ( pMgr ) -+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); -+ if ( aDlgLibAny.hasValue() ) -+ { -+ bDocDialog = true; -+ xModel = xNextModel; -+ break; -+ } -+ } -+ } -+ } -+ } -+ } -+ if ( pFoundBasic ) -+ bDocDialog = pFoundBasic->IsDocBasic(); -+ Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), 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; ---- basic/source/uno/dlgcont.cxx.old 2009-04-06 16:41:59.000000000 +0000 -+++ basic/source/uno/dlgcont.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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; - } ---- extensions/source/propctrlr/defaultforminspection.cxx.old 2009-04-02 10:51:17.000000000 +0000 -+++ extensions/source/propctrlr/defaultforminspection.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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 }, ---- sc/inc/addruno.hxx.old 2009-04-02 10:45:43.000000000 +0000 -+++ sc/inc/addruno.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -50,7 +50,7 @@ private: - sal_Int32 nRefSheet; - sal_Bool bIsRange; - -- sal_Bool ParseUIString( const String& rUIString ); -+ sal_Bool ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv = ::formula::FormulaGrammar::CONV_OOO ); - - public: - ---- sc/inc/unonames.hxx.old 2009-04-06 16:41:58.000000000 +0000 -+++ sc/inc/unonames.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -599,6 +599,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 ---- sc/source/ui/unoobj/addruno.cxx.old 2009-04-02 10:45:26.000000000 +0000 -+++ sc/source/ui/unoobj/addruno.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -72,7 +72,7 @@ void ScAddressConversionObj::Notify( Sfx - } - } - --sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString ) -+sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention 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 ) ) - { -+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO; -+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) ) -+ aConv = ::formula::FormulaGrammar::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,24 @@ 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 ) ) - { -+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO; -+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) ) -+ aConv = ::formula::FormulaGrammar::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 ); -+ USHORT nFlags = SCA_VALID; -+ if( aConv != ::formula::FormulaGrammar::CONV_XL_A1 ) -+ nFlags |= SCA_TAB_3D; -+ aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv ); - aFormatStr.Append( aSecond ); - } - aRet <<= rtl::OUString( aFormatStr ); ---- scripting/source/dlgprov/dlgevtatt.cxx.old 2009-04-02 10:36:33.000000000 +0000 -+++ scripting/source/dlgprov/dlgevtatt.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -399,7 +399,7 @@ namespace dlgprov - - void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException ) - { -- ::osl::MutexGuard aGuard( getMutex() ); -+ //::osl::MutexGuard aGuard( getMutex() ); - - firing_impl( Event, NULL ); - } -@@ -409,7 +409,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 ); -@@ -653,7 +653,7 @@ namespace dlgprov - - void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException ) - { -- ::osl::MutexGuard aGuard( getMutex() ); -+ //::osl::MutexGuard aGuard( getMutex() ); - - firing_impl( aScriptEvent, NULL ); - } -@@ -663,7 +663,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 ); ---- scripting/source/dlgprov/dlgprov.cxx.old 2009-04-02 10:36:33.000000000 +0000 -+++ scripting/source/dlgprov/dlgprov.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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() ) - { -@@ -656,7 +664,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 ) ---- svtools/inc/bindablecontrolhelper.hxx.old 1970-01-01 00:00:00.000000000 +0000 -+++ svtools/inc/bindablecontrolhelper.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -0,0 +1,62 @@ -+/************************************************************************* -+ * -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * Copyright 2008 by Sun Microsystems, Inc. -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile: imageresourceaccess.hxx,v $ -+ * $Revision: 1.5 $ -+ * -+ * This file is part of OpenOffice.org. -+ * -+ * OpenOffice.org is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License version 3 -+ * only, as published by the Free Software Foundation. -+ * -+ * OpenOffice.org is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Lesser General Public License version 3 for more details -+ * (a copy is included in the LICENSE file that accompanied this code). -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * version 3 along with OpenOffice.org. If not, see -+ * <http://www.openoffice.org/license.html> -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+#ifndef SVTOOLS_INC_BINDABLECONTROL_HXX -+#define SVTOOLS_INC_BINDABLECONTROL_HXX -+ -+#include "svtools/svtdllapi.h" -+ -+#include <com/sun/star/frame/XModel.hpp> -+//........................................................................ -+namespace svt -+{ -+//........................................................................ -+ -+ //==================================================================== -+ //= GraphicAccess -+ //==================================================================== -+ /** helper class for obtaining streams (which also can be used with the ImageProducer) -+ from a resource -+ */ -+ class BindableControlHelper -+ { -+ private: -+ BindableControlHelper(); // never implemented -+ -+ public: -+ SVT_DLLPUBLIC static void ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource ); -+ }; -+ -+//........................................................................ -+} // namespace svt -+//........................................................................ -+ -+#endif // DBA14_SVTOOLS_INC_IMAGERESOURCEACCESS_HXX -+ ---- svtools/prj/d.lst.old 2009-04-02 11:06:22.000000000 +0000 -+++ svtools/prj/d.lst 2009-04-06 16:41:59.000000000 +0000 -@@ -172,6 +172,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools - ..\inc\svtools\logindlg.hxx %_DEST%\inc%_EXT%\svtools\logindlg.hxx - ..\inc\svtools\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx - ..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx -+..\inc\bindablecontrolhelper.hxx %_DEST%\inc%_EXT%\svtools\bindablecontrolhelper.hxx - ..\inc\svtools\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx - ..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx - ..\inc\svtools\genericunodialog.hxx %_DEST%\inc%_EXT%\svtools\genericunodialog.hxx ---- svtools/source/misc/bindablecontrolhelper.cxx.old 1970-01-01 00:00:00.000000000 +0000 -+++ svtools/source/misc/bindablecontrolhelper.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -0,0 +1,162 @@ -+/************************************************************************* -+ * -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * Copyright 2008 by Sun Microsystems, Inc. -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile: imageresourceaccess.cxx,v $ -+ * $Revision: 1.5 $ -+ * -+ * This file is part of OpenOffice.org. -+ * -+ * OpenOffice.org is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License version 3 -+ * only, as published by the Free Software Foundation. -+ * -+ * OpenOffice.org is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Lesser General Public License version 3 for more details -+ * (a copy is included in the LICENSE file that accompanied this code). -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * version 3 along with OpenOffice.org. If not, see -+ * <http://www.openoffice.org/license.html> -+ * for a copy of the LGPLv3 License. -+ * -+ ************************************************************************/ -+ -+// MARKER(update_precomp.py): autogen include statement, do not remove -+#include "precompiled_svtools.hxx" -+#include "bindablecontrolhelper.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/form/binding/XListEntrySource.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <com/sun/star/container/XNameAccess.hpp> -+#include <com/sun/star/table/CellRangeAddress.hpp> -+#include <com/sun/star/sheet/XCellRangeReferrer.hpp> -+#include <com/sun/star/sheet/XCellRangeAddressable.hpp> -+#include <com/sun/star/lang/XMultiServiceFactory.hpp> -+#include <com/sun/star/table/CellAddress.hpp> -+#include <com/sun/star/beans/NamedValue.hpp> -+ -+//........................................................................ -+namespace svt -+{ -+//........................................................................ -+ -+#ifndef C2U -+#define C2U(cChar) rtl::OUString::createFromAscii(cChar) -+#endif -+ -+ using namespace ::com::sun::star; -+ -+bool lcl_isNamedRange( const rtl::OUString& sAddress, const uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress ) -+{ -+ bool bRes = false; -+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges")); -+ uno::Reference< sheet::XCellRangeReferrer > xReferrer; -+ try -+ { -+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW ); -+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY ); -+ } -+ catch( uno::Exception& /*e*/ ) -+ { -+ // do nothing -+ } -+ if ( xReferrer.is() ) -+ { -+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY ); -+ if ( xRangeAddressable.is() ) -+ { -+ aAddress = xRangeAddressable->getRangeAddress(); -+ bRes = true; -+ } -+ } -+ return bRes; -+} -+ -+ -+void -+BindableControlHelper::ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, 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( rObj, 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 ); -+ } -+ else if ( xBindable.is() ) // reset it -+ xBindable->setValueBinding( uno::Reference< form::binding::XValueBinding >() ); -+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rObj, 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() ) -+ { -+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) ) -+ { -+ // 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 ); -+ } -+ else if ( xListEntrySink.is() ) // reset -+ xListEntrySink->setListEntrySource( uno::Reference< form::binding::XListEntrySource >() ); -+ -+} -+ -+//........................................................................ -+} // namespace svt -+//........................................................................ -+ ---- svtools/source/misc/makefile.mk.old 2009-04-02 11:06:13.000000000 +0000 -+++ svtools/source/misc/makefile.mk 2009-04-06 16:41:59.000000000 +0000 -@@ -85,6 +85,7 @@ SLOFILES=\ - $(SLO)$/lockfilecommon.obj \ - $(SLO)$/sharecontrolfile.obj \ - $(SLO)$/documentlockfile.obj \ -+ $(SLO)$/bindablecontrolhelper.obj \ - $(SLO)$/langtab.obj - - # --- Targets ------------------------------------------------------- ---- svx/inc/svx/msocximex.hxx.old 2009-04-06 16:41:59.000000000 +0000 -+++ svx/inc/svx/msocximex.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -405,6 +405,8 @@ public: - sal_uInt32 nGroupNameLen; - sal_uInt32 nUnknown10; - -+ rtl::OUString msCtrlSource; -+ rtl::OUString msRowSource; - char *pValue; - char *pCaption; - char *pGroupName; -@@ -490,6 +492,8 @@ struct ContainerRecord - - ::rtl::OUString cName; - ::rtl::OUString controlTip; -+ ::rtl::OUString sCtrlSource; -+ ::rtl::OUString sRowSource; - - sal_uInt32 nTop; - sal_uInt32 nLeft; -@@ -916,7 +920,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); -@@ -1017,7 +1022,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; -@@ -1042,7 +1047,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; ---- svx/source/msfilter/msocximex.cxx.old 2009-04-06 16:41:59.000000000 +0000 -+++ svx/source/msfilter/msocximex.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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> -@@ -86,6 +90,14 @@ - #include <comphelper/componentcontext.hxx> - #include <unotools/streamwrap.hxx> - -+#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> -+#include <com/sun/star/sheet/XCellRangeReferrer.hpp> -+ - #ifndef C2S - #define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar)) - #endif -@@ -636,14 +648,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 -@@ -1425,6 +1445,99 @@ sal_Bool OCX_ImageButton::Export(SvStora - return WriteContents(xContents,rPropSet,rSize); - } - -+bool lcl_isNamedRange( const rtl::OUString& sAddress, uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress ) -+{ -+ bool bRes = false; -+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges")); -+ uno::Reference< sheet::XCellRangeReferrer > xReferrer; -+ try -+ { -+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW ); -+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY ); -+ } -+ catch( uno::Exception& /*e*/ ) -+ { -+ // do nothing -+ } -+ if ( xReferrer.is() ) -+ { -+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY ); -+ if ( xRangeAddressable.is() ) -+ { -+ aAddress = xRangeAddressable->getRangeAddress(); -+ bRes = true; -+ } -+ } -+ return bRes; -+} -+ -+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() ) -+ { -+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) ) -+ { -+ // 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) -@@ -1457,11 +1570,20 @@ sal_Bool OCX_OptionButton::Import(com::s - aTmp <<= ImportSpecEffect( nSpecialEffect ); - rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp); - -- if (pValue && !bSetInDialog) -+ if (pValue) - { - INT16 nTmp = pValue[0]-0x30; - aTmp <<= nTmp; -- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp); -+ if (!bSetInDialog) -+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp); -+ else -+ { -+ // dialog ( but we might be using the form model ) -+ if ( rPropSet->getPropertySetInfo()->hasPropertyByName( WW8_ASCII2STR("DefaultState") ) ) -+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp); -+ else -+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp); -+ } - } - // If this is a dialog control then we need to set a groupname *always* - rtl::OUString sGroupName = lclCreateOUString( pGroupName, nGroupNameLen ); -@@ -1509,11 +1631,14 @@ sal_Bool OCX_OptionButton::Import(com::s - aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen ); - rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp); - } -+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL ); -+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource ); - if ( sImageUrl.getLength() ) - { - aTmp <<= sImageUrl; - rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp); - } -+ - aFontData.Import(rPropSet); - return sal_True; - } -@@ -2630,7 +2755,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; - } -@@ -3419,15 +3545,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 -@@ -4062,7 +4202,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); -@@ -4605,11 +4745,14 @@ sal_Bool OCX_CheckBox::Import(com::sun:: - aTmp <<= ImportSpecEffect( nSpecialEffect ); - rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp); - -- if (pValue && !bSetInDialog) -+ if (pValue) - { - INT16 nTmp=pValue[0]-0x30; - aTmp <<= nTmp; -- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp); -+ if ( !bSetInDialog ) -+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp); -+ else -+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp); - } - - if (pCaption) ---- toolkit/inc/toolkit/controls/dialogcontrol.hxx.old 2009-04-06 16:41:46.000000000 +0000 -+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -52,6 +52,7 @@ - #include <cppuhelper/basemutex.hxx> - #include <list> - #include <map> -+#include <com/sun/star/graphic/XGraphicObject.hpp> - - // ---------------------------------------------------- - // class UnoControlDialogModel -@@ -92,7 +93,9 @@ private: - - AllGroups maGroups; - sal_Bool mbGroupsUpToDate; -- -+ -+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; -+ bool mbAdjustingGraphic; - protected: - ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; - ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); -@@ -179,6 +182,8 @@ public: - protected: - void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel ); - void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel ); -+ // ::cppu::OPropertySetHelper -+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); - - void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor ); - ---- toolkit/inc/toolkit/controls/unocontrols.hxx.old 2009-04-02 10:49:37.000000000 +0000 -+++ toolkit/inc/toolkit/controls/unocontrols.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -225,7 +225,6 @@ private: - bool mbAdjustingGraphic; - - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; -- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ); - protected: - ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } - ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } ---- toolkit/source/controls/dialogcontrol.cxx.old 2009-04-06 16:41:46.000000000 +0000 -+++ toolkit/source/controls/dialogcontrol.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -90,6 +90,8 @@ using namespace toolkit; - //HELPER - ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl ); - -+uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL ); -+ - struct LanguageDependentProp - { - const char* pPropName; -@@ -115,7 +117,7 @@ namespace - } - return s_aLanguageDependentProperties; - } -- -+ - static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) - { - uno::Reference< graphic::XGraphic > xGraphic; -@@ -265,7 +267,7 @@ static const ::rtl::OUString& getStepPro - UnoControlDialogModel::UnoControlDialogModel() - :maContainerListeners( *this ) - ,maChangeListeners ( GetMutex() ) -- ,mbGroupsUpToDate( sal_False ) -+ ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ) - { - ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); - // ImplRegisterProperty( BASEPROPERTY_BORDER ); -@@ -294,7 +296,7 @@ UnoControlDialogModel::UnoControlDialogM - , UnoControlDialogModel_Base( rModel ) - , maContainerListeners( *this ) - , maChangeListeners ( GetMutex() ) -- , mbGroupsUpToDate( sal_False ) -+ , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ) - { - } - -@@ -325,6 +327,40 @@ Sequence< Type > UnoControlDialogModel:: - return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel ); - } - -+void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) -+{ -+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue ); -+ try -+ { -+ switch ( nHandle ) -+ { -+ case BASEPROPERTY_IMAGEURL: -+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) ) -+ { -+ mbAdjustingGraphic = true; -+ ::rtl::OUString sImageURL; -+ OSL_VERIFY( rValue >>= sImageURL ); -+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) ); -+ mbAdjustingGraphic = false; -+ } -+ break; -+ -+ case BASEPROPERTY_GRAPHIC: -+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) ) -+ { -+ mbAdjustingGraphic = true; -+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) ); -+ mbAdjustingGraphic = false; -+ } -+ break; -+ } -+ } -+ catch( const ::com::sun::star::uno::Exception& ) -+ { -+ OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" ); -+ } -+} -+ - Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const - { - Any aAny; -@@ -1668,17 +1704,16 @@ void UnoDialogControl::PrepareWindowDesc - // can lead to overwrites we have to set the graphic property - // before the propertiesChangeEvents are sent! - ::rtl::OUString aImageURL; -- Reference< graphic::XGraphic > xGraphic; - if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) && - ( aImageURL.getLength() > 0 )) - { -- ::rtl::OUString absoluteUrl = -+ aImageURL = - getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ), - ImplGetPropertyValue( PROPERTY_IMAGEURL )); - -- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl ); -- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True ); - } -+ if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 ) -+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True ); - } - - void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException) -@@ -1910,18 +1945,16 @@ void UnoDialogControl::ImplModelProperti - if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 )) - { - ::rtl::OUString aImageURL; -- Reference< graphic::XGraphic > xGraphic; - if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) && - ( aImageURL.getLength() > 0 )) - { -- ::rtl::OUString absoluteUrl = -+ aImageURL = - getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ), - ImplGetPropertyValue( PROPERTY_IMAGEURL )); - -- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl ); - } - -- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True ); -+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True ); - break; - } - } -@@ -2120,10 +2153,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; ---- toolkit/source/controls/unocontrols.cxx.old 2009-04-02 10:49:35.000000000 +0000 -+++ toolkit/source/controls/unocontrols.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -580,7 +580,7 @@ uno::Any ImageProducerControlModel::Impl - - return UnoControlModel::ImplGetDefaultValue( nPropId ); - } -- uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) -+ uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL ) - { - uno::Reference< graphic::XGraphic > xGraphic; - -@@ -590,10 +590,10 @@ uno::Any ImageProducerControlModel::Impl - rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ); - // get the DefaultContext - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); -- mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID ); -+ rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID ); - } - else // linked -- mxGrfObj = NULL; // release the GraphicObject -+ rxGrfObj = NULL; // release the GraphicObject - - if ( !_rURL.getLength() ) - return xGraphic; -@@ -634,7 +634,7 @@ void SAL_CALL ImageProducerControlModel: - mbAdjustingGraphic = true; - ::rtl::OUString sImageURL; - OSL_VERIFY( rValue >>= sImageURL ); -- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) ); -+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) ); - mbAdjustingGraphic = false; - } - break; ---- xmlscript/inc/xmlscript/xmldlg_imexp.hxx.old 2009-04-02 10:57:46.000000000 +0000 -+++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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) ); - - } ---- xmlscript/source/xmldlg_imexp/exp_share.hxx.old 2009-04-02 10:57:46.000000000 +0000 -+++ xmlscript/source/xmldlg_imexp/exp_share.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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) ); ---- xmlscript/source/xmldlg_imexp/imp_share.hxx.old 2009-04-02 10:57:46.000000000 +0000 -+++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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 > ---- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx.old 2009-04-02 10:57:46.000000000 +0000 -+++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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; ---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx.old 2009-04-06 16:41:46.000000000 +0000 -+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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,66 @@ 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() ) -+ { -+ try -+ { -+ 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; -+ 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( uno::Exception& ) -+ { -+ } -+ } -+ Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY ); -+ if ( xEntrySink.is() ) -+ { -+ Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY ); -+ if ( xListSource.is() ) -+ { -+ try -+ { -+ 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 ); -+ } -+ catch( uno::Exception& ) -+ { -+ } -+ } -+ } -+ -+} - static inline bool readBorderProps( - ElementDescriptor * element, Style & style ) - { -@@ -209,7 +278,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 +319,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 +346,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 +381,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 +421,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 +479,7 @@ void ElementDescriptor::readRadioButtonM - break; - } - } -+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this ); - readEvents(); - } - //__________________________________________________________________________________________________ -@@ -581,7 +652,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 +671,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(); ---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx.old 2009-04-02 10:57:46.000000000 +0000 -+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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") ) ) ) - { ---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx.old 2009-04-06 16:41:46.000000000 +0000 -+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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") ), ---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx.old 2009-04-02 10:57:46.000000000 +0000 -+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -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 ) ) ); - } - - } |