1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/embed/Aspects.hpp>
21 #include <com/sun/star/frame/TaskCreator.hpp>
22 #include <com/sun/star/frame/XComponentLoader.hpp>
23 #include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
26 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
27 #include <com/sun/star/util/XCloseBroadcaster.hpp>
28 #include <com/sun/star/util/XCloseable.hpp>
29 #include <com/sun/star/container/XNameAccess.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/beans/NamedValue.hpp>
33 #include <com/sun/star/frame/XModel.hpp>
34 #include <com/sun/star/frame/Desktop.hpp>
35 #include <com/sun/star/frame/XFramesSupplier.hpp>
36 #include <com/sun/star/frame/XDispatchHelper.hpp>
37 #include <com/sun/star/frame/FrameSearchFlag.hpp>
38 #include <com/sun/star/frame/XControllerBorder.hpp>
39 #include <com/sun/star/util/XModifyBroadcaster.hpp>
40 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
41 #include <com/sun/star/awt/Toolkit.hpp>
42 #include <com/sun/star/awt/XTopWindow.hpp>
43 #include <com/sun/star/awt/PosSize.hpp>
44 #include <com/sun/star/awt/XView.hpp>
45 #include <com/sun/star/awt/WindowAttribute.hpp>
46 #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
47 #include <com/sun/star/bridge/XBridgeSupplier2.hpp>
48 #include <com/sun/star/bridge/ModelDependent.hpp>
49 #include <com/sun/star/embed/XHatchWindow.hpp>
50 #include <com/sun/star/embed/HatchWindowFactory.hpp>
51 #include <com/sun/star/embed/XInplaceClient.hpp>
52 #include <com/sun/star/frame/XLayoutManager.hpp>
53 #include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp>
54 #include <com/sun/star/frame/ModuleManager.hpp>
55 #include <com/sun/star/ui/XDockingAreaAcceptor.hpp>
56 #include <com/sun/star/ui/XUIElementSettings.hpp>
57 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
58 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
59 #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
60 #include <com/sun/star/embed/StateChangeInProgressException.hpp>
62 #include <com/sun/star/embed/EmbedMisc.hpp>
63 #include <com/sun/star/embed/EmbedStates.hpp>
64 #include <osl/diagnose.h>
65 #include <rtl/process.h>
66 #include <vcl/svapp.hxx>
68 #include <comphelper/processfactory.hxx>
69 #include <comphelper/namedvaluecollection.hxx>
71 #include "docholder.hxx"
72 #include "commonembobj.hxx"
73 #include "intercept.hxx"
76 #define HATCH_BORDER_WIDTH (((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) && \
77 m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
79 using namespace ::com::sun::star
;
81 //===========================================================================
83 class IntCounterGuard
{
86 IntCounterGuard( sal_Int32
& nFlag
)
99 //===========================================================================
101 static void InsertMenu_Impl( const uno::Reference
< container::XIndexContainer
>& xTargetMenu
,
102 sal_Int32 nTargetIndex
,
103 const uno::Reference
< container::XIndexAccess
>& xSourceMenu
,
104 sal_Int32 nSourceIndex
,
105 const OUString aContModuleName
,
106 const uno::Reference
< frame::XDispatchProvider
>& xSourceDisp
)
109 OUString
aModuleIdentPropName( "ModuleIdentifier" );
110 OUString
aDispProvPropName( "DispatchProvider" );
111 sal_Bool bModuleNameSet
= sal_False
;
112 sal_Bool bDispProvSet
= sal_False
;
114 uno::Sequence
< beans::PropertyValue
> aSourceProps
;
115 xSourceMenu
->getByIndex( nSourceIndex
) >>= aSourceProps
;
116 uno::Sequence
< beans::PropertyValue
> aTargetProps( aSourceProps
.getLength() );
117 for ( nInd
= 0; nInd
< aSourceProps
.getLength(); nInd
++ )
119 aTargetProps
[nInd
].Name
= aSourceProps
[nInd
].Name
;
120 if ( !aContModuleName
.isEmpty() && aTargetProps
[nInd
].Name
.equals( aModuleIdentPropName
) )
122 aTargetProps
[nInd
].Value
<<= aContModuleName
;
123 bModuleNameSet
= sal_True
;
125 else if ( aTargetProps
[nInd
].Name
.equals( aDispProvPropName
) )
127 aTargetProps
[nInd
].Value
<<= xSourceDisp
;
128 bDispProvSet
= sal_True
;
131 aTargetProps
[nInd
].Value
= aSourceProps
[nInd
].Value
;
134 if ( !bModuleNameSet
&& !aContModuleName
.isEmpty() )
136 aTargetProps
.realloc( ++nInd
);
137 aTargetProps
[nInd
-1].Name
= aModuleIdentPropName
;
138 aTargetProps
[nInd
-1].Value
<<= aContModuleName
;
141 if ( !bDispProvSet
&& xSourceDisp
.is() )
143 aTargetProps
.realloc( ++nInd
);
144 aTargetProps
[nInd
-1].Name
= aDispProvPropName
;
145 aTargetProps
[nInd
-1].Value
<<= xSourceDisp
;
148 xTargetMenu
->insertByIndex( nTargetIndex
, uno::makeAny( aTargetProps
) );
151 //===========================================================================
152 DocumentHolder::DocumentHolder( const uno::Reference
< uno::XComponentContext
>& xContext
,
153 OCommonEmbeddedObject
* pEmbObj
)
154 : m_pEmbedObj( pEmbObj
),
155 m_pInterceptor( NULL
),
156 m_xContext( xContext
),
157 m_bReadOnly( sal_False
),
158 m_bWaitForClose( sal_False
),
159 m_bAllowClosing( sal_False
),
160 m_bDesktopTerminated( sal_False
),
161 m_nNoBorderResizeReact( 0 ),
162 m_nNoResizeReact( 0 )
164 m_aOutplaceFrameProps
.realloc( 3 );
165 beans::NamedValue aArg
;
167 aArg
.Name
= "TopWindow";
168 aArg
.Value
<<= sal_True
;
169 m_aOutplaceFrameProps
[0] <<= aArg
;
171 aArg
.Name
= "MakeVisible";
172 aArg
.Value
<<= sal_False
;
173 m_aOutplaceFrameProps
[1] <<= aArg
;
175 uno::Reference
< frame::XDesktop2
> xDesktop
= frame::Desktop::create( m_xContext
);
179 xDesktop
->addTerminateListener( this );
181 catch ( const uno::Exception
& )
186 aArg
.Name
= "ParentFrame";
187 aArg
.Value
<<= xDesktop
; //TODO/LATER: should use parent document frame
188 m_aOutplaceFrameProps
[2] <<= aArg
;
191 //---------------------------------------------------------------------------
192 DocumentHolder::~DocumentHolder()
194 m_refCount
++; // to allow deregistration as a listener
199 if ( m_xComponent
.is() )
202 CloseDocument( sal_True
, sal_False
);
203 } catch( const uno::Exception
& ) {}
206 if ( m_pInterceptor
)
208 m_pInterceptor
->DisconnectDocHolder();
209 m_pInterceptor
->release();
212 if ( !m_bDesktopTerminated
)
216 //---------------------------------------------------------------------------
217 void DocumentHolder::CloseFrame()
219 uno::Reference
< util::XCloseBroadcaster
> xCloseBroadcaster( m_xFrame
, uno::UNO_QUERY
);
220 if ( xCloseBroadcaster
.is() )
221 xCloseBroadcaster
->removeCloseListener( ( util::XCloseListener
* )this );
223 uno::Reference
<util::XCloseable
> xCloseable(
224 m_xFrame
,uno::UNO_QUERY
);
225 if( xCloseable
.is() )
227 xCloseable
->close( sal_True
);
229 catch( const uno::Exception
& ) {
232 uno::Reference
<lang::XComponent
> xComp( m_xFrame
,uno::UNO_QUERY
);
237 uno::Reference
< lang::XComponent
> xComp( m_xHatchWindow
, uno::UNO_QUERY
);
241 m_xHatchWindow
= uno::Reference
< awt::XWindow
>();
242 m_xOwnWindow
= uno::Reference
< awt::XWindow
>();
243 m_xFrame
= uno::Reference
< frame::XFrame
>();
246 //---------------------------------------------------------------------------
247 void DocumentHolder::FreeOffice()
249 uno::Reference
< frame::XDesktop2
> xDesktop
= frame::Desktop::create( m_xContext
);
250 xDesktop
->removeTerminateListener( this );
252 // the following code is commented out since for now there is still no completely correct way to detect
253 // whether the office can be terminated, so it is better to have unnecessary process running than
256 // uno::Reference< frame::XFramesSupplier > xFramesSupplier( xDesktop, uno::UNO_QUERY );
257 // if ( xFramesSupplier.is() )
259 // uno::Reference< frame::XFrames > xFrames = xFramesSupplier->getFrames();
260 // if ( xFrames.is() && !xFrames->hasElements() )
264 // xDesktop->terminate();
266 // catch( uno::Exception & )
272 //---------------------------------------------------------------------------
273 void DocumentHolder::CloseDocument( sal_Bool bDeliverOwnership
, sal_Bool bWaitForClose
)
275 uno::Reference
< util::XCloseBroadcaster
> xBroadcaster( m_xComponent
, uno::UNO_QUERY
);
276 if ( xBroadcaster
.is() )
278 uno::Reference
< document::XEventBroadcaster
> xEventBroadcaster( m_xComponent
, uno::UNO_QUERY
);
279 if ( xEventBroadcaster
.is() )
280 xEventBroadcaster
->removeEventListener( ( document::XEventListener
* )this );
283 // the object does not support document::XEventBroadcaster interface
284 // use the workaround, register for modified events
285 uno::Reference
< util::XModifyBroadcaster
> xModifyBroadcaster( m_xComponent
, uno::UNO_QUERY
);
286 if ( xModifyBroadcaster
.is() )
287 xModifyBroadcaster
->removeModifyListener( ( util::XModifyListener
* )this );
290 uno::Reference
< util::XCloseable
> xCloseable( xBroadcaster
, uno::UNO_QUERY
);
291 if ( xCloseable
.is() )
293 m_bAllowClosing
= sal_True
;
294 m_bWaitForClose
= bWaitForClose
;
295 xCloseable
->close( bDeliverOwnership
);
302 //---------------------------------------------------------------------------
303 void DocumentHolder::PlaceFrame( const awt::Rectangle
& aNewRect
)
305 OSL_ENSURE( m_xFrame
.is() && m_xOwnWindow
.is(),
306 "The object does not have windows required for inplace mode!" );
308 //TODO: may need mutex locking???
309 if ( m_xFrame
.is() && m_xOwnWindow
.is() )
311 // the frame can be replaced only in inplace mode
312 frame::BorderWidths aOldWidths
;
313 IntCounterGuard
aGuard( m_nNoBorderResizeReact
);
317 aOldWidths
= m_aBorderWidths
;
319 awt::Rectangle aHatchRect
= AddBorderToArea( aNewRect
);
321 ResizeWindows_Impl( aHatchRect
);
323 } while ( aOldWidths
.Left
!= m_aBorderWidths
.Left
324 || aOldWidths
.Top
!= m_aBorderWidths
.Top
325 || aOldWidths
.Right
!= m_aBorderWidths
.Right
326 || aOldWidths
.Bottom
!= m_aBorderWidths
.Bottom
);
328 m_aObjRect
= aNewRect
;
332 //---------------------------------------------------------------------------
333 void DocumentHolder::ResizeWindows_Impl( const awt::Rectangle
& aHatchRect
)
335 OSL_ENSURE( m_xFrame
.is() && m_xOwnWindow
.is() /*&& m_xHatchWindow.is()*/,
336 "The object does not have windows required for inplace mode!" );
337 if ( m_xHatchWindow
.is() )
339 m_xOwnWindow
->setPosSize( HATCH_BORDER_WIDTH
,
341 aHatchRect
.Width
- 2*HATCH_BORDER_WIDTH
,
342 aHatchRect
.Height
- 2*HATCH_BORDER_WIDTH
,
343 awt::PosSize::POSSIZE
);
346 m_xHatchWindow
->setPosSize( aHatchRect
.X
,
350 awt::PosSize::POSSIZE
);
353 m_xOwnWindow
->setPosSize( aHatchRect
.X
+ HATCH_BORDER_WIDTH
,
354 aHatchRect
.Y
+ HATCH_BORDER_WIDTH
,
355 aHatchRect
.Width
- 2*HATCH_BORDER_WIDTH
,
356 aHatchRect
.Height
- 2*HATCH_BORDER_WIDTH
,
357 awt::PosSize::POSSIZE
);
360 //---------------------------------------------------------------------------
361 sal_Bool
DocumentHolder::SetFrameLMVisibility( const uno::Reference
< frame::XFrame
>& xFrame
, sal_Bool bVisible
)
363 sal_Bool bResult
= sal_False
;
367 uno::Reference
< ::com::sun::star::frame::XLayoutManager
> xLayoutManager
;
368 uno::Reference
< beans::XPropertySet
> xPropSet( xFrame
, uno::UNO_QUERY_THROW
);
369 xPropSet
->getPropertyValue("LayoutManager") >>= xLayoutManager
;
370 if ( xLayoutManager
.is() )
372 xLayoutManager
->setVisible( bVisible
);
374 // MBA: locking is done only on the container LM, because it is not about hiding windows, it's about
375 // giving up control over the component window (and stopping to listen for resize events of the container window)
377 xLayoutManager
->unlock();
379 xLayoutManager
->lock();
384 catch( const uno::Exception
& )
390 //---------------------------------------------------------------------------
391 sal_Bool
DocumentHolder::ShowInplace( const uno::Reference
< awt::XWindowPeer
>& xParent
,
392 const awt::Rectangle
& aRectangleToShow
,
393 const uno::Reference
< frame::XDispatchProvider
>& xContDisp
)
395 OSL_ENSURE( !m_xFrame
.is(), "A frame exists already!" );
397 if ( !m_xFrame
.is() )
399 uno::Reference
< frame::XModel
> xModel( GetComponent(), uno::UNO_QUERY
);
400 awt::Rectangle aHatchRectangle
= AddBorderToArea( aRectangleToShow
);
402 awt::Rectangle
aOwnRectangle( HATCH_BORDER_WIDTH
,
404 aHatchRectangle
.Width
- 2*HATCH_BORDER_WIDTH
,
405 aHatchRectangle
.Height
- 2*HATCH_BORDER_WIDTH
);
406 uno::Reference
< awt::XWindow
> xHWindow
;
407 uno::Reference
< awt::XWindowPeer
> xMyParent( xParent
);
412 uno::Reference
< embed::XHatchWindowFactory
> xHatchFactory
=
413 embed::HatchWindowFactory::create(m_xContext
);
415 uno::Reference
< embed::XHatchWindow
> xHatchWindow
=
416 xHatchFactory
->createHatchWindowInstance( xParent
,
418 awt::Size( HATCH_BORDER_WIDTH
, HATCH_BORDER_WIDTH
) );
420 uno::Reference
< awt::XWindowPeer
> xHatchWinPeer( xHatchWindow
, uno::UNO_QUERY
);
421 xHWindow
= uno::Reference
< awt::XWindow
>( xHatchWinPeer
, uno::UNO_QUERY
);
422 if ( !xHWindow
.is() )
423 throw uno::RuntimeException(); // TODO: can not create own window
425 xHatchWindow
->setController( uno::Reference
< embed::XHatchWindowController
>(
426 static_cast< embed::XHatchWindowController
* >( this ) ) );
428 xMyParent
= xHatchWinPeer
;
432 aOwnRectangle
.X
+= aHatchRectangle
.X
;
433 aOwnRectangle
.Y
+= aHatchRectangle
.Y
;
436 awt::WindowDescriptor
aOwnWinDescriptor( awt::WindowClass_TOP
,
437 OUString("dockingwindow"),
440 awt::Rectangle(),//aOwnRectangle,
441 awt::WindowAttribute::SHOW
| awt::VclWindowPeerAttribute::CLIPCHILDREN
);
443 uno::Reference
< awt::XToolkit2
> xToolkit
= awt::Toolkit::create(m_xContext
);
445 uno::Reference
< awt::XWindowPeer
> xNewWinPeer
= xToolkit
->createWindow( aOwnWinDescriptor
);
446 uno::Reference
< awt::XWindow
> xOwnWindow( xNewWinPeer
, uno::UNO_QUERY
);
447 if ( !xOwnWindow
.is() )
448 throw uno::RuntimeException(); // TODO: can not create own window
450 // create a frame based on the specified window
451 uno::Reference
< lang::XSingleServiceFactory
> xFrameFact
= frame::TaskCreator::create(m_xContext
);
453 uno::Sequence
< uno::Any
> aArgs( 2 );
454 beans::NamedValue aArg
;
456 aArg
.Name
= "ContainerWindow";
457 aArg
.Value
<<= xOwnWindow
;
460 uno::Reference
< frame::XFrame
> xContFrame( xContDisp
, uno::UNO_QUERY
);
461 if ( xContFrame
.is() )
463 aArg
.Name
= "ParentFrame";
464 aArg
.Value
<<= xContFrame
;
470 // the call will create, initialize the frame, and register it in the parent
471 m_xFrame
.set( xFrameFact
->createInstanceWithArguments( aArgs
), uno::UNO_QUERY_THROW
);
473 m_xHatchWindow
= xHWindow
;
474 m_xOwnWindow
= xOwnWindow
;
476 if ( !SetFrameLMVisibility( m_xFrame
, sal_False
) )
478 OSL_FAIL( "Can't deactivate LayoutManager!\n" );
479 // TODO/LATER: error handling?
482 // m_bIsInplace = sal_True; TODO: ?
484 uno::Reference
< util::XCloseBroadcaster
> xCloseBroadcaster( m_xFrame
, uno::UNO_QUERY
);
485 if ( xCloseBroadcaster
.is() )
486 xCloseBroadcaster
->addCloseListener( ( util::XCloseListener
* )this );
488 // TODO: some listeners to the frame and the window ( resize for example )
491 if ( m_xComponent
.is() )
493 if ( !LoadDocToFrame( sal_True
) )
499 uno::Reference
< frame::XControllerBorder
> xControllerBorder( m_xFrame
->getController(), uno::UNO_QUERY
);
500 if ( xControllerBorder
.is() )
502 m_aBorderWidths
= xControllerBorder
->getBorder();
503 xControllerBorder
->addBorderResizeListener( (frame::XBorderResizeListener
*)this );
506 PlaceFrame( aRectangleToShow
);
508 if ( m_xHatchWindow
.is() )
509 m_xHatchWindow
->setVisible( sal_True
);
517 //---------------------------------------------------------------------------
518 uno::Reference
< container::XIndexAccess
> DocumentHolder::RetrieveOwnMenu_Impl()
520 uno::Reference
< container::XIndexAccess
> xResult
;
522 uno::Reference
< ::com::sun::star::ui::XUIConfigurationManagerSupplier
> xUIConfSupplier(
525 uno::Reference
< ::com::sun::star::ui::XUIConfigurationManager
> xUIConfigManager
;
526 if( xUIConfSupplier
.is())
528 xUIConfigManager
.set(
529 xUIConfSupplier
->getUIConfigurationManager(),
530 uno::UNO_QUERY_THROW
);
535 if( xUIConfigManager
.is())
537 xResult
= xUIConfigManager
->getSettings(
538 OUString( "private:resource/menubar/menubar" ),
542 catch( const uno::Exception
& )
547 // no internal document configuration, use the one from the module
548 uno::Reference
< frame::XModuleManager2
> xModuleMan
= frame::ModuleManager::create(m_xContext
);
549 OUString aModuleIdent
=
550 xModuleMan
->identify( uno::Reference
< uno::XInterface
>( m_xComponent
, uno::UNO_QUERY
) );
552 if ( !aModuleIdent
.isEmpty() )
554 uno::Reference
< ui::XModuleUIConfigurationManagerSupplier
> xModConfSupplier
=
555 ui::ModuleUIConfigurationManagerSupplier::create(m_xContext
);
556 uno::Reference
< ::com::sun::star::ui::XUIConfigurationManager
> xModUIConfMan(
557 xModConfSupplier
->getUIConfigurationManager( aModuleIdent
),
558 uno::UNO_QUERY_THROW
);
559 xResult
= xModUIConfMan
->getSettings(
560 OUString( "private:resource/menubar/menubar" ),
566 throw uno::RuntimeException();
571 //---------------------------------------------------------------------------
572 void DocumentHolder::FindConnectPoints(
573 const uno::Reference
< container::XIndexAccess
>& xMenu
,
574 sal_Int32 nConnectPoints
[2] )
575 throw ( uno::Exception
)
577 nConnectPoints
[0] = -1;
578 nConnectPoints
[1] = -1;
579 for ( sal_Int32 nInd
= 0; nInd
< xMenu
->getCount(); nInd
++ )
581 uno::Sequence
< beans::PropertyValue
> aProps
;
582 xMenu
->getByIndex( nInd
) >>= aProps
;
584 for ( sal_Int32 nSeqInd
= 0; nSeqInd
< aProps
.getLength(); nSeqInd
++ )
585 if ( aProps
[nSeqInd
].Name
== "CommandURL" )
587 aProps
[nSeqInd
].Value
>>= aCommand
;
591 if ( aCommand
.isEmpty() )
592 throw uno::RuntimeException();
594 if ( aCommand
== ".uno:PickList" )
595 nConnectPoints
[0] = nInd
;
596 else if ( aCommand
== ".uno:WindowList" )
597 nConnectPoints
[1] = nInd
;
601 //---------------------------------------------------------------------------
602 uno::Reference
< container::XIndexAccess
> DocumentHolder::MergeMenusForInplace(
603 const uno::Reference
< container::XIndexAccess
>& xContMenu
,
604 const uno::Reference
< frame::XDispatchProvider
>& xContDisp
,
605 const OUString
& aContModuleName
,
606 const uno::Reference
< container::XIndexAccess
>& xOwnMenu
,
607 const uno::Reference
< frame::XDispatchProvider
>& xOwnDisp
)
608 throw ( uno::Exception
)
610 // TODO/LATER: use dispatch providers on merge
612 sal_Int32 nContPoints
[2];
613 sal_Int32 nOwnPoints
[2];
615 uno::Reference
< lang::XSingleComponentFactory
> xIndAccessFact( xContMenu
, uno::UNO_QUERY_THROW
);
617 uno::Reference
< container::XIndexContainer
> xMergedMenu(
618 xIndAccessFact
->createInstanceWithContext(
619 comphelper::getProcessComponentContext() ),
620 uno::UNO_QUERY_THROW
);
622 FindConnectPoints( xContMenu
, nContPoints
);
623 FindConnectPoints( xOwnMenu
, nOwnPoints
);
625 for ( sal_Int32 nInd
= 0; nInd
< xOwnMenu
->getCount(); nInd
++ )
627 if ( nOwnPoints
[0] == nInd
)
629 if ( nContPoints
[0] >= 0 && nContPoints
[0] < xContMenu
->getCount() )
631 InsertMenu_Impl( xMergedMenu
, nInd
, xContMenu
, nContPoints
[0], aContModuleName
, xContDisp
);
634 else if ( nOwnPoints
[1] == nInd
)
636 if ( nContPoints
[1] >= 0 && nContPoints
[1] < xContMenu
->getCount() )
638 InsertMenu_Impl( xMergedMenu
, nInd
, xContMenu
, nContPoints
[1], aContModuleName
, xContDisp
);
642 InsertMenu_Impl( xMergedMenu
, nInd
, xOwnMenu
, nInd
, OUString(), xOwnDisp
);
645 return uno::Reference
< container::XIndexAccess
>( xMergedMenu
, uno::UNO_QUERY_THROW
);
648 //---------------------------------------------------------------------------
649 sal_Bool
DocumentHolder::MergeMenus_Impl( const uno::Reference
< ::com::sun::star::frame::XLayoutManager
>& xOwnLM
,
650 const uno::Reference
< ::com::sun::star::frame::XLayoutManager
>& xContLM
,
651 const uno::Reference
< frame::XDispatchProvider
>& xContDisp
,
652 const OUString
& aContModuleName
)
654 sal_Bool bMenuMerged
= sal_False
;
657 uno::Reference
< ::com::sun::star::ui::XUIElementSettings
> xUISettings(
659 OUString( "private:resource/menubar/menubar" ) ),
660 uno::UNO_QUERY_THROW
);
661 uno::Reference
< container::XIndexAccess
> xContMenu
= xUISettings
->getSettings( sal_True
);
662 if ( !xContMenu
.is() )
663 throw uno::RuntimeException();
665 uno::Reference
< container::XIndexAccess
> xOwnMenu
= RetrieveOwnMenu_Impl();
666 uno::Reference
< frame::XDispatchProvider
> xOwnDisp( m_xFrame
, uno::UNO_QUERY_THROW
);
668 uno::Reference
< container::XIndexAccess
> xMergedMenu
= MergeMenusForInplace( xContMenu
, xContDisp
, aContModuleName
, xOwnMenu
, xOwnDisp
);
669 uno::Reference
< ::com::sun::star::frame::XMenuBarMergingAcceptor
> xMerge( xOwnLM
,
670 uno::UNO_QUERY_THROW
);
671 bMenuMerged
= xMerge
->setMergedMenuBar( xMergedMenu
);
673 catch( const uno::Exception
& )
679 sal_Bool
DocumentHolder::ShowUI( const uno::Reference
< ::com::sun::star::frame::XLayoutManager
>& xContainerLM
,
680 const uno::Reference
< frame::XDispatchProvider
>& xContainerDP
,
681 const OUString
& aContModuleName
)
683 sal_Bool bResult
= sal_False
;
684 if ( xContainerLM
.is() )
686 // the LM of the embedded frame and its current DockingAreaAcceptor
687 uno::Reference
< ::com::sun::star::frame::XLayoutManager
> xOwnLM
;
688 uno::Reference
< ::com::sun::star::ui::XDockingAreaAcceptor
> xDocAreaAcc
;
692 uno::Reference
< beans::XPropertySet
> xPropSet( m_xFrame
, uno::UNO_QUERY_THROW
);
693 xPropSet
->getPropertyValue("LayoutManager") >>= xOwnLM
;
694 xDocAreaAcc
= xContainerLM
->getDockingAreaAcceptor();
696 catch( const uno::Exception
& ){}
698 // make sure that lock state of LM is correct even if an exception is thrown in between
699 sal_Bool bUnlock
= sal_False
;
700 sal_Bool bLock
= sal_False
;
701 if ( xOwnLM
.is() && xDocAreaAcc
.is() )
705 // take over the control over the containers window
706 // as long as the LM is invisible and locked an empty tool space will be used on resizing
707 xOwnLM
->setDockingAreaAcceptor( xDocAreaAcc
);
709 // try to merge menus; don't do anything else if it fails
710 if ( MergeMenus_Impl( xOwnLM
, xContainerLM
, xContainerDP
, aContModuleName
) )
712 // make sure that the container LM does not control the size of the containers window anymore
713 // this must be done after merging menus as we won't get the container menu otherwise
714 xContainerLM
->setDockingAreaAcceptor( uno::Reference
< ui::XDockingAreaAcceptor
>() );
716 // prevent further changes at this LM
717 xContainerLM
->setVisible( sal_False
);
718 xContainerLM
->lock();
721 // by unlocking the LM each layout change will now resize the containers window; pending layouts will be processed now
722 xOwnLM
->setVisible( sal_True
);
724 uno::Reference
< frame::XFramesSupplier
> xSupp( m_xFrame
->getCreator(), uno::UNO_QUERY
);
726 xSupp
->setActiveFrame( m_xFrame
);
732 // TODO/LATER: The following action should be done only if the window is not hidden
733 // otherwise the activation must fail, unfortunatelly currently it is not possible
734 // to detect whether the window is hidden using UNO API
735 m_xOwnWindow
->setFocus();
738 catch( const uno::Exception
& )
740 // activation failed; reestablish old state
743 uno::Reference
< frame::XFramesSupplier
> xSupp( m_xFrame
->getCreator(), uno::UNO_QUERY
);
745 xSupp
->setActiveFrame( 0 );
747 // remove control about containers window from own LM
750 xOwnLM
->setVisible( sal_False
);
751 xOwnLM
->setDockingAreaAcceptor( uno::Reference
< ::com::sun::star::ui::XDockingAreaAcceptor
>() );
754 uno::Reference
< ::com::sun::star::frame::XMenuBarMergingAcceptor
> xMerge( xOwnLM
, uno::UNO_QUERY_THROW
);
755 xMerge
->removeMergedMenuBar();
757 catch( const uno::Exception
& ) {}
761 // reestablish control of containers window
762 xContainerLM
->setDockingAreaAcceptor( xDocAreaAcc
);
763 xContainerLM
->setVisible( sal_True
);
765 xContainerLM
->unlock();
767 catch( const uno::Exception
& ) {}
775 //---------------------------------------------------------------------------
776 sal_Bool
DocumentHolder::HideUI( const uno::Reference
< ::com::sun::star::frame::XLayoutManager
>& xContainerLM
)
778 sal_Bool bResult
= sal_False
;
780 if ( xContainerLM
.is() )
782 uno::Reference
< ::com::sun::star::frame::XLayoutManager
> xOwnLM
;
785 uno::Reference
< beans::XPropertySet
> xPropSet( m_xFrame
, uno::UNO_QUERY_THROW
);
786 xPropSet
->getPropertyValue("LayoutManager") >>= xOwnLM
;
787 } catch( const uno::Exception
& )
793 uno::Reference
< frame::XFramesSupplier
> xSupp( m_xFrame
->getCreator(), uno::UNO_QUERY
);
795 xSupp
->setActiveFrame( 0 );
797 uno::Reference
< ::com::sun::star::ui::XDockingAreaAcceptor
> xDocAreaAcc
= xOwnLM
->getDockingAreaAcceptor();
799 xOwnLM
->setDockingAreaAcceptor( uno::Reference
< ui::XDockingAreaAcceptor
>() );
801 xOwnLM
->setVisible( sal_False
);
803 uno::Reference
< ::com::sun::star::frame::XMenuBarMergingAcceptor
> xMerge( xOwnLM
, uno::UNO_QUERY_THROW
);
804 xMerge
->removeMergedMenuBar();
806 xContainerLM
->setDockingAreaAcceptor( xDocAreaAcc
);
807 xContainerLM
->setVisible( sal_True
);
808 xContainerLM
->unlock();
810 xContainerLM
->doLayout();
813 catch( const uno::Exception
& )
815 SetFrameLMVisibility( m_xFrame
, sal_True
);
823 //---------------------------------------------------------------------------
824 uno::Reference
< frame::XFrame
> DocumentHolder::GetDocFrame()
826 // the frame for outplace activation
827 if ( !m_xFrame
.is() )
829 uno::Reference
< lang::XSingleServiceFactory
> xFrameFact
= frame::TaskCreator::create(m_xContext
);
831 m_xFrame
.set(xFrameFact
->createInstanceWithArguments( m_aOutplaceFrameProps
), uno::UNO_QUERY_THROW
);
833 uno::Reference
< frame::XDispatchProviderInterception
> xInterception( m_xFrame
, uno::UNO_QUERY
);
834 if ( xInterception
.is() )
836 if ( m_pInterceptor
)
838 m_pInterceptor
->DisconnectDocHolder();
839 m_pInterceptor
->release();
840 m_pInterceptor
= NULL
;
843 m_pInterceptor
= new Interceptor( this );
844 m_pInterceptor
->acquire();
846 // register interceptor from outside
847 if ( m_xOutplaceInterceptor
.is() )
848 xInterception
->registerDispatchProviderInterceptor( m_xOutplaceInterceptor
);
850 xInterception
->registerDispatchProviderInterceptor( m_pInterceptor
);
853 uno::Reference
< util::XCloseBroadcaster
> xCloseBroadcaster( m_xFrame
, uno::UNO_QUERY
);
854 if ( xCloseBroadcaster
.is() )
855 xCloseBroadcaster
->addCloseListener( ( util::XCloseListener
* )this );
858 if ( m_xComponent
.is() )
860 uno::Reference
< ::com::sun::star::frame::XLayoutManager
> xOwnLM
;
862 uno::Reference
< beans::XPropertySet
> xPropSet( m_xFrame
, uno::UNO_QUERY_THROW
);
863 xPropSet
->getPropertyValue("LayoutManager") >>= xOwnLM
;
864 } catch( const uno::Exception
& )
870 // TODO/LATER: get it for the real aspect
872 GetExtent( embed::Aspects::MSOLE_CONTENT
, &aSize
);
873 LoadDocToFrame(sal_False
);
881 SetExtent( embed::Aspects::MSOLE_CONTENT
, aSize
);
889 uno::Reference
< awt::XWindow
> xHWindow
= m_xFrame
->getContainerWindow();
893 sal_Int32 nDisplay
= Application::GetDisplayBuiltInScreen();
895 Rectangle aWorkRect
= Application::GetScreenPosSizePixel( nDisplay
);
896 awt::Rectangle aWindowRect
= xHWindow
->getPosSize();
898 if (( aWindowRect
.Width
< aWorkRect
.GetWidth()) && ( aWindowRect
.Height
< aWorkRect
.GetHeight() ))
900 int OffsetX
= ( aWorkRect
.GetWidth() - aWindowRect
.Width
) / 2 + aWorkRect
.Left();
901 int OffsetY
= ( aWorkRect
.GetHeight() - aWindowRect
.Height
) /2 + aWorkRect
.Top();
902 xHWindow
->setPosSize( OffsetX
, OffsetY
, aWindowRect
.Width
, aWindowRect
.Height
, awt::PosSize::POS
);
906 xHWindow
->setPosSize( aWorkRect
.Left(), aWorkRect
.Top(), aWorkRect
.GetWidth(), aWorkRect
.GetHeight(), awt::PosSize::POSSIZE
);
909 xHWindow
->setVisible( sal_True
);
912 catch ( const uno::Exception
& )
919 //---------------------------------------------------------------------------
920 void DocumentHolder::SetComponent( const uno::Reference
< util::XCloseable
>& xDoc
, sal_Bool bReadOnly
)
922 if ( m_xComponent
.is() )
924 // May be should be improved
926 CloseDocument( sal_True
, sal_False
);
927 } catch( const uno::Exception
& )
933 m_bReadOnly
= bReadOnly
;
934 m_bAllowClosing
= sal_False
;
936 uno::Reference
< util::XCloseBroadcaster
> xBroadcaster( m_xComponent
, uno::UNO_QUERY
);
937 if ( xBroadcaster
.is() )
938 xBroadcaster
->addCloseListener( ( util::XCloseListener
* )this );
940 uno::Reference
< document::XEventBroadcaster
> xEventBroadcaster( m_xComponent
, uno::UNO_QUERY
);
941 if ( xEventBroadcaster
.is() )
942 xEventBroadcaster
->addEventListener( ( document::XEventListener
* )this );
945 // the object does not support document::XEventBroadcaster interface
946 // use the workaround, register for modified events
947 uno::Reference
< util::XModifyBroadcaster
> xModifyBroadcaster( m_xComponent
, uno::UNO_QUERY
);
948 if ( xModifyBroadcaster
.is() )
949 xModifyBroadcaster
->addModifyListener( ( util::XModifyListener
* )this );
953 LoadDocToFrame(sal_False
);
956 //---------------------------------------------------------------------------
957 sal_Bool
DocumentHolder::LoadDocToFrame( sal_Bool bInPlace
)
959 if ( m_xFrame
.is() && m_xComponent
.is() )
961 uno::Reference
< frame::XModel
> xDoc( m_xComponent
, uno::UNO_QUERY
);
964 // load new document in to the frame
965 uno::Reference
< frame::XComponentLoader
> xComponentLoader( m_xFrame
, uno::UNO_QUERY_THROW
);
967 ::comphelper::NamedValueCollection aArgs
;
968 aArgs
.put( "Model", m_xComponent
);
969 aArgs
.put( "ReadOnly", m_bReadOnly
);
971 aArgs
.put( "PluginMode", sal_Int16(1) );
973 uno::Reference
< lang::XServiceInfo
> xServiceInfo(xDoc
,uno::UNO_QUERY
);
974 if ( xServiceInfo
.is()
975 && xServiceInfo
->supportsService("com.sun.star.report.ReportDefinition") )
977 sUrl
= ".component:DB/ReportDesign";
979 else if( xServiceInfo
.is()
980 && xServiceInfo
->supportsService("com.sun.star.chart2.ChartDocument"))
981 sUrl
= "private:factory/schart";
983 sUrl
= "private:object";
985 xComponentLoader
->loadComponentFromURL( sUrl
,
988 aArgs
.getPropertyValues() );
994 uno::Reference
< frame::XSynchronousFrameLoader
> xLoader( m_xComponent
, uno::UNO_QUERY
);
996 return xLoader
->load( uno::Sequence
< beans::PropertyValue
>(), m_xFrame
);
1005 //---------------------------------------------------------------------------
1006 void DocumentHolder::Show()
1010 m_xFrame
->activate();
1011 uno::Reference
<awt::XTopWindow
> xTopWindow( m_xFrame
->getContainerWindow(), uno::UNO_QUERY
);
1012 if( xTopWindow
.is() )
1013 xTopWindow
->toFront();
1019 //---------------------------------------------------------------------------
1020 sal_Bool
DocumentHolder::SetExtent( sal_Int64 nAspect
, const awt::Size
& aSize
)
1022 uno::Reference
< embed::XVisualObject
> xDocVis( m_xComponent
, uno::UNO_QUERY
);
1027 xDocVis
->setVisualAreaSize( nAspect
, aSize
);
1030 catch( const uno::Exception
& )
1032 // TODO: Error handling
1039 //---------------------------------------------------------------------------
1040 sal_Bool
DocumentHolder::GetExtent( sal_Int64 nAspect
, awt::Size
*pSize
)
1042 uno::Reference
< embed::XVisualObject
> xDocVis( m_xComponent
, uno::UNO_QUERY
);
1043 if ( pSize
&& xDocVis
.is() )
1047 *pSize
= xDocVis
->getVisualAreaSize( nAspect
);
1050 catch( const uno::Exception
& )
1052 // TODO: Error handling
1059 //---------------------------------------------------------------------------
1060 sal_Int32
DocumentHolder::GetMapUnit( sal_Int64 nAspect
)
1062 uno::Reference
< embed::XVisualObject
> xDocVis( m_xComponent
, uno::UNO_QUERY
);
1067 return xDocVis
->getMapUnit( nAspect
);
1069 catch( const uno::Exception
& )
1071 // TODO: Error handling
1078 //---------------------------------------------------------------------------
1079 awt::Rectangle
DocumentHolder::CalculateBorderedArea( const awt::Rectangle
& aRect
)
1081 return awt::Rectangle( aRect
.X
+ m_aBorderWidths
.Left
+ HATCH_BORDER_WIDTH
,
1082 aRect
.Y
+ m_aBorderWidths
.Top
+ HATCH_BORDER_WIDTH
,
1083 aRect
.Width
- m_aBorderWidths
.Left
- m_aBorderWidths
.Right
- 2*HATCH_BORDER_WIDTH
,
1084 aRect
.Height
- m_aBorderWidths
.Top
- m_aBorderWidths
.Bottom
- 2*HATCH_BORDER_WIDTH
);
1087 //---------------------------------------------------------------------------
1088 awt::Rectangle
DocumentHolder::AddBorderToArea( const awt::Rectangle
& aRect
)
1090 return awt::Rectangle( aRect
.X
- m_aBorderWidths
.Left
- HATCH_BORDER_WIDTH
,
1091 aRect
.Y
- m_aBorderWidths
.Top
- HATCH_BORDER_WIDTH
,
1092 aRect
.Width
+ m_aBorderWidths
.Left
+ m_aBorderWidths
.Right
+ 2*HATCH_BORDER_WIDTH
,
1093 aRect
.Height
+ m_aBorderWidths
.Top
+ m_aBorderWidths
.Bottom
+ 2*HATCH_BORDER_WIDTH
);
1096 //---------------------------------------------------------------------------
1097 void SAL_CALL
DocumentHolder::disposing( const com::sun::star::lang::EventObject
& aSource
)
1098 throw (uno::RuntimeException
)
1100 if ( m_xComponent
.is() && m_xComponent
== aSource
.Source
)
1103 if ( m_bWaitForClose
)
1105 m_bWaitForClose
= sal_False
;
1110 if( m_xFrame
.is() && m_xFrame
== aSource
.Source
)
1112 m_xHatchWindow
= uno::Reference
< awt::XWindow
>();
1113 m_xOwnWindow
= uno::Reference
< awt::XWindow
>();
1114 m_xFrame
= uno::Reference
< frame::XFrame
>();
1119 //---------------------------------------------------------------------------
1120 void SAL_CALL
DocumentHolder::queryClosing( const lang::EventObject
& aSource
, sal_Bool
/*bGetsOwnership*/ )
1121 throw (util::CloseVetoException
, uno::RuntimeException
)
1123 if ( m_xComponent
.is() && m_xComponent
== aSource
.Source
&& !m_bAllowClosing
)
1124 throw util::CloseVetoException();
1127 //---------------------------------------------------------------------------
1128 void SAL_CALL
DocumentHolder::notifyClosing( const lang::EventObject
& aSource
)
1129 throw (uno::RuntimeException
)
1131 if ( m_xComponent
.is() && m_xComponent
== aSource
.Source
)
1134 if ( m_bWaitForClose
)
1136 m_bWaitForClose
= sal_False
;
1141 if( m_xFrame
.is() && m_xFrame
== aSource
.Source
)
1143 m_xHatchWindow
= uno::Reference
< awt::XWindow
>();
1144 m_xOwnWindow
= uno::Reference
< awt::XWindow
>();
1145 m_xFrame
= uno::Reference
< frame::XFrame
>();
1149 //---------------------------------------------------------------------------
1150 void SAL_CALL
DocumentHolder::queryTermination( const lang::EventObject
& )
1151 throw (frame::TerminationVetoException
, uno::RuntimeException
)
1153 if ( m_bWaitForClose
)
1154 throw frame::TerminationVetoException();
1157 //---------------------------------------------------------------------------
1158 void SAL_CALL
DocumentHolder::notifyTermination( const lang::EventObject
& aSource
)
1159 throw (uno::RuntimeException
)
1161 OSL_ENSURE( !m_xComponent
.is(), "Just a disaster..." );
1163 uno::Reference
< frame::XDesktop
> xDesktop( aSource
.Source
, uno::UNO_QUERY
);
1164 m_bDesktopTerminated
= sal_True
;
1165 if ( xDesktop
.is() )
1166 xDesktop
->removeTerminateListener( ( frame::XTerminateListener
* )this );
1169 //---------------------------------------------------------------------------
1170 void SAL_CALL
DocumentHolder::modified( const lang::EventObject
& aEvent
)
1171 throw ( uno::RuntimeException
)
1173 // if the component does not support document::XEventBroadcaster
1174 // the modify notifications are used as workaround, but only for running state
1175 if( aEvent
.Source
== m_xComponent
&& m_pEmbedObj
&& m_pEmbedObj
->getCurrentState() == embed::EmbedStates::RUNNING
)
1176 m_pEmbedObj
->PostEvent_Impl( OUString( "OnVisAreaChanged" ) );
1179 //---------------------------------------------------------------------------
1180 void SAL_CALL
DocumentHolder::notifyEvent( const document::EventObject
& Event
)
1181 throw ( uno::RuntimeException
)
1183 if( m_pEmbedObj
&& Event
.Source
== m_xComponent
)
1185 // for now the ignored events are not forwarded, but sent by the object itself
1186 if ( !Event
.EventName
.startsWith( "OnSave" )
1187 && !Event
.EventName
.startsWith( "OnSaveDone" )
1188 && !Event
.EventName
.startsWith( "OnSaveAs" )
1189 && !Event
.EventName
.startsWith( "OnSaveAsDone" )
1190 && !( Event
.EventName
.startsWith( "OnVisAreaChanged" ) && m_nNoResizeReact
) )
1191 m_pEmbedObj
->PostEvent_Impl( Event
.EventName
);
1195 //---------------------------------------------------------------------------
1196 void SAL_CALL
DocumentHolder::borderWidthsChanged( const uno::Reference
< uno::XInterface
>& aObject
,
1197 const frame::BorderWidths
& aNewSize
)
1198 throw ( uno::RuntimeException
)
1200 // TODO: may require mutex introduction ???
1201 if ( m_pEmbedObj
&& m_xFrame
.is() && aObject
== m_xFrame
->getController() )
1203 if ( m_aBorderWidths
.Left
!= aNewSize
.Left
1204 || m_aBorderWidths
.Right
!= aNewSize
.Right
1205 || m_aBorderWidths
.Top
!= aNewSize
.Top
1206 || m_aBorderWidths
.Bottom
!= aNewSize
.Bottom
)
1208 m_aBorderWidths
= aNewSize
;
1209 if ( !m_nNoBorderResizeReact
)
1210 PlaceFrame( m_aObjRect
);
1215 //---------------------------------------------------------------------------
1216 void SAL_CALL
DocumentHolder::requestPositioning( const awt::Rectangle
& aRect
)
1217 throw (uno::RuntimeException
)
1219 // TODO: may require mutex introduction ???
1222 // borders should not be counted
1223 awt::Rectangle aObjRect
= CalculateBorderedArea( aRect
);
1224 IntCounterGuard
aGuard( m_nNoResizeReact
);
1225 m_pEmbedObj
->requestPositioning( aObjRect
);
1229 //---------------------------------------------------------------------------
1230 awt::Rectangle SAL_CALL
DocumentHolder::calcAdjustedRectangle( const awt::Rectangle
& aRect
)
1231 throw (uno::RuntimeException
)
1233 // Solar mutex should be locked already since this is a call from HatchWindow with focus
1234 awt::Rectangle
aResult( aRect
);
1236 if ( m_xFrame
.is() )
1238 // borders should not be counted
1239 uno::Reference
< frame::XControllerBorder
> xControllerBorder( m_xFrame
->getController(), uno::UNO_QUERY
);
1240 if ( xControllerBorder
.is() )
1242 awt::Rectangle aObjRect
= CalculateBorderedArea( aRect
);
1243 aObjRect
= xControllerBorder
->queryBorderedArea( aObjRect
);
1244 aResult
= AddBorderToArea( aObjRect
);
1248 awt::Rectangle aMinRectangle
= AddBorderToArea( awt::Rectangle() );
1249 if ( aResult
.Width
< aMinRectangle
.Width
+ 2 )
1250 aResult
.Width
= aMinRectangle
.Width
+ 2;
1251 if ( aResult
.Height
< aMinRectangle
.Height
+ 2 )
1252 aResult
.Height
= aMinRectangle
.Height
+ 2;
1257 void SAL_CALL
DocumentHolder::activated( ) throw (::com::sun::star::uno::RuntimeException
)
1259 if ( (m_pEmbedObj
->getStatus(embed::Aspects::MSOLE_CONTENT
)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE
) )
1261 if ( m_pEmbedObj
->getCurrentState() != embed::EmbedStates::UI_ACTIVE
&&
1262 !(m_pEmbedObj
->getStatus(embed::Aspects::MSOLE_CONTENT
)&embed::EmbedMisc::MS_EMBED_NOUIACTIVATE
) )
1266 m_pEmbedObj
->changeState( embed::EmbedStates::UI_ACTIVE
);
1268 catch ( const com::sun::star::embed::StateChangeInProgressException
& )
1270 // must catch this exception because focus is grabbed while UI activation in doVerb()
1272 catch ( const com::sun::star::uno::Exception
& )
1274 // no outgoing exceptions specified here
1279 uno::Reference
< frame::XFramesSupplier
> xSupp( m_xFrame
->getCreator(), uno::UNO_QUERY
);
1281 xSupp
->setActiveFrame( m_xFrame
);
1286 void DocumentHolder::ResizeHatchWindow()
1288 awt::Rectangle aHatchRect
= AddBorderToArea( m_aObjRect
);
1289 ResizeWindows_Impl( aHatchRect
);
1290 uno::Reference
< embed::XHatchWindow
> xHatchWindow( m_xHatchWindow
, uno::UNO_QUERY
);
1291 xHatchWindow
->setHatchBorderSize( awt::Size( HATCH_BORDER_WIDTH
, HATCH_BORDER_WIDTH
) );
1294 void SAL_CALL
DocumentHolder::deactivated( ) throw (::com::sun::star::uno::RuntimeException
)
1296 // deactivation is too unspecific to be useful; usually we only trigger code from activation
1297 // so UIDeactivation is actively triggered by the container
1300 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */