update ooo310-m15
[ooovba.git] / applied_patches / 0366-enhanced-form-userform-controls.diff
blob33e8b351146916bf977abdfc48b873ad0083dc8d
1 --- basctl/source/basicide/baside3.cxx.old 2009-04-02 10:56:36.000000000 +0000
2 +++ basctl/source/basicide/baside3.cxx 2009-04-06 16:41:59.000000000 +0000
3 @@ -112,7 +112,7 @@ DialogWindow::DialogWindow( Window* pPar
5 InitSettings( TRUE, TRUE, TRUE );
7 - pEditor = new DlgEditor();
8 + pEditor = new DlgEditor( rDocument.getDocument() );
9 pEditor->SetWindow( this );
10 pEditor->SetDialog( xDialogModel );
12 @@ -724,7 +724,7 @@ BOOL DialogWindow::SaveDialog()
13 Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
14 OSL_ASSERT( xProps.is() );
15 OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
16 - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
17 + Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
18 Reference< XInputStream > xInput( xISP->createInputStream() );
20 Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
21 @@ -942,7 +942,7 @@ void DialogWindow::StoreData()
22 Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
23 OSL_ASSERT( xProps.is() );
24 OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
25 - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
26 + Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
27 xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
30 --- basctl/source/basicide/basides3.cxx.old 2009-04-02 10:56:36.000000000 +0000
31 +++ basctl/source/basicide/basides3.cxx 2009-04-06 16:41:59.000000000 +0000
32 @@ -98,7 +98,7 @@ DialogWindow* BasicIDEShell::CreateDlgWi
33 Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
34 OSL_ASSERT( xProps.is() );
35 OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
36 - ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
37 + ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.getDocument() );
38 LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
40 // new dialog window
41 --- basctl/source/basicide/moduldlg.cxx.old 2009-04-02 10:56:36.000000000 +0000
42 +++ basctl/source/basicide/moduldlg.cxx 2009-04-06 16:41:59.000000000 +0000
43 @@ -315,7 +315,7 @@ void BasicIDEShell::CopyDialogResources(
44 Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
45 OSL_ASSERT( xProps.is() );
46 OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
47 - ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
48 + ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.getDocument() );
50 if( xDialogModel.is() )
52 @@ -332,7 +332,7 @@ void BasicIDEShell::CopyDialogResources(
54 LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
56 - io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
57 + io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.getDocument() );
61 --- basctl/source/basicide/scriptdocument.cxx.old 2009-04-02 10:56:36.000000000 +0000
62 +++ basctl/source/basicide/scriptdocument.cxx 2009-04-06 16:41:59.000000000 +0000
63 @@ -661,7 +661,7 @@ namespace basctl
64 if ( !_rxExistingDialogModel.is() )
66 Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
67 - ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext() );
68 + ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), getDocument() );
71 // set new name as property
72 @@ -669,7 +669,7 @@ namespace basctl
73 xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
75 // export dialog model
76 - xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
77 + xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
78 aElement <<= xISP;
81 @@ -772,7 +772,7 @@ namespace basctl
82 xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
84 // export dialog model
85 - _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
86 + _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
88 // insert dialog into library
89 xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
90 --- basctl/source/dlged/dlged.cxx.old 2009-04-02 10:56:34.000000000 +0000
91 +++ basctl/source/dlged/dlged.cxx 2009-04-06 16:41:59.000000000 +0000
92 @@ -208,7 +208,7 @@ BOOL DlgEditor::RemarkDialog()
94 //----------------------------------------------------------------------------
96 -DlgEditor::DlgEditor()
97 +DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
98 :pHScroll(NULL)
99 ,pVScroll(NULL)
100 ,pDlgEdModel(NULL)
101 @@ -230,6 +230,7 @@ DlgEditor::DlgEditor()
102 ,bCreateOK(TRUE)
103 ,bDialogModelChanged(FALSE)
104 ,mnPaintGuard(0)
105 + ,m_xDocument( xModel )
107 pDlgEdModel = new DlgEdModel();
108 pDlgEdModel->GetItemPool().FreezeIdRanges();
109 @@ -838,7 +839,7 @@ void DlgEditor::Copy()
110 Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
111 OSL_ASSERT( xProps.is() );
112 OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
113 - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
114 + Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
115 Reference< XInputStream > xStream( xISP->createInputStream() );
116 Sequence< sal_Int8 > DialogModelBytes;
117 implCopyStreamToByteSequence( xStream, DialogModelBytes );
118 @@ -871,7 +872,7 @@ void DlgEditor::Copy()
119 uno::Reference< resource::XStringResourceManager >
120 xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
121 LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
122 - Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
123 + Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
124 Reference< XInputStream > xStream2( xISP2->createInputStream() );
125 Sequence< sal_Int8 > NoResourceDialogModelBytes;
126 implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
127 @@ -1017,7 +1018,7 @@ void DlgEditor::Paste()
128 Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
129 OSL_ASSERT( xProps.is() );
130 OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
131 - ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
132 + ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext, m_xDocument );
135 // get control models from clipboard dialog model
136 --- basctl/source/inc/dlged.hxx.old 2009-04-02 10:56:36.000000000 +0000
137 +++ basctl/source/inc/dlged.hxx 2009-04-06 16:41:59.000000000 +0000
138 @@ -35,6 +35,7 @@
139 #include <com/sun/star/awt/XControlContainer.hpp>
140 #include <com/sun/star/datatransfer/DataFlavor.hpp>
141 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
142 +#include <com/sun/star/frame/XModel.hpp>
143 #include <tools/link.hxx>
144 #include <tools/gen.hxx>
145 #include <vcl/timer.hxx>
146 @@ -129,9 +130,11 @@ protected:
147 BOOL bDialogModelChanged;
148 Timer aMarkTimer;
149 long mnPaintGuard;
150 + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
152 + DlgEditor(); // not implemented
153 public:
154 - DlgEditor();
155 + DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
156 ~DlgEditor();
158 void SetWindow( Window* pWindow );
159 --- basic/source/classes/eventatt.cxx.old 2009-04-02 10:49:17.000000000 +0000
160 +++ basic/source/classes/eventatt.cxx 2009-04-06 16:41:59.000000000 +0000
161 @@ -58,7 +58,10 @@
162 #include <com/sun/star/awt/XDialogProvider.hpp>
164 #include <com/sun/star/frame/XModel.hpp>
166 +#include <com/sun/star/frame/XDesktop.hpp>
167 +#include <com/sun/star/container/XEnumerationAccess.hpp>
168 +#include <basic/basicmanagerrepository.hxx>
169 +#include <basic/basmgr.hxx>
170 //==================================================================================================
172 #include <xmlscript/xmldlg_imexp.hxx>
173 @@ -458,6 +461,43 @@ Any implFindDialogLibForDialog( const An
174 return aRetDlgLibAny;
177 +Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, StarBASIC*& pFoundBasic )
179 + Any aDlgLibAny;
180 + // Find dialog library for dialog, direct access is not possible here
181 + StarBASIC* pStartedBasic = (StarBASIC*)pBasic;
182 + SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
183 + SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
185 + SbxObject* pSearchBasic1 = NULL;
186 + SbxObject* pSearchBasic2 = NULL;
187 + if( pParentParentBasic )
189 + pSearchBasic1 = pParentBasic;
190 + pSearchBasic2 = pParentParentBasic;
192 + else
194 + pSearchBasic1 = pStartedBasic;
195 + pSearchBasic2 = pParentBasic;
197 + if( pSearchBasic1 )
199 + aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
201 + if ( aDlgLibAny.hasValue() )
202 + pFoundBasic = (StarBASIC*)pSearchBasic1;
204 + else if( pSearchBasic2 )
206 + aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
207 + if ( aDlgLibAny.hasValue() )
208 + pFoundBasic = (StarBASIC*)pSearchBasic2;
211 + return aDlgLibAny;
214 static ::rtl::OUString aDecorationPropName =
215 ::rtl::OUString::createFromAscii( "Decoration" );
216 static ::rtl::OUString aTitlePropName =
217 @@ -537,39 +577,51 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
221 - // Find dialog library for dialog, direct access is not possible here
222 - StarBASIC* pStartedBasic = pINST->GetBasic();
223 - SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
224 - SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
226 - SbxObject* pSearchBasic1 = NULL;
227 - SbxObject* pSearchBasic2 = NULL;
228 - if( pParentParentBasic )
230 - pSearchBasic1 = pParentBasic;
231 - pSearchBasic2 = pParentParentBasic;
233 - else
235 - pSearchBasic1 = pStartedBasic;
236 - pSearchBasic2 = pParentBasic;
239 Any aDlgLibAny;
240 - if( pSearchBasic1 )
242 - aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
243 - if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
244 - aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
248 + bool bDocDialog = false;
249 + StarBASIC* pFoundBasic = NULL;
250 OSL_TRACE("About to try get a hold of ThisComponent");
251 - Reference< frame::XModel > xModel = getModelFromBasic( pStartedBasic ) ;
252 - Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pStartedBasic, xModel );
253 + Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
254 + aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
255 + // If we found the dialog then it belongs to the Search basic
256 + if ( !pFoundBasic )
258 + Reference< frame::XDesktop > xDesktop( xMSF->createInstance
259 + ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
260 + UNO_QUERY );
261 + Reference< container::XEnumeration > xModels;
262 + if ( xDesktop.is() )
264 + Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
265 + if ( xComponents.is() )
266 + xModels.set( xComponents->createEnumeration(), UNO_QUERY );
267 + if ( xModels.is() )
269 + while ( xModels->hasMoreElements() )
271 + Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
272 + if ( xNextModel.is() )
274 + BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
275 + if ( pMgr )
276 + aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
277 + if ( aDlgLibAny.hasValue() )
279 + bDocDialog = true;
280 + xModel = xNextModel;
281 + break;
282 + }
288 + if ( pFoundBasic )
289 + bDocDialog = pFoundBasic->IsDocBasic();
290 + Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
292 Sequence< Any > aArgs( 4 );
293 - aArgs[ 0 ] <<= xModel;
294 + aArgs[ 0 ] <<= bDocDialog ? xModel : uno::Reference< uno::XInterface >();
295 aArgs[ 1 ] <<= xInput;
296 aArgs[ 2 ] = aDlgLibAny;
297 aArgs[ 3 ] <<= xScriptListener;
298 --- basic/source/uno/dlgcont.cxx.old 2009-04-06 16:41:59.000000000 +0000
299 +++ basic/source/uno/dlgcont.cxx 2009-04-06 16:41:59.000000000 +0000
300 @@ -322,7 +322,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
302 try {
303 // start parsing
304 - xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
305 + xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
306 xParser->parseStream( source );
308 catch( Exception& )
309 @@ -336,7 +336,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
311 // Create InputStream, TODO: Implement own InputStreamProvider
312 // to avoid creating the DialogModel here!
313 - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
314 + Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
315 aRetAny <<= xISP;
316 return aRetAny;
318 --- extensions/source/propctrlr/defaultforminspection.cxx.old 2009-04-02 10:51:17.000000000 +0000
319 +++ extensions/source/propctrlr/defaultforminspection.cxx 2009-04-06 16:41:59.000000000 +0000
320 @@ -154,7 +154,7 @@ namespace pcr
321 { "com.sun.star.form.inspection.EventHandler", false },
323 // a handler which introduces virtual properties for binding controls to spreadsheet cells
324 - { "com.sun.star.form.inspection.CellBindingPropertyHandler", true },
325 + { "com.sun.star.form.inspection.CellBindingPropertyHandler", false },
327 // properties related to binding to an XForms DOM node
328 { "com.sun.star.form.inspection.XMLFormsPropertyHandler", true },
329 --- sc/inc/addruno.hxx.old 2009-04-02 10:45:43.000000000 +0000
330 +++ sc/inc/addruno.hxx 2009-04-06 16:41:59.000000000 +0000
331 @@ -50,7 +50,7 @@ private:
332 sal_Int32 nRefSheet;
333 sal_Bool bIsRange;
335 - sal_Bool ParseUIString( const String& rUIString );
336 + sal_Bool ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv = ::formula::FormulaGrammar::CONV_OOO );
338 public:
340 --- sc/inc/unonames.hxx.old 2009-04-06 16:41:58.000000000 +0000
341 +++ sc/inc/unonames.hxx 2009-04-06 16:41:59.000000000 +0000
342 @@ -599,6 +599,7 @@
343 #define SC_UNONAME_ADDRESS "Address"
344 #define SC_UNONAME_UIREPR "UserInterfaceRepresentation"
345 #define SC_UNONAME_PERSREPR "PersistentRepresentation"
346 +#define SC_UNONAME_XL_A1_REPR "XL_A1_Representation"
347 #define SC_UNONAME_REFSHEET "ReferenceSheet"
349 // --> PB 2004-08-23 #i33095# Security Options
350 --- sc/source/ui/unoobj/addruno.cxx.old 2009-04-02 10:45:26.000000000 +0000
351 +++ sc/source/ui/unoobj/addruno.cxx 2009-04-06 16:41:59.000000000 +0000
352 @@ -72,7 +72,7 @@ void ScAddressConversionObj::Notify( Sfx
356 -sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
357 +sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv )
359 if (!pDocShell)
360 return sal_False;
361 @@ -81,7 +81,7 @@ sal_Bool ScAddressConversionObj::ParseUI
362 sal_Bool bSuccess = sal_False;
363 if ( bIsRange )
365 - USHORT nResult = aRange.ParseAny( rUIString, pDoc );
366 + USHORT nResult = aRange.ParseAny( rUIString, pDoc, eConv );
367 if ( nResult & SCA_VALID )
369 if ( ( nResult & SCA_TAB_3D ) == 0 )
370 @@ -95,7 +95,7 @@ sal_Bool ScAddressConversionObj::ParseUI
372 else
374 - USHORT nResult = aRange.aStart.Parse( rUIString, pDoc );
375 + USHORT nResult = aRange.aStart.Parse( rUIString, pDoc, eConv );
376 if ( nResult & SCA_VALID )
378 if ( ( nResult & SCA_TAB_3D ) == 0 )
379 @@ -119,6 +119,7 @@ uno::Reference<beans::XPropertySetInfo>
381 {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0 },
382 {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
383 + {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
384 {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
385 {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
386 {0,0,0,0,0,0}
387 @@ -132,6 +133,7 @@ uno::Reference<beans::XPropertySetInfo>
389 {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
390 {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
391 + {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
392 {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
393 {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
394 {0,0,0,0,0,0}
395 @@ -193,8 +195,11 @@ void SAL_CALL ScAddressConversionObj::se
396 bSuccess = ParseUIString( aUIString );
399 - else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
400 + else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
402 + ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
403 + if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
404 + aConv = ::formula::FormulaGrammar::CONV_XL_A1;
405 // parse the file format string
406 rtl::OUString sRepresentation;
407 if (aValue >>= sRepresentation)
408 @@ -215,7 +220,7 @@ void SAL_CALL ScAddressConversionObj::se
411 // parse the rest like a UI string
412 - bSuccess = ParseUIString( aUIString );
413 + bSuccess = ParseUIString( aUIString, aConv );
416 else
417 @@ -268,17 +273,24 @@ uno::Any SAL_CALL ScAddressConversionObj
418 aRange.aStart.Format( aFormatStr, nFlags, pDoc );
419 aRet <<= rtl::OUString( aFormatStr );
421 - else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
422 + else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
424 + ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
425 + if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
426 + aConv = ::formula::FormulaGrammar::CONV_XL_A1;
428 // generate file format string - always include sheet
429 String aFormatStr;
430 - aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc );
431 + aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
432 if ( bIsRange )
434 // manually concatenate range so both parts always have the sheet name
435 aFormatStr.Append( (sal_Unicode) ':' );
436 String aSecond;
437 - aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc );
438 + USHORT nFlags = SCA_VALID;
439 + if( aConv != ::formula::FormulaGrammar::CONV_XL_A1 )
440 + nFlags |= SCA_TAB_3D;
441 + aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
442 aFormatStr.Append( aSecond );
444 aRet <<= rtl::OUString( aFormatStr );
445 --- scripting/source/dlgprov/dlgevtatt.cxx.old 2009-04-02 10:36:33.000000000 +0000
446 +++ scripting/source/dlgprov/dlgevtatt.cxx 2009-04-06 16:41:59.000000000 +0000
447 @@ -399,7 +399,7 @@ namespace dlgprov
449 void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException )
451 - ::osl::MutexGuard aGuard( getMutex() );
452 + //::osl::MutexGuard aGuard( getMutex() );
454 firing_impl( Event, NULL );
456 @@ -409,7 +409,7 @@ namespace dlgprov
457 Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
458 throw ( reflection::InvocationTargetException, RuntimeException )
460 - ::osl::MutexGuard aGuard( getMutex() );
461 + //::osl::MutexGuard aGuard( getMutex() );
463 Any aReturn;
464 firing_impl( Event, &aReturn );
465 @@ -653,7 +653,7 @@ namespace dlgprov
467 void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
469 - ::osl::MutexGuard aGuard( getMutex() );
470 + //::osl::MutexGuard aGuard( getMutex() );
472 firing_impl( aScriptEvent, NULL );
474 @@ -663,7 +663,7 @@ namespace dlgprov
475 Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
476 throw ( reflection::InvocationTargetException, RuntimeException )
478 - ::osl::MutexGuard aGuard( getMutex() );
479 + //::osl::MutexGuard aGuard( getMutex() );
481 Any aReturn;
482 firing_impl( aScriptEvent, &aReturn );
483 --- scripting/source/dlgprov/dlgprov.cxx.old 2009-04-02 10:36:33.000000000 +0000
484 +++ scripting/source/dlgprov/dlgprov.cxx 2009-04-06 16:41:59.000000000 +0000
485 @@ -196,7 +196,15 @@ static ::rtl::OUString aResourceResolver
486 Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
487 xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
489 - ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
490 + // #TODO we really need to detect the source of the Dialog, is it
491 + // located in the document or not. m_xModel need not be the location of
492 + // the dialog. E.g. if the dialog was created from basic ( then we just
493 + // can't tell where its from )
494 + // If we are happy to always substitute the form model for the awt
495 + // one then maybe the presence of a document model is enough to trigger
496 + // swapping out the models ( or perhaps we only want to do this
497 + // for vba mode ) there are a number of feasible and valid possibilities
498 + ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
499 // Set resource property
500 if( xStringResourceManager.is() )
502 @@ -656,7 +664,10 @@ static ::rtl::OUString aResourceResolver
503 aArguments[0] >>= m_xModel;
504 m_BasicInfo.reset( new BasicRTLParams() );
505 m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
506 - m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
507 + // allow null mxDlgLib, a document dialog instantiated from
508 + // from application basic is unable to provide ( or find ) it's
509 + // Library
510 + aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib;
511 // leave the possibility to optionally allow the old dialog creation
512 // to use the new XScriptListener ( which converts the old style macro
513 // to a SF url )
514 --- svtools/inc/bindablecontrolhelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
515 +++ svtools/inc/bindablecontrolhelper.hxx 2009-04-06 16:41:59.000000000 +0000
516 @@ -0,0 +1,62 @@
517 +/*************************************************************************
519 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
520 + *
521 + * Copyright 2008 by Sun Microsystems, Inc.
523 + * OpenOffice.org - a multi-platform office productivity suite
525 + * $RCSfile: imageresourceaccess.hxx,v $
526 + * $Revision: 1.5 $
528 + * This file is part of OpenOffice.org.
530 + * OpenOffice.org is free software: you can redistribute it and/or modify
531 + * it under the terms of the GNU Lesser General Public License version 3
532 + * only, as published by the Free Software Foundation.
534 + * OpenOffice.org is distributed in the hope that it will be useful,
535 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
536 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
537 + * GNU Lesser General Public License version 3 for more details
538 + * (a copy is included in the LICENSE file that accompanied this code).
540 + * You should have received a copy of the GNU Lesser General Public License
541 + * version 3 along with OpenOffice.org. If not, see
542 + * <http://www.openoffice.org/license.html>
543 + * for a copy of the LGPLv3 License.
545 + ************************************************************************/
547 +#ifndef SVTOOLS_INC_BINDABLECONTROL_HXX
548 +#define SVTOOLS_INC_BINDABLECONTROL_HXX
550 +#include "svtools/svtdllapi.h"
552 +#include <com/sun/star/frame/XModel.hpp>
553 +//........................................................................
554 +namespace svt
556 +//........................................................................
558 + //====================================================================
559 + //= GraphicAccess
560 + //====================================================================
561 + /** helper class for obtaining streams (which also can be used with the ImageProducer)
562 + from a resource
563 + */
564 + class BindableControlHelper
566 + private:
567 + BindableControlHelper(); // never implemented
569 + public:
570 + 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 );
571 + };
573 +//........................................................................
574 +} // namespace svt
575 +//........................................................................
577 +#endif // DBA14_SVTOOLS_INC_IMAGERESOURCEACCESS_HXX
579 --- svtools/prj/d.lst.old 2009-04-02 11:06:22.000000000 +0000
580 +++ svtools/prj/d.lst 2009-04-06 16:41:59.000000000 +0000
581 @@ -172,6 +172,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools
582 ..\inc\svtools\logindlg.hxx %_DEST%\inc%_EXT%\svtools\logindlg.hxx
583 ..\inc\svtools\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx
584 ..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx
585 +..\inc\bindablecontrolhelper.hxx %_DEST%\inc%_EXT%\svtools\bindablecontrolhelper.hxx
586 ..\inc\svtools\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx
587 ..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx
588 ..\inc\svtools\genericunodialog.hxx %_DEST%\inc%_EXT%\svtools\genericunodialog.hxx
589 --- svtools/source/misc/bindablecontrolhelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
590 +++ svtools/source/misc/bindablecontrolhelper.cxx 2009-04-06 16:41:59.000000000 +0000
591 @@ -0,0 +1,162 @@
592 +/*************************************************************************
594 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
595 + *
596 + * Copyright 2008 by Sun Microsystems, Inc.
598 + * OpenOffice.org - a multi-platform office productivity suite
600 + * $RCSfile: imageresourceaccess.cxx,v $
601 + * $Revision: 1.5 $
603 + * This file is part of OpenOffice.org.
605 + * OpenOffice.org is free software: you can redistribute it and/or modify
606 + * it under the terms of the GNU Lesser General Public License version 3
607 + * only, as published by the Free Software Foundation.
609 + * OpenOffice.org is distributed in the hope that it will be useful,
610 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
611 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
612 + * GNU Lesser General Public License version 3 for more details
613 + * (a copy is included in the LICENSE file that accompanied this code).
615 + * You should have received a copy of the GNU Lesser General Public License
616 + * version 3 along with OpenOffice.org. If not, see
617 + * <http://www.openoffice.org/license.html>
618 + * for a copy of the LGPLv3 License.
620 + ************************************************************************/
622 +// MARKER(update_precomp.py): autogen include statement, do not remove
623 +#include "precompiled_svtools.hxx"
624 +#include "bindablecontrolhelper.hxx"
625 +#include <com/sun/star/form/binding/XBindableValue.hpp>
626 +#include <com/sun/star/form/binding/XValueBinding.hpp>
627 +#include <com/sun/star/form/binding/XListEntrySink.hpp>
628 +#include <com/sun/star/form/binding/XListEntrySource.hpp>
629 +#include <com/sun/star/beans/XPropertySet.hpp>
630 +#include <com/sun/star/container/XNameAccess.hpp>
631 +#include <com/sun/star/table/CellRangeAddress.hpp>
632 +#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
633 +#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
634 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
635 +#include <com/sun/star/table/CellAddress.hpp>
636 +#include <com/sun/star/beans/NamedValue.hpp>
638 +//........................................................................
639 +namespace svt
641 +//........................................................................
643 +#ifndef C2U
644 +#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
645 +#endif
647 + using namespace ::com::sun::star;
649 +bool lcl_isNamedRange( const rtl::OUString& sAddress, const uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
651 + bool bRes = false;
652 + const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
653 + uno::Reference< sheet::XCellRangeReferrer > xReferrer;
654 + try
656 + uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
657 + uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
658 + xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
660 + catch( uno::Exception& /*e*/ )
662 + // do nothing
664 + if ( xReferrer.is() )
666 + uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
667 + if ( xRangeAddressable.is() )
669 + aAddress = xRangeAddressable->getRangeAddress();
670 + bRes = true;
673 + return bRes;
677 +void
678 +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 )
680 +// XBindable etc.
681 + uno::Reference< lang::XMultiServiceFactory > xFac;
682 + if ( xModel.is() )
683 + xFac.set( xModel, uno::UNO_QUERY );
684 + uno::Reference< form::binding::XBindableValue > xBindable( rObj, uno::UNO_QUERY );
685 + if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
688 + // OOo address structures
689 + // RefCell - convert from XL
690 + // pretend we converted the imported string address into the
691 + // appropriate address structure
692 + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
693 + table::CellAddress aAddress;
694 + if ( xConvertor.is() )
696 + // we need this service to properly convert XL notation also
697 + // Should be easy to extend
698 + xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
699 + xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
702 + beans::NamedValue aArg1;
703 + aArg1.Name = C2U("BoundCell");
704 + aArg1.Value <<= aAddress;
706 + uno::Sequence< uno::Any > aArgs(1);
707 + aArgs[ 0 ] <<= aArg1;
709 + uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
710 + xBindable->setValueBinding( xBinding );
712 + else if ( xBindable.is() ) // reset it
713 + xBindable->setValueBinding( uno::Reference< form::binding::XValueBinding >() );
714 + uno::Reference< form::binding::XListEntrySink > xListEntrySink( rObj, uno::UNO_QUERY );
715 + if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
718 + // OOo address structures
719 + // RefCell - convert from XL
720 + // pretend we converted the imported string address into the
721 + // appropriate address structure
722 + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
723 + table::CellRangeAddress aAddress;
724 + if ( xConvertor.is() )
726 + if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
728 + // we need this service to properly convert XL notation also
729 + // Should be easy to extend
730 + xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
731 + xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
735 + beans::NamedValue aArg1;
736 + aArg1.Name = C2U("CellRange");
737 + aArg1.Value <<= aAddress;
739 + uno::Sequence< uno::Any > aArgs(1);
740 + aArgs[ 0 ] <<= aArg1;
742 + uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
743 + xListEntrySink->setListEntrySource( xSource );
745 + else if ( xListEntrySink.is() ) // reset
746 + xListEntrySink->setListEntrySource( uno::Reference< form::binding::XListEntrySource >() );
750 +//........................................................................
751 +} // namespace svt
752 +//........................................................................
754 --- svtools/source/misc/makefile.mk.old 2009-04-02 11:06:13.000000000 +0000
755 +++ svtools/source/misc/makefile.mk 2009-04-06 16:41:59.000000000 +0000
756 @@ -85,6 +85,7 @@ SLOFILES=\
757 $(SLO)$/lockfilecommon.obj \
758 $(SLO)$/sharecontrolfile.obj \
759 $(SLO)$/documentlockfile.obj \
760 + $(SLO)$/bindablecontrolhelper.obj \
761 $(SLO)$/langtab.obj
763 # --- Targets -------------------------------------------------------
764 --- svx/inc/svx/msocximex.hxx.old 2009-04-06 16:41:59.000000000 +0000
765 +++ svx/inc/svx/msocximex.hxx 2009-04-06 16:41:59.000000000 +0000
766 @@ -405,6 +405,8 @@ public:
767 sal_uInt32 nGroupNameLen;
768 sal_uInt32 nUnknown10;
770 + rtl::OUString msCtrlSource;
771 + rtl::OUString msRowSource;
772 char *pValue;
773 char *pCaption;
774 char *pGroupName;
775 @@ -490,6 +492,8 @@ struct ContainerRecord
777 ::rtl::OUString cName;
778 ::rtl::OUString controlTip;
779 + ::rtl::OUString sCtrlSource;
780 + ::rtl::OUString sRowSource;
782 sal_uInt32 nTop;
783 sal_uInt32 nLeft;
784 @@ -916,7 +920,8 @@ public:
785 OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton"))
787 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
788 - msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
789 + //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
790 + msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
791 mnBackColor = 0x80000005L;
792 mnForeColor = 0x80000008L;
793 aFontData.SetHasAlign(TRUE);
794 @@ -1017,7 +1022,7 @@ class OCX_ComboBox : public OCX_ModernCo
795 public:
796 OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){
797 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
798 - msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel");
799 + msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
800 mnBackColor = 0x80000005;
801 mnForeColor = 0x80000008;
802 nBorderColor = 0x80000006;
803 @@ -1042,7 +1047,8 @@ class OCX_ListBox : public OCX_ModernCon
804 public:
805 OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){
806 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
807 - msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
808 + //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
809 + msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
810 mnBackColor = 0x80000005;
811 mnForeColor = 0x80000008;
812 nBorderColor = 0x80000006;
813 --- svx/source/msfilter/msocximex.cxx.old 2009-04-06 16:41:59.000000000 +0000
814 +++ svx/source/msfilter/msocximex.cxx 2009-04-06 16:41:59.000000000 +0000
815 @@ -49,6 +49,10 @@
816 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
817 #include <com/sun/star/form/XFormsSupplier.hpp>
818 #include <com/sun/star/form/XForm.hpp>
819 +#include <com/sun/star/form/binding/XBindableValue.hpp>
820 +#include <com/sun/star/form/binding/XValueBinding.hpp>
821 +#include <com/sun/star/form/binding/XListEntrySink.hpp>
822 +#include <com/sun/star/form/binding/XListEntrySource.hpp>
823 #include <com/sun/star/form/FormComponentType.hpp>
824 #include <com/sun/star/awt/FontWeight.hpp>
825 #include <com/sun/star/awt/FontSlant.hpp>
826 @@ -86,6 +90,14 @@
827 #include <comphelper/componentcontext.hxx>
828 #include <unotools/streamwrap.hxx>
830 +#include <com/sun/star/beans/NamedValue.hpp>
831 +#include <com/sun/star/table/XCellRange.hpp>
832 +#include <com/sun/star/table/CellRangeAddress.hpp>
833 +#include <com/sun/star/table/CellAddress.hpp>
834 +#include <com/sun/star/sheet/XSpreadsheetView.hpp>
835 +#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
836 +#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
838 #ifndef C2S
839 #define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
840 #endif
841 @@ -636,14 +648,22 @@ class ContainerRecReader
842 if( nCtrlSrcBufSize > 0 )
844 ReadAlign( pS, pS->Tell() - nStartPos, 4 );
845 - pS->SeekRel( nCtrlSrcBufSize );
846 + std::auto_ptr< sal_Char > pCtrlSrcName;
847 + pCtrlSrcName.reset( new sal_Char[ nCtrlSrcBufSize ] );
848 + pS->Read( pCtrlSrcName.get(), nCtrlSrcBufSize );
849 + rec.sCtrlSource = lclCreateOUString( pCtrlSrcName.get(), nCtrlSrcLen );
850 + OSL_TRACE("*** *** *** ControlSourceName -> %s ", rtl::OUStringToOString( rec.sCtrlSource, RTL_TEXTENCODING_UTF8 ).getStr() );
852 // row source name
853 sal_uInt32 nRowSrcBufSize = lclGetBufferSize( nRowSrcLen );
854 if( nRowSrcBufSize > 0 )
856 ReadAlign( pS, pS->Tell() - nStartPos, 4 );
857 - pS->SeekRel( nRowSrcBufSize );
858 + std::auto_ptr< sal_Char > pRowSrcName;
859 + pRowSrcName.reset( new sal_Char[ nRowSrcBufSize ] );
860 + pS->Read( pRowSrcName.get(), nRowSrcBufSize );
861 + rec.sRowSource = lclCreateOUString( pRowSrcName.get(), nRowSrcLen );
862 + OSL_TRACE("*** *** *** RowSourceName -> %s ", rtl::OUStringToOString( rec.sRowSource, RTL_TEXTENCODING_UTF8 ).getStr() );
865 // seek to end of data
866 @@ -1425,6 +1445,99 @@ sal_Bool OCX_ImageButton::Export(SvStora
867 return WriteContents(xContents,rPropSet,rSize);
870 +bool lcl_isNamedRange( const rtl::OUString& sAddress, uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
872 + bool bRes = false;
873 + const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
874 + uno::Reference< sheet::XCellRangeReferrer > xReferrer;
875 + try
877 + uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
878 + uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
879 + xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
881 + catch( uno::Exception& /*e*/ )
883 + // do nothing
885 + if ( xReferrer.is() )
887 + uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
888 + if ( xRangeAddressable.is() )
890 + aAddress = xRangeAddressable->getRangeAddress();
891 + bRes = true;
894 + return bRes;
897 +void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
899 +// XBindable etc.
900 + uno::Reference< lang::XMultiServiceFactory > xFac;
901 + if ( xModel.is() )
902 + xFac.set( xModel, uno::UNO_QUERY );
903 + uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
904 + if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
907 + // OOo address structures
908 + // RefCell - convert from XL
909 + // pretend we converted the imported string address into the
910 + // appropriate address structure
911 + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
912 + table::CellAddress aAddress;
913 + if ( xConvertor.is() )
915 + // we need this service to properly convert XL notation also
916 + // Should be easy to extend
917 + xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
918 + xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
921 + beans::NamedValue aArg1;
922 + aArg1.Name = C2U("BoundCell");
923 + aArg1.Value <<= aAddress;
925 + uno::Sequence< uno::Any > aArgs(1);
926 + aArgs[ 0 ] <<= aArg1;
928 + uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
929 + xBindable->setValueBinding( xBinding );
931 + uno::Reference< form::binding::XListEntrySink > xListEntrySink( rPropSet, uno::UNO_QUERY );
932 + if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
935 + // OOo address structures
936 + // RefCell - convert from XL
937 + // pretend we converted the imported string address into the
938 + // appropriate address structure
939 + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
940 + table::CellRangeAddress aAddress;
941 + if ( xConvertor.is() )
943 + if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
945 + // we need this service to properly convert XL notation also
946 + // Should be easy to extend
947 + xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
948 + xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
952 + beans::NamedValue aArg1;
953 + aArg1.Name = C2U("CellRange");
954 + aArg1.Value <<= aAddress;
956 + uno::Sequence< uno::Any > aArgs(1);
957 + aArgs[ 0 ] <<= aArg1;
959 + uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
960 + xListEntrySink->setListEntrySource( xSource );
964 sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
965 com::sun::star::beans::XPropertySet> &rPropSet)
966 @@ -1457,11 +1570,20 @@ sal_Bool OCX_OptionButton::Import(com::s
967 aTmp <<= ImportSpecEffect( nSpecialEffect );
968 rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
970 - if (pValue && !bSetInDialog)
971 + if (pValue)
973 INT16 nTmp = pValue[0]-0x30;
974 aTmp <<= nTmp;
975 - rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
976 + if (!bSetInDialog)
977 + rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
978 + else
980 + // dialog ( but we might be using the form model )
981 + if ( rPropSet->getPropertySetInfo()->hasPropertyByName( WW8_ASCII2STR("DefaultState") ) )
982 + rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
983 + else
984 + rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
987 // If this is a dialog control then we need to set a groupname *always*
988 rtl::OUString sGroupName = lclCreateOUString( pGroupName, nGroupNameLen );
989 @@ -1509,11 +1631,14 @@ sal_Bool OCX_OptionButton::Import(com::s
990 aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen );
991 rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
993 + uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
994 + lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
995 if ( sImageUrl.getLength() )
997 aTmp <<= sImageUrl;
998 rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
1001 aFontData.Import(rPropSet);
1002 return sal_True;
1004 @@ -2630,7 +2755,8 @@ sal_Bool OCX_ListBox::Import(com::sun::s
1006 aTmp <<= ImportColor( nBorderColor );
1007 rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
1009 + uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
1010 + lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
1011 aFontData.Import(rPropSet);
1012 return sal_True;
1014 @@ -3419,15 +3545,29 @@ void OCX_ContainerControl::ProcessContro
1016 // A container control needs to read the f stream in
1017 // the folder ( substorage ) associated with this control
1018 - if ( rec.nTypeIdent == FRAME ||
1019 - rec.nTypeIdent == MULTIPAGE||
1020 - rec.nTypeIdent == PAGE )
1021 + switch ( rec.nTypeIdent )
1023 - OCX_ContainerControl* pContainer =
1024 - static_cast< OCX_ContainerControl* >( pControl );
1025 - oStream = pContainer->getContainerStream();
1026 + case FRAME:
1027 + case MULTIPAGE:
1028 + case PAGE:
1030 + OCX_ContainerControl* pContainer =
1031 + static_cast< OCX_ContainerControl* >( pControl );
1032 + oStream = pContainer->getContainerStream();
1033 + break;
1035 + case LISTBOX:
1036 + case OPTIONBUTTON:
1037 + case COMBOBOX:
1039 + OCX_ModernControl* pList = static_cast< OCX_ModernControl* >( pControl );
1040 + if ( pList )
1042 + pList->msCtrlSource = rec.sCtrlSource;
1043 + pList->msRowSource = rec.sRowSource;
1048 pControl->sName = rec.cName;
1049 pControl->msToolTip = rec.controlTip;
1050 // Position of controls is relative to the container
1051 @@ -4062,7 +4202,7 @@ sal_Bool OCX_UserForm::Import(
1052 OCX_ContainerControl::Import( xPropSet );
1054 uno::Reference<io::XInputStreamProvider> xSource =
1055 - xmlscript::exportDialogModel(mxParent, mxCtx);
1056 + xmlscript::exportDialogModel(mxParent, mxCtx, pDocSh->GetModel() );
1057 uno::Any aSourceAny(uno::makeAny(xSource));
1058 if (rLib->hasByName(sName))
1059 rLib->replaceByName(sName, aSourceAny);
1060 @@ -4605,11 +4745,14 @@ sal_Bool OCX_CheckBox::Import(com::sun::
1061 aTmp <<= ImportSpecEffect( nSpecialEffect );
1062 rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
1064 - if (pValue && !bSetInDialog)
1065 + if (pValue)
1067 INT16 nTmp=pValue[0]-0x30;
1068 aTmp <<= nTmp;
1069 - rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
1070 + if ( !bSetInDialog )
1071 + rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
1072 + else
1073 + rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
1076 if (pCaption)
1077 --- toolkit/inc/toolkit/controls/dialogcontrol.hxx.old 2009-04-06 16:41:46.000000000 +0000
1078 +++ toolkit/inc/toolkit/controls/dialogcontrol.hxx 2009-04-06 16:41:59.000000000 +0000
1079 @@ -52,6 +52,7 @@
1080 #include <cppuhelper/basemutex.hxx>
1081 #include <list>
1082 #include <map>
1083 +#include <com/sun/star/graphic/XGraphicObject.hpp>
1085 // ----------------------------------------------------
1086 // class UnoControlDialogModel
1087 @@ -92,7 +93,9 @@ private:
1089 AllGroups maGroups;
1090 sal_Bool mbGroupsUpToDate;
1093 + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
1094 + bool mbAdjustingGraphic;
1095 protected:
1096 ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
1097 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
1098 @@ -179,6 +182,8 @@ public:
1099 protected:
1100 void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
1101 void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
1102 + // ::cppu::OPropertySetHelper
1103 + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
1105 void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
1107 --- toolkit/inc/toolkit/controls/unocontrols.hxx.old 2009-04-02 10:49:37.000000000 +0000
1108 +++ toolkit/inc/toolkit/controls/unocontrols.hxx 2009-04-06 16:41:59.000000000 +0000
1109 @@ -225,7 +225,6 @@ private:
1110 bool mbAdjustingGraphic;
1112 ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
1113 - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
1114 protected:
1115 ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
1116 ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
1117 --- toolkit/source/controls/dialogcontrol.cxx.old 2009-04-06 16:41:46.000000000 +0000
1118 +++ toolkit/source/controls/dialogcontrol.cxx 2009-04-06 16:41:59.000000000 +0000
1119 @@ -90,6 +90,8 @@ using namespace toolkit;
1120 //HELPER
1121 ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
1123 +uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL );
1125 struct LanguageDependentProp
1127 const char* pPropName;
1128 @@ -115,7 +117,7 @@ namespace
1130 return s_aLanguageDependentProperties;
1134 static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
1136 uno::Reference< graphic::XGraphic > xGraphic;
1137 @@ -265,7 +267,7 @@ static const ::rtl::OUString& getStepPro
1138 UnoControlDialogModel::UnoControlDialogModel()
1139 :maContainerListeners( *this )
1140 ,maChangeListeners ( GetMutex() )
1141 - ,mbGroupsUpToDate( sal_False )
1142 + ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
1144 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
1145 // ImplRegisterProperty( BASEPROPERTY_BORDER );
1146 @@ -294,7 +296,7 @@ UnoControlDialogModel::UnoControlDialogM
1147 , UnoControlDialogModel_Base( rModel )
1148 , maContainerListeners( *this )
1149 , maChangeListeners ( GetMutex() )
1150 - , mbGroupsUpToDate( sal_False )
1151 + , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
1155 @@ -325,6 +327,40 @@ Sequence< Type > UnoControlDialogModel::
1156 return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
1159 +void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
1161 + UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
1162 + try
1164 + switch ( nHandle )
1166 + case BASEPROPERTY_IMAGEURL:
1167 + if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
1169 + mbAdjustingGraphic = true;
1170 + ::rtl::OUString sImageURL;
1171 + OSL_VERIFY( rValue >>= sImageURL );
1172 + setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
1173 + mbAdjustingGraphic = false;
1175 + break;
1177 + case BASEPROPERTY_GRAPHIC:
1178 + if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
1180 + mbAdjustingGraphic = true;
1181 + setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) );
1182 + mbAdjustingGraphic = false;
1184 + break;
1187 + catch( const ::com::sun::star::uno::Exception& )
1189 + OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" );
1193 Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
1195 Any aAny;
1196 @@ -1668,17 +1704,16 @@ void UnoDialogControl::PrepareWindowDesc
1197 // can lead to overwrites we have to set the graphic property
1198 // before the propertiesChangeEvents are sent!
1199 ::rtl::OUString aImageURL;
1200 - Reference< graphic::XGraphic > xGraphic;
1201 if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
1202 ( aImageURL.getLength() > 0 ))
1204 - ::rtl::OUString absoluteUrl =
1205 + aImageURL =
1206 getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
1207 ImplGetPropertyValue( PROPERTY_IMAGEURL ));
1209 - xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
1210 - ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
1212 + if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
1213 + ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
1216 void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
1217 @@ -1910,18 +1945,16 @@ void UnoDialogControl::ImplModelProperti
1218 if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
1220 ::rtl::OUString aImageURL;
1221 - Reference< graphic::XGraphic > xGraphic;
1222 if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
1223 ( aImageURL.getLength() > 0 ))
1225 - ::rtl::OUString absoluteUrl =
1226 + aImageURL =
1227 getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
1228 ImplGetPropertyValue( PROPERTY_IMAGEURL ));
1230 - xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
1233 - ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
1234 + ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
1235 break;
1238 @@ -2120,10 +2153,17 @@ throw (RuntimeException)
1240 if ( url.getLength() > 0 )
1242 - INetURLObject urlObj(baseLocation);
1243 - urlObj.removeSegment();
1244 - baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
1245 - ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
1246 + // Don't adjust GraphicObject url(s)
1247 + if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
1249 + INetURLObject urlObj(baseLocation);
1250 + urlObj.removeSegment();
1251 + baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
1252 + ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
1254 + else
1255 + ret = url;
1259 return ret;
1260 --- toolkit/source/controls/unocontrols.cxx.old 2009-04-02 10:49:35.000000000 +0000
1261 +++ toolkit/source/controls/unocontrols.cxx 2009-04-06 16:41:59.000000000 +0000
1262 @@ -580,7 +580,7 @@ uno::Any ImageProducerControlModel::Impl
1264 return UnoControlModel::ImplGetDefaultValue( nPropId );
1266 - uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
1267 + uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL )
1269 uno::Reference< graphic::XGraphic > xGraphic;
1271 @@ -590,10 +590,10 @@ uno::Any ImageProducerControlModel::Impl
1272 rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
1273 // get the DefaultContext
1274 ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
1275 - mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
1276 + rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
1278 else // linked
1279 - mxGrfObj = NULL; // release the GraphicObject
1280 + rxGrfObj = NULL; // release the GraphicObject
1282 if ( !_rURL.getLength() )
1283 return xGraphic;
1284 @@ -634,7 +634,7 @@ void SAL_CALL ImageProducerControlModel:
1285 mbAdjustingGraphic = true;
1286 ::rtl::OUString sImageURL;
1287 OSL_VERIFY( rValue >>= sImageURL );
1288 - setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
1289 + setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
1290 mbAdjustingGraphic = false;
1292 break;
1293 --- xmlscript/inc/xmlscript/xmldlg_imexp.hxx.old 2009-04-02 10:57:46.000000000 +0000
1294 +++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx 2009-04-06 16:41:59.000000000 +0000
1295 @@ -30,6 +30,8 @@
1296 #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
1297 #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
1299 +#include <com/sun/star/frame/XModel.hpp>
1301 #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HXX_
1302 #include <com/sun/star/container/XNameContainer.hpp>
1303 #endif
1304 @@ -54,7 +56,9 @@ void SAL_CALL exportDialogModel(
1305 ::com::sun::star::uno::Reference<
1306 ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut,
1307 ::com::sun::star::uno::Reference<
1308 - ::com::sun::star::container::XNameContainer > const & xDialogModel )
1309 + ::com::sun::star::container::XNameContainer > const & xDialogModel,
1310 + ::com::sun::star::uno::Reference<
1311 + ::com::sun::star::frame::XModel > const & xDocument )
1312 SAL_THROW( (::com::sun::star::uno::Exception) );
1314 //==============================================================================
1315 @@ -63,7 +67,9 @@ SAL_CALL importDialogModel(
1316 ::com::sun::star::uno::Reference<
1317 ::com::sun::star::container::XNameContainer > const & xDialogModel,
1318 ::com::sun::star::uno::Reference<
1319 - ::com::sun::star::uno::XComponentContext > const & xContext )
1320 + ::com::sun::star::uno::XComponentContext > const & xContext,
1321 + ::com::sun::star::uno::Reference<
1322 + ::com::sun::star::frame::XModel > const & xDocument )
1323 SAL_THROW( (::com::sun::star::uno::Exception) );
1325 // additional functions for convenience
1326 @@ -74,7 +80,9 @@ SAL_CALL exportDialogModel(
1327 ::com::sun::star::uno::Reference<
1328 ::com::sun::star::container::XNameContainer > const & xDialogModel,
1329 ::com::sun::star::uno::Reference<
1330 - ::com::sun::star::uno::XComponentContext > const & xContext )
1331 + ::com::sun::star::uno::XComponentContext > const & xContext,
1332 + ::com::sun::star::uno::Reference<
1333 + ::com::sun::star::frame::XModel > const & xDocument )
1334 SAL_THROW( (::com::sun::star::uno::Exception) );
1336 //==============================================================================
1337 @@ -84,7 +92,9 @@ void SAL_CALL importDialogModel(
1338 ::com::sun::star::uno::Reference<
1339 ::com::sun::star::container::XNameContainer > const & xDialogModel,
1340 ::com::sun::star::uno::Reference<
1341 - ::com::sun::star::uno::XComponentContext > const & xContext )
1342 + ::com::sun::star::uno::XComponentContext > const & xContext,
1343 + ::com::sun::star::uno::Reference<
1344 + ::com::sun::star::frame::XModel > const & xDocument )
1345 SAL_THROW( (::com::sun::star::uno::Exception) );
1348 --- xmlscript/source/xmldlg_imexp/exp_share.hxx.old 2009-04-02 10:57:46.000000000 +0000
1349 +++ xmlscript/source/xmldlg_imexp/exp_share.hxx 2009-04-06 16:41:59.000000000 +0000
1350 @@ -180,9 +180,9 @@ public:
1351 SAL_THROW( (css::uno::Exception) );
1352 void readCheckBoxModel( StyleBag * all_styles )
1353 SAL_THROW( (css::uno::Exception) );
1354 - void readRadioButtonModel( StyleBag * all_styles )
1355 + void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
1356 SAL_THROW( (css::uno::Exception) );
1357 - void readComboBoxModel( StyleBag * all_styles )
1358 + void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
1359 SAL_THROW( (css::uno::Exception) );
1360 void readCurrencyFieldModel( StyleBag * all_styles )
1361 SAL_THROW( (css::uno::Exception) );
1362 @@ -196,9 +196,9 @@ public:
1363 SAL_THROW( (css::uno::Exception) );
1364 void readGroupBoxModel( StyleBag * all_styles )
1365 SAL_THROW( (css::uno::Exception) );
1366 - void readImageControlModel( StyleBag * all_styles )
1367 + void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
1368 SAL_THROW( (css::uno::Exception) );
1369 - void readListBoxModel( StyleBag * all_styles )
1370 + void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
1371 SAL_THROW( (css::uno::Exception) );
1372 void readNumericFieldModel( StyleBag * all_styles )
1373 SAL_THROW( (css::uno::Exception) );
1374 --- xmlscript/source/xmldlg_imexp/imp_share.hxx.old 2009-04-02 10:57:46.000000000 +0000
1375 +++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2009-04-06 16:41:59.000000000 +0000
1376 @@ -131,6 +131,7 @@ struct DialogImport
1378 css::uno::Reference< css::container::XNameContainer > _xDialogModel;
1379 css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
1380 + css::uno::Reference< css::frame::XModel > _xDoc;
1382 sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
1384 @@ -164,16 +165,18 @@ public:
1385 inline DialogImport(
1386 css::uno::Reference<css::uno::XComponentContext> const & xContext,
1387 css::uno::Reference<css::container::XNameContainer>
1388 - const & xDialogModel )
1389 + const & xDialogModel,
1390 + css::uno::Reference<css::frame::XModel> const & xDoc )
1391 SAL_THROW( () )
1392 : _xContext( xContext )
1393 , _xDialogModel( xDialogModel )
1394 - , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
1395 + , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
1396 { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
1397 _xContext.is() ); }
1398 virtual ~DialogImport()
1399 SAL_THROW( () );
1401 + inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
1402 // XRoot
1403 virtual void SAL_CALL startDocument(
1404 css::uno::Reference< css::xml::input::XNamespaceMapping >
1405 --- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx.old 2009-04-02 10:57:46.000000000 +0000
1406 +++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx 2009-04-06 16:41:59.000000000 +0000
1407 @@ -44,6 +44,7 @@
1408 using namespace ::rtl;
1409 using namespace ::com::sun::star;
1410 using namespace ::com::sun::star::uno;
1411 +using namespace ::com::sun::star::frame;
1413 namespace xmlscript
1415 @@ -73,7 +74,8 @@ Reference< io::XInputStream > InputStrea
1416 //==================================================================================================
1417 Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
1418 Reference< container::XNameContainer > const & xDialogModel,
1419 - Reference< XComponentContext > const & xContext )
1420 + Reference< XComponentContext > const & xContext,
1421 + Reference< XModel > const & xDocument )
1422 SAL_THROW( (Exception) )
1424 Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
1425 @@ -98,7 +100,7 @@ Reference< io::XInputStreamProvider > SA
1427 Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
1428 xSource->setOutputStream( createOutputStream( &aBytes ) );
1429 - exportDialogModel( xHandler, xDialogModel );
1430 + exportDialogModel( xHandler, xDialogModel, xDocument );
1432 return new InputStreamProvider( aBytes );
1434 @@ -107,7 +109,8 @@ Reference< io::XInputStreamProvider > SA
1435 void SAL_CALL importDialogModel(
1436 Reference< io::XInputStream > xInput,
1437 Reference< container::XNameContainer > const & xDialogModel,
1438 - Reference< XComponentContext > const & xContext )
1439 + Reference< XComponentContext > const & xContext,
1440 + Reference< XModel > const & xDocument )
1441 SAL_THROW( (Exception) )
1443 Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
1444 @@ -129,7 +132,7 @@ void SAL_CALL importDialogModel(
1447 // error handler, entity resolver omitted for this helper function
1448 - xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
1449 + xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) );
1451 xml::sax::InputSource source;
1452 source.aInputStream = xInput;
1453 --- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx.old 2009-04-06 16:41:46.000000000 +0000
1454 +++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx 2009-04-06 16:41:59.000000000 +0000
1455 @@ -32,7 +32,16 @@
1456 #include "precompiled_xmlscript.hxx"
1457 #include "exp_share.hxx"
1459 +#include <com/sun/star/form/binding/XListEntrySink.hpp>
1460 +#include <com/sun/star/form/binding/XBindableValue.hpp>
1461 +#include <com/sun/star/form/binding/XValueBinding.hpp>
1462 +#include <com/sun/star/table/CellAddress.hpp>
1463 +#include <com/sun/star/table/CellRangeAddress.hpp>
1464 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
1465 +#include <com/sun/star/document/XStorageBasedDocument.hpp>
1466 +#include <com/sun/star/document/XGraphicObjectResolver.hpp>
1467 +#include <comphelper/componentcontext.hxx>
1468 +#include <comphelper/processfactory.hxx>
1471 using namespace ::com::sun::star;
1472 @@ -42,6 +51,66 @@ using ::rtl::OUString;
1473 namespace xmlscript
1476 +void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
1478 + Reference< lang::XMultiServiceFactory > xFac;
1479 + if ( xDocument.is() )
1480 + xFac.set( xDocument, uno::UNO_QUERY );
1482 + Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
1484 + if ( xFac.is() && xBinding.is() )
1486 + try
1488 + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
1489 + Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
1490 + if ( xBindable.is() )
1492 + table::CellAddress aAddress;
1493 + xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
1494 + xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
1495 + rtl::OUString sAddress;
1496 + xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
1497 + if ( sAddress.getLength() > 0 )
1498 + rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
1500 + OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
1504 + catch( uno::Exception& )
1508 + Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
1509 + if ( xEntrySink.is() )
1511 + Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
1512 + if ( xListSource.is() )
1514 + try
1516 + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
1518 + table::CellRangeAddress aAddress;
1519 + xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
1521 + rtl::OUString sAddress;
1522 + xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
1523 + xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
1524 + OSL_TRACE("**** cell range source list %s",
1525 + rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
1526 + if ( sAddress.getLength() > 0 );
1527 + rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
1529 + catch( uno::Exception& )
1536 static inline bool readBorderProps(
1537 ElementDescriptor * element, Style & style )
1539 @@ -209,7 +278,7 @@ void ElementDescriptor::readCheckBoxMode
1540 readEvents();
1542 //__________________________________________________________________________________________________
1543 -void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
1544 +void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
1545 SAL_THROW( (Exception) )
1547 // collect styles
1548 @@ -250,7 +319,8 @@ void ElementDescriptor::readComboBoxMode
1549 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
1550 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
1551 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
1553 + // Cell Range, Ref Cell etc.
1554 + lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
1555 // string item list
1556 Sequence< OUString > itemValues;
1557 if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
1558 @@ -276,7 +346,7 @@ void ElementDescriptor::readComboBoxMode
1559 readEvents();
1561 //__________________________________________________________________________________________________
1562 -void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
1563 +void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
1564 SAL_THROW( (Exception) )
1566 // collect styles
1567 @@ -311,7 +381,7 @@ void ElementDescriptor::readListBoxModel
1568 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
1569 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1570 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1572 + lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
1573 // string item list
1574 Sequence< OUString > itemValues;
1575 if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
1576 @@ -351,7 +421,7 @@ void ElementDescriptor::readListBoxModel
1577 readEvents();
1579 //__________________________________________________________________________________________________
1580 -void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
1581 +void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
1582 SAL_THROW( (Exception) )
1584 // collect styles
1585 @@ -409,6 +479,7 @@ void ElementDescriptor::readRadioButtonM
1586 break;
1589 + lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
1590 readEvents();
1592 //__________________________________________________________________________________________________
1593 @@ -581,7 +652,7 @@ void ElementDescriptor::readEditModel( S
1594 readEvents();
1596 //__________________________________________________________________________________________________
1597 -void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
1598 +void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
1599 SAL_THROW( (Exception) )
1601 // collect styles
1602 @@ -600,8 +671,31 @@ void ElementDescriptor::readImageControl
1603 readDefaults();
1604 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
1605 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
1606 - readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1607 - OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
1608 + rtl::OUString sURL;
1609 + _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
1611 + if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
1613 + Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
1615 + if ( xDocStorage.is() )
1617 + uno::Sequence< Any > aArgs( 1 );
1618 + aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
1620 + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
1621 + uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
1622 + aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
1623 + if ( xGraphicResolver.is() )
1625 + sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
1627 + }
1629 + if ( sURL.getLength() > 0 )
1631 + addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
1633 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1634 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1635 readEvents();
1636 --- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx.old 2009-04-02 10:57:46.000000000 +0000
1637 +++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx 2009-04-06 16:41:59.000000000 +0000
1638 @@ -1309,7 +1309,8 @@ void StyleBag::dump( Reference< xml::sax
1639 //==================================================================================================
1640 void SAL_CALL exportDialogModel(
1641 Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
1642 - Reference< container::XNameContainer > const & xDialogModel )
1643 + Reference< container::XNameContainer > const & xDialogModel,
1644 + Reference< frame::XModel > const & xDocument )
1645 SAL_THROW( (Exception) )
1647 StyleBag all_styles;
1648 @@ -1357,7 +1358,7 @@ void SAL_CALL exportDialogModel(
1649 xProps, xPropState,
1650 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
1651 xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1652 - pElem->readRadioButtonModel( &all_styles );
1653 + pElem->readRadioButtonModel( &all_styles, xDocument );
1654 pRadioGroup->addSubElement( xElem );
1656 else // no radio
1657 @@ -1386,7 +1387,7 @@ void SAL_CALL exportDialogModel(
1658 xProps, xPropState,
1659 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
1660 xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1661 - pElem->readComboBoxModel( &all_styles );
1662 + pElem->readComboBoxModel( &all_styles, xDocument );
1664 else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
1666 @@ -1394,7 +1395,7 @@ void SAL_CALL exportDialogModel(
1667 xProps, xPropState,
1668 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
1669 xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1670 - pElem->readListBoxModel( &all_styles );
1671 + pElem->readListBoxModel( &all_styles, xDocument );
1673 else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
1675 @@ -1435,7 +1436,7 @@ void SAL_CALL exportDialogModel(
1676 xProps, xPropState,
1677 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
1678 xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1679 - pElem->readImageControlModel( &all_styles );
1680 + pElem->readImageControlModel( &all_styles, xDocument );
1682 else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
1684 --- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx.old 2009-04-06 16:41:46.000000000 +0000
1685 +++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2009-04-06 16:41:59.000000000 +0000
1686 @@ -31,11 +31,19 @@
1687 // MARKER(update_precomp.py): autogen include statement, do not remove
1688 #include "precompiled_xmlscript.hxx"
1689 #include "imp_share.hxx"
1691 +#include <com/sun/star/form/binding/XBindableValue.hpp>
1692 +#include <com/sun/star/form/binding/XValueBinding.hpp>
1693 +#include <com/sun/star/form/binding/XListEntrySink.hpp>
1694 +#include <com/sun/star/beans/NamedValue.hpp>
1695 +#include <com/sun/star/table/CellAddress.hpp>
1696 +#include <com/sun/star/table/CellRangeAddress.hpp>
1697 #include <com/sun/star/beans/XPropertySet.hpp>
1698 #include <com/sun/star/beans/XPropertyState.hpp>
1699 +#include <com/sun/star/document/XStorageBasedDocument.hpp>
1700 +#include <com/sun/star/document/XGraphicObjectResolver.hpp>
1703 +#include <comphelper/componentcontext.hxx>
1704 +#include <comphelper/processfactory.hxx>
1705 using namespace ::com::sun::star;
1706 using namespace ::com::sun::star::uno;
1707 using ::rtl::OUString;
1708 @@ -43,6 +51,100 @@ using ::rtl::OUString;
1709 namespace xmlscript
1712 +// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
1713 +// of course we need to find a common home for this helper
1715 +bool IsPackageURL( const ::rtl::OUString& rURL )
1717 + // Some quick tests: Some may rely on the package structure!
1718 + sal_Int32 nLen = rURL.getLength();
1719 + if( (nLen > 0 && '/' == rURL[0]) )
1720 + // RFC2396 net_path or abs_path
1721 + return false;
1722 + else if( nLen > 1 && '.' == rURL[0] )
1724 + if( '.' == rURL[1] )
1725 + // ../: We are never going up one level, so we know
1726 + // it's not an external URI
1727 + return false;
1728 + else if( '/' == rURL[1] )
1729 + // we are remaining on a level, so it's an package URI
1730 + return true;
1733 + // Now check for a RFC2396 schema
1734 + sal_Int32 nPos = 1;
1735 + while( nPos < nLen )
1737 + switch( rURL[nPos] )
1739 + case '/':
1740 + // a relative path segement
1741 + return true;
1742 + case ':':
1743 + // a schema
1744 + return false;
1745 + default:
1746 + break;
1747 + // we don't care about any other characters
1749 + ++nPos;
1752 + return true;
1755 +void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
1757 + Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
1758 + if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
1760 + // Set up Celllink
1761 + if ( sLinkedCell.getLength() )
1763 + Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
1764 + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
1765 + if ( xBindable.is() && xConvertor.is() )
1767 + table::CellAddress aAddress;
1768 + xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
1769 + xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
1770 + beans::NamedValue aArg1;
1771 + aArg1.Name = OUSTR("BoundCell");
1772 + aArg1.Value <<= aAddress;
1774 + uno::Sequence< uno::Any > aArgs(1);
1775 + aArgs[ 0 ] <<= aArg1;
1777 + uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
1778 + xBindable->setValueBinding( xBinding );
1782 + // Set up CelllRange
1783 + if ( sCellRange.getLength() )
1785 + Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
1786 + Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
1787 + if ( xListEntrySink.is() && xConvertor.is() )
1789 + table::CellRangeAddress aAddress;
1790 + xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
1791 + xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
1792 + beans::NamedValue aArg1;
1793 + aArg1.Name = OUSTR("CellRange");
1794 + aArg1.Value <<= aAddress;
1796 + uno::Sequence< uno::Any > aArgs(1);
1797 + aArgs[ 0 ] <<= aArg1;
1799 + uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
1800 + xListEntrySink->setListEntrySource( xSource );
1806 // progessmeter
1807 //__________________________________________________________________________________________________
1808 Reference< xml::input::XElement > ProgressBarElement::startChildElement(
1809 @@ -1003,9 +1105,37 @@ void ImageControlElement::endElement()
1810 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
1811 OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
1812 _xAttributes );
1813 - ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1814 - OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
1815 - _xAttributes );
1816 + rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
1817 + Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
1819 + if ( xDocStorage.is() && IsPackageURL( sURL ) )
1821 + uno::Sequence< Any > aArgs( 1 );
1822 + aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
1824 + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
1825 + uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
1826 + aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
1828 + if ( xGraphicResolver.is() )
1830 + rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
1831 + aTmp += sURL;
1832 + sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
1833 + Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
1834 + // we must set the url while the graphic object ( held by the resolver is in scope )
1835 + if ( xProps.is() )
1836 + xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
1840 + else if ( sURL.getLength() > 0 )
1842 + Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
1843 + if ( xProps.is() )
1844 + xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
1847 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1848 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1849 _xAttributes );
1850 @@ -1338,10 +1468,24 @@ void TitledBoxElement::endElement()
1851 Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1852 Reference< xml::input::XAttributes > xAttributes(
1853 xRadio->getAttributes() );
1854 + OUString sLinkedCell;
1855 + OUString sCellRange;
1856 + OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
1857 + try
1859 + sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
1860 + // we should probably limit this to vba mode also ( leave for now )
1861 + if ( _pImport->getDocOwner().is() )
1862 + sService = OUSTR("com.sun.star.form.component.RadioButton");
1864 + catch( Exception& /*e*/ )
1869 ControlImportContext ctx(
1870 _pImport, getControlId( xAttributes ),
1871 - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1872 + sService );
1873 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1875 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1876 @@ -1393,7 +1537,7 @@ void TitledBoxElement::endElement()
1878 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1879 makeAny( nVal ) );
1881 + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
1882 ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1883 static_cast< RadioElement * >( xRadio.get() )->getEvents();
1884 ctx.importEvents( *radioEvents );
1885 @@ -1469,10 +1613,23 @@ void RadioGroupElement::endElement()
1886 Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1887 Reference< xml::input::XAttributes > xAttributes(
1888 xRadio->getAttributes() );
1889 + OUString sLinkedCell;
1890 + OUString sCellRange;
1891 + OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
1892 + try
1894 + sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
1895 + // we should probably limit this to vba mode also ( leave for now )
1896 + if ( _pImport->getDocOwner().is() )
1897 + sService = OUSTR("com.sun.star.form.component.RadioButton");
1899 + catch( Exception& /*e*/ )
1903 ControlImportContext ctx(
1904 _pImport, getControlId( xAttributes ),
1905 - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1906 + sService );
1907 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1909 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1910 @@ -1524,6 +1681,7 @@ void RadioGroupElement::endElement()
1911 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1912 makeAny( nVal ) );
1914 + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
1915 ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1916 static_cast< RadioElement * >( xRadio.get() )->getEvents();
1917 ctx.importEvents( *radioEvents );
1918 @@ -1644,9 +1802,26 @@ Reference< xml::input::XElement > MenuLi
1919 void MenuListElement::endElement()
1920 throw (xml::sax::SAXException, RuntimeException)
1922 + OUString sLinkedCell;
1923 + OUString sCellRange;
1924 + OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
1926 + // we should probably limit this to vba mode also ( leave for now )
1927 + if ( _pImport->getDocOwner().is() )
1928 + sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
1930 + try
1932 + sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
1933 + sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
1935 + catch( Exception& /*e*/ )
1938 ControlImportContext ctx(
1939 _pImport, getControlId( _xAttributes ),
1940 - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
1941 + //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
1942 + sListBoxService );
1943 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1945 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1946 @@ -1679,13 +1854,16 @@ void MenuListElement::endElement()
1947 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1948 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1949 _xAttributes );
1951 + // import cell-link and cell source range
1952 + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
1953 if (_popup.is())
1955 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1956 - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1957 + if ( !sCellRange.getLength() )
1958 + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1959 makeAny( p->getItemValues() ) );
1960 - xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
1961 + if ( !sLinkedCell.getLength() )
1962 + xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
1963 makeAny( p->getSelectedItems() ) );
1965 ctx.importEvents( _events );
1966 @@ -1731,9 +1909,26 @@ Reference< xml::input::XElement > ComboB
1967 void ComboBoxElement::endElement()
1968 throw (xml::sax::SAXException, RuntimeException)
1970 + OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
1972 + // we should probably limit this to vba mode also ( leave for now )
1973 + if ( _pImport->getDocOwner().is() )
1974 + sService = OUSTR("com.sun.star.form.component.ComboBox");
1976 + OUString sLinkedCell;
1977 + OUString sCellRange;
1978 + try
1980 + sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
1981 + sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
1983 + catch( Exception& /*e*/ )
1987 ControlImportContext ctx(
1988 _pImport, getControlId( _xAttributes ),
1989 - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
1990 + sService );
1991 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1993 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1994 @@ -1775,8 +1970,10 @@ void ComboBoxElement::endElement()
1995 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1996 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1997 _xAttributes );
1998 + // import cell-link and cell source range
1999 + importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
2001 - if (_popup.is())
2002 + if (_popup.is() && !sCellRange.getLength() )
2004 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
2005 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
2006 --- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx.old 2009-04-02 10:57:46.000000000 +0000
2007 +++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx 2009-04-06 16:41:59.000000000 +0000
2008 @@ -62,6 +62,7 @@
2010 using namespace ::com::sun::star;
2011 using namespace ::com::sun::star::uno;
2012 +using namespace ::com::sun::star::frame;
2013 using ::rtl::OUString;
2015 namespace xmlscript
2016 @@ -1879,12 +1880,13 @@ Reference< xml::input::XElement > Dialog
2017 //==================================================================================================
2018 Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
2019 Reference< container::XNameContainer > const & xDialogModel,
2020 - Reference< XComponentContext > const & xContext )
2021 + Reference< XComponentContext > const & xContext,
2022 + Reference< XModel > const & xDocument )
2023 SAL_THROW( (Exception) )
2025 return ::xmlscript::createDocumentHandler(
2026 static_cast< xml::input::XRoot * >(
2027 - new DialogImport( xContext, xDialogModel ) ) );
2028 + new DialogImport( xContext, xDialogModel, xDocument ) ) );