1d119d52dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3d119d52dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d119d52dSAndrew Rist * or more contributor license agreements. See the NOTICE file
5d119d52dSAndrew Rist * distributed with this work for additional information
6d119d52dSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7d119d52dSAndrew Rist * to you under the Apache License, Version 2.0 (the
8d119d52dSAndrew Rist * "License"); you may not use this file except in compliance
9d119d52dSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11d119d52dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13d119d52dSAndrew Rist * Unless required by applicable law or agreed to in writing,
14d119d52dSAndrew Rist * software distributed under the License is distributed on an
15d119d52dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d119d52dSAndrew Rist * KIND, either express or implied. See the License for the
17d119d52dSAndrew Rist * specific language governing permissions and limitations
18d119d52dSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20d119d52dSAndrew Rist *************************************************************/
21d119d52dSAndrew Rist
22d119d52dSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sfx2.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "iframe.hxx"
28cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx>
29cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
30*da3cea1dSArrigo Marchiori #include <com/sun/star/document/XLinkAuthorizer.hpp>
31*da3cea1dSArrigo Marchiori #include <com/sun/star/frame/XDesktop.hpp>
32cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
33cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp>
34cdf0e10cSrcweir #include <com/sun/star/frame/XFramesSupplier.hpp>
35cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <tools/urlobj.hxx>
38cdf0e10cSrcweir #include <tools/debug.hxx>
39cdf0e10cSrcweir #include <rtl/ustring.hxx>
40cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
41*da3cea1dSArrigo Marchiori #include <ucbhelper/simpleinteractionrequest.hxx>
42cdf0e10cSrcweir #include <svtools/miscopt.hxx>
43cdf0e10cSrcweir #include <vcl/window.hxx>
44cdf0e10cSrcweir
45cdf0e10cSrcweir using namespace ::com::sun::star;
46cdf0e10cSrcweir
47cdf0e10cSrcweir namespace sfx2
48cdf0e10cSrcweir {
49cdf0e10cSrcweir
50cdf0e10cSrcweir class IFrameWindow_Impl : public Window
51cdf0e10cSrcweir {
52cdf0e10cSrcweir uno::Reference < frame::XFrame > mxFrame;
53cdf0e10cSrcweir sal_Bool bActive;
54cdf0e10cSrcweir sal_Bool bBorder;
55cdf0e10cSrcweir
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir IFrameWindow_Impl( Window *pParent,
58cdf0e10cSrcweir sal_Bool bHasBorder,
59cdf0e10cSrcweir WinBits nWinBits = 0 );
60cdf0e10cSrcweir
61cdf0e10cSrcweir public:
62cdf0e10cSrcweir void SetBorder( sal_Bool bNewBorder = sal_True );
HasBorder() const63cdf0e10cSrcweir sal_Bool HasBorder() const { return bBorder; }
64cdf0e10cSrcweir };
65cdf0e10cSrcweir
IFrameWindow_Impl(Window * pParent,sal_Bool bHasBorder,WinBits nWinBits)66cdf0e10cSrcweir IFrameWindow_Impl::IFrameWindow_Impl( Window *pParent, sal_Bool bHasBorder, WinBits nWinBits )
67cdf0e10cSrcweir : Window( pParent, nWinBits | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_DOCKBORDER )
68cdf0e10cSrcweir , bActive(sal_False)
69cdf0e10cSrcweir , bBorder(bHasBorder)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir if ( !bHasBorder )
72cdf0e10cSrcweir SetBorderStyle( WINDOW_BORDER_NOBORDER );
73cdf0e10cSrcweir else
74cdf0e10cSrcweir SetBorderStyle( WINDOW_BORDER_NORMAL );
75cdf0e10cSrcweir //SetActivateMode( ACTIVATE_MODE_GRABFOCUS );
76cdf0e10cSrcweir }
77cdf0e10cSrcweir
SetBorder(sal_Bool bNewBorder)78cdf0e10cSrcweir void IFrameWindow_Impl::SetBorder( sal_Bool bNewBorder )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir if ( bBorder != bNewBorder )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir Size aSize = GetSizePixel();
83cdf0e10cSrcweir bBorder = bNewBorder;
84cdf0e10cSrcweir if ( bBorder )
85cdf0e10cSrcweir SetBorderStyle( WINDOW_BORDER_NORMAL );
86cdf0e10cSrcweir else
87cdf0e10cSrcweir SetBorderStyle( WINDOW_BORDER_NOBORDER );
88cdf0e10cSrcweir if ( GetSizePixel() != aSize )
89cdf0e10cSrcweir SetSizePixel( aSize );
90cdf0e10cSrcweir }
91cdf0e10cSrcweir }
92cdf0e10cSrcweir
93cdf0e10cSrcweir #define PROPERTY_UNBOUND 0
94cdf0e10cSrcweir
95cdf0e10cSrcweir #define WID_FRAME_URL 1
96cdf0e10cSrcweir #define WID_FRAME_NAME 2
97cdf0e10cSrcweir #define WID_FRAME_IS_AUTO_SCROLL 3
98cdf0e10cSrcweir #define WID_FRAME_IS_SCROLLING_MODE 4
99cdf0e10cSrcweir #define WID_FRAME_IS_BORDER 5
100cdf0e10cSrcweir #define WID_FRAME_IS_AUTO_BORDER 6
101cdf0e10cSrcweir #define WID_FRAME_MARGIN_WIDTH 7
102cdf0e10cSrcweir #define WID_FRAME_MARGIN_HEIGHT 8
103cdf0e10cSrcweir
lcl_GetIFramePropertyMap_Impl()104cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetIFramePropertyMap_Impl()
105cdf0e10cSrcweir {
106cdf0e10cSrcweir static SfxItemPropertyMapEntry aIFramePropertyMap_Impl[] =
107cdf0e10cSrcweir {
108cdf0e10cSrcweir { MAP_CHAR_LEN("FrameIsAutoBorder"), WID_FRAME_IS_AUTO_BORDER, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
109cdf0e10cSrcweir { MAP_CHAR_LEN("FrameIsAutoScroll"), WID_FRAME_IS_AUTO_SCROLL, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
110cdf0e10cSrcweir { MAP_CHAR_LEN("FrameIsBorder"), WID_FRAME_IS_BORDER, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
111cdf0e10cSrcweir { MAP_CHAR_LEN("FrameIsScrollingMode"), WID_FRAME_IS_SCROLLING_MODE, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
112cdf0e10cSrcweir { MAP_CHAR_LEN("FrameMarginHeight"), WID_FRAME_MARGIN_HEIGHT, &::getCppuType( (sal_Int32*)0 ), PROPERTY_UNBOUND, 0 },
113cdf0e10cSrcweir { MAP_CHAR_LEN("FrameMarginWidth"), WID_FRAME_MARGIN_WIDTH, &::getCppuType( (sal_Int32*)0 ), PROPERTY_UNBOUND, 0 },
114cdf0e10cSrcweir { MAP_CHAR_LEN("FrameName"), WID_FRAME_NAME, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
115cdf0e10cSrcweir { MAP_CHAR_LEN("FrameURL"), WID_FRAME_URL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
116cdf0e10cSrcweir {0,0,0,0,0,0}
117cdf0e10cSrcweir };
118cdf0e10cSrcweir return aIFramePropertyMap_Impl;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
121cdf0e10cSrcweir SFX_IMPL_XSERVICEINFO( IFrameObject, "com.sun.star.embed.SpecialEmbeddedObject", "com.sun.star.comp.sfx2.IFrameObject" )
122cdf0e10cSrcweir SFX_IMPL_SINGLEFACTORY( IFrameObject );
123cdf0e10cSrcweir
IFrameObject(const uno::Reference<lang::XMultiServiceFactory> & rFact)124cdf0e10cSrcweir IFrameObject::IFrameObject( const uno::Reference < lang::XMultiServiceFactory >& rFact )
125cdf0e10cSrcweir : mxFact( rFact )
126cdf0e10cSrcweir , maPropMap( lcl_GetIFramePropertyMap_Impl() )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir }
129cdf0e10cSrcweir
~IFrameObject()130cdf0e10cSrcweir IFrameObject::~IFrameObject()
131cdf0e10cSrcweir {
132cdf0e10cSrcweir }
133cdf0e10cSrcweir
134cdf0e10cSrcweir
initialize(const uno::Sequence<uno::Any> & aArguments)135cdf0e10cSrcweir void SAL_CALL IFrameObject::initialize( const uno::Sequence< uno::Any >& aArguments ) throw ( uno::Exception, uno::RuntimeException )
136cdf0e10cSrcweir {
137cdf0e10cSrcweir if ( aArguments.getLength() )
138cdf0e10cSrcweir aArguments[0] >>= mxObj;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir
load(const uno::Sequence<com::sun::star::beans::PropertyValue> &,const uno::Reference<frame::XFrame> & xFrame)141cdf0e10cSrcweir sal_Bool SAL_CALL IFrameObject::load(
142cdf0e10cSrcweir const uno::Sequence < com::sun::star::beans::PropertyValue >& /*lDescriptor*/,
143cdf0e10cSrcweir const uno::Reference < frame::XFrame >& xFrame )
144cdf0e10cSrcweir throw( uno::RuntimeException )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir if ( SvtMiscOptions().IsPluginsEnabled() )
147cdf0e10cSrcweir {
148cdf0e10cSrcweir DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
149*da3cea1dSArrigo Marchiori ::rtl::OUString sURL( maFrmDescr.GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
150*da3cea1dSArrigo Marchiori // Obtain authorization from the current document, that is: our mxObj'x "client site"
151*da3cea1dSArrigo Marchiori uno::Reference< com::sun::star::document::XLinkAuthorizer > xLinkAuthorizer;
152*da3cea1dSArrigo Marchiori uno::Reference< com::sun::star::lang::XComponent > xComponent;
153*da3cea1dSArrigo Marchiori uno::Reference< com::sun::star::embed::XComponentSupplier > xCompSupplier( mxObj->getClientSite(), uno::UNO_QUERY );
154*da3cea1dSArrigo Marchiori if ( xCompSupplier.is() ) {
155*da3cea1dSArrigo Marchiori xComponent.set( xCompSupplier->getComponent(), uno::UNO_QUERY );
156*da3cea1dSArrigo Marchiori if ( xComponent.is() ) {
157*da3cea1dSArrigo Marchiori xLinkAuthorizer.set( xComponent, uno::UNO_QUERY );
158*da3cea1dSArrigo Marchiori }
159*da3cea1dSArrigo Marchiori }
160*da3cea1dSArrigo Marchiori if ( xLinkAuthorizer.is() ) {
161*da3cea1dSArrigo Marchiori if ( !xLinkAuthorizer->authorizeLinks( sURL ) )
162*da3cea1dSArrigo Marchiori return sal_False;
163*da3cea1dSArrigo Marchiori }
164cdf0e10cSrcweir Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
165cdf0e10cSrcweir IFrameWindow_Impl* pWin = new IFrameWindow_Impl( pParent, maFrmDescr.IsFrameBorderOn() );
166cdf0e10cSrcweir pWin->SetSizePixel( pParent->GetOutputSizePixel() );
167cdf0e10cSrcweir pWin->SetBackground();
168cdf0e10cSrcweir pWin->Show();
169cdf0e10cSrcweir
170cdf0e10cSrcweir uno::Reference < awt::XWindow > xWindow( pWin->GetComponentInterface(), uno::UNO_QUERY );
171cdf0e10cSrcweir xFrame->setComponent( xWindow, uno::Reference < frame::XController >() );
172cdf0e10cSrcweir
173cdf0e10cSrcweir // we must destroy the IFrame before the parent is destroyed
174cdf0e10cSrcweir xWindow->addEventListener( this );
175cdf0e10cSrcweir
176cdf0e10cSrcweir mxFrame = uno::Reference< frame::XFrame >( mxFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Frame" ) ),
177cdf0e10cSrcweir uno::UNO_QUERY );
178cdf0e10cSrcweir uno::Reference < awt::XWindow > xWin( pWin->GetComponentInterface(), uno::UNO_QUERY );
179cdf0e10cSrcweir mxFrame->initialize( xWin );
180cdf0e10cSrcweir mxFrame->setName( maFrmDescr.GetName() );
181cdf0e10cSrcweir
182cdf0e10cSrcweir uno::Reference < frame::XFramesSupplier > xFramesSupplier( xFrame, uno::UNO_QUERY );
183cdf0e10cSrcweir if ( xFramesSupplier.is() )
184cdf0e10cSrcweir mxFrame->setCreator( xFramesSupplier );
185cdf0e10cSrcweir
186cdf0e10cSrcweir uno::Reference< frame::XDispatchProvider > xProv( mxFrame, uno::UNO_QUERY );
187cdf0e10cSrcweir
188cdf0e10cSrcweir util::URL aTargetURL;
189*da3cea1dSArrigo Marchiori aTargetURL.Complete = sURL;
190cdf0e10cSrcweir uno::Reference < util::XURLTransformer > xTrans( mxFact->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY );
191cdf0e10cSrcweir xTrans->parseStrict( aTargetURL );
192cdf0e10cSrcweir
193cdf0e10cSrcweir uno::Sequence < beans::PropertyValue > aProps(2);
194cdf0e10cSrcweir aProps[0].Name = ::rtl::OUString::createFromAscii("PluginMode");
195cdf0e10cSrcweir aProps[0].Value <<= (sal_Int16) 2;
196cdf0e10cSrcweir aProps[1].Name = ::rtl::OUString::createFromAscii("ReadOnly");
197cdf0e10cSrcweir aProps[1].Value <<= (sal_Bool) sal_True;
198cdf0e10cSrcweir uno::Reference < frame::XDispatch > xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString::createFromAscii("_self"), 0 );
199cdf0e10cSrcweir if ( xDisp.is() )
200cdf0e10cSrcweir xDisp->dispatch( aTargetURL, aProps );
201cdf0e10cSrcweir
202cdf0e10cSrcweir return sal_True;
203cdf0e10cSrcweir }
204cdf0e10cSrcweir
205cdf0e10cSrcweir return sal_False;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir
cancel()208cdf0e10cSrcweir void SAL_CALL IFrameObject::cancel() throw( com::sun::star::uno::RuntimeException )
209cdf0e10cSrcweir {
210cdf0e10cSrcweir try
211cdf0e10cSrcweir {
212cdf0e10cSrcweir uno::Reference < util::XCloseable > xClose( mxFrame, uno::UNO_QUERY );
213cdf0e10cSrcweir if ( xClose.is() )
214cdf0e10cSrcweir xClose->close( sal_True );
215cdf0e10cSrcweir mxFrame = 0;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir catch ( uno::Exception& )
218cdf0e10cSrcweir {}
219cdf0e10cSrcweir }
220cdf0e10cSrcweir
close(sal_Bool)221cdf0e10cSrcweir void SAL_CALL IFrameObject::close( sal_Bool /*bDeliverOwnership*/ ) throw( com::sun::star::util::CloseVetoException, com::sun::star::uno::RuntimeException )
222cdf0e10cSrcweir {
223cdf0e10cSrcweir }
224cdf0e10cSrcweir
addCloseListener(const com::sun::star::uno::Reference<com::sun::star::util::XCloseListener> &)225cdf0e10cSrcweir void SAL_CALL IFrameObject::addCloseListener( const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& ) throw( com::sun::star::uno::RuntimeException )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir }
228cdf0e10cSrcweir
removeCloseListener(const com::sun::star::uno::Reference<com::sun::star::util::XCloseListener> &)229cdf0e10cSrcweir void SAL_CALL IFrameObject::removeCloseListener( const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& ) throw( com::sun::star::uno::RuntimeException )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir }
232cdf0e10cSrcweir
disposing(const com::sun::star::lang::EventObject &)233cdf0e10cSrcweir void SAL_CALL IFrameObject::disposing( const com::sun::star::lang::EventObject& ) throw (com::sun::star::uno::RuntimeException)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir cancel();
236cdf0e10cSrcweir }
237cdf0e10cSrcweir
getPropertySetInfo()238cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL IFrameObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir static uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo( &maPropMap );
241cdf0e10cSrcweir return xInfo;
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
setPropertyValue(const::rtl::OUString & aPropertyName,const uno::Any & aAny)244cdf0e10cSrcweir void SAL_CALL IFrameObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aAny)
245cdf0e10cSrcweir throw ( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
246cdf0e10cSrcweir {
247cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName );
248cdf0e10cSrcweir if( !pEntry )
249cdf0e10cSrcweir throw beans::UnknownPropertyException();
250cdf0e10cSrcweir switch( pEntry->nWID )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir case WID_FRAME_URL:
253cdf0e10cSrcweir {
254cdf0e10cSrcweir ::rtl::OUString aURL;
255cdf0e10cSrcweir aAny >>= aURL;
256cdf0e10cSrcweir maFrmDescr.SetURL( String(aURL) );
257cdf0e10cSrcweir }
258cdf0e10cSrcweir break;
259cdf0e10cSrcweir case WID_FRAME_NAME:
260cdf0e10cSrcweir {
261cdf0e10cSrcweir ::rtl::OUString aName;
262cdf0e10cSrcweir if ( aAny >>= aName )
263cdf0e10cSrcweir maFrmDescr.SetName( aName );
264cdf0e10cSrcweir }
265cdf0e10cSrcweir break;
266cdf0e10cSrcweir case WID_FRAME_IS_AUTO_SCROLL:
267cdf0e10cSrcweir {
268cdf0e10cSrcweir sal_Bool bIsAutoScroll = sal_Bool();
269cdf0e10cSrcweir if ( (aAny >>= bIsAutoScroll) && bIsAutoScroll )
270cdf0e10cSrcweir maFrmDescr.SetScrollingMode( ScrollingAuto );
271cdf0e10cSrcweir }
272cdf0e10cSrcweir break;
273cdf0e10cSrcweir case WID_FRAME_IS_SCROLLING_MODE:
274cdf0e10cSrcweir {
275cdf0e10cSrcweir sal_Bool bIsScroll = sal_Bool();
276cdf0e10cSrcweir if ( aAny >>= bIsScroll )
277cdf0e10cSrcweir maFrmDescr.SetScrollingMode( bIsScroll ? ScrollingYes : ScrollingNo );
278cdf0e10cSrcweir }
279cdf0e10cSrcweir break;
280cdf0e10cSrcweir case WID_FRAME_IS_BORDER:
281cdf0e10cSrcweir {
282cdf0e10cSrcweir sal_Bool bIsBorder = sal_Bool();
283cdf0e10cSrcweir if ( aAny >>= bIsBorder )
284cdf0e10cSrcweir maFrmDescr.SetFrameBorder( bIsBorder );
285cdf0e10cSrcweir }
286cdf0e10cSrcweir break;
287cdf0e10cSrcweir case WID_FRAME_IS_AUTO_BORDER:
288cdf0e10cSrcweir {
289cdf0e10cSrcweir sal_Bool bIsAutoBorder = sal_Bool();
290cdf0e10cSrcweir if ( (aAny >>= bIsAutoBorder) )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir sal_Bool bBorder = maFrmDescr.IsFrameBorderOn();
293cdf0e10cSrcweir maFrmDescr.ResetBorder();
294cdf0e10cSrcweir if ( bIsAutoBorder )
295cdf0e10cSrcweir maFrmDescr.SetFrameBorder( bBorder );
296cdf0e10cSrcweir }
297cdf0e10cSrcweir }
298cdf0e10cSrcweir break;
299cdf0e10cSrcweir case WID_FRAME_MARGIN_WIDTH:
300cdf0e10cSrcweir {
301cdf0e10cSrcweir sal_Int32 nMargin = 0;
302cdf0e10cSrcweir Size aSize = maFrmDescr.GetMargin();
303cdf0e10cSrcweir if ( aAny >>= nMargin )
304cdf0e10cSrcweir {
305cdf0e10cSrcweir aSize.Width() = nMargin;
306cdf0e10cSrcweir maFrmDescr.SetMargin( aSize );
307cdf0e10cSrcweir }
308cdf0e10cSrcweir }
309cdf0e10cSrcweir break;
310cdf0e10cSrcweir case WID_FRAME_MARGIN_HEIGHT:
311cdf0e10cSrcweir {
312cdf0e10cSrcweir sal_Int32 nMargin = 0;
313cdf0e10cSrcweir Size aSize = maFrmDescr.GetMargin();
314cdf0e10cSrcweir if ( aAny >>= nMargin )
315cdf0e10cSrcweir {
316cdf0e10cSrcweir aSize.Height() = nMargin;
317cdf0e10cSrcweir maFrmDescr.SetMargin( aSize );
318cdf0e10cSrcweir }
319cdf0e10cSrcweir }
320cdf0e10cSrcweir break;
321cdf0e10cSrcweir default: ;
322cdf0e10cSrcweir }
323cdf0e10cSrcweir }
324cdf0e10cSrcweir
getPropertyValue(const::rtl::OUString & aPropertyName)325cdf0e10cSrcweir uno::Any SAL_CALL IFrameObject::getPropertyValue(const ::rtl::OUString& aPropertyName)
326cdf0e10cSrcweir throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
327cdf0e10cSrcweir {
328cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName );
329cdf0e10cSrcweir if( !pEntry )
330cdf0e10cSrcweir throw beans::UnknownPropertyException();
331cdf0e10cSrcweir uno::Any aAny;
332cdf0e10cSrcweir switch( pEntry->nWID )
333cdf0e10cSrcweir {
334cdf0e10cSrcweir case WID_FRAME_URL:
335cdf0e10cSrcweir {
336cdf0e10cSrcweir aAny <<= ::rtl::OUString( maFrmDescr.GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
337cdf0e10cSrcweir }
338cdf0e10cSrcweir break;
339cdf0e10cSrcweir case WID_FRAME_NAME:
340cdf0e10cSrcweir {
341cdf0e10cSrcweir aAny <<= ::rtl::OUString( maFrmDescr.GetName() );
342cdf0e10cSrcweir }
343cdf0e10cSrcweir break;
344cdf0e10cSrcweir case WID_FRAME_IS_AUTO_SCROLL:
345cdf0e10cSrcweir {
346cdf0e10cSrcweir sal_Bool bIsAutoScroll = ( maFrmDescr.GetScrollingMode() == ScrollingAuto );
347cdf0e10cSrcweir aAny <<= bIsAutoScroll;
348cdf0e10cSrcweir }
349cdf0e10cSrcweir break;
350cdf0e10cSrcweir case WID_FRAME_IS_SCROLLING_MODE:
351cdf0e10cSrcweir {
352cdf0e10cSrcweir sal_Bool bIsScroll = ( maFrmDescr.GetScrollingMode() == ScrollingYes );
353cdf0e10cSrcweir aAny <<= bIsScroll;
354cdf0e10cSrcweir }
355cdf0e10cSrcweir break;
356cdf0e10cSrcweir case WID_FRAME_IS_BORDER:
357cdf0e10cSrcweir {
358cdf0e10cSrcweir sal_Bool bIsBorder = maFrmDescr.IsFrameBorderOn();
359cdf0e10cSrcweir aAny <<= bIsBorder;
360cdf0e10cSrcweir }
361cdf0e10cSrcweir break;
362cdf0e10cSrcweir case WID_FRAME_IS_AUTO_BORDER:
363cdf0e10cSrcweir {
364cdf0e10cSrcweir sal_Bool bIsAutoBorder = !maFrmDescr.IsFrameBorderSet();
365cdf0e10cSrcweir aAny <<= bIsAutoBorder;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir break;
368cdf0e10cSrcweir case WID_FRAME_MARGIN_WIDTH:
369cdf0e10cSrcweir {
370cdf0e10cSrcweir aAny <<= (sal_Int32 ) maFrmDescr.GetMargin().Width();
371cdf0e10cSrcweir }
372cdf0e10cSrcweir break;
373cdf0e10cSrcweir case WID_FRAME_MARGIN_HEIGHT:
374cdf0e10cSrcweir {
375cdf0e10cSrcweir aAny <<= (sal_Int32 ) maFrmDescr.GetMargin().Height();
376cdf0e10cSrcweir }
377cdf0e10cSrcweir default: ;
378cdf0e10cSrcweir }
379cdf0e10cSrcweir return aAny;
380cdf0e10cSrcweir }
381cdf0e10cSrcweir
addPropertyChangeListener(const::rtl::OUString &,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertyChangeListener> &)382cdf0e10cSrcweir void SAL_CALL IFrameObject::addPropertyChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException )
383cdf0e10cSrcweir {
384cdf0e10cSrcweir }
385cdf0e10cSrcweir
removePropertyChangeListener(const::rtl::OUString &,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertyChangeListener> &)386cdf0e10cSrcweir void SAL_CALL IFrameObject::removePropertyChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException )
387cdf0e10cSrcweir {
388cdf0e10cSrcweir }
389cdf0e10cSrcweir
addVetoableChangeListener(const::rtl::OUString &,const::com::sun::star::uno::Reference<::com::sun::star::beans::XVetoableChangeListener> &)390cdf0e10cSrcweir void SAL_CALL IFrameObject::addVetoableChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir }
393cdf0e10cSrcweir
removeVetoableChangeListener(const::rtl::OUString &,const::com::sun::star::uno::Reference<::com::sun::star::beans::XVetoableChangeListener> &)394cdf0e10cSrcweir void SAL_CALL IFrameObject::removeVetoableChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException )
395cdf0e10cSrcweir {
396cdf0e10cSrcweir }
397cdf0e10cSrcweir
execute()398cdf0e10cSrcweir ::sal_Int16 SAL_CALL IFrameObject::execute() throw (::com::sun::star::uno::RuntimeException)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
401cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateEditObjectDialog( NULL, rtl::OUString::createFromAscii(".uno:InsertObjectFloatingFrame"), mxObj );
402cdf0e10cSrcweir if ( pDlg )
403cdf0e10cSrcweir pDlg->Execute();
404cdf0e10cSrcweir return 0;
405cdf0e10cSrcweir }
406cdf0e10cSrcweir
setTitle(const::rtl::OUString &)407cdf0e10cSrcweir void SAL_CALL IFrameObject::setTitle( const ::rtl::OUString& ) throw (::com::sun::star::uno::RuntimeException)
408cdf0e10cSrcweir {
409cdf0e10cSrcweir }
410cdf0e10cSrcweir
411cdf0e10cSrcweir }
412