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