22#include <com/sun/star/ucb/Command.hpp>
23#include <com/sun/star/frame/XController2.hpp>
30 using ::com::sun::star::uno::Reference;
31 using ::com::sun::star::uno::UNO_QUERY_THROW;
32 using ::com::sun::star::uno::UNO_SET_THROW;
33 using ::com::sun::star::uno::Exception;
34 using ::com::sun::star::frame::XController;
35 using ::com::sun::star::frame::XFrame;
36 using ::com::sun::star::awt::XWindow;
37 using ::com::sun::star::awt::WindowEvent;
38 using ::com::sun::star::lang::EventObject;
39 using ::com::sun::star::ucb::Command;
40 using ::com::sun::star::ucb::XCommandProcessor;
41 using ::com::sun::star::frame::XController2;
42 using ::com::sun::star::lang::XComponent;
46 const Reference< XCommandProcessor >& i_rSubDocumentDefinition )
47 :mxDocDefCommands( i_rSubDocumentDefinition )
50 Reference< XController2 >
xController( i_rApplicationController, UNO_QUERY_THROW );
51 mxAppComponentWindow.set(
xController->getComponentWindow(), UNO_SET_THROW );
53 osl_atomic_increment( &m_refCount );
55 mxAppComponentWindow->addWindowListener(
this );
57 osl_atomic_decrement( &m_refCount );
60 SubComponentLoader::SubComponentLoader(
const Reference< XController >& i_rApplicationController,
61 const Reference< XComponent >& i_rNonDocumentComponent )
62 :mxNonDocComponent( i_rNonDocumentComponent )
65 Reference< XController2 >
xController( i_rApplicationController, UNO_QUERY_THROW );
66 mxAppComponentWindow.set(
xController->getComponentWindow(), UNO_SET_THROW );
68 osl_atomic_increment( &m_refCount );
70 mxAppComponentWindow->addWindowListener(
this );
72 osl_atomic_decrement( &m_refCount );
75 SubComponentLoader::~SubComponentLoader()
79 void SAL_CALL SubComponentLoader::windowResized(
const WindowEvent& )
83 void SAL_CALL SubComponentLoader::windowMoved(
const WindowEvent& )
87 void SAL_CALL SubComponentLoader::windowShown(
const EventObject& )
91 if ( mxDocDefCommands.is() )
94 aCommandOpen.Name =
"show";
96 const sal_Int32 nCommandIdentifier = mxDocDefCommands->createCommandIdentifier();
97 mxDocDefCommands->execute( aCommandOpen, nCommandIdentifier,
nullptr );
101 const Reference< XController >
xController( mxNonDocComponent, UNO_QUERY_THROW );
103 const Reference< XWindow > xWindow(
xFrame->getContainerWindow(), UNO_SET_THROW );
104 xWindow->setVisible(
true );
111 mxAppComponentWindow->removeWindowListener(
this );
114 void SAL_CALL SubComponentLoader::windowHidden(
const EventObject& )
118 void SAL_CALL SubComponentLoader::disposing(
const EventObject& )
SubComponentLoader(const css::uno::Reference< css::frame::XController > &i_rApplicationController, const css::uno::Reference< css::ucb::XCommandProcessor > &i_rSubDocumentDefinition)
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XController > xController
the controller of the sub component. Must not be <NULL>
Reference< XFrame > xFrame
the frame which the component resides in. Must not be <NULL>