xref: /trunk/main/cui/source/dialogs/insdlg.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
30 
31 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
32 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
33 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
34 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
37 #include <comphelper/processfactory.hxx>
38 #include <com/sun/star/embed/EmbedStates.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/beans/PropertyValue.hpp>
41 #include <com/sun/star/embed/XInsertObjectDialog.hpp>
42 #include <com/sun/star/ucb/CommandAbortedException.hpp>
43 #include <com/sun/star/task/XInteractionHandler.hpp>
44 
45 #include "insdlg.hxx"
46 #include <dialmgr.hxx>
47 #include <svtools/sores.hxx>
48 
49 #include <stdio.h>
50 #include <tools/urlobj.hxx>
51 #include <tools/debug.hxx>
52 #include <svl/urihelper.hxx>
53 #include <svtools/svmedit.hxx>
54 #include <vcl/button.hxx>
55 #include <vcl/fixed.hxx>
56 #include <vcl/group.hxx>
57 #include <vcl/lstbox.hxx>
58 #include <vcl/msgbox.hxx>
59 #include <vcl/svapp.hxx>
60 #include <sot/clsids.hxx>
61 #include <sfx2/frmdescr.hxx>
62 #include <sfx2/viewsh.hxx>
63 #include <sfx2/filedlghelper.hxx>
64 #include <svl/ownlist.hxx>
65 #include <comphelper/seqstream.hxx>
66 
67 #include "svuidlg.hrc"
68 
69 #include <osl/file.hxx>
70 
71 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
72 #include <com/sun/star/container/XNameAccess.hpp>
73 #include <unotools/processfactory.hxx>
74 
75 using namespace ::com::sun::star;
76 using namespace ::com::sun::star::lang;
77 using namespace ::com::sun::star::uno;
78 using namespace ::com::sun::star::container;
79 using namespace ::com::sun::star::ui::dialogs;
80 using ::rtl::OUString;
81 
82 #define _SVSTDARR_STRINGSDTOR
83 #include <svl/svstdarr.hxx>
84 
85 
86 static String impl_getSvtResString( sal_uInt32 nId )
87 {
88     String aRet;
89     com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
90     ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale );
91     if( pMgr )
92     {
93         aRet = String( ResId( nId, *pMgr ) );
94         delete pMgr;
95     }
96     return aRet;
97 }
98 
99 sal_Bool InsertObjectDialog_Impl::IsCreateNew() const
100 {
101     return sal_False;
102 }
103 
104 uno::Reference< io::XInputStream > InsertObjectDialog_Impl::GetIconIfIconified( ::rtl::OUString* /*pGraphicMediaType*/ )
105 {
106 	return uno::Reference< io::XInputStream >();
107 }
108 
109 InsertObjectDialog_Impl::InsertObjectDialog_Impl( Window * pParent, const ResId & rResId, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage )
110  : ModalDialog( pParent, rResId )
111  , m_xStorage( xStorage )
112  , aCnt( m_xStorage )
113 {
114 }
115 
116 // -----------------------------------------------------------------------
117 
118 IMPL_LINK_INLINE_START( SvInsertOleDlg, DoubleClickHdl, ListBox *, EMPTYARG )
119 {
120 	EndDialog( RET_OK );
121 	return 0;
122 }
123 IMPL_LINK_INLINE_END( SvInsertOleDlg, DoubleClickHdl, ListBox *, pListBox )
124 
125 // -----------------------------------------------------------------------
126 
127 IMPL_LINK( SvInsertOleDlg, BrowseHdl, PushButton *, EMPTYARG )
128 {
129     Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
130     if( xFactory.is() )
131     {
132         Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY );
133         DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
134 
135         Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
136         Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
137         if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
138         {
139             Sequence< Any > aServiceType( 1 );
140             aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
141             xInit->initialize( aServiceType );
142 
143             // add filter
144             try
145             {
146                 xFilterMgr->appendFilter(
147                      OUString(),
148                      OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) )
149                      );
150             }
151             catch( IllegalArgumentException& )
152             {
153                 DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" );
154             }
155 
156             if( xFilePicker->execute() == ExecutableDialogResults::OK )
157             {
158                 Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
159 				INetURLObject aObj( aPathSeq[0] );
160 				aEdFilepath.SetText( aObj.PathToFileName() );
161             }
162         }
163     }
164 
165 	return 0;
166 }
167 
168 // -----------------------------------------------------------------------
169 
170 IMPL_LINK( SvInsertOleDlg, RadioHdl, RadioButton *, EMPTYARG )
171 {
172 	if ( aRbNewObject.IsChecked() )
173 	{
174 		aLbObjecttype.Show();
175 		aEdFilepath.Hide();
176 		aBtnFilepath.Hide();
177 		aCbFilelink.Hide();
178 		aGbObject.SetText( _aOldStr );
179 	}
180 	else
181 	{
182         aCbFilelink.Show();
183 		aLbObjecttype.Hide();
184 		aEdFilepath.Show();
185 		aBtnFilepath.Show();
186 		aCbFilelink.Show();
187 		aGbObject.SetText( aStrFile );
188 	}
189 	return 0;
190 }
191 
192 // -----------------------------------------------------------------------
193 
194 void SvInsertOleDlg::SelectDefault()
195 {
196 	aLbObjecttype.SelectEntryPos( 0 );
197 }
198 
199 // -----------------------------------------------------------------------
200 SvInsertOleDlg::SvInsertOleDlg
201 (
202     Window* pParent,
203     const Reference < embed::XStorage >& xStorage,
204     const SvObjectServerList* pServers
205 )
206     : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OLEOBJECT ), xStorage ),
207     aRbNewObject( this, CUI_RES( RB_NEW_OBJECT ) ),
208     aRbObjectFromfile( this, CUI_RES( RB_OBJECT_FROMFILE ) ),
209     aGbObject( this, CUI_RES( GB_OBJECT ) ),
210     aLbObjecttype( this, CUI_RES( LB_OBJECTTYPE ) ),
211     aEdFilepath( this, CUI_RES( ED_FILEPATH ) ),
212     aBtnFilepath( this, CUI_RES( BTN_FILEPATH ) ),
213     aCbFilelink( this, CUI_RES( CB_FILELINK ) ),
214     aOKButton1( this, CUI_RES( 1 ) ),
215     aCancelButton1( this, CUI_RES( 1 ) ),
216     aHelpButton1( this, CUI_RES( 1 ) ),
217     aStrFile( CUI_RES( STR_FILE ) ),
218     m_pServers( pServers )
219 {
220     FreeResource();
221 	_aOldStr = aGbObject.GetText();
222     aLbObjecttype.SetDoubleClickHdl( LINK( this, SvInsertOleDlg, DoubleClickHdl ) );
223 	aBtnFilepath.SetClickHdl( LINK( this, SvInsertOleDlg, BrowseHdl ) );
224 	Link aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
225 	aRbNewObject.SetClickHdl( aLink );
226 	aRbObjectFromfile.SetClickHdl( aLink );
227 	aRbNewObject.Check( sal_True );
228 	RadioHdl( NULL );
229 	aBtnFilepath.SetAccessibleRelationMemberOf(&aGbObject);
230 }
231 
232 short SvInsertOleDlg::Execute()
233 {
234     short nRet = RET_OK;
235 	SvObjectServerList  aObjS;
236     if ( !m_pServers )
237 	{
238         // if no list was provided, take the complete one
239 		aObjS.FillInsertObjects();
240         m_pServers = &aObjS;
241 	}
242 
243     // fill listbox and select default
244     ListBox& rBox = GetObjectTypes();
245 	rBox.SetUpdateMode( sal_False );
246     for ( sal_uLong i = 0; i < m_pServers->Count(); i++ )
247         rBox.InsertEntry( (*m_pServers)[i].GetHumanName() );
248 	rBox.SetUpdateMode( sal_True );
249     SelectDefault();
250     ::rtl::OUString aName;
251 
252     DBG_ASSERT( m_xStorage.is(), "No storage!");
253     if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK )
254 	{
255         String aFileName;
256         sal_Bool bLink = sal_False;
257         sal_Bool bCreateNew = IsCreateNew();
258         if ( bCreateNew )
259 		{
260             // create and insert new embedded object
261             String aServerName = rBox.GetSelectEntry();
262             const SvObjectServer* pS = m_pServers->Get( aServerName );
263 			if ( pS )
264 			{
265                 if( pS->GetClassName() == SvGlobalName( SO3_OUT_CLASSID ) )
266 				{
267 					try
268 					{
269                     	uno::Reference < embed::XInsertObjectDialog > xDialogCreator(
270 							::comphelper::getProcessServiceFactory()->createInstance(
271                             	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator")) ),
272 							uno::UNO_QUERY );
273 
274 						if ( xDialogCreator.is() )
275 						{
276 							aName = aCnt.CreateUniqueObjectName();
277                         	embed::InsertedObjectInfo aNewInf = xDialogCreator->createInstanceByDialog(
278 																	m_xStorage,
279 																	aName,
280                                     								uno::Sequence < beans::PropertyValue >() );
281 
282 							OSL_ENSURE( aNewInf.Object.is(), "The object must be created or an exception must be thrown!" );
283 							m_xObj = aNewInf.Object;
284 							for ( sal_Int32 nInd = 0; nInd < aNewInf.Options.getLength(); nInd++ )
285 								if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Icon" ) ) ) )
286 								{
287 									aNewInf.Options[nInd].Value >>= m_aIconMetaFile;
288 								}
289 								else if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconFormat" ) ) ) )
290 								{
291 									datatransfer::DataFlavor aFlavor;
292 									if ( aNewInf.Options[nInd].Value >>= aFlavor )
293 										m_aIconMediaType = aFlavor.MimeType;
294 								}
295 
296 						}
297 					}
298 					catch( ucb::CommandAbortedException& )
299 					{
300 						// the user has pressed cancel
301 					}
302 					catch( uno::Exception& )
303 					{
304 						// TODO: Error handling
305 					}
306 				}
307                 else
308                 {
309                     // create object with desired ClassId
310                     m_xObj = aCnt.CreateEmbeddedObject( pS->GetClassName().GetByteSequence(), aName );
311                 }
312 
313                 if ( !m_xObj.is() )
314 				{
315                     if( aFileName.Len() )  // from OLE Dialog
316 					{
317 						// Objekt konnte nicht aus Datei erzeugt werden
318                         // global Resource from svtools (former so3 resource)
319                         String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) );
320                         aErr.SearchAndReplace( String( '%' ), aFileName );
321                         ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
322 					}
323 					else
324 					{
325 						// Objekt konnte nicht erzeugt werden
326                         // global Resource from svtools (former so3 resource)
327                         String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE ) );
328                         aErr.SearchAndReplace( String( '%' ), aServerName );
329                         ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
330 					}
331 				}
332 			}
333 		}
334 		else
335 		{
336             aFileName = GetFilePath();
337             INetURLObject aURL;
338             aURL.SetSmartProtocol( INET_PROT_FILE );
339             aURL.SetSmartURL( aFileName );
340             aFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
341             bLink = IsLinked();
342 
343             if ( aFileName.Len() )
344             {
345                 // create MediaDescriptor for file to create object from
346                 uno::Sequence < beans::PropertyValue > aMedium( 2 );
347                 aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
348                 aMedium[0].Value <<= ::rtl::OUString( aFileName );
349 
350         		uno::Reference< task::XInteractionHandler > xInteraction;
351     			uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
352     			if ( xFactory.is() )
353         			xInteraction = uno::Reference< task::XInteractionHandler >(
354 						xFactory->createInstance(
355 							DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ),
356 						uno::UNO_QUERY_THROW );
357 
358 				if ( xInteraction.is() )
359 				{
360                		aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) );
361                		aMedium[1].Value <<= xInteraction;
362 				}
363 				else
364 				{
365 					OSL_ASSERT( "Can not get InteractionHandler!\n" );
366 					aMedium.realloc( 1 );
367 				}
368 
369                 // create object from media descriptor
370 				if ( bLink )
371 					m_xObj = aCnt.InsertEmbeddedLink( aMedium, aName );
372 				else
373                 	m_xObj = aCnt.InsertEmbeddedObject( aMedium, aName );
374             }
375 
376             if ( !m_xObj.is() )
377 			{
378 				// Objekt konnte nicht aus Datei erzeugt werden
379                 // global Resource from svtools (former so3 resource)
380                 String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) );
381                 aErr.SearchAndReplace( String( '%' ), aFileName );
382                 ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
383 			}
384 		}
385 	}
386 
387     m_pServers = 0;
388     return nRet;
389 }
390 
391 uno::Reference< io::XInputStream > SvInsertOleDlg::GetIconIfIconified( ::rtl::OUString* pGraphicMediaType )
392 {
393 	if ( m_aIconMetaFile.getLength() )
394 	{
395 		if ( pGraphicMediaType )
396 			*pGraphicMediaType = m_aIconMediaType;
397 
398 		return uno::Reference< io::XInputStream >( new ::comphelper::SequenceInputStream( m_aIconMetaFile ) );
399 	}
400 
401 	return uno::Reference< io::XInputStream >();
402 }
403 
404 IMPL_LINK( SvInsertPlugInDialog, BrowseHdl, PushButton *, EMPTYARG )
405 {
406     Sequence< OUString > aFilterNames, aFilterTypes;
407     void fillNetscapePluginFilters( Sequence< OUString >& rNames, Sequence< OUString >& rTypes );
408     fillNetscapePluginFilters( aFilterNames, aFilterTypes );
409 
410     Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
411     if( xFactory.is() )
412     {
413         Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY );
414         DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
415 
416         Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
417         Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
418         if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
419         {
420             Sequence< Any > aServiceType( 1 );
421             aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
422             xInit->initialize( aServiceType );
423 
424             // add the filters
425             try
426             {
427                 const OUString* pNames = aFilterNames.getConstArray();
428                 const OUString* pTypes = aFilterTypes.getConstArray();
429                 for( int i = 0; i < aFilterNames.getLength(); i++ )
430                     xFilterMgr->appendFilter( pNames[i], pTypes[i] );
431             }
432             catch( IllegalArgumentException& )
433             {
434                 DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" );
435             }
436 
437             if( xFilePicker->execute() == ExecutableDialogResults::OK )
438             {
439                 Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
440 				INetURLObject aObj( aPathSeq[0] );
441 				aEdFileurl.SetText( aObj.PathToFileName() );
442             }
443         }
444     }
445 
446 	return 0;
447 }
448 
449 // -----------------------------------------------------------------------
450 
451 SvInsertPlugInDialog::SvInsertPlugInDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage )
452     : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_PLUGIN ), xStorage ),
453     aGbFileurl( this, CUI_RES( GB_FILEURL ) ),
454     aEdFileurl( this, CUI_RES( ED_FILEURL ) ),
455     aBtnFileurl( this, CUI_RES( BTN_FILEURL ) ),
456     aGbPluginsOptions( this, CUI_RES( GB_PLUGINS_OPTIONS ) ),
457     aEdPluginsOptions( this, CUI_RES( ED_PLUGINS_OPTIONS ) ),
458     aOKButton1( this, CUI_RES( 1 ) ),
459     aCancelButton1( this, CUI_RES( 1 ) ),
460     aHelpButton1( this, CUI_RES( 1 ) ),
461     m_pURL(0)
462 {
463     FreeResource();
464     aBtnFileurl.SetClickHdl( LINK( this, SvInsertPlugInDialog, BrowseHdl ) );
465 }
466 
467 SvInsertPlugInDialog::~SvInsertPlugInDialog()
468 {
469     delete m_pURL;
470 }
471 
472 // -----------------------------------------------------------------------
473 
474 static void Plugin_ImplFillCommandSequence( const String& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence )
475 {
476     sal_uInt16 nEaten;
477     SvCommandList aLst;
478     aLst.AppendCommands( aCommands, &nEaten );
479 
480     const sal_Int32 nCount = aLst.Count();
481 	aCommandSequence.realloc( nCount );
482 	for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
483 	{
484         const SvCommand& rCommand = aLst[ nIndex ];
485 
486 		aCommandSequence[nIndex].Name = rCommand.GetCommand();
487 		aCommandSequence[nIndex].Handle = -1;
488 		aCommandSequence[nIndex].Value = makeAny( OUString( rCommand.GetArgument() ) );
489         aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
490 	}
491 }
492 
493 short SvInsertPlugInDialog::Execute()
494 {
495     short nRet = RET_OK;
496     m_aCommands.Erase();
497     DBG_ASSERT( m_xStorage.is(), "No storage!");
498     if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK )
499 	{
500         if ( !m_pURL )
501             m_pURL = new INetURLObject();
502 		else
503             *m_pURL = INetURLObject();
504 
505         m_aCommands = GetPlugInOptions();
506         String aURL = GetPlugInFile();
507 
508         // URL can be a valid and absolute URL or a system file name
509         m_pURL->SetSmartProtocol( INET_PROT_FILE );
510         if ( !aURL.Len() || m_pURL->SetSmartURL( aURL ) )
511 		{
512             // create a plugin object
513             ::rtl::OUString aName;
514             SvGlobalName aClassId( SO3_PLUGIN_CLASSID );
515             m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName );
516         }
517 
518         if ( m_xObj.is() )
519         {
520             // set properties from dialog
521             if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
522                 m_xObj->changeState( embed::EmbedStates::RUNNING );
523 
524             uno::Reference < beans::XPropertySet > xSet( m_xObj->getComponent(), uno::UNO_QUERY );
525             if ( xSet.is() )
526             {
527                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"),
528                         makeAny( ::rtl::OUString( m_pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) );
529                 uno::Sequence< beans::PropertyValue > aCommandSequence;
530                 Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence );
531                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginCommands"), makeAny( aCommandSequence ) );
532             }
533 		}
534 		else
535 		{
536 			// PlugIn konnte nicht erzeugt werden
537             // global Resource from svtools (former so3 resource)
538             String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_PLUGIN ) );
539 			aErr.SearchAndReplace( String( '%' ), aURL );
540             ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute();
541 		}
542 	}
543 
544     return nRet;
545 }
546 
547 // class SvInsertAppletDlg -----------------------------------------------
548 
549 IMPL_LINK( SvInsertAppletDialog, BrowseHdl, PushButton *, EMPTYARG )
550 {
551     Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
552     if( xFactory.is() )
553     {
554         Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY );
555         DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
556 
557         Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
558         Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
559         if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
560         {
561             Sequence< Any > aServiceType( 1 );
562             aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
563             xInit->initialize( aServiceType );
564 
565             // add filter
566             try
567             {
568                 xFilterMgr->appendFilter(
569                      OUString( RTL_CONSTASCII_USTRINGPARAM( "Applet" ) ),
570                      OUString( RTL_CONSTASCII_USTRINGPARAM( "*.class" ) )
571                      );
572             }
573             catch( IllegalArgumentException& )
574             {
575                 DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" );
576             }
577 
578             if( xFilePicker->execute() == ExecutableDialogResults::OK )
579             {
580                 Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
581 
582 				INetURLObject aObj( aPathSeq[0] );
583                 aEdClassfile.SetText( aObj.getName() );
584                 aObj.removeSegment();
585 				aEdClasslocation.SetText( aObj.PathToFileName() );
586             }
587         }
588     }
589 
590 	return 0;
591 }
592 
593 // -----------------------------------------------------------------------
594 
595 SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage )
596     : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_APPLET ), xStorage ),
597     aFtClassfile( this, CUI_RES( FT_CLASSFILE ) ),
598     aEdClassfile( this, CUI_RES( ED_CLASSFILE ) ),
599     aFtClasslocation( this, CUI_RES( FT_CLASSLOCATION ) ),
600     aEdClasslocation( this, CUI_RES( ED_CLASSLOCATION ) ),
601     aBtnClass( this, CUI_RES( BTN_CLASS ) ),
602     aGbClass( this, CUI_RES( GB_CLASS ) ),
603     aEdAppletOptions( this, CUI_RES( ED_APPLET_OPTIONS ) ),
604     aGbAppletOptions( this, CUI_RES( GB_APPLET_OPTIONS ) ),
605     aOKButton1( this, CUI_RES( 1 ) ),
606     aCancelButton1( this, CUI_RES( 1 ) ),
607     aHelpButton1( this, CUI_RES( 1 ) ),
608     m_pURL(0)
609 {
610     FreeResource();
611     aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) );
612 }
613 
614 SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XEmbeddedObject >& xObj )
615     : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_APPLET ), uno::Reference < embed::XStorage >() ),
616     aFtClassfile( this, CUI_RES( FT_CLASSFILE ) ),
617     aEdClassfile( this, CUI_RES( ED_CLASSFILE ) ),
618     aFtClasslocation( this, CUI_RES( FT_CLASSLOCATION ) ),
619     aEdClasslocation( this, CUI_RES( ED_CLASSLOCATION ) ),
620     aBtnClass( this, CUI_RES( BTN_CLASS ) ),
621     aGbClass( this, CUI_RES( GB_CLASS ) ),
622     aEdAppletOptions( this, CUI_RES( ED_APPLET_OPTIONS ) ),
623     aGbAppletOptions( this, CUI_RES( GB_APPLET_OPTIONS ) ),
624     aOKButton1( this, CUI_RES( 1 ) ),
625     aCancelButton1( this, CUI_RES( 1 ) ),
626     aHelpButton1( this, CUI_RES( 1 ) ),
627     m_pURL(0)
628 {
629     m_xObj = xObj;
630     FreeResource();
631     aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) );
632 }
633 
634 
635 SvInsertAppletDialog::~SvInsertAppletDialog()
636 {
637     delete m_pURL;
638 }
639 
640 short SvInsertAppletDialog::Execute()
641 {
642     short nRet = RET_OK;
643     m_aClass.Erase();
644     m_aCommands.Erase();
645 
646     sal_Bool bOK = sal_False;
647     uno::Reference < beans::XPropertySet > xSet;
648     if ( m_xObj.is() )
649 	{
650         try
651         {
652             if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
653                 m_xObj->changeState( embed::EmbedStates::RUNNING );
654             xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
655             ::rtl::OUString aStr;
656             uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCode") );
657             if ( aAny >>= aStr )
658                 SetClass( aStr );
659             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase") );
660             if ( aAny >>= aStr )
661                 SetClassLocation( aStr );
662             uno::Sequence< beans::PropertyValue > aCommands;
663             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands") );
664             if ( aAny >>= aCommands )
665             {
666                 SvCommandList aList;
667                 aList.FillFromSequence( aCommands );
668                 SetAppletOptions( aList.GetCommands() );
669             }
670 
671             String aText( CUI_RES( STR_EDIT_APPLET ) );
672             SetText( aText );
673             bOK = sal_True;
674         }
675         catch ( uno::Exception& )
676         {
677             DBG_ERROR( "No Applet!" );
678         }
679 	}
680     else
681     {
682         DBG_ASSERT( m_xStorage.is(), "No storage!");
683         bOK = m_xStorage.is();
684     }
685 
686     if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK )
687 	{
688         if ( !m_xObj.is() )
689         {
690             ::rtl::OUString aName;
691             SvGlobalName aClassId( SO3_APPLET_CLASSID );
692             m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName );
693             if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
694                 m_xObj->changeState( embed::EmbedStates::RUNNING );
695             xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
696         }
697 
698         if ( m_xObj.is() )
699         {
700             try
701             {
702                 sal_Bool bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE;
703                 if ( bIPActive )
704                     m_xObj->changeState( embed::EmbedStates::RUNNING );
705 
706                 String aClassLocation = GetClassLocation();
707 
708                 // Hack, aFileName wird auch fuer Class benutzt
709                 m_aClass = GetClass();
710                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCode"), makeAny( ::rtl::OUString( m_aClass ) ) );
711 
712                 ::rtl::OUString tmp = aClassLocation;
713                 ::osl::File::getFileURLFromSystemPath(tmp, tmp);
714                 aClassLocation = tmp;
715                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase"), makeAny( tmp ) );
716                 m_aCommands = GetAppletOptions();
717 
718                 uno::Sequence< beans::PropertyValue > aCommandSequence;
719                 Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence );
720                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands"), makeAny( aCommandSequence ) );
721 
722                 if ( bIPActive )
723                     m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE );
724             }
725             catch ( uno::Exception& )
726             {
727                 DBG_ERROR( "No Applet!" );
728             }
729         }
730     }
731 
732     return nRet;
733 }
734 
735 SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent,
736                             const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage )
737     : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_IFRAME ), xStorage )
738 	, aFTName ( this, CUI_RES( FT_FRAMENAME ) )
739 	, aEDName ( this, CUI_RES( ED_FRAMENAME ) )
740 	, aFTURL ( this, CUI_RES( FT_URL ) )
741 	, aEDURL ( this, CUI_RES( ED_URL ) )
742 	, aBTOpen ( this, CUI_RES(BT_FILEOPEN ) )
743 
744     , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) )
745 	, aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) )
746 	, aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) )
747 	, aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) )
748     , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) )
749     , aFLFrameBorder( this, CUI_RES( GB_BORDER ) )
750 	, aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) )
751 	, aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) )
752     , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) )
753     , aFLMargin( this, CUI_RES( GB_MARGIN ) )
754 	, aFTMarginWidth ( this, CUI_RES( FT_MARGINWIDTH ) )
755 	, aNMMarginWidth ( this, CUI_RES( NM_MARGINWIDTH ) )
756 	, aCBMarginWidthDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) )
757 	, aFTMarginHeight ( this, CUI_RES( FT_MARGINHEIGHT ) )
758 	, aNMMarginHeight ( this, CUI_RES( NM_MARGINHEIGHT ) )
759 	, aCBMarginHeightDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) )
760     , aOKButton1( this, CUI_RES( 1 ) )
761     , aCancelButton1( this, CUI_RES( 1 ) )
762     , aHelpButton1( this, CUI_RES( 1 ) )
763 {
764 	FreeResource();
765 
766 	aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT);
767     aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT);
768 
769     Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) );
770 	aCBMarginWidthDefault.SetClickHdl( aLink );
771 	aCBMarginHeightDefault.SetClickHdl( aLink );
772 
773     aCBMarginWidthDefault.Check();
774     aCBMarginHeightDefault.Check();
775     aRBScrollingAuto.Check();
776     aRBFrameBorderOn.Check();
777 
778     aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) );
779 }
780 
781 SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent, const uno::Reference < embed::XEmbeddedObject >& xObj )
782     : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_IFRAME ), uno::Reference < embed::XStorage >() )
783 	, aFTName ( this, CUI_RES( FT_FRAMENAME ) )
784 	, aEDName ( this, CUI_RES( ED_FRAMENAME ) )
785 	, aFTURL ( this, CUI_RES( FT_URL ) )
786 	, aEDURL ( this, CUI_RES( ED_URL ) )
787 	, aBTOpen ( this, CUI_RES(BT_FILEOPEN ) )
788 
789     , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) )
790 	, aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) )
791 	, aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) )
792 	, aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) )
793 
794     , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) )
795     , aFLFrameBorder( this, CUI_RES( GB_BORDER ) )
796 	, aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) )
797 	, aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) )
798 
799     , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) )
800     , aFLMargin( this, CUI_RES( GB_MARGIN ) )
801 	, aFTMarginWidth ( this, CUI_RES( FT_MARGINWIDTH ) )
802 	, aNMMarginWidth ( this, CUI_RES( NM_MARGINWIDTH ) )
803 	, aCBMarginWidthDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) )
804 	, aFTMarginHeight ( this, CUI_RES( FT_MARGINHEIGHT ) )
805 	, aNMMarginHeight ( this, CUI_RES( NM_MARGINHEIGHT ) )
806 	, aCBMarginHeightDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) )
807     , aOKButton1( this, CUI_RES( 1 ) )
808     , aCancelButton1( this, CUI_RES( 1 ) )
809     , aHelpButton1( this, CUI_RES( 1 ) )
810 {
811 	FreeResource();
812 
813     m_xObj = xObj;
814 
815 	aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT);
816     aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT);
817 
818     Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) );
819 	aCBMarginWidthDefault.SetClickHdl( aLink );
820 	aCBMarginHeightDefault.SetClickHdl( aLink );
821 
822     aCBMarginWidthDefault.Check();
823     aCBMarginHeightDefault.Check();
824     aRBScrollingAuto.Check();
825     aRBFrameBorderOn.Check();
826 
827     aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) );
828 }
829 
830 short SfxInsertFloatingFrameDialog::Execute()
831 {
832     short nRet = RET_OK;
833     sal_Bool bOK = sal_False;
834     uno::Reference < beans::XPropertySet > xSet;
835     if ( m_xObj.is() )
836 	{
837         try
838         {
839             if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
840                 m_xObj->changeState( embed::EmbedStates::RUNNING );
841             xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
842             ::rtl::OUString aStr;
843             uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameURL") );
844             if ( aAny >>= aStr )
845                 aEDURL.SetText( aStr );
846             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameName") );
847             if ( aAny >>= aStr )
848                 aEDName.SetText( aStr );
849 
850             sal_Int32 nSize = SIZE_NOT_SET;
851             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth") );
852             aAny >>= nSize;
853 
854             if ( nSize == SIZE_NOT_SET )
855             {
856                 aCBMarginWidthDefault.Check( sal_True );
857                 aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH )  );
858                 aFTMarginWidth.Enable( sal_False );
859                 aNMMarginWidth.Enable( sal_False );
860             }
861             else
862                 aNMMarginWidth.SetText( String::CreateFromInt32( nSize ) );
863 
864             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight") );
865             aAny >>= nSize;
866 
867             if ( nSize == SIZE_NOT_SET )
868             {
869                 aCBMarginHeightDefault.Check( sal_True );
870                 aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT )  );
871                 aFTMarginHeight.Enable( sal_False );
872                 aNMMarginHeight.Enable( sal_False );
873             }
874             else
875                 aNMMarginHeight.SetText( String::CreateFromInt32( nSize ) );
876 
877             sal_Bool bScrollOn = sal_False;
878             sal_Bool bScrollOff = sal_False;
879             sal_Bool bScrollAuto = sal_False;
880 
881             sal_Bool bSet = sal_False;
882             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll") );
883             aAny >>= bSet;
884             if ( !bSet )
885             {
886                 aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode") );
887                 aAny >>= bSet;
888                 bScrollOn = bSet;
889                 bScrollOff = !bSet;
890             }
891             else
892                 bScrollAuto = sal_True;
893 
894             aRBScrollingOn.Check( bScrollOn );
895             aRBScrollingOff.Check( bScrollOff );
896             aRBScrollingAuto.Check( bScrollAuto );
897 
898             bSet = sal_False;
899             aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder") );
900             aAny >>= bSet;
901             if ( !bSet )
902             {
903                 aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder") );
904                 aAny >>= bSet;
905                 aRBFrameBorderOn.Check( bSet );
906                 aRBFrameBorderOff.Check( !bSet );
907             }
908 
909             SetUpdateMode( sal_True );
910             bOK = sal_True;
911         }
912         catch ( uno::Exception& )
913         {
914             DBG_ERROR( "No IFrame!" );
915         }
916 	}
917     else
918     {
919         DBG_ASSERT( m_xStorage.is(), "No storage!");
920         bOK = m_xStorage.is();
921     }
922 
923     if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK )
924 	{
925         ::rtl::OUString aURL;
926         if ( aEDURL.GetText().Len() )
927         {
928             // URL can be a valid and absolute URL or a system file name
929             INetURLObject aObj;
930             aObj.SetSmartProtocol( INET_PROT_FILE );
931             if ( aObj.SetSmartURL( aEDURL.GetText() ) )
932                 aURL = aObj.GetMainURL( INetURLObject::NO_DECODE );
933         }
934 
935         if ( !m_xObj.is() && aURL.getLength() )
936 		{
937             // create the object
938             ::rtl::OUString aName;
939             SvGlobalName aClassId( SO3_IFRAME_CLASSID );
940             m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName );
941             if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
942                 m_xObj->changeState( embed::EmbedStates::RUNNING );
943             xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY );
944         }
945 
946         if ( m_xObj.is() )
947         {
948             try
949             {
950                 sal_Bool bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE;
951                 if ( bIPActive )
952                     m_xObj->changeState( embed::EmbedStates::RUNNING );
953 
954                 ::rtl::OUString aName = aEDName.GetText();
955                 ScrollingMode eScroll = ScrollingNo;
956                 if ( aRBScrollingOn.IsChecked() )
957                     eScroll = ScrollingYes;
958                 if ( aRBScrollingOff.IsChecked() )
959                     eScroll = ScrollingNo;
960                 if ( aRBScrollingAuto.IsChecked() )
961                     eScroll = ScrollingAuto;
962 
963                 sal_Bool bHasBorder = aRBFrameBorderOn.IsChecked();
964 
965                 long lMarginWidth;
966                 if ( !aCBMarginWidthDefault.IsChecked() )
967                     lMarginWidth = (long) aNMMarginWidth.GetText().ToInt32();
968                 else
969                     lMarginWidth = SIZE_NOT_SET;
970 
971                 long lMarginHeight;
972                 if ( !aCBMarginHeightDefault.IsChecked() )
973                     lMarginHeight = (long) aNMMarginHeight.GetText().ToInt32();
974                 else
975                     lMarginHeight = SIZE_NOT_SET;
976 
977                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameURL"), makeAny( aURL ) );
978                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameName"), makeAny( aName ) );
979 
980                 if ( eScroll == ScrollingAuto )
981                     xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll"),
982                         makeAny( sal_True ) );
983                 else
984                     xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode"),
985                         makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) );
986 
987                 //if ( aFrmDescr.IsFrameBorderSet() )
988                     xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder"),
989                         makeAny( bHasBorder ) );
990                 /*else
991                     xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder"),
992                         makeAny( sal_True ) );*/
993 
994                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth"),
995                     makeAny( sal_Int32( lMarginWidth ) ) );
996 
997                 xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight"),
998                     makeAny( sal_Int32( lMarginHeight ) ) );
999 
1000                 if ( bIPActive )
1001                     m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE );
1002             }
1003             catch ( uno::Exception& )
1004             {
1005                 DBG_ERROR( "No IFrame!" );
1006             }
1007         }
1008     }
1009 
1010     return nRet;
1011 }
1012 
1013 //------------------------------------------------------------------------------
1014 
1015 IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, CheckHdl, CheckBox*, pCB )
1016 {
1017 	if ( pCB == &pThis->aCBMarginWidthDefault )
1018 	{
1019 		if ( pCB->IsChecked() )
1020 			pThis->aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) );
1021 		pThis->aFTMarginWidth.Enable( !pCB->IsChecked() );
1022 		pThis->aNMMarginWidth.Enable( !pCB->IsChecked() );
1023 	}
1024 
1025 	if ( pCB == &pThis->aCBMarginHeightDefault )
1026 	{
1027 		if ( pCB->IsChecked() )
1028 			pThis->aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) );
1029 		pThis->aFTMarginHeight.Enable( !pCB->IsChecked() );
1030 		pThis->aNMMarginHeight.Enable( !pCB->IsChecked() );
1031 	}
1032 
1033 	return 0L;
1034 }
1035 
1036 //------------------------------------------------------------------------------
1037 
1038 IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, OpenHdl, PushButton*, EMPTYARG )
1039 {
1040     Window* pOldParent = Application::GetDefDialogParent();
1041 	Application::SetDefDialogParent( pThis );
1042 
1043     // create the file dialog
1044 	sfx2::FileDialogHelper aFileDlg( WB_OPEN | SFXWB_PASSWORD, String() );
1045 
1046 	// set the title
1047     aFileDlg.SetTitle( OUString( String( CUI_RES( MD_INSERT_OBJECT_IFRAME ) ) ) );
1048 
1049 	// show the dialog
1050     if ( aFileDlg.Execute() == ERRCODE_NONE )
1051 		pThis->aEDURL.SetText(
1052 			INetURLObject( aFileDlg.GetPath() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) );
1053 
1054     Application::SetDefDialogParent( pOldParent );
1055 	return 0L;
1056 }
1057 
1058